From 79cde9d60d15bafc1ad7621486caf4ee3450f7ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Sun, 10 Nov 2024 19:06:31 +0100 Subject: [PATCH 1/2] compat: rasterio 1.4.2 (#763) --- geoviews/util.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/geoviews/util.py b/geoviews/util.py index d99ede9f..ee5839fe 100644 --- a/geoviews/util.py +++ b/geoviews/util.py @@ -1,3 +1,5 @@ +from contextlib import suppress + import numpy as np import shapely import shapely.geometry as sgeom @@ -652,9 +654,16 @@ def from_xarray(da, crs=None, apply_transform=False, nan_nodata=False, **kwargs) 'defaulting to non-geographic element.') elif hasattr(da, 'rio') and da.rio.crs is not None: # rioxarray.open_rasterio - try: - kwargs['crs'] = process_crs(da.rio.crs.to_proj4()) - except Exception: + crs = None + # to handle rasterio 1.4.1 vs 1.4.2 differences + # https://github.com/holoviz/geoviews/pull/763 + for method_name in ("to_epsg", "to_proj4"): + with suppress(Exception): + crs = process_crs(getattr(da.rio.crs, method_name)()) + break + if crs: + kwargs['crs'] = crs + else: warn(f'Could not decode projection from crs string {da.rio.crs}, ' 'defaulting to non-geographic element.') From da8719e6775d01a0509c6e0c9597eb9301fc19a1 Mon Sep 17 00:00:00 2001 From: Andrew <15331990+ahuang11@users.noreply.github.com> Date: Sun, 10 Nov 2024 23:37:34 -0800 Subject: [PATCH 2/2] compat: Dask 2024.11 (#766) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Simon Høxbro Hansen --- geoviews/tests/conftest.py | 7 ------- pixi.toml | 1 - pyproject.toml | 2 -- 3 files changed, 10 deletions(-) diff --git a/geoviews/tests/conftest.py b/geoviews/tests/conftest.py index 8d29ff23..65fd24aa 100644 --- a/geoviews/tests/conftest.py +++ b/geoviews/tests/conftest.py @@ -48,10 +48,3 @@ def pytest_collection_modifyitems(config, items): import matplotlib.pyplot as plt plt.switch_backend("agg") - -with suppress(Exception): - # From Dask 2024.3.0 they now use `dask_expr` by default - # https://github.com/dask/dask/issues/10995 - import dask - - dask.config.set({"dataframe.query-planning": False}) diff --git a/pixi.toml b/pixi.toml index d6d2234c..744fb6e9 100644 --- a/pixi.toml +++ b/pixi.toml @@ -10,7 +10,6 @@ sync-git-tags = 'python scripts/sync_git_tags.py geoviews' [activation.env] PYTHONIOENCODING = "utf-8" USE_PYGEOS = "0" -DASK_DATAFRAME__QUERY_PLANNING = "False" [environments] test-310 = ["py310", "test-core", "test-unit-task", "test", "example", "test-example", "download-data"] diff --git a/pyproject.toml b/pyproject.toml index b2be65db..fa34ecfb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -175,8 +175,6 @@ filterwarnings = [ "ignore:\\s*Pyarrow will become a required dependency of pandas:DeprecationWarning", # Will go away by itself in Pandas 3.0 "ignore:Passing a (SingleBlockManager|BlockManager) to (Series|GeoSeries|DataFrame|GeoDataFrame) is deprecated:DeprecationWarning", # https://github.com/holoviz/spatialpandas/issues/137 "ignore:datetime.datetime.utcfromtimestamp():DeprecationWarning:dateutil.tz.tz", # https://github.com/dateutil/dateutil/pull/1285 - # 2024-02 - "ignore:The current Dask DataFrame implementation is deprecated:DeprecationWarning", # https://github.com/dask/dask/issues/10917 # 2024-03 "ignore:\\s*Dask dataframe query planning is disabled because dask-expr is not installed:FutureWarning", "ignore:numpy.ndarray size changed, may indicate binary incompatibility:RuntimeWarning", # https://github.com/pydata/xarray/issues/7259