uxarray icon indicating copy to clipboard operation
uxarray copied to clipboard

Are `spatialpandas` and `antimeridian` optional dependencies?

Open philipc2 opened this issue 10 months ago • 0 comments

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 notebook in the documentation.

I tried to run grid.plot but get ModuleNotFoundError: No module named 'spatialpandas'.

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 page doesn't list optional dependencies. However, I see that the conda recipe 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 avatar Apr 08 '24 22:04 philipc2