Project

General

Profile

Regarding Regridding/ Mapping

Added by Harsh Vardhan Singh almost 5 years ago

I want to regrid the IMD .nc file of precipitation from 0.25 to 0.50 degree resolution.
If anyone knows kindly share his/her contact. Its urgent.
Thanks for the help.


Replies (13)

RE: Regarding Regridding/ Mapping - Added by Karin Meier-Fleischer almost 5 years ago

Hi Harsh,

I don't know IMD netCDF files. Can you upload one?

-Karin

RE: Regarding Regridding/ Mapping - Added by Harsh Vardhan Singh almost 5 years ago

Dear Karin,
Thank you for your help.
Can you send me your email id so that i can share that with you.
my emailid is

RE: Regarding Regridding/ Mapping - Added by Karin Meier-Fleischer almost 5 years ago

If it is not more than 70 MB you can upload the file here.
Click on Reply and below the text box is the Files part.

RE: Regarding Regridding/ Mapping - Added by Harsh Vardhan Singh almost 5 years ago

It is more than the size you said. Please tell me your email id show that I can share with you on Google Drive.

RE: Regarding Regridding/ Mapping - Added by Harsh Vardhan Singh almost 5 years ago

Dear Karin,
There is some problem with uploading the file on your link. It gets fail after sometime. Can't I share on Google Drive?

RE: Regarding Regridding/ Mapping - Added by Harsh Vardhan Singh almost 5 years ago

I have uploaded the file. Kindly see it.
The uploaded file is in 0.25 degree resolution and I want to get it in 0.5 degree by interpolation.
kindly help me in doing so.

Thank you very much.

RE: Regarding Regridding/ Mapping - Added by Karin Meier-Fleischer almost 5 years ago

The input file contains regional data. To remap this to another grid you need a grid description file
for the target grid (0.5x0.5).

1. Retrieve the grid description from the input file and make some changes

cdo griddes RF_1901_2016.nc > gridfile.txt

Source grid:

#
# gridID 1
#
gridtype  = lonlat
gridsize  = 17415
xsize     = 135
ysize     = 129
xname     = lon
xlongname = "longitude" 
xunits    = "degrees_east" 
yname     = lat
ylongname = "latitude" 
yunits    = "degrees_north" 
xfirst    = 66.5
xinc      = 0.25
yfirst    = 6.5
yinc      = 0.25

Target grid:

#
# gridID 1
#
gridtype  = lonlat
gridsize  = 4420
xsize     = 68
ysize     = 65
xname     = lon
xlongname = "longitude" 
xunits    = "degrees_east" 
yname     = lat
ylongname = "latitude" 
yunits    = "degrees_north" 
xfirst    = 66.5
xinc      = 0.5
yfirst    = 6.5
yinc      = 0.5

2. Remap the input data to the target grid

cdo remapbil,gridfile.txt RF_1901_2016.nc outfile.nc
cdo    remapbil: Bilinear weights from lonlat (135x129) to lonlat (68x65) grid, with source mask (4964)
cdo    remapbil: Processed 1 variable over 42369 timesteps [5.83s 43MB].
cdo sinfon outfile.nc 
   File format : NetCDF2
    -1 : Institut Source   T Steptype Levels Num    Points Num Dtype : Parameter name
     1 : unknown  unknown  v instant       1   1      4420   1  F32  : rf            
   Grid coordinates :
     1 : lonlat                   : points=4420 (68x65)
                              lon : 66.5 to 100 by 0.5 degrees_east
                              lat : 6.5 to 38.5 by 0.5 degrees_north
   Vertical coordinates :
     1 : surface                  : levels=1
   Time coordinate :  42369 steps
     RefTime =  0001-01-01 00:00:00  Units = hours  Calendar = standard
  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss
  1901-01-01 00:00:00  1901-01-02 00:00:00  1901-01-03 00:00:00  1901-01-04 00:00:00
  1901-01-05 00:00:00  1901-01-06 00:00:00  1901-01-07 00:00:00  1901-01-08 00:00:00
  1901-01-09 00:00:00  1901-01-10 00:00:00  1901-01-11 00:00:00  1901-01-12 00:00:00
  ...

RE: Regarding Regridding/ Mapping - Added by Harsh Vardhan Singh almost 5 years ago

Thank you for the kind support.
Can I know how to make the target grid file i.e., gridfile.txt.?

What should it contain?

RE: Regarding Regridding/ Mapping - Added by Karin Meier-Fleischer almost 5 years ago

As described above.

1. Retrieve the grid description of the input file, save it to file gridfile.txt
2. Edit gridfile.txt. Change gridsize, xsize, ysize, xinc and yinc


Input data
RF_1901_2016.nc has 135 longitude values and 129 latitude values

xsize = 135
ysize = 129
gridsize = 17415
(= xsize*ysize)

and the longitude increment is 0.25 and the latitude increment is 0.25 degrees

xinc = 0.25
yinc = 0.25


Changes for the target grid
The longitude increment is 0.5 and the latitude increment is 0.5 - this halves the number of xinc and yinc (only integers are valid).

xsize = 68
ysize = 65
gridsize = 4420 (= xsize*ysize)

and the longitude increment is 0.5 and the latitude increment is 0.5 degrees

xinc = 0.5
yinc = 0.5

Have a look at section 1.3.2.4 CDO grids at https://code.mpimet.mpg.de/projects/cdo/embedded/index.html#x1-130001.3

RE: Regarding Regridding/ Mapping - Added by Brendan DeTracey almost 5 years ago

Read the cdo documentation for horizontal grids. There is a shortcut for describing regular grids, section 1.3.2.1, no grid file required.

RE: Regarding Regridding/ Mapping - Added by Karin Meier-Fleischer almost 5 years ago

This is ok for global data but his data is regional.

RE: Regarding Regridding/ Mapping - Added by Brendan DeTracey almost 5 years ago

I have foot-in mouth disease.

    (1-13/13)