Open
Description
Ok, kind of an edge-case, but a problem for what I am working on right now: when I use a different delr and delc, and I use grid-rotation, the method nlmod.resample.structured_da_to_ds produces nans in areas that should not be nan. This can be reproduced with the following code:
import nlmod
ds = nlmod.get_ds(
[0, 1000, 0, 100],
xorigin=100_000,
yorigin=400_000,
angrot=45,
delr=100.0,
delc=100.0,
)
extent = nlmod.grid.get_extent(ds)
ahn = nlmod.read.ahn.get_ahn4(extent)
da = nlmod.resample.structured_da_to_ds(ahn, ds)
And then plot this data-array, using
f, ax = nlmod.plot.get_map(extent, ncols=2)
nlmod.plot.data_array(ahn, ax=ax[0], vmin=-0.5, vmax=2.0)
nlmod.plot.data_array(da, ax=ax[1], vmin=-0.5, vmax=2.0, rotated=True)
Everything looks good. I have a value for each of my grid-cells that are the average of the original data within this cell
If I change the grid to have a delr of 50m and a delc of 100m:
ds = nlmod.get_ds(
[0, 1000, 0, 100],
xorigin=100_000,
yorigin=400_000,
angrot=45,
delr=50.0,
delc=100.0,
)
da = nlmod.resample.structured_da_to_ds(ahn, ds)
There are nans in my DataArray da that should not be nan. The non-nan values seem to be right (the mean of the original data-array):
I think this is because of a bug in rioxarray:
corteva/rioxarray#847
Metadata
Metadata
Assignees
Labels
No labels