Skip to content

Commit

Permalink
Merge pull request #32 from knubez/pygeos
Browse files Browse the repository at this point in the history
Remove PyGEOS
  • Loading branch information
zmoon committed Aug 8, 2024
2 parents 29c2edf + 48def48 commit 0096017
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/examples/sample-mpas-ug-data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@
"metadata": {},
"outputs": [],
"source": [
"%watermark -v -w -p cartopy,dask,gdown,geopandas,joblib,matplotlib,netCDF4,numpy,pandas,pygeos,regionmask,scipy,seaborn,shapely,skimage,xarray"
"%watermark -v -w -p cartopy,dask,gdown,geopandas,joblib,matplotlib,netCDF4,numpy,pandas,regionmask,scipy,seaborn,shapely,skimage,xarray"
]
}
],
Expand Down
15 changes: 15 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,21 @@ with `matplotlib` 3.8.0 (mid Sep 2023), but 3.8.1 (end of Oct 2023)
restored the previous behavior.
```

```{note}
In the past (before TAMS v0.1.5, mid Aug 2024),
the TAMS conda-forge recipe included PyGEOS,
in order to make certain GeoPandas and regionmask operations faster.
[In Shapely v2](https://shapely.readthedocs.io/en/stable/release/2.x.html)
(mid Dec 2022, but not relevant to TAMS
[until mid 2023](https://geopandas.org/en/stable/docs/user_guide/pygeos_to_shapely.html)),
[PyGEOS is part of Shapely](https://shapely.readthedocs.io/en/stable/migration_pygeos.html)
and doesn't need to be installed separately.
GeoPandas dropped support for Shapely v1 and PyGEOS in
[their v1 release](https://github.com/geopandas/geopandas/releases/tag/v1.0.0) (late Jun 2024).
[PyGEOS on conda-forge](https://github.com/conda-forge/pygeos-feedstock) has been retired,
so you likely won't be able to install it in new Conda environments in any case.
```

### Development install

If you want to modify the code, you can first clone the repo
Expand Down
1 change: 0 additions & 1 deletion environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ dependencies:
- gdown
- joblib
- netcdf4
- pygeos
- regionmask >=0.9
- scipy
- seaborn >=0.13.2
Expand Down
5 changes: 3 additions & 2 deletions tams/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,8 @@ def _data_in_contours_regionmask(
# Form regionmask(s)
shapes = contours[["geometry"]]
regions = regionmask.from_geopandas(shapes)
mask = regions.mask(data) # works but takes long (though shorter with pygeos)!
mask = regions.mask(data)
# Note: before Shapely v2, having `pygeos` installed made this faster

# Aggregate points inside contour
new_data_ = {
Expand Down Expand Up @@ -1126,7 +1127,7 @@ def f(g):
# Trying regionmask
shapes = cs235[["geometry"]]
regions = regionmask.from_geopandas(shapes)
mask = regions.mask(tb) # works but takes long (though shorter with pygeos)!
mask = regions.mask(tb)

regions.plot(ax=ax)

Expand Down

0 comments on commit 0096017

Please sign in to comment.