From 975e3099925ce8ce8a6fd44f92421159f2c6e6f2 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Fri, 28 Jun 2024 22:37:55 +0800 Subject: [PATCH 1/7] CI: Unpin geopandas in the Docs workflow --- .github/workflows/ci_docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_docs.yml b/.github/workflows/ci_docs.yml index 74951d365f2..47ebaa5f2bb 100644 --- a/.github/workflows/ci_docs.yml +++ b/.github/workflows/ci_docs.yml @@ -101,7 +101,7 @@ jobs: netCDF4 packaging contextily - geopandas<1.0 + geopandas ipython rioxarray build From ff0b55ff2c119adbab9aa4df9f9c37d06b483817 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Sat, 29 Jun 2024 00:44:14 +0800 Subject: [PATCH 2/7] Revert "CI: Temporarily pin geopandas<1.0 in ReadTheDocs" This reverts commit 3574603f27dcbfe46b0277d14fb40c2f1c095bd1. --- ci/requirements/docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/requirements/docs.yml b/ci/requirements/docs.yml index b7381844b92..414f1419d44 100644 --- a/ci/requirements/docs.yml +++ b/ci/requirements/docs.yml @@ -14,7 +14,7 @@ dependencies: - packaging # Optional dependencies - contextily - - geopandas<1.0 + - geopandas - ipython - rioxarray # Development dependencies (general) From 8dfd10c9959a319782351b8760f779ba6f5c00bf Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Tue, 9 Jul 2024 17:24:59 +1200 Subject: [PATCH 3/7] Force pyogrio to register GDAL drivers Trying to solve `pyogrio.errors.DataSourceError: No driver registered` error by forcing driver registration. Xref https://github.com/geopandas/pyogrio/pull/145 --- examples/gallery/lines/roads.py | 2 ++ examples/get_started/04_table_inputs.py | 3 +++ 2 files changed, 5 insertions(+) diff --git a/examples/gallery/lines/roads.py b/examples/gallery/lines/roads.py index 7c1e75ef943..e0766e031b0 100644 --- a/examples/gallery/lines/roads.py +++ b/examples/gallery/lines/roads.py @@ -14,8 +14,10 @@ # %% import geopandas as gpd import pygmt +import pyogrio # Read shapefile data using geopandas +pyogrio.core._register_drivers() gdf = gpd.read_file( "http://www2.census.gov/geo/tiger/TIGER2015/PRISECROADS/tl_2015_15_prisecroads.zip" ) diff --git a/examples/get_started/04_table_inputs.py b/examples/get_started/04_table_inputs.py index 541a7057711..fd428eb8a76 100644 --- a/examples/get_started/04_table_inputs.py +++ b/examples/get_started/04_table_inputs.py @@ -26,6 +26,9 @@ import numpy as np import pandas as pd import pygmt +import pyogrio + +pyogrio.core._register_drivers() # %% # ASCII table file From 988335912f1372f1992d97e89eab495e4d796380 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Tue, 9 Jul 2024 20:44:51 +0800 Subject: [PATCH 4/7] Use sphinx_gallery_start_ignore and sphinx_gallery_end_ignore flags to hide the workaround https://sphinx-gallery.github.io/stable/configuration.html#hiding-code-blocks --- examples/gallery/lines/roads.py | 7 ++++++- examples/get_started/04_table_inputs.py | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/examples/gallery/lines/roads.py b/examples/gallery/lines/roads.py index e0766e031b0..d93cd95a239 100644 --- a/examples/gallery/lines/roads.py +++ b/examples/gallery/lines/roads.py @@ -14,10 +14,15 @@ # %% import geopandas as gpd import pygmt + +# sphinx_gallery_start_ignore +# Workaround for https://github.com/GenericMappingTools/pygmt/issues/3301 import pyogrio -# Read shapefile data using geopandas pyogrio.core._register_drivers() +# sphinx_gallery_end_ignore + +# Read shapefile data using geopandas gdf = gpd.read_file( "http://www2.census.gov/geo/tiger/TIGER2015/PRISECROADS/tl_2015_15_prisecroads.zip" ) diff --git a/examples/get_started/04_table_inputs.py b/examples/get_started/04_table_inputs.py index fd428eb8a76..9f92d704602 100644 --- a/examples/get_started/04_table_inputs.py +++ b/examples/get_started/04_table_inputs.py @@ -26,9 +26,14 @@ import numpy as np import pandas as pd import pygmt + +# sphinx_gallery_start_ignore +# Workaround for https://github.com/GenericMappingTools/pygmt/issues/3301 import pyogrio pyogrio.core._register_drivers() +# sphinx_gallery_end_ignore + # %% # ASCII table file From b403e6eac42683b2d9fb78f26857b2c8c1dd7cb3 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Fri, 27 Sep 2024 12:50:58 +0800 Subject: [PATCH 5/7] Remove the workaround to see if there are any upstream fixes --- examples/gallery/lines/roads.py | 7 ------- examples/get_started/04_table_inputs.py | 8 -------- 2 files changed, 15 deletions(-) diff --git a/examples/gallery/lines/roads.py b/examples/gallery/lines/roads.py index d93cd95a239..7c1e75ef943 100644 --- a/examples/gallery/lines/roads.py +++ b/examples/gallery/lines/roads.py @@ -15,13 +15,6 @@ import geopandas as gpd import pygmt -# sphinx_gallery_start_ignore -# Workaround for https://github.com/GenericMappingTools/pygmt/issues/3301 -import pyogrio - -pyogrio.core._register_drivers() -# sphinx_gallery_end_ignore - # Read shapefile data using geopandas gdf = gpd.read_file( "http://www2.census.gov/geo/tiger/TIGER2015/PRISECROADS/tl_2015_15_prisecroads.zip" diff --git a/examples/get_started/04_table_inputs.py b/examples/get_started/04_table_inputs.py index 9f92d704602..541a7057711 100644 --- a/examples/get_started/04_table_inputs.py +++ b/examples/get_started/04_table_inputs.py @@ -27,14 +27,6 @@ import pandas as pd import pygmt -# sphinx_gallery_start_ignore -# Workaround for https://github.com/GenericMappingTools/pygmt/issues/3301 -import pyogrio - -pyogrio.core._register_drivers() -# sphinx_gallery_end_ignore - - # %% # ASCII table file # ---------------- From 2fc85662cb059abd69072235ee243feda3953c75 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Tue, 3 Dec 2024 12:14:27 +0800 Subject: [PATCH 6/7] Revert "CI: Pin rasterio < 1.4.3 temporarily (#3668)" This reverts commit 7845e9e79b3d5a802f16597d7280fb7a159e19de. --- .github/workflows/ci_docs.yml | 1 - .github/workflows/ci_doctests.yaml | 1 - .github/workflows/ci_tests.yaml | 4 ++-- .github/workflows/ci_tests_dev.yaml | 2 +- .github/workflows/ci_tests_legacy.yaml | 1 - ci/requirements/docs.yml | 1 - 6 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci_docs.yml b/.github/workflows/ci_docs.yml index f139f4a1422..6d65b3cc49b 100644 --- a/.github/workflows/ci_docs.yml +++ b/.github/workflows/ci_docs.yml @@ -104,7 +104,6 @@ jobs: geopandas ipython pyarrow - rasterio<1.4.3 rioxarray make pip diff --git a/.github/workflows/ci_doctests.yaml b/.github/workflows/ci_doctests.yaml index 5af0276f5ca..023584bd9ef 100644 --- a/.github/workflows/ci_doctests.yaml +++ b/.github/workflows/ci_doctests.yaml @@ -61,7 +61,6 @@ jobs: geopandas ipython pyarrow - rasterio<1.4.3 rioxarray make pip diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index fa1e5e24114..1d65157803d 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -73,13 +73,13 @@ jobs: numpy-version: '1.24' pandas-version: '=2.0' xarray-version: '=2023.04' - optional-packages: ' contextily geopandas<1 ipython pyarrow rasterio<1.4.3 rioxarray sphinx-gallery' + optional-packages: ' contextily geopandas<1 ipython pyarrow rioxarray sphinx-gallery' # Python 3.12 + core packages (latest versions) + optional packages - python-version: '3.12' numpy-version: '2.1' pandas-version: '' xarray-version: '' - optional-packages: ' contextily geopandas>=1.0 ipython pyarrow rasterio<1.4.3 rioxarray sphinx-gallery' + optional-packages: ' contextily geopandas>=1.0 ipython pyarrow rioxarray sphinx-gallery' # Python 3.11 + core packages (Linux only) - os: 'ubuntu-latest' python-version: '3.11' diff --git a/.github/workflows/ci_tests_dev.yaml b/.github/workflows/ci_tests_dev.yaml index f5bbef85be6..d61d0ce9e1d 100644 --- a/.github/workflows/ci_tests_dev.yaml +++ b/.github/workflows/ci_tests_dev.yaml @@ -152,7 +152,7 @@ jobs: python -m pip install --pre --prefer-binary \ --extra-index https://pypi.anaconda.org/scientific-python-nightly-wheels/simple \ numpy pandas xarray netCDF4 packaging \ - build contextily dvc geopandas ipython pyarrow 'rasterio<1.4.3' rioxarray \ + build contextily dvc geopandas ipython pyarrow rioxarray \ pytest pytest-cov pytest-doctestplus pytest-mpl pytest-rerunfailures \ sphinx-gallery diff --git a/.github/workflows/ci_tests_legacy.yaml b/.github/workflows/ci_tests_legacy.yaml index aa6530f134c..466ca6db933 100644 --- a/.github/workflows/ci_tests_legacy.yaml +++ b/.github/workflows/ci_tests_legacy.yaml @@ -71,7 +71,6 @@ jobs: geopandas ipython pyarrow - rasterio<1.4.3 rioxarray sphinx-gallery make diff --git a/ci/requirements/docs.yml b/ci/requirements/docs.yml index 8660e9d8ff6..559fb6f5690 100644 --- a/ci/requirements/docs.yml +++ b/ci/requirements/docs.yml @@ -17,7 +17,6 @@ dependencies: - geopandas - ipython - pyarrow - - rasterio<1.4.3 - rioxarray # Development dependencies (general) - make From 20ede1b21571ee7eb0173da459dde33f878b3bd9 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Wed, 4 Dec 2024 12:58:22 +0800 Subject: [PATCH 7/7] Add a session flag to not close GDAL --- pygmt/clib/session.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/clib/session.py b/pygmt/clib/session.py index 4ce5cb99eab..4e5874ca505 100644 --- a/pygmt/clib/session.py +++ b/pygmt/clib/session.py @@ -400,7 +400,7 @@ def print_func(file_pointer, message): # noqa: ARG001 self._print_callback = print_func padding = self["GMT_PAD_DEFAULT"] - session_type = self["GMT_SESSION_EXTERNAL"] + session_type = self["GMT_SESSION_EXTERNAL"] + self["GMT_SESSION_NOGDALCLOSE"] session = c_create_session(name.encode(), padding, session_type, print_func) if session is None: