Project

General

Profile

cdo remapbil (Abort): lonlat grid without latitude coordinates!

Added by Sjoerd Terpstra over 1 year ago

Hi, I have some issues using the remapbil command:

cdo remapbil,mygrid3 units_pre_tas.nc out.nc

The target grid mygrid3 is given by

gridtype = lonlat
xsize = 192
ysize = 144
xvals = -179.0625 -177.1875 -175.3125 -173.4375 -171.5625 -169.6875 -167.8125 -165.9375 -164.0625 -162.1875 -160.3125 -158.4375 -156.5625 -154.6875 -152.8125 -150.9375 -149.0625 -147.1875 -145.3125 -143.4375 -141.5625 -139.6875 -137.8125 -135.9375 -134.0625 -132.1875 -130.3125 -128.4375 -126.5625 -124.6875 -122.8125 -120.9375 -119.0625 -117.1875 -115.3125 -113.4375 -111.5625 -109.6875 -107.8125 -105.9375 -104.0625 -102.1875 -100.3125 -98.4375 -96.5625 -94.6875 -92.8125 -90.9375 -89.0625 -87.1875 -85.3125 -83.4375 -81.5625 -79.6875 -77.8125 -75.9375 -74.0625 -72.1875 -70.3125 -68.4375 -66.5625 -64.6875 -62.8125 -60.9375 -59.0625 -57.1875 -55.3125 -53.4375 -51.5625 -49.6875 -47.8125 -45.9375 -44.0625 -42.1875 -40.3125 -38.4375 -36.5625 -34.6875 -32.8125 -30.9375 -29.0625 -27.1875 -25.3125 -23.4375 -21.5625 -19.6875 -17.8125 -15.9375 -14.0625 -12.1875 -10.3125 -8.4375 -6.5625 -4.6875 -2.8125 -0.9375 0.9375 2.8125 4.6875 6.5625 8.4375 10.3125 12.1875 14.0625 15.9375 17.8125 19.6875 21.5625 23.4375 25.3125 27.1875 29.0625 30.9375 32.8125 34.6875 36.5625 38.4375 40.3125 42.1875 44.0625 45.9375 47.8125 49.6875 51.5625 53.4375 55.3125 57.1875 59.0625 60.9375 62.8125 64.6875 66.5625 68.4375 70.3125 72.1875 74.0625 75.9375 77.8125 79.6875 81.5625 83.4375 85.3125 87.1875 89.0625 90.9375 92.8125 94.6875 96.5625 98.4375 100.3125 102.1875 104.0625 105.9375 107.8125 109.6875 111.5625 113.4375 115.3125 117.1875 119.0625 120.9375 122.8125 124.6875 126.5625 128.4375 130.3125 132.1875 134.0625 135.9375 137.8125 139.6875 141.5625 143.4375 145.3125 147.1875 149.0625 150.9375 152.8125 154.6875 156.5625 158.4375 160.3125 162.1875 164.0625 165.9375 167.8125 169.6875 171.5625 173.4375 175.3125 177.1875 179.0625
yvals = -89.375 -88.125 -86.875 -85.625 -84.375 -83.125 -81.875 -80.625 -79.375 -78.125 -76.875 -75.625 -74.375 -73.125 -71.875 -70.625 -69.375 -68.125 -66.875 -65.625 -64.375 -63.125 -61.875 -60.625 -59.375 -58.125 -56.875 -55.625 -54.375 -53.125 -51.875 -50.625 -49.375 -48.125 -46.875 -45.625 -44.375 -43.125 -41.875 -40.625 -39.375 -38.125 -36.875 -35.625 -34.375 -33.125 -31.875 -30.625 -29.375 -28.125 -26.875 -25.625 -24.375 -23.125 -21.875 -20.625 -19.375 -18.125 -16.875 -15.625 -14.375 -13.125 -11.875 -10.625 -9.375 -8.125 -6.875 -5.625 -4.375 -3.125 -1.875 -0.625 0.625 1.875 3.125 4.375 5.625 6.875 8.125 9.375 10.625 11.875 13.125 14.375 15.625 16.875 18.125 19.375 20.625 21.875 23.125 24.375 25.625 26.875 28.125 29.375 30.625 31.875 33.125 34.375 35.625 36.875 38.125 39.375 40.625 41.875 43.125 44.375 45.625 46.875 48.125 49.375 50.625 51.875 53.125 54.375 55.625 56.875 58.125 59.375 60.625 61.875 63.125 64.375 65.625 66.875 68.125 69.375 70.625 71.875 73.125 74.375 75.625 76.875 78.125 79.375 80.625 81.875 83.125 84.375 85.625 86.875 88.125 89.375

And the header of units_pre_tas.nc is (followed by the header of out.nc)

@netcdf units_pre_tas {
dimensions:
time = 1800 ;
y = 144 ;
x = 192 ;
bnds = 2 ;
variables:
float tas(time, y, x) ;
tas:_FillValue = 1.e+20f ;
tas:standard_name = "air_temperature" ;
tas:long_name = "Near-Surface Air Temperature" ;
tas:comment = "near-surface (usually, 2 meter) air temperature" ;
tas:cell_methods = "area: time: mean" ;
tas:cell_measures = "area: areacella" ;
tas:history = "2019-11-08T03:20:32Z altered by CMOR: Treated scalar dimension: \'height\'. 2019-11-08T03:20:32Z altered by CMOR: replaced missing value flag (-1.07374e+09) with standard missing value (1e+20)." ;
tas:missing_value = 1.e+20f ;
tas:units = "K" ;
tas:coordinates = "height" ;
double time(time) ;
time:_FillValue = NaN ;
time:bounds = "time_bnds" ;
time:axis = "T" ;
time:long_name = "time" ;
time:standard_name = "time" ;
time:units = "days since 0950-01-01" ;
time:calendar = "proleptic_gregorian" ;
double time_bnds(time, bnds) ;
time_bnds:_FillValue = NaN ;
double y(y) ;
y:_FillValue = NaN ;
y:units = "degrees_north" ;
double x(x) ;
x:_FillValue = NaN ;
x:units = "degrees_east" ;
double lon(x) ;
lon:_FillValue = NaN ;
lon:units = "degrees_east" ;
double lat(y) ;
lat:_FillValue = NaN ;
lat:units = "degrees_north" ;

// global attributes:
:Conventions = "CF-1.7 CMIP-6.2" ;
:activity_id = "CMIP" ;
:branch_method = "standard" ;
:branch_time_in_child = 0. ;
:branch_time_in_parent = 0. ;
:creation_date = "2019-11-08T03:20:33Z" ;
:data_specs_version = "01.00.30" ;
:experiment = "abrupt quadrupling of CO2" ;
:experiment_id = "abrupt-4xCO2" ;
:external_variables = "areacella" ;
:forcing_index = 1 ;
:frequency = "mon" ;
:further_info_url = "https://furtherinfo.es-doc.org/CMIP6.CSIRO-ARCCSS.ACCESS-CM2.abrupt-4xCO2.none.r1i1p1f1" ;
:grid = "native atmosphere N96 grid (144x192 latxlon)" ;
:grid_label = "gn" ;
:initialization_index = 1 ;
:institution = "CSIRO (Commonwealth Scientific and Industrial Research Organisation, Aspendale, Victoria 3195, Australia), ARCCSS (Australian Research Council Centre of Excellence for Climate System Science)" ;
:institution_id = "CSIRO-ARCCSS" ;
:mip_era = "CMIP6" ;
:nominal_resolution = "250 km" ;
:notes = "Exp: CM2-abrupt-4xCO2; Local ID: bn570; Variable: tas ([\'fld_s03i236\'])" ;
:parent_activity_id = "CMIP" ;
:parent_experiment_id = "piControl" ;
:parent_mip_era = "CMIP6" ;
:parent_source_id = "ACCESS-CM2" ;
:parent_time_units = "days since 0950-01-01" ;
:parent_variant_label = "r1i1p1f1" ;
:physics_index = 1 ;
:product = "model-output" ;
:realization_index = 1 ;
:realm = "atmos" ;
:run_variant = "forcing: GHG, Oz, SA, Sl, Vl, BC, OC, (GHG = CO2, N2O, CH4, CFC11, CFC12, CFC113, HCFC22, HFC125, HFC134a)" ;
:source = "ACCESS-CM2 (2019): \naerosol: UKCA-GLOMAP-mode\natmos: MetUM-HadGEM3-GA7.1 (N96; 192 x 144 longitude/latitude; 85 levels; top level 85 km)\natmosChem: none\nland: CABLE2.5\nlandIce: none\nocean: ACCESS-OM2 (GFDL-MOM5, tripolar primarily 1deg; 360 x 300 longitude/latitude; 50 levels; top grid cell 0-10 m)\nocnBgchem: none\nseaIce: CICE5.1.2 (same grid as ocean)" ;
:source_id = "ACCESS-CM2" ;
:source_type = "AOGCM" ;
:sub_experiment = "none" ;
:sub_experiment_id = "none" ;
:table_id = "Amon" ;
:table_info = "Creation Date:(30 April 2019) MD5:e14f55f257cceafb2523e41244962371" ;
:title = "ACCESS-CM2 output prepared for CMIP6" ;
:variable_id = "tas" ;
:variant_label = "r1i1p1f1" ;
:version = "v20191108" ;
:cmor_version = "3.4.0" ;
:tracking_id = "hdl:21.14100/302dc95e-3b58-4e89-8b7d-002b0829fe40" ;
:license = "CMIP6 model data produced by CSIRO is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License (https://creativecommons.org/licenses/). Consult https://pcmdi.llnl.gov/CMIP6/TermsOfUse for terms of use governing CMIP6 output, including citation requirements and proper acknowledgment. Further information about this data, including some limitations, can be found via the further_info_url (recorded as a global attribute in this file). The data producers and data providers make no warranty, either express or implied, including, but not limited to, warranties of merchantability and fitness for a particular purpose. All liabilities arising from the supply of the information (including any liability arising in negligence) are excluded to the fullest extent permitted by law." ;
:coordinates = "lat lon time_bnds" ;
:history = "Mon Dec 19 14:55:28 2022: ncatted -O -a units,lon,c,c,degrees_east -a units,lat,c,c,degrees_north -a units,x,c,c,degrees_east -a units,y,c,c,degrees_north pre_tas.nc units_pre_tas.nc\n2019-11-08T03:20:33Z ; CMOR rewrote data to be consistent with CMIP6, CF-1.7 CMIP-6.2 and CF standards." ;
:NCO = "netCDF Operators version 5.1.3 (Homepage = http://nco.sf.net, Code = http://github.com/nco/nco)" ;
}
@

-------------------
And my output file:
-------------------

@netcdf out {
dimensions:
time = UNLIMITED ; // (1 currently)
bnds = 2 ;
lon = 192 ;
lat = 144 ;
variables:
double time(time) ;
time:standard_name = "time" ;
time:long_name = "time" ;
time:bounds = "time_bnds" ;
time:units = "days since 0950-01-01" ;
time:calendar = "proleptic_gregorian" ;
time:axis = "T" ;
double time_bnds(time, bnds) ;
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" ;
float tas(time, lat, lon) ;
tas:standard_name = "air_temperature" ;
tas:long_name = "Near-Surface Air Temperature" ;
tas:units = "K" ;
tas:_FillValue = 1.e+20f ;
tas:missing_value = 1.e+20f ;
tas:comment = "near-surface (usually, 2 meter) air temperature" ;
tas:cell_methods = "area: time: mean" ;
tas:cell_measures = "area: areacella" ;
tas:history = "2019-11-08T03:20:32Z altered by CMOR: Treated scalar dimension: \'height\'. 2019-11-08T03:20:32Z altered by CMOR: replaced missing value flag (-1.07374e+09) with standard missing value (1e+20)." ;
double lon_2(lat, lon) ;
lon_2:units = "degrees_east" ;
lon_2:_FillValue = NaN ;
lon_2:missing_value = NaN ;
double lat_2(lon, lat) ;
lat_2:units = "degrees_north" ;
lat_2:_FillValue = NaN ;
lat_2:missing_value = NaN ;

// global attributes:
:CDI = "Climate Data Interface version 2.1.1 (https://mpimet.mpg.de/cdi)" ;
:source = "ACCESS-CM2 (2019): \naerosol: UKCA-GLOMAP-mode\natmos: MetUM-HadGEM3-GA7.1 (N96; 192 x 144 longitude/latitude; 85 levels; top level 85 km)\natmosChem: none\nland: CABLE2.5\nlandIce: none\nocean: ACCESS-OM2 (GFDL-MOM5, tripolar primarily 1deg; 360 x 300 longitude/latitude; 50 levels; top grid cell 0-10 m)\nocnBgchem: none\nseaIce: CICE5.1.2 (same grid as ocean)" ;
:institution = "CSIRO (Commonwealth Scientific and Industrial Research Organisation, Aspendale, Victoria 3195, Australia), ARCCSS (Australian Research Council Centre of Excellence for Climate System Science)" ;
:Conventions = "CF-1.7 CMIP-6.2" ;
:activity_id = "CMIP" ;
:branch_method = "standard" ;
:branch_time_in_child = 0. ;
:branch_time_in_parent = 0. ;
:creation_date = "2019-11-08T03:20:33Z" ;
:data_specs_version = "01.00.30" ;
:experiment = "abrupt quadrupling of CO2" ;
:experiment_id = "abrupt-4xCO2" ;
:external_variables = "areacella" ;
:forcing_index = 1 ;
:frequency = "mon" ;
:further_info_url = "https://furtherinfo.es-doc.org/CMIP6.CSIRO-ARCCSS.ACCESS-CM2.abrupt-4xCO2.none.r1i1p1f1" ;
:grid = "native atmosphere N96 grid (144x192 latxlon)" ;
:grid_label = "gn" ;
:initialization_index = 1 ;
:institution_id = "CSIRO-ARCCSS" ;
:mip_era = "CMIP6" ;
:nominal_resolution = "250 km" ;
:notes = "Exp: CM2-abrupt-4xCO2; Local ID: bn570; Variable: tas ([\'fld_s03i236\'])" ;
:parent_activity_id = "CMIP" ;
:parent_experiment_id = "piControl" ;
:parent_mip_era = "CMIP6" ;
:parent_source_id = "ACCESS-CM2" ;
:parent_time_units = "days since 0950-01-01" ;
:parent_variant_label = "r1i1p1f1" ;
:physics_index = 1 ;
:product = "model-output" ;
:realization_index = 1 ;
:realm = "atmos" ;
:run_variant = "forcing: GHG, Oz, SA, Sl, Vl, BC, OC, (GHG = CO2, N2O, CH4, CFC11, CFC12, CFC113, HCFC22, HFC125, HFC134a)" ;
:source_id = "ACCESS-CM2" ;
:source_type = "AOGCM" ;
:sub_experiment = "none" ;
:sub_experiment_id = "none" ;
:table_id = "Amon" ;
:table_info = "Creation Date:(30 April 2019) MD5:e14f55f257cceafb2523e41244962371" ;
:title = "ACCESS-CM2 output prepared for CMIP6" ;
:variable_id = "tas" ;
:variant_label = "r1i1p1f1" ;
:version = "v20191108" ;
:cmor_version = "3.4.0" ;
:tracking_id = "hdl:21.14100/302dc95e-3b58-4e89-8b7d-002b0829fe40" ;
:license = "CMIP6 model data produced by CSIRO is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License (https://creativecommons.org/licenses/). Consult https://pcmdi.llnl.gov/CMIP6/TermsOfUse for terms of use governing CMIP6 output, including citation requirements and proper acknowledgment. Further information about this data, including some limitations, can be found via the further_info_url (recorded as a global attribute in this file). The data producers and data providers make no warranty, either express or implied, including, but not limited to, warranties of merchantability and fitness for a particular purpose. All liabilities arising from the supply of the information (including any liability arising in negligence) are excluded to the fullest extent permitted by law." ;
:coordinates = "lat lon time_bnds" ;
:history = "Mon Dec 19 15:20:09 2022: cdo remapbil,mygrid3 units_pre_tas.nc out.nc\nMon Dec 19 14:55:28 2022: ncatted -O -a units,lon,c,c,degrees_east -a units,lat,c,c,degrees_north -a units,x,c,c,degrees_east -a units,y,c,c,degrees_north pre_tas.nc units_pre_tas.nc\n2019-11-08T03:20:33Z ; CMOR rewrote data to be consistent with CMIP6, CF-1.7 CMIP-6.2 and CF standards." ;
:NCO = "netCDF Operators version 5.1.3 (Homepage = http://nco.sf.net, Code = http://github.com/nco/nco)" ;
:CDO = "Climate Data Operators version 2.1.1 (https://mpimet.mpg.de/cdo)" ;
}
@

The remapbil command works so far as it does produce out.nc with (as far as I can tell) the correct coordinates. However, it somehow has collapsed time dimensions (time = UNLIMITED) which is something I do not want/expect to happen.

Does someone have an idea what could be the issue/has a solution for this? It would be greatly appreciated!

Sjoerd


Replies (4)

RE: cdo remapbil (Abort): lonlat grid without latitude coordinates! - Added by Karin Meier-Fleischer over 1 year ago

Hi Sjoerd,

is it possible to upload the files?

RE: cdo remapbil (Abort): lonlat grid without latitude coordinates! - Added by Karin Meier-Fleischer over 1 year ago

If you take a look at the 'ncdump -h' output or the 'cdo sinfo' output you can see that there is someting wrong with the coordinates of the variable tas.

cdo sinfon units_pre_tas.nc 
Warning (cdfScanVarAttr): NetCDF: Variable not found - >height<
   File format : NetCDF4 zip
    -1 : Institut Source   T Steptype Levels Num    Points Num Dtype : Parameter name
     1 : unknown  ACCESS-CM2 v instant       1   1     27648   1  F32z : tas           
     2 : unknown  ACCESS-CM2 c instant       1   1       192   2  F64  : lon           
     3 : unknown  ACCESS-CM2 c instant       1   1       144   3  F64  : lat           
   Grid coordinates :
     1 : lonlat                   : points=27648 (192x144)
                                x : -179.0625 to 179.0625 by 1.875 degrees_east  circular
                                y : -89.375 to 89.375 by 1.25 degrees_north
     2 : lonlat                   : points=192
                                x : -179.0625 to 179.0625 by 1.875 degrees_east  circular
     3 : lonlat                   : points=144
                                y : -89.375 to 89.375 by 1.25 degrees_north
   Vertical coordinates :
     1 : surface                  : levels=1
   Time coordinate :
                             time : 1800 steps
     RefTime =  0950-01-01 00:00:00  Units = days  Calendar = proleptic_gregorian  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
  0950-01-16 12:00:00  0950-02-15 00:00:00  0950-03-16 12:00:00  0950-04-16 00:00:00
  0950-05-16 12:00:00  0950-06-16 00:00:00  0950-07-16 12:00:00  0950-08-16 12:00:00
...

The wrong attribute coordinates points to 'height' instead of 'lat lon'. You can change it with

ncatted -O -a coordinates,tas,o,c,'lat lon' units_pre_tas.nc infile.nc

The above command creates a copy of the units_pre_tas.nc file named 'infile.nc' with the correct coordinates attribute.

The grid description file mygrid3 has no xunits, yunits, xname, yname, gridsize entry. The correct one is

gridtype = lonlat
gridsize = 27648
xsize    = 192
ysize    = 144
xname    = "lon" 
xunits   = "degrees_east" 
yname    = "lat" 
yunits   = "degrees_north" 
xvals    = -179.0625 -177.1875 -175.3125 -173.4375 -171.5625 -169.6875 -167.8125 -165.9375 -164.0625 -162.1875 -160.3125 -158.4375 -156.5625 -154.6875 -152.8125 -150.9375 -149.0625 -147.1875 -145.3125 -143.4375 -141.5625 -139.6875 -137.8125 -135.9375 -134.0625 -132.1875 -130.3125 -128.4375 -126.5625 -124.6875 -122.8125 -120.9375 -119.0625 -117.1875 -115.3125 -113.4375 -111.5625 -109.6875 -107.8125 -105.9375 -104.0625 -102.1875 -100.3125 -98.4375 -96.5625 -94.6875 -92.8125 -90.9375 -89.0625 -87.1875 -85.3125 -83.4375 -81.5625 -79.6875 -77.8125 -75.9375 -74.0625 -72.1875 -70.3125 -68.4375 -66.5625 -64.6875 -62.8125 -60.9375 -59.0625 -57.1875 -55.3125 -53.4375 -51.5625 -49.6875 -47.8125 -45.9375 -44.0625 -42.1875 -40.3125 -38.4375 -36.5625 -34.6875 -32.8125 -30.9375 -29.0625 -27.1875 -25.3125 -23.4375 -21.5625 -19.6875 -17.8125 -15.9375 -14.0625 -12.1875 -10.3125 -8.4375 -6.5625 -4.6875 -2.8125 -0.9375 0.9375 2.8125 4.6875 6.5625 8.4375 10.3125 12.1875 14.0625 15.9375 17.8125 19.6875 21.5625 23.4375 25.3125 27.1875 29.0625 30.9375 32.8125 34.6875 36.5625 38.4375 40.3125 42.1875 44.0625 45.9375 47.8125 49.6875 51.5625 53.4375 55.3125 57.1875 59.0625 60.9375 62.8125 64.6875 66.5625 68.4375 70.3125 72.1875 74.0625 75.9375 77.8125 79.6875 81.5625 83.4375 85.3125 87.1875 89.0625 90.9375 92.8125 94.6875 96.5625 98.4375 100.3125 102.1875 104.0625 105.9375 107.8125 109.6875 111.5625 113.4375 115.3125 117.1875 119.0625 120.9375 122.8125 124.6875 126.5625 128.4375 130.3125 132.1875 134.0625 135.9375 137.8125 139.6875 141.5625 143.4375 145.3125 147.1875 149.0625 150.9375 152.8125 154.6875 156.5625 158.4375 160.3125 162.1875 164.0625 165.9375 167.8125 169.6875 171.5625 173.4375 175.3125 177.1875 179.0625
yvals    = -89.375 -88.125 -86.875 -85.625 -84.375 -83.125 -81.875 -80.625 -79.375 -78.125 -76.875 -75.625 -74.375 -73.125 -71.875 -70.625 -69.375 -68.125 -66.875 -65.625 -64.375 -63.125 -61.875 -60.625 -59.375 -58.125 -56.875 -55.625 -54.375 -53.125 -51.875 -50.625 -49.375 -48.125 -46.875 -45.625 -44.375 -43.125 -41.875 -40.625 -39.375 -38.125 -36.875 -35.625 -34.375 -33.125 -31.875 -30.625 -29.375 -28.125 -26.875 -25.625 -24.375 -23.125 -21.875 -20.625 -19.375 -18.125 -16.875 -15.625 -14.375 -13.125 -11.875 -10.625 -9.375 -8.125 -6.875 -5.625 -4.375 -3.125 -1.875 -0.625 0.625 1.875 3.125 4.375 5.625 6.875 8.125 9.375 10.625 11.875 13.125 14.375 15.625 16.875 18.125 19.375 20.625 21.875 23.125 24.375 25.625 26.875 28.125 29.375 30.625 31.875 33.125 34.375 35.625 36.875 38.125 39.375 40.625 41.875 43.125 44.375 45.625 46.875 48.125 49.375 50.625 51.875 53.125 54.375 55.625 56.875 58.125 59.375 60.625 61.875 63.125 64.375 65.625 66.875 68.125 69.375 70.625 71.875 73.125 74.375 75.625 76.875 78.125 79.375 80.625 81.875 83.125 84.375 85.625 86.875 88.125 89.375

After all these corrections you can run the cdo remapbil command:

cdo -remapbil,mygrid3 infile.nc out.nc
    (1-4/4)