Project

General

Profile

reproduce griddescription / remapping issue

Added by Andreas Hilboll over 11 years ago

Hi,

I have an issue reproducing a grid definition "by hand". My situation is as follows:

I have a dataset of CTM output. An example file can be found at http://www.iup.uni-bremen.de/~hilboll/_cdogrid-original.nc.

Using my own Python scripts, I do some calculations with the data (calculate vertical densities from concentration profiles) and write the output again to a NC file. An example can be found at http://www.iup.uni-bremen.de/~hilboll/_cdogrid-reproduced.nc. I'm using python-netcdf4 for this, but this should be irrelevant. I'm trying to reproduce the header information as closely as possible:

$ ncdump -h /home/doas/hilboll/public_html/_cdogrid-original.nc 
netcdf _cdogrid-original {
dimensions:
    lon = 52 ;
    lat = 38 ;
    rlat = 38 ;
    lev = 16 ;
    time = UNLIMITED ; // (24 currently)
variables:
    float lon(lon) ;
        lon:long_name = "longitude in rotated pole grid" ;
        lon:units = "degrees_east" ;
        lon:standard_name = "grid_longitude" ;
        lon:axis = "X" ;
    float lat(lat) ;
        lat:long_name = "latitude in rotated pole grid" ;
        lat:units = "degrees_north" ;
        lat:standard_name = "grid_latitude" ;
        lat:axis = "Y" ;
    char rotated_pole ;
        rotated_pole:grid_mapping_name = "rotated_latitude_longitude" ;
        rotated_pole:grid_north_pole_latitude = 46.5 ;
        rotated_pole:grid_north_pole_longitude = 12.5 ;
    float rlat(rlat) ;
        rlat:long_name = "latitude in rotated pole grid" ;
        rlat:units = "degrees_north" ;
        rlat:standard_name = "grid_latitude" ;
        rlat:axis = "Y" ;
    double lev(lev) ;
        lev:long_name = "hybrid sigma level index" ;
        lev:units = "level" ;
        lev:axis = "Z" ;
    double time(time) ;
        time:units = "hours since 2000-08-08 00:00:00" ;
        time:calendar = "standard" ;
    float glon(time, lat, lon) ;
        glon:long_name = "longitude" ;
        glon:standard_name = "longitude" ;
        glon:units = "degrees_east" ;
        glon:grid_mapping = "rotated_pole" ;
    float glat(time, lat, lon) ;
        glat:long_name = "latitude" ;
        glat:standard_name = "latitude" ;
        glat:units = "degrees_north" ;
        glat:grid_mapping = "rotated_pole" ;
    float phig(time, lat, lon) ;
        phig:long_name = "geopotential of the surface" ;
        phig:standard_name = "geopotential_of_the_surface" ;
        phig:units = "m2/s2" ;
        phig:grid_mapping = "rotated_pole" ;
    float fmask(time, lat, lon) ;
        fmask:long_name = "land/sea mask" ;
        fmask:standard_name = "land_sea_mask" ;
        fmask:grid_mapping = "rotated_pole" ;
        fmask:units = 1 ;
    float level_height(time, lev, lat, lon) ;
        level_height:long_name = "model level height" ;
        level_height:standard_name = "model_level_height" ;
        level_height:units = "m" ;
        level_height:grid_mapping = "rotated_pole" ;
    float level_thickness(time, lev, lat, lon) ;
        level_thickness:long_name = "model level thickness" ;
        level_thickness:standard_name = "model_level_thickness" ;
        level_thickness:units = "m" ;
        level_thickness:grid_mapping = "rotated_pole" ;
    float NO2(time, lev, rlat, lon) ;
        NO2:grid_mapping = "rotated_pole" ;

// global attributes:
        :CDI = "Climate Data Interface version 1.4.7 (http://code.zmaw.de/projects/cdi)" ;
        :Conventions = "CF-1.0" ;
        :history = "Sat Aug 20 14:37:56 2011: cdo merge qaz.nc zaq.nc zot.nc NO2-20000808.nc\n",
            "Sat Aug 20 14:37:55 2011: cdo expr,NO2=NO2*46.0 bolchem-saprc90soa-out-20000808.nc zot.nc\n",
            "Sat Aug 13 18:21:37 2011: ncatted -a grid_north_pole_latitude,rotated_pole,o,d,43.50 2000080800/out/bolchem-saprc90soa-out-20000808.nc\n",
            "Sat Aug 13 18:20:37 2011: ncatted -a grid_north_pole_longitude,rotated_pole,o,d,-167.5 2000080800/out/bolchem-saprc90soa-out-20000808.nc" ;
        :CDO = "Climate Data Operators version 1.4.7 (http://code.zmaw.de/projects/cdo)" ;
}

and

$ ncdump -h /home/doas/hilboll/public_html/_cdogrid-reproduced.nc 
netcdf _cdogrid-reproduced {
dimensions:
    lon = 52 ;
    lat = 38 ;
    rlat = 38 ;
    time = UNLIMITED ; // (31 currently)
variables:
    float lon(lon) ;
        lon:long_name = "longitude in rotated pole grid" ;
        lon:units = "degrees_east" ;
        lon:standard_name = "grid_longitude" ;
        lon:axis = "X" ;
    float lat(lat) ;
        lat:long_name = "latitude in rotated pole grid" ;
        lat:units = "degrees_north" ;
        lat:standard_name = "grid_latitude" ;
        lat:axis = "Y" ;
    char rotated_pole ;
        rotated_pole:grid_mapping_name = "rotated_latitude_longitude" ;
        rotated_pole:grid_north_pole_latitude = 46.5 ;
        rotated_pole:grid_north_pole_longitude = 12.5 ;
    float rlat(rlat) ;
        rlat:long_name = "latitude in rotated pole grid" ;
        rlat:units = "degrees_north" ;
        rlat:standard_name = "grid_latitude" ;
        rlat:axis = "Y" ;
    double time(time) ;
        time:units = "hours since 1994-01-01 00:00:00" ;
        time:calendar = "standard" ;
    float glon(time, lat, lon) ;
        glon:long_name = "longitude" ;
        glon:standard_name = "longitude" ;
        glon:units = "degrees_east" ;
        glon:grid_mapping = "rotated_pole" ;
    float glat(time, lat, lon) ;
        glat:long_name = "latitude" ;
        glat:standard_name = "latitude" ;
        glat:units = "degrees_north" ;
        glat:grid_mapping = "rotated_pole" ;
    float NO2_tropospheric_column(time, rlat, lon) ;
        NO2_tropospheric_column:units = "molecules / cm^2" ;
        NO2_tropospheric_column:long_name = "Vertical tropospheric column NO2 (from surface to top of model)" ;
        NO2_tropospheric_column:label = "VC_trop NO2 [molec/cm^2]" ;

// global attributes:
        :description = "Vertical NO2 columns from Bolchem model." ;
        :Conventions = "CF-1.4" ;
        :title = "Vertical NO2 columns from Bolchem model." ;
        :institution = "Institute of Environmental Physics, University of Bremen, Germany." ;
        :source = "model" ;
        :comment = "Model version Bolchem v1.\r\n",
            "Model run performed by Alberto Maurizi <a.maurizi@isac.cnr.it>" ;
        :contact = "Andreas Hilboll <hilboll@iup.physik.uni-bremen.de>" ;
}

However, the grid descriptions do not match:

$ cdo griddes /home/doas/hilboll/public_html/_cdogrid-original.nc 
#
# gridID 2
#
gridtype  = lonlat
gridsize  = 1976
xname     = lon
xlongname = longitude in rotated pole grid
xunits    = degrees_east
yname     = lat
ylongname = latitude in rotated pole grid
yunits    = degrees_north
xsize     = 52
ysize     = 38
xnpole    = 12.5
ynpole    = 46.5
xfirst    = -4.001
xinc      = 0.1
yfirst    = -3.284
yinc      = 0.0999999
#
# gridID 3
#
gridtype  = lonlat
gridsize  = 1976
xname     = lon
xlongname = longitude in rotated pole grid
xunits    = degrees_east
yname     = rlat
ylongname = latitude in rotated pole grid
yunits    = degrees_north
xsize     = 52
ysize     = 38
xnpole    = 12.5
ynpole    = 46.5
xfirst    = -4.001
xinc      = 0.1
yfirst    = -3.284
yinc      = 0.0999999
cdo griddes: Processed 7 variables ( 0.01s )
$ cdo griddes /home/doas/hilboll/public_html/_cdogrid-reproduced.nc 
#
# gridID 25
#
gridtype  = lonlat
gridsize  = 1976
xname     = lon
xlongname = longitude in rotated pole grid
xunits    = degrees_east
yname     = lat
ylongname = latitude in rotated pole grid
yunits    = degrees_north
xsize     = 52
ysize     = 38
xnpole    = 12.5
ynpole    = 46.5
xfirst    = -4.001
xinc      = 0.1
yfirst    = -3.284
yinc      = 0.0999999
#
# gridID 26
#
gridtype  = lonlat
gridsize  = 1976
xname     = lon
xlongname = longitude in rotated pole grid
xunits    = degrees_east
yname     = rlat
ylongname = latitude in rotated pole grid
yunits    = degrees_north
xsize     = 52
ysize     = 38
xfirst    = -4.001
xinc      = 0.1
yfirst    = -3.284
yinc      = 0.0999999
cdo griddes: Processed 3 variables ( 0.00s )

I'm at a loss here. The problem is that in a next step, i want to use remapcon2, and currently, this produces nan-filled files from my data:

$ cat IUP/data/bolchem/griddef_povalley.txt 
gridtype = lonlat 
    xsize    =  336 
    ysize    =   64 
    xfirst   =    6.03125 
    xinc     =    0.0625
    yfirst   =   43.03125
    yinc     =    0.0625
$ cdo remapcon2,IUP/data/bolchem/griddef_povalley.txt /home/doas/hilboll/public_html/_cdogrid-reproduced.nc /home/doas/hilboll/public_html/_cdogrid-remapped.nc
cdo remapcon2: Processed 183768 values from 3 variables over 31 timesteps ( 0.24s )
$ cdo info /home/doas/hilboll/public_html/_cdogrid-remapped.nc 
    -1 :       Date     Time   Level Gridsize    Miss :     Minimum        Mean     Maximum : Parameter ID
     1 : 2001-01-01 00:00:00       0    21504   21504 :                     nan             : -1         
     2 : 2001-01-01 00:00:00       0    21504   21504 :                     nan             : -2         
     3 : 2001-01-01 00:00:00       0    21504   21504 :                     nan             : -3         
     4 : 2001-01-02 00:00:00       0    21504   21504 :                     nan             : -1         
     5 : 2001-01-02 00:00:00       0    21504   21504 :                     nan             : -2         
     6 : 2001-01-02 00:00:00       0    21504   21504 :                     nan             : -3         
     7 : 2001-01-03 00:00:00       0    21504   21504 :                     nan             : -1         
     8 : 2001-01-03 00:00:00       0    21504   21504 :                     nan             : -2         
     9 : 2001-01-03 00:00:00       0    21504   21504 :                     nan             : -3         
    10 : 2001-01-04 00:00:00       0    21504   21504 :                     nan             : -1         
    11 : 2001-01-04 00:00:00       0    21504   21504 :                     nan             : -2         
    12 : 2001-01-04 00:00:00       0    21504   21504 :                     nan             : -3         
    13 : 2001-01-05 00:00:00       0    21504   21504 :                     nan             : -1         
    14 : 2001-01-05 00:00:00       0    21504   21504 :                     nan             : -2         
    15 : 2001-01-05 00:00:00       0    21504   21504 :                     nan             : -3         
    16 : 2001-01-06 00:00:00       0    21504   21504 :                     nan             : -1         
    17 : 2001-01-06 00:00:00       0    21504   21504 :                     nan             : -2         
    18 : 2001-01-06 00:00:00       0    21504   21504 :                     nan             : -3         
    19 : 2001-01-07 00:00:00       0    21504   21504 :                     nan             : -1         
    20 : 2001-01-07 00:00:00       0    21504   21504 :                     nan             : -2         
    21 : 2001-01-07 00:00:00       0    21504   21504 :                     nan             : -3         
    22 : 2001-01-08 00:00:00       0    21504   21504 :                     nan             : -1         
    23 : 2001-01-08 00:00:00       0    21504   21504 :                     nan             : -2         
    24 : 2001-01-08 00:00:00       0    21504   21504 :                     nan             : -3         
    25 : 2001-01-09 00:00:00       0    21504   21504 :                     nan             : -1         
    26 : 2001-01-09 00:00:00       0    21504   21504 :                     nan             : -2         
    27 : 2001-01-09 00:00:00       0    21504   21504 :                     nan             : -3         
    28 : 2001-01-10 00:00:00       0    21504   21504 :                     nan             : -1         
    29 : 2001-01-10 00:00:00       0    21504   21504 :                     nan             : -2         
    30 : 2001-01-10 00:00:00       0    21504   21504 :                     nan             : -3         
    31 : 2001-01-11 00:00:00       0    21504   21504 :                     nan             : -1         
    32 : 2001-01-11 00:00:00       0    21504   21504 :                     nan             : -2         
    33 : 2001-01-11 00:00:00       0    21504   21504 :                     nan             : -3         
    34 : 2001-01-12 00:00:00       0    21504   21504 :                     nan             : -1         
    35 : 2001-01-12 00:00:00       0    21504   21504 :                     nan             : -2         
    36 : 2001-01-12 00:00:00       0    21504   21504 :                     nan             : -3         
    37 : 2001-01-13 00:00:00       0    21504   21504 :                     nan             : -1         
    38 : 2001-01-13 00:00:00       0    21504   21504 :                     nan             : -2         
    39 : 2001-01-13 00:00:00       0    21504   21504 :                     nan             : -3         
    40 : 2001-01-14 00:00:00       0    21504   21504 :                     nan             : -1         
    41 : 2001-01-14 00:00:00       0    21504   21504 :                     nan             : -2         
    42 : 2001-01-14 00:00:00       0    21504   21504 :                     nan             : -3         
    43 : 2001-01-15 00:00:00       0    21504   21504 :                     nan             : -1         
    44 : 2001-01-15 00:00:00       0    21504   21504 :                     nan             : -2         
    45 : 2001-01-15 00:00:00       0    21504   21504 :                     nan             : -3         
    46 : 2001-01-16 00:00:00       0    21504   21504 :                     nan             : -1         
    47 : 2001-01-16 00:00:00       0    21504   21504 :                     nan             : -2         
    48 : 2001-01-16 00:00:00       0    21504   21504 :                     nan             : -3         
    49 : 2001-01-17 00:00:00       0    21504   21504 :                     nan             : -1         
    50 : 2001-01-17 00:00:00       0    21504   21504 :                     nan             : -2         
    51 : 2001-01-17 00:00:00       0    21504   21504 :                     nan             : -3         
    52 : 2001-01-18 00:00:00       0    21504   21504 :                     nan             : -1         
    53 : 2001-01-18 00:00:00       0    21504   21504 :                     nan             : -2         
    54 : 2001-01-18 00:00:00       0    21504   21504 :                     nan             : -3         
    55 : 2001-01-19 00:00:00       0    21504   21504 :                     nan             : -1         
    56 : 2001-01-19 00:00:00       0    21504   21504 :                     nan             : -2         
    57 : 2001-01-19 00:00:00       0    21504   21504 :                     nan             : -3         
    58 : 2001-01-20 00:00:00       0    21504   21504 :                     nan             : -1         
    59 : 2001-01-20 00:00:00       0    21504   21504 :                     nan             : -2         
    60 : 2001-01-20 00:00:00       0    21504   21504 :                     nan             : -3         
    61 : 2001-01-21 00:00:00       0    21504   21504 :                     nan             : -1         
    62 : 2001-01-21 00:00:00       0    21504   21504 :                     nan             : -2         
    63 : 2001-01-21 00:00:00       0    21504   21504 :                     nan             : -3         
    64 : 2001-01-22 00:00:00       0    21504   21504 :                     nan             : -1         
    65 : 2001-01-22 00:00:00       0    21504   21504 :                     nan             : -2         
    66 : 2001-01-22 00:00:00       0    21504   21504 :                     nan             : -3         
    67 : 2001-01-23 00:00:00       0    21504   21504 :                     nan             : -1         
    68 : 2001-01-23 00:00:00       0    21504   21504 :                     nan             : -2         
    69 : 2001-01-23 00:00:00       0    21504   21504 :                     nan             : -3         
    70 : 2001-01-24 00:00:00       0    21504   21504 :                     nan             : -1         
    71 : 2001-01-24 00:00:00       0    21504   21504 :                     nan             : -2         
    72 : 2001-01-24 00:00:00       0    21504   21504 :                     nan             : -3         
    73 : 2001-01-25 00:00:00       0    21504   21504 :                     nan             : -1         
    74 : 2001-01-25 00:00:00       0    21504   21504 :                     nan             : -2         
    75 : 2001-01-25 00:00:00       0    21504   21504 :                     nan             : -3         
    76 : 2001-01-26 00:00:00       0    21504   21504 :                     nan             : -1         
    77 : 2001-01-26 00:00:00       0    21504   21504 :                     nan             : -2         
    78 : 2001-01-26 00:00:00       0    21504   21504 :                     nan             : -3         
    79 : 2001-01-27 00:00:00       0    21504   21504 :                     nan             : -1         
    80 : 2001-01-27 00:00:00       0    21504   21504 :                     nan             : -2         
    81 : 2001-01-27 00:00:00       0    21504   21504 :                     nan             : -3         
    82 : 2001-01-28 00:00:00       0    21504   21504 :                     nan             : -1         
    83 : 2001-01-28 00:00:00       0    21504   21504 :                     nan             : -2         
    84 : 2001-01-28 00:00:00       0    21504   21504 :                     nan             : -3         
    85 : 2001-01-29 00:00:00       0    21504   21504 :                     nan             : -1         
    86 : 2001-01-29 00:00:00       0    21504   21504 :                     nan             : -2         
    87 : 2001-01-29 00:00:00       0    21504   21504 :                     nan             : -3         
    88 : 2001-01-30 00:00:00       0    21504   21504 :                     nan             : -1         
    89 : 2001-01-30 00:00:00       0    21504   21504 :                     nan             : -2         
    90 : 2001-01-30 00:00:00       0    21504   21504 :                     nan             : -3         
    91 : 2001-01-31 00:00:00       0    21504   21504 :                     nan             : -1         
    92 : 2001-01-31 00:00:00       0    21504   21504 :                     nan             : -2         
    93 : 2001-01-31 00:00:00       0    21504   21504 :                     nan             : -3         
cdo info: Processed 1999872 values from 3 variables over 31 timesteps ( 0.13s )

Any help resolving this issue would be greatly appreciated.

Cheers, Andreas.


Replies (1)

RE: reproduce griddescription / remapping issue - Added by Andreas Hilboll over 11 years ago

Sorry for the noise, but the problem is solved. The input files were corrupt in the sense that they contained wrong rotated-pole coordinates :-/

Cheers, Andreas.

    (1-1/1)