UXARRAY / uxarray

Xarray-styled package for reading and directly operating on unstructured grid datasets following UGRID conventions
https://uxarray.readthedocs.io/
Apache License 2.0
142 stars 31 forks source link

Are `spatialpandas` and `antimeridian` optional dependencies? #757

Closed philipc2 closed 2 months ago

philipc2 commented 3 months ago

Discussed in https://github.com/UXARRAY/uxarray/discussions/756

Originally posted by **tomvothecoder** April 8, 2024 Hello, I'm going through the [Visualizing Grid Topology](https://uxarray.readthedocs.io/en/latest/examples/006-plot-api-topology.html) notebook in the documentation. I tried to run `grid.plot` but get `ModuleNotFoundError: No module named 'spatialpandas'`. ```python File ~/miniforge3/envs/xcdat_test_uxarray/lib/python3.12/site-packages/uxarray/grid/geometry.py:134, in _build_geodataframe_with_antimeridian(polygon_shells, antimeridian_face_indices) 131 """Builds a ``spatialpandas.GeoDataFrame`` including any faces that cross 132 the antimeridian.""" 133 # import optional dependencies --> 134 from spatialpandas.geometry import MultiPolygonArray 135 from spatialpandas import GeoDataFrame 137 polygons = _build_corrected_shapely_polygons( 138 polygon_shells, antimeridian_face_indices 139 ) ModuleNotFoundError: No module named 'spatialpandas' ``` I assumed that `uxarray` would include `spatialpandas` since the [Installation](https://uxarray.readthedocs.io/en/latest/installation.html) page doesn't list optional dependencies. However, I see that the [conda recipe](https://github.com/conda-forge/uxarray-feedstock/blob/main/recipe/meta.yaml) doesn't list `spatialpandas` and the stack trace says it is an optional dependency (line 133 above). I'm just making sure if I should install `spatialpandas` alongside `uxarray`. Thanks!
philipc2 commented 2 months ago

Resolved as of v2024.04.0