Project

General

Profile

Nan values after remapping

Added by Andrea Vito Vacca over 2 years ago

Goodevening,
I have a problem with the remapcon function. My purpose is to perform a simple bias correction of models' output by removing their mean and add the mean of the reanalysis file ("pr_era5.nc"). In order to do that, I need to regrid the era5 file to the same resolution of every model. As an example, I attach here two of them: "pr_EC-Earth3-CC_mm.nc" (dimension 5x4) and "pr_ACCESS-CM2_mm.nc" (dimension 1x3). The area represented from the models and the reanalysis is the same, only the resulution changes. I am doing the operation with the following commands:
- cdo remapcon,my_target_file.nc pr_era5.nc result.nc
or
- cdo remapcon,r(dim1)x(dim2) input.nc output.nc

While the operation works well for "pr_EC-Earth3-CC_mm.nc" this does not happen for "pr_ACCESS-CM2_mm.nc" because the resulting file has only nan as values. I'm afraid the problem depends on the size (in terms of cells) of the files. If the model has "1" as rows or columns the procedure returns only nan. I thank you in advance for any suggestion.
Andrea Vacca


Replies (1)

RE: Nan values after remapping - Added by Uwe Schulzweida over 2 years ago

For the conservative remapping the corners of the grid cells are needed. For regular lon/lat grids these are calculated automatically if they are not present. If only one grid point is present, these corners cannot be calculated. In this case you have to create a grid description file which contains the corners.
In the present case, in principle, only the following line must be added:

xbounds   = 34.0625 35.3125
The complete grid description file should look like this:
gridtype  = lonlat
gridsize  = 3
xsize     = 1
ysize     = 3
xname     = lon
xlongname = "Longitude" 
xunits    = "degrees_east" 
yname     = lat
ylongname = "Latitude" 
yunits    = "degrees_north" 
xvals     = 34.6875
xbounds   = 34.0625 35.3125
yfirst    = -20.625
yinc      = 1.25
This file can then be used directly for remapping:
cdo remapcon,mygridfile infile outfile

    (1-1/1)