[gradsusr] (no subject)

praveen rai praveenrai583 at gmail.com
Wed Apr 19 06:08:27 EDT 2017


This script runs successfully but the .bin file is getting made because of
which .ctl file is not opening. Please anyone tell me how to made this .bin
file and where i am doing wrong.

Thanks

On Wed, Apr 19, 2017 at 2:04 PM, praveen rai <praveenrai583 at gmail.com>
wrote:

> Hello all,
>
> I have made a .ctl file from .nc file using CDO command which shows
> following description-
>
> * Generated by CDO operator gradsdes
> *
> DSET  ^merge_rf79_05_act_0lag.nc
> DTYPE  netCDF
> XDEF 720 LINEAR 0.000000 0.500000
> YDEF 361 LINEAR -90.000000 0.500000
> ZDEF 7 LEVELS 2 3 5 7 8.5 9.25 10
> TDEF 164 LINEAR 12:00Z03aug1979 1dy
> TITLE  merge_rf79_05_act_0lag.nc  720x361 grid
> OPTIONS yrev zrev
> UNDEF  -32767
> VARS  4
> v                  7  t,z,y,x  V component of wind  [m s**-1]
> u                  7  t,z,y,x  U component of wind  [m s**-1]
> t                  7  t,z,y,x  Temperature  [K]
> w                  7  t,z,y,x  Vertical velocity  [Pa s**-1]
> ENDVARS
>
> Using this .ctl file, i am trying to write a .ctl file containing
> variables for my diabatic heating calculation but the new .ctl file is not
> opening and it gives following error-
>
> Scanning description file:  thermo.ctl
> Open Error:  Looking for "endvars", found "res   7  99  residuo of
> diabatic heating  (q)  [k/dia] " instead.
>   --> The invalid description file record is:
>   --> res   7  99  residuo of diabatic heating  (Q)  [K/dia]
>   The data file was not opened.
> I am using the following script to calculate the diabatic heating variable
> in .ctl file-
> 'reinit'
> 'open merge_rf79_05_act_0lag.ctl'
>
> ***********************************************************
> '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)
>
> ***********************************************************
>
> 'set fwrite thermo.bin'
> 'set gxout fwrite'
> 'set x 1 720 '
> 'set y 1 361 '
>
> * Note: Repeat 1000 and 100 to permit program diferentiate z levels.
>
> string=' 10 10 9.25 8.5 7 5 3 2 2 '
>
> *aa      --> m
> *Rgas    --> 287.05 J/Kg K
> *Cp      --> 1004   J/Kg K
> *dt      --> s
> *T       --> K
> *u       --> m/s
> *v       --> m/s
> *P       --> Pa
> *W       --> Pa/s
>
> 'define aa=6.37e6'
> 'define pi=2*asin(1)'
> 'define rd=pi/180'
> 'define clat=cos(lat*rd)'
> 'define dx=cdiff(lon,x)*rd'
> 'define dy=cdiff(lat,y)*rd'
> 'define kp=287.05/1004'
> 'define dt=3600*6*2'
>
> 'k = 1'
> 'l = 2'
>
> while (k <= 164)
>
> while (l <= 7+1)
>
> 'set t 'k
>
> l1=l-1
> l2=l+1
>
> nivel  = subwrd(string,l)
> nivel1 = subwrd(string,11)
> nivel2 = subwrd(string,l2)
>
> * As vertical velocity is in units of Pa/sec and the levels (in CTL and nc
> data)
> * are in hPa, we must multiply the levels (hPa) by 100 to convert it in Pa
> units
> * (the same unit of vertical velocity)
>
> 'define p1='nivel1'*100'
> 'define p2='nivel2'*100'
>
> say nivel' 'nivel1' 'nivel2' 'k' 'l
>
> 'set lev 'nivel
>
> * Computing Temperature tendency term
> *_____________ dT/dt _______________*
> * Units must be in K/s
>
> k1=k-1
> k2=k+1
>
>
> if(k!=1 | k!=nt)
> 'define ttend = (T(t='k2')-T(t='k1'))/dt'
> endif
>
> if(k=1)
> 'define ttend = (T(t='k2')-T(t='k'))/(dt/2)'
> say 'k=1'
> endif
>
>
> if(k=nt)
> 'define ttend = (T(t='k')-T(t='k1'))/(dt/2)'
> say 'k=nt'
> endif
>
> * Computing Temperature horizontal advection
> * in hespherical coordinates
> *_____________ V Grad(T) _______________*
> * Units must be in K/s
>
> 'define advh = ((u*cdiff(T,x))/(clat*dx) + (v*cdiff(T,y))/dy)/aa'
>
> * Computing Temperature vertical advection
> * in hespherical coordinates
> *_________ w Grad(T) or wdT/dp __________*
> * Units must be in K/s
>
> 'define advv = w*(t(lev='nivel2')-t(lev='nivel1'))/(p2-p1)'
>
> * Computing alfa term
> * in hespherical coordinates
> * _____RTW/CpP _____________*
> * Units must be in K/s
>
> 'define qd   = -kp *  (w*(t))/(lev*100)'
>
> * Computing ther esidual term or the diabatic term
> * in hespherical coordinates
> * _____ Q _____________*
> * Units must be in K/s
>
> 'define res   = ttend + advh + advv + qd'
>
> * Recording the diabatic term in units of K/day
>
> 'd ttend*86400'
> 'd advh*86400'
> 'd advv*86400'
> 'd qd*86400'
> 'd res*86400'
>
>
>
> k = k
> l = l + 1
>
> endwhile
>
> l = 2
> k = k + 1
>
> endwhile
>
> 'disable fwrite'
>
> **********************************************************
> write (thermo.ctl,'dset thermo.bin')
> write (thermo.ctl,'undef  -32767')
> write (thermo.ctl,'title merge_rf79_05_act_0lag.nc  720x361 grid')
> write (thermo.ctl,"xdef "720" linear    0.0 "0.5"")
> write (thermo.ctl,"ydef "361" linear  -90.0 "0.5"")
> write (thermo.ctl,"zdef "7" levels  "2" "3" "5" "7" "8.5" "9.25" "10" ")
> write (thermo.ctl,"tdef "164" linear "00Z03aug1979" "12hr" "   )
> write (thermo.ctl,'vars  4')
> write (thermo.ctl,'ttend 7  99  temperature tendency  [K/dia] ')
> write (thermo.ctl,'advh  7  99  horiz. temperature advection  [K/dia] ')
> write (thermo.ctl,'advv  7  99  vertical temperature advection  [K/dia] ')
> write (thermo.ctl,'qd    7  99                                  [K/dia] ')
> write (thermo.ctl,"res   "7"  99  residuo of diabatic heating  (Q)
>  [K/dia] ")
> write (thermo.ctl,'endvars')
> **********************************************************
>
> Sorry for the long note. Any help will be much appreciated.
>
> Thanks
> Praveen
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20170419/952b25bf/attachment-0001.html 


More information about the gradsusr mailing list