-
Notifications
You must be signed in to change notification settings - Fork 8
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
consider prevent UgridDataset
type if no grid present
#180
Comments
You could check the xarray object too, there's an xarray accessor (via uds = xu.data.disk()
ds = uds.ugrid.to_dataset()
print(ds.ugrid_roles.topology) # ["mesh2d"]
# If there's no UGRID stuff in there, the list is empty, so you could do:
if ds.ugrid_roles.topology:
uds = xu.UgridDataset(ds) |
Ok, but the ugrid roles from a UgridDataset are None, since the grid part is under the grid accessor (if it is present) This issue also relates to grid preservation with operations: #181 |
I guess I should've asked to start with: why are you reading non-UGRID data with xugrid anyway? Just like you should use pandas to read CSV's rather than xarray, you should use xarray to read non-UGRID datasets. Maybe related, what I have been thinking about: if the work on xarray's explicit indexes is done, we would get rid of UgridDataset and UgridDataArray, and |
When loading a non-ugrid dataset with xugrid, it is converted to a UgridDataset anyway. This is a bit inconvenient, since checking whether it is really a dataset with ugrid, can only be done by checking if it has a "grid".
The text was updated successfully, but these errors were encountered: