[gradsusr] command sdfattr not working to change header of netcdf file

pankaj kumar pankajqumar at yahoo.com
Sun Mar 23 23:14:01 EDT 2014


Dear Sir/Ma'am,

I want to write the header of a netcdf file generated using sdfwrite as follows:

netcdf monthly_SST {
dimensions:
    time = 12 ;
    z_t = 15 ;
    nlon = 360 ;
    nlat = 180 ;
variables:
    double time(time) ;
        time:long_name = "time" ;
        time:units = "days since 0000-01-01 00:00:00" ;
        time:bounds = "time_bound" ;
        time:calendar = "noleap" ;
    float z_t(z_t) ;
        z_t:long_name = "depth from surface to midpoint of layer" ;
        z_t:units = "centimeters" ;
        z_t:positive = "down" ;
   
     z_t:valid_min = 500.f ;
        z_t:valid_max = 14500.f ;
    float TEMP(time, z_t, nlat, nlon) ;
        TEMP:_FillValue = 9.96921e+36f ;
        TEMP:long_name = "Potential Temperature" ;
        TEMP:units = "degC" ;
    float TLAT(nlat) ;
        TLAT:long_name = "array of t-grid latitudes" ;
        TLAT:units = "degrees_north" ;
    float TLONG(nlon) ;
        TLONG:long_name = "array of t-grid longitudes" ;
        TLONG:units = "degrees_east" 

however, the auto-written header of the file generated by grads command is very different which has many missing information also. I tried to change the header using 

set sdfattr
but I have not got any success in changing anything. My grads script is as given below:

       'set yflip on'
       'set sdfwrite -flt montly_temp.nc'

       'set sdfattr time String long_name time'
       'set sdfattr time String units days since 0000-01-01 00:00:00'

       'set sdfattr time String bounds time_bound'
       'set sdfattr time String calendar noleap'


       'set sdfattr z_t String long_name depth from surface to midpoint of layer'
       'set sdfattr z_t String units centimeters'
       'set sdfattr z_t Sting positive down'
       'set sdfattr z_t float valid_min 500.f'
        'set sdfattr z_t float valid_max 14500.f'
  
       'set sdfattr TEMP String long_name Potential Temperature'
       'set sdfattr TEMP String units degC'
       'set undef 'undef_value
 
       'set sdfattr TLAT String long_name array of t-grid latitudes'
       'set sdfattr TLAT String units degrees_north'

       'set sdfattr TLONG String long_name array of t-grid longitudes'
       'set sdfattr TLONG String units degrees_east'
           
       'q sdfwrite'
       'sdfwrite TEMP'
       'c sdfwrite'

Since I am writing ocean data, I want to set top layer (500 cm) as first level but the bottom layer (14500 cm) is by default set as first level. I tried to invert levels using 'set yflip on' before sdfwrite command but it is not working. Please see how this can be achieved.

Thank you.
With Regards
Pankaj Sinha 

Hokkaido University
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20140323/0b8c45ab/attachment.html 


More information about the gradsusr mailing list