Project

General

Profile

Help needed converting curvilinear to lonlat grid

Added by Sebastian Engelstaedter over 5 years ago

Hi all,

The topic has been discussed in several threads through the years but I did not find a solution for my problem, unfortunately. My input file is a CMIP5 model file (BNU-ESM) which is on a curvilinear grid. ncdump -h looks like the following:

dimensions:
x = 360 ;
y = 200 ;
nv4 = 4 ;
time = UNLIMITED ; // (1 currently)
bnds = 2 ;
variables:
float lon(y, x) ;
lon:standard_name = "longitude" ;
lon:long_name = "longitude coordinate" ;
lon:units = "degrees_east" ;
lon:_CoordinateAxisType = "Lon" ;
lon:bounds = "lon_bnds" ;
float lon_bnds(y, x, nv4) ;
float lat(y, x) ;
lat:standard_name = "latitude" ;
lat:long_name = "latitude coordinate" ;
lat:units = "degrees_north" ;
lat:_CoordinateAxisType = "Lat" ;
lat:bounds = "lat_bnds" ;
float lat_bnds(y, x, nv4) ;
double time(time) ;
time:standard_name = "time" ;
time:long_name = "time" ;
time:bounds = "time_bnds" ;
time:units = "days since 1850-1-1 00:00:00" ;
time:calendar = "365_day" ;
time:axis = "T" ;
double time_bnds(time, bnds) ;
float tos(time, y, x) ;
tos:standard_name = "sea_surface_temperature" ;
tos:long_name = "Sea Surface Temperature" ;
tos:units = "K" ;
tos:coordinates = "lat lon" ;
tos:_FillValue = 1.e+20f ;
tos:missing_value = 1.e+20f ;
tos:comment = "\"this may differ from \"\"surface temperature\"\" in regions of sea ice.\"" ;
tos:cell_methods = "time: mean" ;

The following CDO command seems to convert the input file from curvilinear to a 1x1 degree regular lonlat grid without any error messages.

cdo remapnn,global_1 ltm_tos.nc ltm_tos_ll.nc

ncdump -h of the output file looks as following:

dimensions:
lon = 360 ;
lat = 180 ;
time = UNLIMITED ; // (1 currently)
bnds = 2 ;
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:bounds = "time_bnds" ;
time:units = "days since 1850-1-1 00:00:00" ;
time:calendar = "365_day" ;
time:axis = "T" ;
double time_bnds(time, bnds) ;
float tos(time, lat, lon) ;
tos:standard_name = "sea_surface_temperature" ;
tos:long_name = "Sea Surface Temperature" ;
tos:units = "K" ;
tos:_FillValue = 1.e+20f ;
tos:missing_value = 1.e+20f ;

Longitude values go as expected from -179.5 to 179.5. However, when visualising the the output file using ncview there seems to be a distortion in the longitude direction (see attached image). Africa should be at the centre of the image. Also, the lon and lat variables are not shown in the ncview interface which they usually are. So something has gone wrong somewhere but I am unable to figure it out. Any pointers would be much appreciated.

I am using CDO v1.7.

Thanks,
Sebastian


Replies (3)

RE: Help needed converting curvilinear to lonlat grid - Added by Ralf Mueller over 5 years ago

Hi Sebastian!

I cross-checked with cdo-1.9.5 with identical results. The coordinates are correct. As an alternative I checked

cdo -f nc topo,global_1 topo.nc
which has identical coordinates to your output file, but ncview comes up with then Africa-centered representation you wanted to have. TBH I have no idea, what ncview is doing here. Panoply behaves in the same way.

RE: Help needed converting curvilinear to lonlat grid - Added by Uwe Schulzweida over 5 years ago

The problem is that the original data on the curvilinear grid doesn't fit to the geographical coordinates available in the file.
You can see the shift of the continents also in the original data with ncview.

RE: Help needed converting curvilinear to lonlat grid - Added by Sebastian Engelstaedter over 5 years ago

Thanks for checking Ralf. And thanks for pointing out the problem in the original file. I had not noticed that actually. Seems to make sense now.
Thanks,
Sebastian

    (1-3/3)