Skip to content

Commit

Permalink
857 update contextily errors with 130 (#858)
Browse files Browse the repository at this point in the history
* added contextily testcase

* updated pyproject.toml
  • Loading branch information
veenstrajelmer committed May 16, 2024
1 parent fb2c4fc commit c082d80
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ dependencies = [
"geopandas>=0.13.0",
#fiona<1.9 does not contain sql where filter
"fiona>=1.9",
#contextily<1.0.0 is from April 2020
"contextily>=1.0.0",
#contextily<1.4.0 raises AttributeError and UnidentifiedImageError: https://github.com/Deltares/dfm_tools/issues/857
"contextily>=1.4.0",
#xarray<2023.9.0 does not support multidimensional coordinates (used in e.g. HIRLAM meteo data)
"xarray>=2023.9.0",
#dask version is aligned with xarray
Expand Down
14 changes: 14 additions & 0 deletions tests/test_external_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import numpy as np
import matplotlib.pyplot as plt
import dfm_tools as dfmt
import contextily as ctx


@pytest.mark.unittest
Expand Down Expand Up @@ -165,3 +166,16 @@ def test_xarray_decode_default_fillvals(tmp_path):
fnc_new = uds2.grid.face_node_connectivity

assert fill_value_default in fnc_new


@pytest.mark.unittest
def test_ctx_add_basemap():
"""
tests wheter this often used function still works, it fails in contextily 1.3.0
mainly relevant to update the minimal contextily version in the pyproject.toml file sometimes
https://github.com/Deltares/dfm_tools/issues/857
"""
_, ax = plt.subplots()
ax.set_xlim(1.8,3.2)
ax.set_ylim(50.8, 52.2)
ctx.add_basemap(ax=ax,crs="EPSG:4326",attribution=False)

0 comments on commit c082d80

Please sign in to comment.