[gradsusr] Opening a netCDF file using xdfopen/sdfopen

Jeffrey Duda jdduda at iastate.edu
Mon Apr 25 21:16:56 EDT 2011


Chuck,
Thanks for the help.  I have gotten Grads to recognize the data and open the
.ctl file, but now the data doesn't look right.  What have I done wrong?

SGS2.ctl text:
DSET ^SGS.nc
UNDEF -1e.+34 _FillValue
OPTIONS 365_day_calendar
XDEF 248 LINEAR 1 1.0
YDEF 144 LEVELS
-88, -84, -80, -76, -72, -68, -65.4684377765723, -63.4528127641699,
    -61.4371877517676, -59.4215627393652, -57.4059377269629,
    -55.3903127145605, -53.3746877021582, -51.3590626897559,
    -49.3434376773535, -47.3278126649512, -45.3121876525488,
    -43.2965626401465, -41.2809376277441, -39.2653126153418,
    -37.2496876029395, -35.2340625905371, -33.2184375781348,
    -31.2028125657324, -29.1871875533301, -27.1715625409277,
    -25.1559375285254, -23.140312516123, -21.1246875037207,
    -19.1090624913184, -17.093437478916, -15.0778124665137,
    -13.0621874541113, -11.046562441709, -9.03093742930666,
    -7.01531241690431, -4.99968740450198, -3.07649989284378,
    -2.60149989284378, -2.12649989284376, -1.65149989284377,
    -1.17649989284377, -0.701499892843798, -0.226499892843742,
    0.248500107156228, 0.723500107156225, 1.19850010715621, 1.6735001071562,
    2.14850010715623, 2.62350010715626, 3.09850010715625, 3.57350010715625,
    4.04850010715625, 4.52350010715621, 4.99850010715626, 5.47350010715624,
    5.94850010715622, 6.42350010715623, 6.89850010715621, 7.37350010715624,
    7.84850010715624, 8.32350010715629, 8.79850010715625, 9.27350010715626,
    9.74850010715623, 10.2235001071563, 10.6985001071563, 11.1735001071562,
    11.6485001071562, 12.1235001071562, 12.5985001071563, 13.0735001071562,
    13.5485001071562, 14.0235001071562, 14.4985001071562, 14.9735001071563,
    15.4485001071563, 15.9235001071563, 16.3985001071563, 16.8735001071562,
    17.3485001071563, 17.8235001071562, 18.2985001071562, 18.7735001071562,
    19.2485001071563, 19.7235001071563, 20.1985001071563, 20.6735001071563,
    21.1485001071562, 21.6235001071562, 22.0985001071562, 22.5735001071562,
    23.0485001071562, 23.5235001071562, 23.9985001071562, 24.4735001071562,
    24.9485001071563, 25.4235001071563, 25.8985001071563, 26.3735001071563,
    26.8485001071563, 27.3235001071563, 27.7985001071563, 28.2735001071563,
    28.7485001071563, 29.2235001071562, 29.6985001071562, 30.1735001071563,
    30.6485001071562, 31.1235001071562, 31.5985001071562, 32.0735001071562,
    32.5485001071562, 33.0235001071562, 33.4985001071562, 33.9735001071562,
    34.4485001071563, 34.9235001071563, 35.3985001071563, 35.8735001071563,
    36.3485001071563, 36.8235001071562, 37.2985001071563, 37.7735001071562,
    39.2653126153417, 41.2809376277441, 43.2965626401464, 45.3121876525488,
    47.3278126649512, 49.3434376773535, 51.3590626897559, 53.3746877021582,
    55.3903127145606, 57.4059377269629, 59.4215627393652, 61.4371877517676,
    63.4528127641699, 65.4684377765723, 68, 71.9999999999999, 76,
    79.9999999999999, 83.9999999999999, 87.9999999999999
ZDEF 1 LEVELS 1000
TDEF 12 LINEAR 00Z01SEP1996 1mo
VARS 1
PRECLIM 0 y,x PRECIPITATION
ENDVARS

Jeff Duda

On Mon, Apr 25, 2011 at 11:24 AM, Charles Seman <Charles.Seman at noaa.gov>wrote:

> Jeff,
>
> Try this (http://iges.org/grads/gadoc/gradcomdxdfopen.html):
>
> TDEF TIME 12 LINEAR 00Z01SEP1996 1mo
>
> Note the use of "TIME 12" and dt = "1mo"...
> For reference, please find attached a GrADS ctl file which opens a NOLEAP
> climatology.nc file in GrADS v2 and an "ncdump -c" file showing the time
> coordinates, etc...
>
> Hope this helps,
> Chuck
>
> Jeffrey Duda wrote:
>
>> Hello,
>> I need help opening a netcdf file to be viewed in Grads.  I've attached it
>> to this email.  I tried sdfopen , but I got this error:
>>
>> SDF Error: 365 day calendars are no longer supported by sdfopen.
>>  To open this file with GrADS, use a descriptor file with
>>  a complete TDEF entry and OPTIONS 365_day_calendar.
>>  Documentation is at http://iges.org/grads/gadoc/SDFdescriptorfile.html
>>
>> So I tried writing a very simple descriptor file:
>>
>> DSET ^SGS.nc
>> OPTIONS 365_day_calendar
>> TDEF 365 LINEAR 00Z01SEP1996 1dy
>>
>> When I tried to open this using xdfopen, I got this error:
>>
>> gadxdf error: Missing or invalid dimension size.
>>  --> The invalid description file record is:
>>  --> tdef 365 linear 00z01sep1996 1dy
>>  The data file was not opened.
>>
>> So I'm not really sure what I'm doing wrong...or what I'm doing at all,
>> for that matter.  Please help.  The output from ncdump on the file is:
>>
>> netcdf SGS {
>> dimensions:
>>        LON = 248 ;
>>        LAT = 144 ;
>>        bnds = 2 ;
>>        TIME = UNLIMITED ; // (12 currently)
>> variables:
>>        double LON(LON) ;
>>                LON:units = "degrees_east" ;
>>                LON:modulo = 360. ;
>>                LON:point_spacing = "even" ;
>>                LON:axis = "X" ;
>>        double LAT(LAT) ;
>>                LAT:units = "degrees_north" ;
>>                LAT:point_spacing = "uneven" ;
>>                LAT:axis = "Y" ;
>>                LAT:bounds = "LAT_bnds" ;
>>        double LAT_bnds(LAT, bnds) ;
>>        double TIME(TIME) ;
>>                TIME:units = "days since 1996-09-01 00:00:00" ;
>>                TIME:time_origin = "01-SEP-1996 00:00:00" ;
>>                TIME:calendar = "NOLEAP" ;
>>                TIME:axis = "T" ;
>>                TIME:bounds = "TIME_bnds" ;
>>        double TIME_bnds(TIME, bnds) ;
>>        float PRECLIM(TIME, LAT, LON) ;
>>                PRECLIM:missing_value = -1.e+34f ;
>>                PRECLIM:_FillValue = -1.e+34f ;
>>                PRECLIM:long_name = "(PRECIP[D=1,L=1])" ;
>>
>> // global attributes:
>>                :history = "FERRET V6.65   30-Mar-11" ;
>>                :Conventions = "CF-1.0" ;
>> }
>>
>> Thanks.
>>
>> Jeff Duda
>>
>> --
>> Jeff Duda
>> Iowa State University
>> Meteorology Graduate Student
>> 3134 Agronomy Hall
>> www.meteor.iastate.edu/~jdduda <http://www.meteor.iastate.edu/%7Ejdduda><
>> http://www.meteor.iastate.edu/~jdduda>
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org
>> http://gradsusr.org/mailman/listinfo/gradsusr
>>
>
> --
>
> Please note that Charles.Seman at noaa.gov should be considered my NOAA
> email address, not cjs at gfdl.noaa.gov.
>
> ********************************************************************
>  Charles Seman                                Charles.Seman at noaa.gov
>  U.S. Department of Commerce / NOAA / OAR
>  Geophysical Fluid Dynamics Laboratory         voice: (609) 452-6547
>  201 Forrestal Road                              fax: (609) 987-5063
>  Princeton, NJ  08540-6649            http://www.gfdl.noaa.gov/~cjs/
> ********************************************************************
>
> "The contents of this message are mine personally and do not reflect any
> official or unofficial position of the United States Federal Government,
> the United States Department of Commerce, or NOAA."
>
> dset ^climatology.nc
> dtype netcdf
> options 365_day_calendar
> undef -999.
> xdef 144 linear 1.25 2.5
> ydef 90 linear -89 2
> zdef 23 levels 1000 925 850 775 700 600 500 400
>  300 250 200 150 100 70 50 30 20 10
>  7 5 3 2 1
> tdef 12 linear 12Z11JAN2000 1mo
> vars 5
> olr=>olr 0 t,y,x outgoing longwave radiation
> swdn_toa=>swdn_toa 0 t,y,x SW flux down at TOA
> swup_toa=>swup_toa 0 t,y,x SW flux up at TOA
> olr_clr=>olr_clr 0 t,y,x clear skyoutgoing longwave radiation
> swup_toa_clr=>swup_toa_clr 0 t,y,x clear skySW flux up at TOA
> endvars
>
> netcdf climatology { // format variant: 64bit
> dimensions:
>        time = UNLIMITED ; // (12 currently)
>        level = 23 ;
>        lat = 90 ;
>        lon = 144 ;
> variables:
>        double time(time) ;
>                time:long_name = "time" ;
>                time:units = "days since 1980-01-01 00:00:00" ;
>                time:cartesian_axis = "T" ;
>                time:calendar_type = "NOLEAP" ;
>                time:calendar = "NOLEAP" ;
>                time:climatology = "climatology_bounds" ;
>        float level(level) ;
>                level:units = "hPa" ;
>                level:long_name = "pressure" ;
>                level:cartesian_axis = "Z" ;
>                level:axis = "Z" ;
>                level:positive = "down" ;
>        float lat(lat) ;
>                lat:long_name = "latitude" ;
>                lat:units = "degrees_N" ;
>                lat:cartesian_axis = "Y" ;
>        float lon(lon) ;
>                lon:long_name = "longitude" ;
>                lon:units = "degrees_E" ;
>                lon:cartesian_axis = "X" ;
>        float olr(time, lat, lon) ;
>                olr:long_name = "outgoing longwave radiation" ;
>                olr:units = "watts/m2" ;
>                olr:missing_value = -999.f ;
>                olr:interp_method = "conserve_order2" ;
>                olr:cell_methods = "time: mean within months time: mean over
> years" ;
>                olr:time_avg_info = "average_T1,average_T2,average_DT" ;
>        float swdn_toa(time, lat, lon) ;
>                swdn_toa:long_name = "SW flux down at TOA" ;
>                swdn_toa:units = "watts/m2" ;
>                swdn_toa:missing_value = -999.f ;
>                swdn_toa:interp_method = "conserve_order2" ;
>                swdn_toa:cell_methods = "time: mean within months time: mean
> over years" ;
>                swdn_toa:time_avg_info = "average_T1,average_T2,average_DT"
> ;
>        float swup_toa(time, lat, lon) ;
>                swup_toa:long_name = "SW flux up at TOA" ;
>                swup_toa:units = "watts/m2" ;
>                swup_toa:missing_value = -999.f ;
>                swup_toa:interp_method = "conserve_order2" ;
>                swup_toa:cell_methods = "time: mean within months time: mean
> over years" ;
>                swup_toa:time_avg_info = "average_T1,average_T2,average_DT"
> ;
>        float olr_clr(time, lat, lon) ;
>                olr_clr:long_name = "clear skyoutgoing longwave radiation" ;
>                olr_clr:units = "watts/m2" ;
>                olr_clr:missing_value = -999.f ;
>                olr_clr:interp_method = "conserve_order2" ;
>                olr_clr:cell_methods = "time: mean within months time: mean
> over years" ;
>                olr_clr:time_avg_info = "average_T1,average_T2,average_DT" ;
>        float swup_toa_clr(time, lat, lon) ;
>                swup_toa_clr:long_name = "clear skySW flux up at TOA" ;
>                swup_toa_clr:units = "watts/m2" ;
>                swup_toa_clr:missing_value = -999.f ;
>                swup_toa_clr:interp_method = "conserve_order2" ;
>                swup_toa_clr:cell_methods = "time: mean within months time:
> mean over years" ;
>                swup_toa_clr:time_avg_info =
> "average_T1,average_T2,average_DT" ;
>
> // global attributes:
>                :filename = "atmos.1981-2000.01.nc" ;
>                :title = "c48L48_am3p8" ;
>                :grid_type = "mosaic" ;
>                :grid_tile = "1" ;
>                :history = "Thu Mar  4 15:44:48 2010: ncrcat -O
> atmos.1981-2000.01_subvars.nc atmos.1981-2000.02_subvars.nc
> atmos.1981-2000.03_subvars.nc atmos.1981-2000.04_subvars.nc
> atmos.1981-2000.05_subvars.nc atmos.1981-2000.06_subvars.nc
> atmos.1981-2000.07_subvars.nc atmos.1981-2000.08_subvars.nc
> atmos.1981-2000.09_subvars.nc atmos.1981-2000.10_subvars.nc
> atmos.1981-2000.11_subvars.nc atmos.1981-2000.12_subvars.nc climatology.nc
> \n",
>                        "/home/z1l/bin/tools/fregrid_parallel --input_mosaic
> atmos_mosaic.nc --input_file 19810101.atmos_month --interp_method
> conserve_order2 --nlon 144 --nlat 90 --scalar_field (**please see the field
> list in this file**)" ;
>                :code_version = "$Name: preQ_z1l $" ;
>                :comment = "FMS time averaging, version 3.0,
> precision=double" ;
>                :nco_openmp_thread_number = 1 ;
> data:
>
>  time = 7315.5, 7345, 7374.5, 7405, 7435.5, 7466, 7496.5, 7527.5, 7558,
>    7588.5, 7619, 7649.5 ;
>
>  level = 1000, 925, 850, 775, 700, 600, 500, 400, 300, 250, 200, 150, 100,
>    70, 50, 30, 20, 10, 7, 5, 3, 2, 1 ;
>
>  lat = -89, -87, -85, -83, -81, -79, -77, -75, -73, -71, -69, -67, -65,
> -63,
>    -61, -59, -57, -55, -53, -51, -49, -47, -45, -43, -41, -39, -37, -35,
>    -33, -31, -29, -27, -25, -23, -21, -19, -17, -15, -13, -11, -9, -7, -5,
>    -3, -1, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33,
>    35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69,
>    71, 73, 75, 77, 79, 81, 83, 85, 87, 89 ;
>
>  lon = 1.25, 3.75, 6.25, 8.75, 11.25, 13.75, 16.25, 18.75, 21.25, 23.75,
>    26.25, 28.75, 31.25, 33.75, 36.25, 38.75, 41.25, 43.75, 46.25, 48.75,
>    51.25, 53.75, 56.25, 58.75, 61.25, 63.75, 66.25, 68.75, 71.25, 73.75,
>    76.25, 78.75, 81.25, 83.75, 86.25, 88.75, 91.25, 93.75, 96.25, 98.75,
>    101.25, 103.75, 106.25, 108.75, 111.25, 113.75, 116.25, 118.75, 121.25,
>    123.75, 126.25, 128.75, 131.25, 133.75, 136.25, 138.75, 141.25, 143.75,
>    146.25, 148.75, 151.25, 153.75, 156.25, 158.75, 161.25, 163.75, 166.25,
>    168.75, 171.25, 173.75, 176.25, 178.75, 181.25, 183.75, 186.25, 188.75,
>    191.25, 193.75, 196.25, 198.75, 201.25, 203.75, 206.25, 208.75, 211.25,
>    213.75, 216.25, 218.75, 221.25, 223.75, 226.25, 228.75, 231.25, 233.75,
>    236.25, 238.75, 241.25, 243.75, 246.25, 248.75, 251.25, 253.75, 256.25,
>    258.75, 261.25, 263.75, 266.25, 268.75, 271.25, 273.75, 276.25, 278.75,
>    281.25, 283.75, 286.25, 288.75, 291.25, 293.75, 296.25, 298.75, 301.25,
>    303.75, 306.25, 308.75, 311.25, 313.75, 316.25, 318.75, 321.25, 323.75,
>    326.25, 328.75, 331.25, 333.75, 336.25, 338.75, 341.25, 343.75, 346.25,
>    348.75, 351.25, 353.75, 356.25, 358.75 ;
> }
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
>


-- 
Jeff Duda
Iowa State University
Meteorology Graduate Student
3134 Agronomy Hall
www.meteor.iastate.edu/~jdduda
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20110425/eec8e993/attachment-0003.html 


More information about the gradsusr mailing list