Skip to content

Commit

Permalink
Configuration of cache_netcdf usages
Browse files Browse the repository at this point in the history
  • Loading branch information
bdestombe committed Apr 10, 2024
1 parent e1fc0d8 commit bd81e00
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions nlmod/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,9 @@ def ds_contains(ds, coords_2d=False, coords_3d=False, coords_time=False, datavar
coords.append("x")
coords.append("y")
attrs.append("extent")

if "gridtype" in ds.attrs:
attrs.append("gridtype")

if "angrot" in ds.attrs:
attrs.append("angrot")
Expand Down
2 changes: 1 addition & 1 deletion nlmod/dims/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -1846,7 +1846,7 @@ def get_vertices(ds, vert_per_cid=4, epsilon=0, rotated=False):
return vertices_da


@cache.cache_netcdf()
@cache.cache_netcdf(coords_2d=True)
def mask_model_edge(ds, idomain=None):
"""get data array which is 1 for every active cell (defined by idomain) at
the boundaries of the model (xmin, xmax, ymin, ymax). Other cells are 0.
Expand Down
2 changes: 1 addition & 1 deletion nlmod/read/ahn.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
logger = logging.getLogger(__name__)


@cache.cache_netcdf()
@cache.cache_netcdf(coords_2d=True)
def get_ahn(ds=None, identifier="AHN4_DTM_5m", method="average", extent=None):
"""Get a model dataset with ahn variable.
Expand Down
2 changes: 1 addition & 1 deletion nlmod/read/knmi.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
logger = logging.getLogger(__name__)


@cache.cache_netcdf()
@cache.cache_netcdf(coords_2d=True, coords_time=True)
def get_recharge(ds, method="linear", most_common_station=False):
"""add multiple recharge packages to the groundwater flow model with knmi
data by following these steps:
Expand Down
2 changes: 1 addition & 1 deletion nlmod/read/rws.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def get_gdf_surface_water(ds):
return gdf_swater


@cache.cache_netcdf()
@cache.cache_netcdf(coords_2d=True)
def get_surface_water(ds, da_basename):
"""create 3 data-arrays from the shapefile with surface water:
Expand Down

0 comments on commit bd81e00

Please sign in to comment.