Open veenstrajelmer opened 3 months ago
The code below adds a face_dimension to variables that not defined there if some of the points are out of bounds.
face_dimension
import numpy as np import xugrid as xu import xarray as xr uds = xu.data.adh_san_diego() facedim = uds.grid.face_dimension facesize = uds.grid.sizes[facedim] uds['face_var'] = xr.DataArray(np.ones((facesize)), dims=facedim) ds = uds.ugrid.sel_points(x=[475153,475153,1],y=[3621027,3621027,1]) print(uds.elevation.dims) print(ds.elevation.dims)
Prints:
('node',) ('node', 'face')
If only providing points that are in bounds, this issue does not occur and ds.elevation has only a node dimension.
ds.elevation
This is due to the fact that isel doesn't broadcast, but .where does.
isel
.where
Might have to solve it by filtering variables based on dimension, then only applying where if the dimension is present.
The code below adds a
face_dimension
to variables that not defined there if some of the points are out of bounds.Prints:
If only providing points that are in bounds, this issue does not occur and
ds.elevation
has only a node dimension.