Project

General

Profile

Regridding issue with CDO

Added by Kasra Keshavarz about 2 years ago

Hello,

I have two netcdf files, A and B that do not necessary have similar variables. A has a higher spatial resolution with limited regional extend with a lat/lon grid, B is coarser and global with a gaussian grid. I would like to re-grid/re-sample the variable from B to the exact grid coordinates of A. How would I achieve this with minimal manual adjustments? My own solution was to 1) regrid the global netCDF file with the following command:

cdo remapbil r4320,2160 B.nc B_regrid.nc

and then 2) spatial subsetting (or CDO equivalent):

ncks -d lon,-141.0,-52.04167 -d lat,41.0,83.45833 B_regrid.nc B_regrid_subset.nc

The problem is the final grid product does not exactly align with the target netCDF file, i.e., A.nc. The latitudes are fine but the longitudes are half of 0.083333 degrees off. If you can suggest me anything, it'll be amazing.

Thanks,
Kasra

B.nc (90.7 KB) B.nc
A.nc (2.12 MB) A.nc

Replies (4)

RE: Regridding issue with CDO - Added by Uwe Schulzweida about 2 years ago

Use the grid coordinates from A in order to get exactly the same coordinates:

cdo remapbil,A.nc B.nc B_regrid.nc

RE: Regridding issue with CDO - Added by Kasra Keshavarz about 2 years ago

Thanks Uwe, it seems to be working, however, I am noticing that the spatial extend of B_regrid is the same as A. Did the command automatically do a spatial subsetting or this is an error? Because, technically, B is global and A has a limited spatial extend.

RE: Regridding issue with CDO - Added by Uwe Schulzweida about 2 years ago

The grid information from A is taken and used as the target grid for interpolation. The grid information from A contains the coordinates and the spatial extent.

RE: Regridding issue with CDO - Added by Kasra Keshavarz about 2 years ago

Thanks Uwe! Awesome! What a tool!

    (1-4/4)