salem icon indicating copy to clipboard operation
salem copied to clipboard

reproject grid data for rasterio / gdal

Open vodp opened this issue 1 year ago • 3 comments

I find salem super helpful to deal with .nc files. My tasks however somtimes involves with reprojecting nc gridded data to be used with rasterio and visualizing on top of Google Maps. I find that merely setting crs to epsg:4326 is not correct to show nc data. For example in the following data of global soil moisture product, overlaying on top of Esri map gives incorrect results: image

but with the internal quick_map of salem, the country boundaries are correctly visualized:

image

I am wondering is there a mechanism to help project the grid data so that it can be conveniently used with Transform matrix, and Crs as like rasterio or Gdal ?

vodp avatar Mar 07 '23 10:03 vodp

I'm sorry I can't help you there. You should have a look at https://corteva.github.io/rioxarray though, this is much better than salem!

fmaussion avatar Mar 07 '23 11:03 fmaussion

Thanks. Because the source netcdf lacks some georeference data, rioxarray is quite not useful for my problem. I find salem's subset and roi could be the workaround for this particular case.

Can you help explaining why country boundaries are not drawn for America as in the figure above?

vodp avatar Mar 08 '23 21:03 vodp

Yes Sorry Salem does not support 0-360 grids. I recommend to shift your dataset to -180 > 180 (using xarray .roll), or use cartopy for plotting. If Salem can read it, your dataset is probably a straightforward plate carree projection

fmaussion avatar Mar 16 '23 12:03 fmaussion