Project

General

Profile

Query on grid Option in CDO Interpolation

Added by Ralf Mueller about 13 years ago

original from Abhik Santra

I am using the CDO for the horizontal interpolation of 0.25dx0.25d resolution single level data, available in between +-50 Lat & 360 Lon, into 1dx1d resolution. When I am applying "genbil" and "remap"commands, I need to provide the 'grid' option. If I give r"$nlon"x"$nlat" , where nlon=360 & nlat=101, then it is interpolating globally at 1.8d interval. So, instead of r"$nlon"x"$nlat option, what should I write there? Please, suggest me the same as early as possible.

Thanking you in anticipation.


Replies (5)

RE: Query on grid Option in CDO Interpolation - Added by Ralf Mueller about 13 years ago

The r360x95 shortcut is meant to create a global regular grid. If you want to have a 1deg-grid, you should use r360x180 and select you region with the sellonlatbox operator afterwards.

BTW don't forget the OpenMP support! It can speed up remapping substantially. If you use cygwin or unix and your version of CDO is compiled with OpenMP support, use the -P option to setthe number of threads. You can ckeck it with

cdo -V
My current version gives this:

Climate Data Operators version 1.5.0 (http://code.zmaw.de/projects/cdo)
Compiler: gcc -std=gnu99 -fopenmp
 version: gcc (GCC) 4.5.2 20110127 (prerelease)
    with: NC4 PTHREADS SZ Z OpenMP
Compiled: by ram on thingol (x86_64-unknown-linux-gnu) Mar 25 2011 10:47:33
     CDI library version : 1.5.0 of Mar 25 2011 10:47:31
 CGRIBEX library version : 1.5.0 of Feb 15 2011 10:23:39
GRIB_API library version : 1.9.5
  netCDF library version : 4.1.1 of Oct 12 2010 11:51:41 $
    HDF5 library version : 1.8.5
 SERVICE library version : 1.3.0 of Mar 25 2011 10:47:29
   EXTRA library version : 1.3.0 of Mar 25 2011 10:47:28
     IEG library version : 1.3.0 of Mar 25 2011 10:47:29
    FILE library version : 1.7.1 of Mar 25 2011 10:47:29

RE: Query on grid Option in CDO Interpolation - Added by Abhik Santra about 13 years ago

Ralf Mueller wrote:

The r360x95 shortcut is meant to create a global regular grid. If you want to have a 1deg-grid, you should use r360x180 and select you region with the sellonlatbox operator afterwards.

BTW don't forget the OpenMP support! It can speed up remapping substantially. If you use cygwin or unix and your version of CDO is compiled with OpenMP support, use the -P option to setthe number of threads. You can ckeck it with [...] My current version gives this:
[...]

Dear Ralf,

Currently, I am using CDO v1.4.7 in RHEL5.3. I have written my code for interpolation as follows:
_nlon=360
nlat=101
cdo genbil,r"$nlon"x"$nlat" "$ncfile" remapweights.nc
cdo remap,r"$nlon"x"$nlat",remapweights.nc "$ncfile" "$ofile"_.
But I am unable to select my region with sellonlatbox option. Kindly suggest me, how can I use  the option to select lon=0 to 360 and lat=-50 to +50?
Thanking you.

With regards,
Abhik.

RE: Query on grid Option in CDO Interpolation - Added by Ralf Mueller about 13 years ago

I guess

cdo sellonlatbox,0,360,-50,50 ifile ofile 
should work.

RE: Query on grid Option in CDO Interpolation - Added by Abhik Santra about 13 years ago

I have already tried with "cdo sellonlatbox,0,360,-50,50 ifile ofile" command. But my question is whether I should use it before making remapweights.nc or after that. Since my input $ncfile has dimension Lon=0-360 & Lat=-50-+50, then is it required again to select the region?
Otherwise, if I use the command just after making remapweights.nc, then shoud I give remapweights.nc as ifile and another .nc file as ofile?

Please allow me to know which one is the right way?
I already post main part of my interpolation script in earlier query for your concern. Kindly check it.
Thanking you.

RE: Query on grid Option in CDO Interpolation - Added by Uwe Schulzweida almost 13 years ago

You have to select the region after the interpolation:

cdo genbil,r360x180 ncfile remapweights.nc
cdo remap,r360x180,remapweights.nc ncfile rfile
cdo sellonlatbox,0,360,-50,50 rfile ofile

A general better solution is to define your target grid and do not use the default grid r360x180. Here is an example:
cat > mygrid << EOR
gridtype  = lonlat
xsize     = 360
ysize     = 100
xfirst    = 0
xinc      = 1
yfirst    = -49.5
yinc      = 1
EOR

cdo genbil,mygrid ncfile remapweights.nc
cdo remap,mygrid,remapweights.nc ncfile ofile

    (1-5/5)