diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 3db0d6a..3079d3f 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -34,8 +34,8 @@ http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports - geocube version (`geocube --version`) - rasterio version (`rio --version`) - rasterio GDAL version (`rio --gdal-version`) - - fiona version (`fio --version`) - - fiona GDAL version (`fio --gdal-version`) + - pyogrio version (`python -c "import pyogrio; print(pyogrio.__version__)"`) + - pyogrio GDAL version (`python -c "import pyogrio; print(pyogrio.__gdal_version__)"`) - Python version (`python -c "import sys; print(sys.version.replace('\n', ' '))"`) - Operation System Information (`python -c "import platform; print(platform.platform())"`) @@ -50,7 +50,7 @@ Environment (conda list):
``` -$ conda list | grep -E "rasterio|xarray|gdal|fiona|scipy" +$ conda list | grep -E "rasterio|xarray|gdal|pyogrio|scipy" ```
diff --git a/.github/ISSUE_TEMPLATE/installation_issues.md b/.github/ISSUE_TEMPLATE/installation_issues.md index b42b35c..1ca6058 100644 --- a/.github/ISSUE_TEMPLATE/installation_issues.md +++ b/.github/ISSUE_TEMPLATE/installation_issues.md @@ -8,13 +8,13 @@ labels: installation-issues #### Installation method/steps - Installation method (conda, pip, from source, etc...) - - Please provide all commands/steps you used to install geocube and GDAL/rasterio/fiona. + - Please provide all commands/steps you used to install geocube and GDAL/rasterio/pyogrio. #### Environment Information - rioxarray version you are attempting to install - rasterio version (`rio --version`) - rasterio GDAL version (`rio --gdal-version`) - - fiona version (`fio --version`) - - fiona GDAL version (`fio --gdal-version`) + - pyogrio version (`fio --version`) + - pyogrio GDAL version (`fio --gdal-version`) - Python version (`python -c "import sys; print(sys.version.replace('\n', ' '))"`) - Operation System Information (`python -c "import platform; print(platform.platform())"`) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 98f6d30..2fb43ed 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -40,7 +40,7 @@ jobs: environment-name: test create-args: >- python=${{ matrix.python-version }} - geopandas<1 + geopandas numpy<2 netcdf4 odc-geo diff --git a/docs/getting_started.rst b/docs/getting_started.rst index 585d025..e86596a 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -10,7 +10,7 @@ Getting Started and is powered by `GDAL `__ using: - `rasterio `__ -- `fiona `__ +- `pyogrio `__ - `odc-geo `__ diff --git a/geocube/_show_versions.py b/geocube/_show_versions.py index 58c25bb..1ac7904 100644 --- a/geocube/_show_versions.py +++ b/geocube/_show_versions.py @@ -34,12 +34,12 @@ def _get_gdal_info(): proj_info: dict system GDAL information """ - import fiona + import pyogrio import rasterio blob = [ - ("fiona", importlib.metadata.version("fiona")), - ("GDAL[fiona]", fiona.__gdal_version__), + ("pyogrio", importlib.metadata.version("pyogrio")), + ("GDAL[pyogrio]", pyogrio.__gdal_version__), ("rasterio", importlib.metadata.version("rasterio")), ("GDAL[rasterio]", rasterio.__gdal_version__), ] diff --git a/geocube/geo_utils/geobox.py b/geocube/geo_utils/geobox.py index fc05320..2a1d4d4 100644 --- a/geocube/geo_utils/geobox.py +++ b/geocube/geo_utils/geobox.py @@ -6,7 +6,6 @@ from collections.abc import Iterable from typing import Any, Optional, Union -import fiona.errors import geopandas import rioxarray # noqa: F401 pylint: disable=unused-import import shapely.geometry.base @@ -69,12 +68,7 @@ def load_vector_data( logger = get_logger() if isinstance(vector_data, (str, os.PathLike)): - try: - vector_data = geopandas.read_file(vector_data, include_fields=measurements) - except fiona.errors.DriverError as error: - if "ignore_fields" not in str(error): - raise - vector_data = geopandas.read_file(vector_data) + vector_data = geopandas.read_file(vector_data, columns=measurements) elif not isinstance(vector_data, geopandas.GeoDataFrame): vector_data = geopandas.GeoDataFrame(vector_data) @@ -95,7 +89,7 @@ def load_vector_data( # make sure projection is set if not vector_data.crs: - vector_data.crs = "EPSG:4326" + vector_data.set_crs("EPSG:4326") logger.warning( "Projection not defined in `vector_data`." " Setting to geographic (EPSG:4326)." diff --git a/geocube/xarray_extensions/vectorxarray.py b/geocube/xarray_extensions/vectorxarray.py index 9db6fd8..cc5a867 100644 --- a/geocube/xarray_extensions/vectorxarray.py +++ b/geocube/xarray_extensions/vectorxarray.py @@ -68,9 +68,9 @@ def to_geodataframe(self): extra_coords = list(set(list(out_obj.coords)) - {"geometry"}) if extra_coords: out_obj = out_obj.copy().reset_coords(extra_coords) - geodf = geopandas.GeoDataFrame(out_obj.to_dataframe().reset_index()) - geodf.crs = self._obj.rio.crs - return geodf + return geopandas.GeoDataFrame( + out_obj.to_dataframe().reset_index(), crs=self._obj.rio.crs + ) def to_netcdf(self, *args, **kwargs): """ diff --git a/mypy.ini b/mypy.ini index c3fd77f..ff3c350 100644 --- a/mypy.ini +++ b/mypy.ini @@ -6,7 +6,7 @@ plugins = numpy.typing.mypy_plugin [mypy-appdirs] ignore_missing_imports = True -[mypy-fiona.*] +[mypy-pyogrio.*] ignore_missing_imports = True [mypy-geopandas] diff --git a/pyproject.toml b/pyproject.toml index 9ea3a33..5817196 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,7 +35,7 @@ requires-python = ">=3.10" dependencies = [ "appdirs", "click>=6.0", - "geopandas>=0.7,<1", + "geopandas>=1", "odc_geo", "rasterio>=1.3", "rioxarray>=0.4", diff --git a/test/unit/test_show_versions.py b/test/unit/test_show_versions.py index c26c6d0..6ecb100 100644 --- a/test/unit/test_show_versions.py +++ b/test/unit/test_show_versions.py @@ -6,8 +6,8 @@ def test_get_gdal_info(): gdal_info = _get_gdal_info() assert "rasterio" in gdal_info assert "GDAL[rasterio]" in gdal_info - assert "fiona" in gdal_info - assert "GDAL[fiona]" in gdal_info + assert "pyogrio" in gdal_info + assert "GDAL[pyogrio]" in gdal_info def test_get_sys_info():