Skip to content

Commit

Permalink
fixed enrich_rst_with_map for westernscheldt rstfile (#1114)
Browse files Browse the repository at this point in the history
* fixed enrich_rst_with_map for westernscheldt rstfile

* updated whatsnew
  • Loading branch information
veenstrajelmer authored Feb 5, 2025
1 parent 2de0954 commit e7f1449
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions dfm_tools/xugrid_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,9 @@ def enrich_rst_with_map(ds_rst:xr.Dataset):
file_nc_map = os.path.join(dir_output, fname_map)
ds_map = xr.open_dataset(file_nc_map)

# remove unassociated edges from mapfile to align with rst file
ds_map = remove_unassociated_edges(ds_map)

# enrich rst file with topology variables from mapfile
topology_varn = ds_map.ugrid_roles.topology[0]
topo_var = ds_map[topology_varn]
Expand All @@ -665,10 +668,11 @@ def enrich_rst_with_map(ds_rst:xr.Dataset):
ds_rst[fnc_varn] = ds_map[fnc_varn]

# rename old dims
if 'nFlowElem' in ds_rst.dims and 'nNetElem' in ds_rst.dims:
ds_rst = ds_rst.rename({'nFlowElem':'nNetElem'})
if 'nFlowLinkPts' in ds_rst.dims and 'nNetLinkPts' in ds_rst.dims:
ds_rst = ds_rst.rename({'nFlowLinkPts':'nNetLinkPts'})
if 'nFlowElem' in ds_rst.dims:
facedim = topo_var.attrs["face_dimension"]
ds_rst = ds_rst.rename({'nFlowElem':facedim})
if 'nNetElem' in ds_rst.dims:
facedim = topo_var.attrs["face_dimension"]
ds_rst = ds_rst.rename({'nNetElem':facedim})
Expand Down
1 change: 1 addition & 0 deletions docs/whats-new.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

### Fix
- made p-drive paths for tide models and gesla3 work on linux also in [#1083](https://github.com/Deltares/dfm_tools/pull/1083) and [#1085](https://github.com/Deltares/dfm_tools/pull/1085)
- support for different face dimension names in `dfmt.enrich_rst_with_map` in [#1114](https://github.com/Deltares/dfm_tools/pull/1114)


## 0.33.0 (2025-01-20)
Expand Down

0 comments on commit e7f1449

Please sign in to comment.