Interpolate Gaussian grids to regular fixed grids using bilinear interpolation?
climate data operators (CDO)

define grid

We define a lat-lon target grid with 1°x1° grid cell size 30x30 grid cells starting at 40°N and -10°E (=10°W):

gridtype = lonlat 
xsize    =  30 
ysize    =  30 
xfirst   = -10 
xinc     =   1 
yfirst   =  40 
yinc     =   1


This text is written into a text file. See section 1.3.2 CDO Manual for details and further examples.

If you already have a netCDF file which has data on your target grid, you can also extract the grid definition from that file:

cdo griddes FILE_WITH_TARGET_GRID.nc &gt; myGridDef


myGridDef is a text file.

interpolate data

I assume that we do a bilinear interpolation. This is done with the remapbil operator via:

cdo remapbil,myGridDef INPUT_FILE.nc OUTPUT_FILE.nc


The grid of your input data needs to be properly defined in your input file (that is often a problem).

'properly defined' grid

Alternative 1

The spatial dimensions of the data variable (SST in the example below) need to be named lon and lat. Additionally, coordinate variables lon and lat have to exist (time independent!). These need to have correct coordinate variable attributes (see example below).

Example:

dimensions:
    lon = 30 ;
    lat = 30 ;
    time = UNLIMITED ; // (24 currently)
variables:
    double lon(lon) ;
            lon:standard_name = "longitude" ;
            lon:long_name = "longitude" ;
            lon:units = "degrees_east" ;
            lon:axis = "X" ;
    double lat(lat) ;
            lat:standard_name = "latitude" ;
            lat:long_name = "latitude" ;
            lat:units = "degrees_north" ;
            lat:axis = "Y" ;
    double time(time) ;
            time:standard_name = "time" ;
            time:long_name = "time" ;
            time:units = "seconds since 1900-01-01 00:00:00" ;
            time:calendar = "standard" ;
            time:axis = "T" ;
    float SST(time, lat, lon) ;
            SST:long_name = "sea_surface_temperature" ;
            SST:units = "degree celsius" ;
            SST:_FillValue = NaNf ;
            SST:missing_value = NaNf ;
            SST:var_desc = "sea surface temperature" ;


Alternative 2

The spatial dimensions and corresponding variables exist in the source file but are not denoted as lon and lat. Then each data variable (SST, in this example) needs to have an attribute coordinates that holds the names of the coordinate variables.

SST:coordinates = "lon lat" ;


Example:

dimensions:
    TSTEP = UNLIMITED ; // (24 currently)
    COL = 112 ;
    ROW = 106 ;
variables:                     " ;
    double lon(ROW, COL) ;
        lon:standard_name = "longitude" ;
        lon:long_name = "longitude coordinate" ;
        lon:units = "degrees_east" ;
        lon:_CoordinateAxisType = "Lon" ;
    double lat(ROW, COL) ;
        lat:standard_name = "latitude" ;
        lat:long_name = "latitude coordinate" ;
        lat:units = "degrees_north" ;
        lat:_CoordinateAxisType = "Lat" ;
    double time(TSTEP) ;
        time:standard_name = "time" ;
        time:long_name = "time" ;
        time:units = "seconds since 1900-01-01 00:00:00" ;
        time:calendar = "standard" ;
    float SST(TSTEP, ROW, COL) ;
        SST:long_name = "sea_surface_temperature" ;
        SST:units = "degree celsius" ;
        SST:coordinates = "lon lat" ;
        SST:var_desc = "sea surface temperature" ;


Note:

If the coordinate variables are missing, then they can be created via the setgrid operator. If we want to add a grid definition to the source file then we need the source file's grid definition in the text file (see 'define grid').

cdo setgrid,mySourceGridDef INFILE_NO_COORDS.nc INFILE_WI_COORDS.nc