Skip to content

Commit

Permalink
Fix test_update_ds_from_layer_ds
Browse files Browse the repository at this point in the history
  • Loading branch information
rubencalje committed Sep 19, 2024
1 parent b1810e8 commit 555e0f0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions nlmod/read/regis.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,11 @@ def get_regis(
regis_ds : xarray dataset
dataset with regis data projected on the modelgrid.
"""
ds = xr.open_dataset(REGIS_URL, decode_times=False)
ds = xr.open_dataset(REGIS_URL, decode_coords="all")
if "crs" in ds.coords:
# remove the crs coordinate, as rioxarray does not recognise the crs
# and we set the crs at the end of this method by hand
ds = ds.drop_vars("crs")

# set x and y dimensions to cell center
ds["x"] = ds.x_bounds.mean("bounds")
Expand Down Expand Up @@ -187,7 +191,6 @@ def get_regis(
ds.attrs["gridtype"] = "structured"
ds.attrs["extent"] = extent
for datavar in ds:
ds[datavar].attrs["grid_mapping"] = "crs"
ds[datavar].attrs["source"] = "REGIS"
ds[datavar].attrs["url"] = REGIS_URL
ds[datavar].attrs["date"] = dt.datetime.now().strftime("%Y%m%d")
Expand Down
2 changes: 1 addition & 1 deletion tests/test_026_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def get_regis():
os.makedirs(model_ws)
regis = nlmod.read.regis.get_regis(extent)
regis.to_netcdf(fname)
return xr.open_dataset(fname)
return xr.open_dataset(fname, decode_coords="all")


def get_structured_model_ds():
Expand Down

0 comments on commit 555e0f0

Please sign in to comment.