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 :
![image](https://private-user-images.githubusercontent.com/38355798/244315706-935ed627-d426-4507-bca3-e76439ab4a25.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQwMjkxODQsIm5iZiI6MTcyNDAyODg4NCwicGF0aCI6Ii8zODM1NTc5OC8yNDQzMTU3MDYtOTM1ZWQ2MjctZDQyNi00NTA3LWJjYTMtZTc2NDM5YWI0YTI1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE5VDAwNTQ0NFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQ1NjhlMWFiYmYxNjJmNTFmYWQwNzFhMzkwY2RiNjk3MDFiZWQyYjY4MjAyMDlkZDk1MDVkY2JmNjhkYTA3ZWQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.-9izWvafN7LPUpdXZhgooDEzeVPaNTuY39FHHw7sKO8)
with the NaN problem we got wrong values (on the right) instead of Nans
Using interp :
![image](https://private-user-images.githubusercontent.com/38355798/244316217-a102f220-2684-4ba9-908e-a0e610fe2ecc.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQwMjkxODQsIm5iZiI6MTcyNDAyODg4NCwicGF0aCI6Ii8zODM1NTc5OC8yNDQzMTYyMTctYTEwMmYyMjAtMjY4NC00YmE5LTkwOGUtYTBlNjEwZmUyZWNjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE5VDAwNTQ0NFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTNkZjJiNWZiMmNlMWMzNDA1NzM1N2JkNDMxMmU0OGFkNmE3ZWNkMzJjMDU0YzliZWU2NzQ4Y2IwNzNhNDU1YTMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.cP_IPjEpaeNJt_WMtUE4Cqi7t6hA6NfYSF6pLg-Vh0w)
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: