[gradsusr] problem during creating bin and ctl files from a nc data format

Jose Augusto Paixão Veiga veiga.uea at gmail.com
Fri Dec 16 22:17:27 EST 2011


Dear all,
I am trying to construct two files, a binary and a CTL, from 5 NC files format. To do that job, first I opened the NC file into GrAds to get infos (with "q ctlinfo" command) to prepare my GrAds script to produce the files.


The q ctlinfo command give me the following lines for one NC file:


dset ta_A1_1960_1999.nc
title CNRM  model output prepared for IPCC Fourth Assessment climate of the 20th Century experiment (20C3M)
undef 1e+20
dtype netcdf
xdef 128 linear 0 2.8125
ydef 64 levels -87.8638 -85.0965 -82.3129 -79.5256 -76.7369 -73.9475 -71.1577 -68.3678
 -65.5776 -62.7873 -59.997 -57.2066 -54.4162 -51.6257 -48.8352 -46.0447 -43.2542 -40.4636
 -37.6731 -34.8825 -32.0919 -29.3014 -26.5108 -23.7202 -20.9296 -18.139 -15.3484 -12.5578
 -9.76715 -6.97653 -4.18592 -1.39531 1.39531 4.18592 6.97653 9.76715 12.5578 15.3484
 18.139 20.9296 23.7202 26.5108 29.3014 32.0919 34.8825 37.6731 40.4636 43.2542
 46.0447 48.8352 51.6257 54.4162 57.2066 59.997 62.7873 65.5776 68.3678 71.1577
 73.9475 76.7369 79.5256 82.3129 85.0965 87.8638
zdef 17 levels 100000 92500 85000 70000 60000 50000 40000 30000
 25000 20000 15000 10000 7000 5000 3000 2000 1000
tdef 480 linear 12Z16JAN1960 1mo
vars 1
ta=>ta  17  t,z,y,x  Temperature
endvars


And from this information I prepared my GrAds script (listened in the end of the e-mail message). 

But, I get surprised when compared both graph outputs (in attach). As you can note they differ from each other.

What should I do to fix this kind of problem? 

Thanks in advance,


The GrAds script is:

* This program selects a binary file with u, v, T and w (necessary data form energy computation)
* data to be read by the thermo.gs program

'reinit'

'sdfopen  ua_A1_1960_1999.nc'
'sdfopen  va_A1_1960_1999.nc'
'sdfopen  ta_A1_1960_1999.nc'
'sdfopen  wap_A1_1960_1999.nc'
'sdfopen  zg_A1_1960_1999.nc'

frase='ua.1 va.2 ta.3 wap.4 zg.5'


***********************************************************
'q file'
rc=sublin(result,5)
nt=subwrd(rc,12)
nl=subwrd(rc,9)
nx=subwrd(rc,3)
ny=subwrd(rc,6)
rc=sublin(result,6)
'q time'
td=subwrd(result,3)
ano=substr(td, 9, 4)

say n_tempos '  'nt
say n_niveis '  'nl
say n_lons   '  'nx
say n_lats   '  'ny
say n_ano    '  'ano
say npz1     '  '12

 
***********************************************************

'set fwrite uvtwg.bin'

'set gxout fwrite'
'set x 1 128 '
'set y 1 64 '

i=109


while (i <= 480)
'set t ' i

  v=1
 while(v <= 5)
 var=subwrd(frase,v) 
  j=1
  
  
while (j <= 12)
   'set z ' j

    'd 'var'' 

   j=j+1
  endwhile
 v=v+1
 endwhile

i=i+1
endwhile

'disable fwrite'

**********************************************************
write (uvtwg.ctl,'dset   ^uvtwg.bin')
write (uvtwg.ctl,'undef  1e+20 ')
write (uvtwg.ctl,'title  CNRM  model output prepared for IPCC Fourth Assessment climate of the 20th Century experiment (20C3M) ')
write (uvtwg.ctl,"xdef 128 linear 0 2.8125  ")
write (uvtwg.ctl,"ydef 64 levels    -87.8638 -85.0965 -82.3129 -79.5256 -76.7369 -73.9475 -71.1577 -68.3678 -65.5776 -62.7873 -59.997 -57.2066 -54.4162 -51.6257 -48.8352 -46.0447 -43.2542 -40.4636 -37.6731 -34.8825 -32.0919 -29.3014 -26.5108 -23.7202 -20.9296 -18.139 -15.3484 -12.5578 -9.76715 -6.97653 -4.18592 -1.39531 1.39531 4.18592 6.97653 9.76715 12.5578 15.3484 18.139 20.9296 23.7202 26.5108 29.3014 32.0919 34.8825 37.6731 40.4636 43.2542 46.0447 48.8352 51.6257 54.4162 57.2066 59.997 62.7873 65.5776 68.3678 71.1577 73.9475 76.7369 79.5256 82.3129 85.0965 87.8638  ")
write (uvtwg.ctl,"zdef "12" levels  100000 92500 85000 70000 60000 50000 40000 30000 25000 20000 15000 10000 ")
write (uvtwg.ctl,"tdef 372 linear  JAN1969 1MO "   )
write (uvtwg.ctl,'vars  5')
write (uvtwg.ctl,"u "12"  33,100  zonal wind            (U)  [m/sec]   ")
write (uvtwg.ctl,"v "12"  34,100  meridional wind       (V)  [m/sec]   ")
write (uvtwg.ctl,"t "12"  34,100  temperature           (T)  [K]   ")
write (uvtwg.ctl,"w "12"  11,100  vertical velocity     (dp/dt) [pa/dia] ")
write (uvtwg.ctl,"g "12"  11,100  geopotential         (zg)  [m2/s2]  ")
write (uvtwg.ctl,'endvars')
**********************************************************



José Augusto P. Veiga, 

======================================
Universidade do Estado do Amazonas 
Departamento de Meteorologia
Escola Superior de Tecnologia (EST)
-----------------------------------------------------------------------------
Av. Darcy Vargas, 1200, Manaus-AM Brasil
Work phone:    (92) 3878 4333
Skype: veiga_j.a.p.
-----------------------------------------------------------------------------
CV: http://lattes.cnpq.br/4027612512091565
URL:http://scientificmet.wordpress.com/
http://nmet.wordpress.com/
-----------------------------------------------------------------------------




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20111216/fcb01ace/attachment-0003.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Original_NC.gif
Type: image/gif
Size: 36842 bytes
Desc: not available
Url : http://gradsusr.org/pipermail/gradsusr/attachments/20111216/fcb01ace/attachment-0006.gif 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: created_from_NC.gif
Type: image/gif
Size: 37187 bytes
Desc: not available
Url : http://gradsusr.org/pipermail/gradsusr/attachments/20111216/fcb01ace/attachment-0007.gif 


More information about the gradsusr mailing list