Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prevent calls to uds.grid in dfmt #363

Open
veenstrajelmer opened this issue Jun 1, 2023 · 0 comments
Open

prevent calls to uds.grid in dfmt #363

veenstrajelmer opened this issue Jun 1, 2023 · 0 comments
Labels

Comments

@veenstrajelmer
Copy link
Collaborator

veenstrajelmer commented Jun 1, 2023

remove_ghostcells fails for grid with langeduikers. This raises "TypeError: Can only access grid topology via '.grid' if dataset contains exactly one grid. Dataset contains 2 grids. Use '.grids' instead."

When setting remove_edges=False and remove_ghost=False and using xugrid>=0.9.0, the dataset is successfully read. However, more errors will follow when using other dfm_tools functions due to .grid calls.

MWE:

import dfm_tools as dfmt
#file_nc = r'p:\11209233-mad09a-2023-rijn\C_Work\02_lange_duikers\02_berekeningen\dflowfm2d-rijn-j19_6-v2a\computations\hist\hw2018_kort\v15\results\*_fou.nc'
file_nc = r'p:\11209233-mad09a-2023-rijn\C_Work\02_lange_duikers\02_berekeningen\dflowfm2d-rijn-j19_6-v2a\computations\hist\hw2018_kort\v15\results\converted_RIJN_0*_map.nc'
# file_nc = r'p:\1230882-emodnet_hrsm\GTSMv5.0\SO_NHrivGTSM\UGgtsm_snipbd_v2_withriv_cellinfo_net.nc'
# file_nc = r"p:\1230882-emodnet_hrsm\GTSMv5.0\SO_NHrivGTSM\computations\BD014_fix_mapformat4\output\gtsm_model_0*_map.nc"
uds = dfmt.open_partitioned_dataset(file_nc)#, remove_edges=False, remove_ghost=False)

Prevent calls to .grid in dfmt code, or escape edges/ghost functions in case of multiple grids. This is at least the case in remove_ghostcells and remove_unassociated_edges. But there are more .grid calls in dfm_tools:

  • xugrid_helpers.py: dimn_faces = grid.face_dimension, dimn_nodes = grid.node_dimension, dimn_edges = grid.edge_dimension, fill_value = grid.fill_value, indexer_np = grid.face_node_connectivity, gridname = uds.grid.name, uds.grid.to_dataset()[gridname], isinstance(uds.grid,xu.Ugrid1d), uds.grid.validate_edge_node_connectivity(), uds.grid.face_node_coordinates, uds.grid.meshkernel, uds.grid.crs, uds.grid.is_geographic
  • get_nc.py: gridname = uds.grid.name, uds.grid.face_dimension, uds.grids[0].is_geographic, uds.grid.bounds.
  • get_nc_helpers.py: gridname = ds.grid.name
  • meshkernel_helpers.py: grid_is_geographic = uds.grid.is_geographic
  • interpolate_grid2bnd.py: facedim = uds.grid.face_dimension
This was referenced Jul 11, 2023
@veenstrajelmer veenstrajelmer changed the title remove_ghostcells fails for grid with langeduikers prevent calls to uds.grid in dfmt Feb 14, 2024
This was referenced Sep 3, 2024
This was referenced Sep 26, 2024
This was referenced Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant