Rotated pole grid problem in CORDEX AFR-44 data
Added by Jonas Ardö about 5 years ago
Dear Forum,
I am working with CORDEX data for Africa (tas_AFR-44_CCCma-CanESM2_rcp45_r1i1p1_SMHI-RCA4_v1_3hr_208501010000-208512312100.nc) and note that these do not display correctly using PANOPLY as there is a 180 degree longitude shift due to the rotated pole grid that I suspect makes things difficult.
Questions:
1. Any suggestion how to solve this to get a correct display in Panoply?
2. Does this effect other CDO tools such as "cdo -outputtab,name,date,lon,lat,value -remapnn,lon=0.1_lat=0.1 infil.nc"
Jonas Ardö, Lund University
Details:
After suggestions in this forum I tried to unsuccessfully correct this using setattribute:
$ cdo setattribute,pr@coordinates="lat lon" tas_AFR-44_CCCma-CanESM2_rcp45_r1i1p1_SMHI-RCA4_v1_3hr_208501010000-208512312100.nc tempfile1.nc
cdo setattribute (Warning): Variable >pr< not found!
cdo setattribute: Processed 113862480 values from 1 variable over 2920 timesteps [2.42s 24MB]
$ cdo setattribute,tas@coordinates="lat lon" tas_AFR-44_CCCma-CanESM2_rcp45_r1i1p1_SMHI-RCA4_v1_3hr_208501010000-208512312100.nc tempfile2.nc
cdo setattribute: Processed 113862480 values from 1 variable over 2920 timesteps [2.30s 24MB]
When I contacted Panoply/ Robert B. Schmunk i got this answer:
Jonas,
The problem is in the definition of the grid and how Panoply interprets it.
The data are on a rotated-pole projected grid, as defined by the attributes of the "rotated_pole" variable. That var indicates that the rotated north pole is at -180°E 90°N. This might look to the casual observer as if it means that there is no rotation of the pole at all. However, Panoply understands this to mean that the primary meridian is to be rotated 180° of longitude. Thus you get the plot that you are seeing.
Note that Panoply does not use the values of longitude and latitude specified in the "lon" and "lat" variables. It instead constructs a rotated-pole map projection according to its understanding of the "rotated_pole" projection definition and then transforms the coordinate values in the "rlon" and "rlat" variables to the plotted coordinates.
I was able to doublecheck this by poking around the web and finding some sample AFR-44 datasets at
http://climate-modelling.canada.ca/climatemodeldata/canrcm/CanRCM4/AFR-44_CCCma-CanESM2_rcp45/day/atmos/tas/index.shtmlAs a further check, I also downloaded a couple EUR-44 and NAM-44 region datasets from the same repository, and those data plot exactly as expected. So the rotated-pole projection code in Panoply is not necessarily wrong. It makes me wonder if there is an error or misunderstanding in how the projection attributes are written to the "rotated_pole" variable for the AFR-44 region.
Also while poking about the web I found a PDF titled "CORDEX Archive Design" at
https://is-enes-data.github.io/cordex_archive_specifications.pdf
I found it very interesting to see there that the AFR-44 definition given in Table 1 says that the longitude of the north pole for that domain is "N/A". However, the example in Appendix A on page 14 does say -180°.rbs
netcdf file:/H:/Forskning/2018/WBGT/CORDEX/Ta/tas_AFR-44_CCCma-CanESM2_rcp45_r1i1p1_SMHI-RCA4_v1_3hr_208501010000-208512312100.nc {
dimensions:
rlon = 194;
rlat = 201;
time = UNLIMITED; // (2920 currently)
variables:
double height;
:axis = "Z";
:long_name = "height";
:positive = "up";
:standard_name = "height";
:units = "m";
double rlon(rlon=194);
:standard_name = "grid_longitude";
:long_name = "longitude in rotated pole grid";
:units = "degrees";
:axis = "X";
:_ChunkSizes = 194U; // uint
double rlat(rlat=201);
:standard_name = "grid_latitude";
:long_name = "latitude in rotated pole grid";
:units = "degrees";
:axis = "Y";
:_ChunkSizes = 201U; // uint
char rotated_pole;
:grid_mapping_name = "rotated_latitude_longitude";
:grid_north_pole_latitude = 90.0; // double
:grid_north_pole_longitude = -180.0; // double
double time(time=2920);
:standard_name = "time";
:units = "days since 1949-12-01 00:00:00";
:calendar = "365_day";
:long_name = "time";
:axis = "T";
:_ChunkSizes = 524288U; // uint
float tas(time=2920, rlat=201, rlon=194);
:grid_mapping = "rotated_pole";
:_FillValue = 1.0E20f; // float
:missing_value = 1.0E20f; // float
:standard_name = "air_temperature";
:long_name = "Near-Surface Air Temperature";
:units = "K";
:coordinates = "lon lat height";
:cell_methods = "time: point";
:_ChunkSizes = 1U, 201U, 194U; // uint
double lon(rlat=201, rlon=194);
:standard_name = "longitude";
:long_name = "longitude";
:units = "degrees_east";
:_ChunkSizes = 201U, 194U; // uint
double lat(rlat=201, rlon=194);
:standard_name = "latitude";
:long_name = "latitude";
:units = "degrees_north";
:_ChunkSizes = 201U, 194U; // uint
// global attributes:
:Conventions = "CF-1.4";
:contact = "rossby.cordex@smhi.se";
:creation_date = "2017-08-30-T02:47:35Z";
:experiment = "RCP4.5";
:experiment_id = "rcp45";
:driving_experiment = "CCCma-CanESM2, rcp45, r1i1p1";
:driving_model_id = "CCCma-CanESM2";
:driving_model_ensemble_member = "r1i1p1";
:driving_experiment_name = "rcp45";
:frequency = "3hr";
:institution = "Swedish Meteorological and Hydrological Institute, Rossby Centre";
:institute_id = "SMHI";
:model_id = "SMHI-RCA4";
:rcm_version_id = "v1";
:project_id = "CORDEX";
:CORDEX_domain = "AFR-44";
:product = "output";
:references = "http://www.smhi.se/en/Research/Research-departments/climate-research-rossby-centre";
:tracking_id = "569a0a0d-aea2-4af3-aded-5cdfefdd44e9";
:rossby_comment = "201108: CORDEX Africa 0.44 deg | RCA4 v1 | CCCma-CanESM2 | r1i1p1 | rcp45 | L40";
:rossby_run_id = "201108";
:rossby_grib_path = "/home/rossby/prod/201108/raw/";
$ cdo sinfon tas_AFR-44_CCCma-CanESM2_rcp45_r1i1p1_SMHI-RCA4_v1_3hr_208501010000-208512312100.nc
File format : NetCDF4 classic zip
-1 : Institut Source T Steptype Levels Num Points Num Dtype : Parameter name
1 : unknown unknown v instant 1 1 38994 1 F32z : tas
Grid coordinates :
1 : curvilinear : points=38994 (194x201)
lon : -24.64 to 60.28 degrees_east
lat : -45.76 to 42.24 by 0.44 degrees_north
mapping : rotated_latitude_longitude
rlon : -24.64 to 60.28 by 0.44 degrees
rlat : -45.76 to 42.24 by 0.44 degrees
Vertical coordinates :
1 : height : levels=1 scalar
height : 2 m
Time coordinate : 2920 steps
RefTime = 1949-12-01 00:00:00 Units = days Calendar = 365_day
Replies (3)
RE: Rotated pole grid problem in CORDEX AFR-44 data - Added by Ralf Mueller about 5 years ago
hi Jonas!
if you only want to plot it, you can interpolate it with CDO on a global grid and use panoply again:
cdo -remapbil,global_0.5 -seltimestep,22 tas_AFR-44_CCCma-CanESM2_rcp45_r1i1p1_CCCma-CanRCM4_r2_day_20410101-20451231.nc tasAFR.nc

cdo outputtab,lon,lat
prints the values of the non-rotated coordinated (lon,lat) not (rlon,rlat) using your uploaded file. But I think the addition of the coordinates
attribute is wrong. Without it, cdo outputtab
prints the rotated values.
IMO lon
and lat
are not connected to the data nor needed for describing the grid. But I am not an expert in setting up grids like this - I just don't see the need for 2d-coordinate variables like lon
and lat
in your file, but it's clearly stated in the cordex-archive document Robert was referring to.
hth
ralf
tas_in_tasAFR.png (147 KB) tas_in_tasAFR.png |
RE: Rotated pole grid problem in CORDEX AFR-44 data - Added by Jonas Ardö about 5 years ago
Thanks.
Works but increases file size with a factor 23 when including all time steps.
Anyway to simply shift :grid_mapping = "rotated_pole"; to something else? (What?)
/Jonas
RE: Rotated pole grid problem in CORDEX AFR-44 data - Added by Jonas Ardö about 5 years ago
What about using "cdo setgrid,mygrid.txt infile outfile" ?
/jonas
$ more mygrid.txt
gridtype = lonlat
gridsize = 38994
xname = lon
xlongname = Longitude
xunits = degrees_east
yname = lat
ylongname = Latitude
yunits = degrees_north
xsize = 194
ysize = 201
xfirst = -24.64
xinc = 0.44
yfirst = -45.76
yinc = 0.44
tas_in_mygrid2.png (143 KB) tas_in_mygrid2.png |