You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When applying polyline_mapslice to a uds with mapformat1, it raises KeyError: 'Mesh2D_s1'. This is probably only relevant for 2D models since it finds the wl/bl variables there. Since mapformat1 does not have the gridname as varname prefix, this fails.
Therefore, a 3D dataset is incorrectly interpreted as being 2D. Fix in get_vertical_dimensions() by adding:
elif "laydim" in uds.dims and "wdim" in uds.dims:
# workaround for mapformat1
layer_dimension = "laydim"
interface_dimension = "wdim"
return layer_dimension, interface_dimension
This in turn raises KeyError: 'layers present, but unknown layertype, expected one of variables: mesh2d_flowelem_zw, mesh2d_layer_sigma, mesh2d_layer_z' since the layertype is not derived in a generic way. Renaming these as a workaround raises KeyError: 'depth' since that key is not present in the formula_terms. A link to FlowElem_bl should be added here, but keep in mind the sign is opposite as expected so add the correct standard_name from reconstruct_zw_zcc_fromsigma. Seems best to cluster all mapformat1 preprocessing in a separate preprocessing function, to start with:
ifset(["laydim","wdim"]).issubset(ds.dims):
# set layer/interface dimension attrs in mesh_topology variablevarn_mesh_topology=list(ds.filter_by_attrs(cf_role="mesh_topology").data_vars)[0]
vertical_attrs= {"layer_dimension":"laydim",
"interface_dimension":"wdim",
}
ds[varn_mesh_topology] =ds[varn_mesh_topology].assign_attrs(vertical_attrs)
ifset(["LayCoord_cc","LayCoord_w"]).issubset(ds.data_vars):
# rename layer variables so they can be recognized as layer/interface formula_terms variablesds=ds.rename_vars(LayCoord_cc="LayCoord_cc_layer", LayCoord_w="LayCoord_w_interface")
Keep in mind that the renamed varnames should also be updated in formula_terms attrs.
When applying
polyline_mapslice
to a uds with mapformat1, it raisesKeyError: 'Mesh2D_s1'
. This is probably only relevant for 2D models since it finds the wl/bl variables there. Since mapformat1 does not have the gridname as varname prefix, this fails.MWE:
Can be solved by editing
get_xzcoords_onintersection
, but then somewhat neater:It also happens for 3D models since it fails to find the layer/interface dimensions, they are not set in the topology attributes:
Therefore, a 3D dataset is incorrectly interpreted as being 2D. Fix in
get_vertical_dimensions()
by adding:This in turn raises
KeyError: 'layers present, but unknown layertype, expected one of variables: mesh2d_flowelem_zw, mesh2d_layer_sigma, mesh2d_layer_z'
since the layertype is not derived in a generic way. Renaming these as a workaround raisesKeyError: 'depth'
since that key is not present in theformula_terms
. A link toFlowElem_bl
should be added here, but keep in mind the sign is opposite as expected so add the correct standard_name fromreconstruct_zw_zcc_fromsigma
. Seems best to cluster all mapformat1 preprocessing in a separate preprocessing function, to start with:Keep in mind that the renamed varnames should also be updated in formula_terms attrs.
Todo:
The text was updated successfully, but these errors were encountered: