Deltares / xugrid

Xarray and unstructured grids
https://deltares.github.io/xugrid/
MIT License
64 stars 8 forks source link

Ugrid1D `ugrid.sel()` results in zero-size dataset #130

Closed veenstrajelmer closed 1 year ago

veenstrajelmer commented 1 year ago

Below example results in dataset with zero-size dims: Frozen({'nNetNode': 0, 'nNetLink': 0})

import os
import dfm_tools as dfmt
import matplotlib.pyplot as plt
plt.close('all')

dir_issue = r'p:\dflowfm\maintenance\JIRA\06000-06999\06548'

slice_x = slice(15,25)
slice_y = slice(56,62)

#plot bedlevel from interpreted network
file_nc = os.path.join(dir_issue,'set_bathy_2.17.06','DFM_interpreted_network_dummy_model_net.nc')
uds = dfmt.open_partitioned_dataset(file_nc)
uds_sel = uds.ugrid.sel(x=slice_x,y=slice_x)
print(uds.grid.bounds)
print(uds_sel)
veenstrajelmer commented 1 year ago

Mistake with y=slice_x, the function actually works as expected.