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

Plot contour/contourf for crossect fails #506

Open
veenstrajelmer opened this issue Sep 6, 2023 · 0 comments
Open

Plot contour/contourf for crossect fails #506

veenstrajelmer opened this issue Sep 6, 2023 · 0 comments
Labels

Comments

@veenstrajelmer
Copy link
Collaborator

veenstrajelmer commented Sep 6, 2023

Plot contour for crosssect/mapslice raises "IndexError: index 1 is out of bounds for axis 1 with size 1" because edge_face_connectivity has shape (24336, 1)

MWE:

import dfm_tools as dfmt
import numpy as np
file_nc = dfmt.data.fm_grevelingen_map(return_filepath=True)
uds = dfmt.open_partitioned_dataset(file_nc)
line_array = np.array([[ 53181.96942503, 424270.83361629],
                       [ 55160.15232593, 416913.77136685]])
uds_crs = dfmt.polyline_mapslice(uds.isel(time=3), line_array)
uds_crs['mesh2d_sa1'].ugrid.plot(cmap='jet')
uds_crs['mesh2d_sa1'].ugrid.plot.contour()

This probably happens since we generate Ugrid2d based on crs_tstart and crs_tstop, with many overlapping values between crs_start[1:] and crs_stop[:-1]. The resulting node_x values are therefore not unique. However, the z on these x-unique points can be non-unique so we need this for flat water surfaces until xarray supports plotting bounds.

Wait on new xugrid cross section method/dataset from Deltares/xugrid#59

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