From e0db579ef91a88b3e6f5ec90cc7541e594cc5661 Mon Sep 17 00:00:00 2001 From: Dai-Hai Ton-That Date: Sun, 18 Aug 2024 16:38:16 -0700 Subject: [PATCH 1/2] Fix: fix the issue of No module named geopandas._vectorized for the new version of geopandas --- starepandas/tools/trixel_conversions.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/starepandas/tools/trixel_conversions.py b/starepandas/tools/trixel_conversions.py index 6a1f078..fb4c3f1 100644 --- a/starepandas/tools/trixel_conversions.py +++ b/starepandas/tools/trixel_conversions.py @@ -1,12 +1,12 @@ import math import dask.dataframe -import geopandas._vectorized as vectorized import numpy import pystare import shapely import geopandas from shapely.geometry import Point +from geopandas.array import from_shapely def to_vertices(sids, wrap_lon=True): @@ -545,7 +545,7 @@ def trixels_from_stareseries(sids_series, n_partitions=1, num_workers=None, wrap ddf = dask.dataframe.from_pandas(sids_series, npartitions=npartitions) meta = {'name': 'geometry'} res = ddf.map_partitions(lambda df: - vectorized.from_shapely( + from_shapely( trixels_from_stareseries(df, n_partitions=1, wrap_lon=wrap_lon)).flatten(), meta=meta) trixels_series = res.compute(scheduler='processes', num_workers=num_workers) @@ -579,7 +579,7 @@ def split_antimeridian_series(trixels_series, n_partitions=1, num_workers=None, ddf = dask.dataframe.from_pandas(trixels_series, npartitions=n_partitions) meta = {'trixels': 'object'} res = ddf.map_partitions(lambda df: - vectorized.from_shapely( + from_shapely( split_antimeridian_series(df, n_partitions=1, drop=drop)).flatten(), meta=meta) trixels_series = res.compute(scheduler='processes', num_workers=num_workers) From 0b3f9db90a8d13c5621bbed3900224322cafaffe Mon Sep 17 00:00:00 2001 From: Dai-Hai Ton-That Date: Sun, 18 Aug 2024 17:04:34 -0700 Subject: [PATCH 2/2] feat: add troubleshooting for a known issue --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index 88263fd..f1b6684 100644 --- a/README.md +++ b/README.md @@ -176,6 +176,23 @@ stare_amazon = samerica.stare_intersection(amazon.make_sids.iloc[0]) ![Example 3](figures/amazon.png) +# Troubleshooting +## `UserWarning: pyproj unable to set database path _pyproj_global_context_initialize()` Or `Invalid projection: EPSG:4326: (Internal Proj Error: proj_create: no database context specified)` + +This is typically caused by a problem with the PROJ library and Geopandas. So, one potential solution for this is to do the followings: + +- Install proj-data with conda: `conda install -c conda-forge proj-data` +- Install geopandas and pyproj with pip: + - may need to uninstall geopandas from conda: `conda remove geopandas` + - `pip install scipy` + - `pip install pyproj geopandas` + - May need to install shapely with conda: `conda install -c conda-forge shapely` + - May need to intall matlib: `conda install -c conda-forge matplotlib` + - Check the PROJ data directory: + - `import python` + - `print(pyproj.datadir.get_data_dir())` + - `export PROJ_LIB=/path/to/proj/data` + # Acknowledgments 2018-2021 STARE development supported by NASA/ACCESS-17 grant 80NSSC18M0118.