Project

General

Profile

Optimal approach for remapping rotated grid data

Added by Richard Cooper over 9 years ago

Hello,

I'm trying to determine the optimal approach for remapping rotated grid data (latlon WGS84) to normal (non-rotated) latlon.

The method adopted is based on the post at https://code.zmaw.de/boards/1/topics/2632?r=2634#message-2634 and lots of online searching including the CDO manual.

I've used 'cdo sinfo' to identify the real (ie., non-rotated) spatial boundaries of the data, and 'gdalinfo' to find the files spatial resolution (see i and ii below).

Then the ouput target grid (seasia.nc) is used for remapping the rotated nc file to normal latlon coordinates using cdo's remapbil (see iii below)

My queries:

1. I couldn't find any information related to the '-topo' flag used for creating the seasia.nc target grid. Can anyone point me to any info on this flag. The flag is needed or the command fails otherwise.

2. I've used bilinear interpolation - would remapcon be better in this case with daily precipitation values?

3. 'cdo sinfo' outputs the long and lat of the grid boundaries - this command appears to ignore the rotated pole parameters or is it remapping to normal (non-rotated) latlon WGS84 coordinates?

Thanks for your feedback.

Cheers
Richard

(i) Find spatial extent of nc file (in normal non-rotated latlon WGS84):

cdo sinfo cahpa.f1jan.05216.nc
File format : netCDF
-1 : Institut Source Ttype Levels Num Points Num Dtype : Parameter ID
1 : unknown unknown instant 1 1 36864 1 F32 : -1
Grid coordinates :
1 : curvilinear : points=36864 (192x192) * longitude : 90.3057 to 136.942 degrees_east
latitude : -13.0722 to 30.24 degrees_north*
Vertical coordinates :
1 : surface : levels=1
Time coordinate : 30 steps
RefTime = 1860-12-01 00:00:00 Units = days Calendar = 360_day Bounds = true
YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss
1951-01-01 12:00:00 1951-01-02 12:00:00 1951-01-03 12:00:00 1951-01-04 12:00:00
1951-01-05 12:00:00 1951-01-06 12:00:00 1951-01-07 12:00:00 1951-01-08 12:00:00
1951-01-09 12:00:00 1951-01-10 12:00:00 1951-01-11 12:00:00 1951-01-12 12:00:00
1951-01-13 12:00:00 1951-01-14 12:00:00 1951-01-15 12:00:00 1951-01-16 12:00:00
1951-01-17 12:00:00 1951-01-18 12:00:00 1951-01-19 12:00:00 1951-01-20 12:00:00
1951-01-21 12:00:00 1951-01-22 12:00:00 1951-01-23 12:00:00 1951-01-24 12:00:00
1951-01-25 12:00:00 1951-01-26 12:00:00 1951-01-27 12:00:00 1951-01-28 12:00:00
1951-01-29 12:00:00 1951-01-30 12:00:00
cdo sinfo: Processed 1 variable over 30 timesteps ( 0.01s )

(ii) Use gdalinfo to find spatial resolution (0.22 degrees)

gdalinfo cahpa.f1jan.05216.nc 
Driver: netCDF/Network Common Data Format
Files: cahpa.f1jan.05216.nc
Size is 192, 192
Coordinate System is `'
Origin = (-16.909989696522658,15.349998811152593)
Pixel Size = (0.219999992410550,-0.219999987417491)
...
precipitation_flux#units=kg m-2 s-1
rotated_latitude_longitude#grid_mapping_name=rotated_latitude_longitude
rotated_latitude_longitude#grid_north_pole_latitude=75
rotated_latitude_longitude#grid_north_pole_longitude=289
...
Geolocation:
LINE_OFFSET=0
LINE_STEP=1
PIXEL_OFFSET=0
PIXEL_STEP=1
SRS=GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9108"]],AUTHORITY["EPSG","4326"]]
X_BAND=1
X_DATASET=NETCDF:"cahpa.f1jan.05216.nc":longitude
Y_BAND=1
Y_DATASET=NETCDF:"cahpa.f1jan.05216.nc":latitude
Corner Coordinates:
Upper Left ( -16.9099897, 15.3499988)
Lower Left ( -16.9099897, -26.8899988)
Upper Right ( 25.3300088, 15.3499988)
Lower Right ( 25.3300088, -26.8899988)
Center ( 4.2100096, -5.7700000)

(iii) Remap to normal (non-rotated) latlon WGS84 with 0.25 degree resolution:

*cdo -f nc -sellonlatbox,90,140,35,-15 -remapbil,r1440x720 -topo seasia.nc

cdo -f nc remapbil,seasia.nc cahpa.f1jan.05216.nc ofile.nc*


Replies (3)

RE: Optimal approach for remapping rotated grid data - Added by Uwe Schulzweida over 9 years ago

-topo is an undocumented CDO operator to generate a 2D field with the topography on a half degree grid. You don't need this operator. Try it with the operator random, to create a 2D field with random numbers:

cdo -f nc -sellonlatbox,90,140,35,-15 -random,r1440x720 seasia.nc
Or better, use a grid description file:
cat > seasia.grid << EOR
gridtype  = lonlat
xsize     = 201
ysize     = 200
xfirst    = 90
xinc      = 0.25
yfirst    = -14.875
yinc      = 0.25
EOR

cdo -f nc remapbil,seasia.grid cahpa.f1jan.05216.nc ofile.nc

The optimal interpolation method depends on the contents of the data, and the resolution of the source and target grid. The conservative method (remapcon) is necessary to preserve the mass. If the source and target resolution is nearly the same then the bilinear interpolation could be sufficient.
remapcon needs the vertices of all gridcells. Your file seems to provide only the geographical coordinates for the gridcell center. CDO can recalculate the gridcell center and vertices from the rotated coordinates if you remove the gridcell center. This can be achieved by setting the env. variable:

export IGNORE_ATT_COORDINATES=1
Check the result with sinfo.

RE: Optimal approach for remapping rotated grid data - Added by François Roberge about 6 years ago

Hi Uwe,

I just tested this method and it seems that conservative remapping works with many grids that were not working before I tried by setting this first :

export IGNORE_ATT_COORDINATES=1

However, I always thought that CDO could not calculate the grid cell corners by my own experience, but also based on many others posts.

So, CDO can recalculate the grid cell corners based on the rotated coordinates?

Thank you,

François Roberge

RE: Optimal approach for remapping rotated grid data - Added by Uwe Schulzweida about 6 years ago

Hi François,

Yes, CDO can recalculate the grid cell corners base on rotated coordinates!

Cheers,
Uwe

    (1-3/3)