You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using hwrf as a raster with hwrf_0015_3h(fname, **kwargs)from raster_readers.py.
However map_raster - which is used to map the raster on the SAR grid - is defined to be used only with a L1. It's a problem since anyone would use this function for a L2 product. It's the case for me, i need to map hwrf on the new L2-GRD.
So first suggestion : addapt the code to make map_raster usable for any dataset.
To use it on my L2-GRD dataset I adapted the map_raster function. I pointed an 'issue' using the interpolation of hwrf. It happened on these lines :
forvarinraster_ds:
raster_da=raster_ds[var].chunk(raster_ds[var].shape)
# upscale in original projection using interpolation# in most cases, RectBiVariateSpline give better results, but can't handle Nansifnp.any(np.isnan(raster_da)):
upscaled_da=raster_da.interp(x=lons, y=lats)
else:
upscaled_da=map_blocks_coords(
xr.DataArray(dims=['y', 'x'], coords={'x': lons, 'y': lats}).chunk(1000),
RectBivariateSpline(
raster_da.y.values,
raster_da.x.values,
raster_da.values,
kx=3, ky=3
)
)
upscaled_da.name=var# interp upscaled_da on sar gridmapped_ds_list.append(
upscaled_da.interp(
x=self._dataset.longitude,
y=self._dataset.latitude
).drop_vars(['x', 'y'])
)
As written, RectBiVariateSpline can't handle Nans. But the upper condition to not use RectBivariateSpline is not enough for a local model like ecmwf;
Using RectBiVariateSpline :
with the NaN problem we got wrong values (on the right) instead of Nans
Using interp :
I suggest to change the code of map_raster to force the use of "interp" for some rasters
could be removed from xsar to be versioned in a separate repository. The new repository would be a dependency for xsar sphinx documentation compilation (especially projections.ipynb)
I'm using hwrf as a raster with
hwrf_0015_3h(fname, **kwargs)
from raster_readers.py.However map_raster - which is used to map the raster on the SAR grid - is defined to be used only with a L1. It's a problem since anyone would use this function for a L2 product. It's the case for me, i need to map hwrf on the new L2-GRD.
So first suggestion : addapt the code to make map_raster usable for any dataset.
To use it on my L2-GRD dataset I adapted the map_raster function. I pointed an 'issue' using the interpolation of hwrf. It happened on these lines :
As written, RectBiVariateSpline can't handle Nans. But the upper condition to not use RectBivariateSpline is not enough for a local model like ecmwf;
Using RectBiVariateSpline :
with the NaN problem we got wrong values (on the right) instead of Nans
Using interp :
I suggest to change the code of map_raster to force the use of "interp" for some rasters
here are my inputs :
The text was updated successfully, but these errors were encountered: