<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: times new roman,new york,times,serif; font-size: 12pt; color: #000000'><font face="times new roman, new york, times, serif">Praveen,</font><div style="font-family: "times new roman", "new york", times, serif;"><br></div><div style="font-family: "times new roman", "new york", times, serif;">use</div><div style="font-family: "times new roman", "new york", times, serif;"><span style="font-family: Helvetica, Arial, sans-serif;">write (thermo.ctl,'vars 5')</span></div><div><font face="Helvetica, Arial, sans-serif"><br></font></div><div><font face="Helvetica, Arial, sans-serif">since you are writing 5 variables in the binary.</font></div><div><font face="Helvetica, Arial, sans-serif"><br></font></div><div><font face="Helvetica, Arial, sans-serif">Regards,</font></div><div><font face="Helvetica, Arial, sans-serif">Ricardo<br></font><br><hr id="zwchr" style="font-family: "times new roman", "new york", times, serif;"><blockquote style="font-family: Helvetica, Arial, sans-serif; border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px; color: rgb(0, 0, 0); font-weight: normal; font-style: normal; text-decoration: none; font-size: 12pt;"><div dir="ltr">Hello all,<div><br></div><div>I have made a .ctl file from .nc file using CDO command which shows following description-</div><div><br></div><div><div>* Generated by CDO operator gradsdes</div><div>*</div><div>DSET ^<a href="http://merge_rf79_05_act_0lag.nc" target="_blank">merge_rf79_05_act_0lag.nc</a></div><div>DTYPE netCDF</div><div>XDEF 720 LINEAR 0.000000 0.500000</div><div>YDEF 361 LINEAR -90.000000 0.500000</div><div>ZDEF 7 LEVELS 2 3 5 7 8.5 9.25 10 </div><div>TDEF 164 LINEAR 12:00Z03aug1979 1dy</div><div>TITLE <a href="http://merge_rf79_05_act_0lag.nc" target="_blank">merge_rf79_05_act_0lag.nc</a> 720x361 grid</div><div>OPTIONS yrev zrev</div><div>UNDEF -32767</div><div>VARS 4</div><div>v 7 t,z,y,x V component of wind [m s**-1]</div><div>u 7 t,z,y,x U component of wind [m s**-1]</div><div>t 7 t,z,y,x Temperature [K]</div><div>w 7 t,z,y,x Vertical velocity [Pa s**-1]</div><div>ENDVARS</div></div><div><br></div><div>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-</div><div><br></div><div><div>Scanning description file: thermo.ctl</div><div>Open Error: Looking for "endvars", found "res 7 99 residuo of diabatic heating (q) [k/dia] " instead.</div><div> --> The invalid description file record is:</div><div> --> res 7 99 residuo of diabatic heating (Q) [K/dia]</div><div> The data file was not opened.</div></div><div>I am using the following script to calculate the diabatic heating variable in .ctl file-</div><div><div>'reinit'</div><div>'open merge_rf79_05_act_0lag.ctl'</div><div><br></div><div>***********************************************************</div><div>'q file'</div><div>rc=sublin(result,5)</div><div>nt=subwrd(rc,12)</div><div>nl=subwrd(rc,9)</div><div>nx=subwrd(rc,3)</div><div>ny=subwrd(rc,6)</div><div>rc=sublin(result,6)</div><div>'q time'</div><div>td=subwrd(result,3)</div><div>ano=substr (td, 9, 4)</div><div><br></div><div>***********************************************************</div><div><br></div><div>'set fwrite thermo.bin'</div><div>'set gxout fwrite'</div><div>'set x 1 720 '</div><div>'set y 1 361 '</div><div><br></div><div>* Note: Repeat 1000 and 100 to permit program diferentiate z levels.</div><div><br></div><div>string=' 10 10 9.25 8.5 7 5 3 2 2 '</div><div><br></div><div>*aa --> m</div><div>*Rgas --> 287.05 J/Kg K</div><div>*Cp --> 1004 J/Kg K</div><div>*dt --> s</div><div>*T --> K</div><div>*u --> m/s</div><div>*v --> m/s</div><div>*P --> Pa</div><div>*W --> Pa/s</div><div><br></div><div>'define aa=6.37e6'</div><div>'define pi=2*asin(1)'</div><div>'define rd=pi/180'</div><div>'define clat=cos(lat*rd)'</div><div>'define dx=cdiff(lon,x)*rd'</div><div>'define dy=cdiff(lat,y)*rd'</div><div>'define kp=287.05/1004'</div><div>'define dt=3600*6*2'</div><div><br></div><div>'k = 1'</div><div>'l = 2'</div><div><br></div><div>while (k <= 164)</div><div><br></div><div>while (l <= 7+1)</div><div><br></div><div>'set t 'k</div><div><br></div><div>l1=l-1</div><div>l2=l+1</div><div><br></div><div>nivel = subwrd(string,l)</div><div>nivel1 = subwrd(string,11)</div><div>nivel2 = subwrd(string,l2)</div><div><br></div><div>* As vertical velocity is in units of Pa/sec and the levels (in CTL and nc data) </div><div>* are in hPa, we must multiply the levels (hPa) by 100 to convert it in Pa units </div><div>* (the same unit of vertical velocity)</div><div><br></div><div>'define p1='nivel1'*100'</div><div>'define p2='nivel2'*100'</div><div><br></div><div>say nivel' 'nivel1' 'nivel2' 'k' 'l</div><div><br></div><div>'set lev 'nivel</div><div><br></div><div>* Computing Temperature tendency term</div><div>*_____________ dT/dt _______________*</div><div>* Units must be in K/s</div><div><br></div><div>k1=k-1</div><div>k2=k+1</div><div><br></div><div><br></div><div>if(k!=1 | k!=nt)</div><div>'define ttend = (T(t='k2')-T(t='k1'))/dt'</div><div>endif</div><div><br></div><div>if(k=1)</div><div>'define ttend = (T(t='k2')-T(t='k'))/(dt/2)'</div><div>say 'k=1'</div><div>endif</div><div><br></div><div><br></div><div>if(k=nt)</div><div>'define ttend = (T(t='k')-T(t='k1'))/(dt/2)'</div><div>say 'k=nt'</div><div>endif</div><div><br></div><div>* Computing Temperature horizontal advection</div><div>* in hespherical coordinates</div><div>*_____________ V Grad(T) _______________*</div><div>* Units must be in K/s</div><div><br></div><div>'define advh = ((u*cdiff(T,x))/(clat*dx) + (v*cdiff(T,y))/dy)/aa'</div><div><br></div><div>* Computing Temperature vertical advection</div><div>* in hespherical coordinates</div><div>*_________ w Grad(T) or wdT/dp __________*</div><div>* Units must be in K/s</div><div><br></div><div>'define advv = w*(t(lev='nivel2')-t(lev='nivel1'))/(p2-p1)'</div><div><br></div><div>* Computing alfa term</div><div>* in hespherical coordinates</div><div>* _____RTW/CpP _____________*</div><div>* Units must be in K/s</div><div><br></div><div>'define qd = -kp * (w*(t))/(lev*100)'</div><div><br></div><div>* Computing ther esidual term or the diabatic term</div><div>* in hespherical coordinates</div><div>* _____ Q _____________*</div><div>* Units must be in K/s</div><div><br></div><div>'define res = ttend + advh + advv + qd'</div><div><br></div><div>* Recording the diabatic term in units of K/day</div><div><br></div><div>'d ttend*86400'</div><div>'d advh*86400'</div><div>'d advv*86400'</div><div>'d qd*86400'</div><div>'d res*86400'</div><div><br></div><div><br></div><div><br></div><div>k = k</div><div>l = l + 1</div><div><br></div><div>endwhile</div><div><br></div><div>l = 2</div><div>k = k + 1</div><div><br></div><div>endwhile</div><div><br></div><div>'disable fwrite'</div><div><br></div><div>**********************************************************</div><div>write (thermo.ctl,'dset thermo.bin')</div><div>write (thermo.ctl,'undef -32767')</div><div>write (thermo.ctl,'title <a href="http://merge_rf79_05_act_0lag.nc" target="_blank">merge_rf79_05_act_0lag.nc</a> 720x361 grid')</div><div>write (thermo.ctl,"xdef "720" linear 0.0 "0.5"")</div><div>write (thermo.ctl,"ydef "361" linear -90.0 "0.5"")</div><div>write (thermo.ctl,"zdef "7" levels "2" "3" "5" "7" "8.5" "9.25" "10" ")</div><div>write (thermo.ctl,"tdef "164" linear "00Z03aug1979" "12hr" " )</div><div>write (thermo.ctl,'vars 4')</div><div>write (thermo.ctl,'ttend 7 99 temperature tendency [K/dia] ')</div><div>write (thermo.ctl,'advh 7 99 horiz. temperature advection [K/dia] ')</div><div>write (thermo.ctl,'advv 7 99 vertical temperature advection [K/dia] ')</div><div>write (thermo.ctl,'qd 7 99 [K/dia] ')</div><div>write (thermo.ctl,"res "7" 99 residuo of diabatic heating (Q) [K/dia] ")</div><div>write (thermo.ctl,'endvars')</div><div>**********************************************************</div></div><div><br></div><div>Sorry for the long note. Any help will be much appreciated.</div><div><br></div><div>Thanks</div><div>Praveen</div><div><br></div></div>
<br>_______________________________________________<br>gradsusr mailing list<br>gradsusr@gradsusr.org<br>http://gradsusr.org/mailman/listinfo/gradsusr<br></blockquote><br><br><br><font face="times new roman, new york, times, serif">-- </font><br><div style="font-family: "times new roman", "new york", times, serif;"><span name="x"></span>Prof. Ricardo Hallak<br>Laboratório de Meteorologia de Mesoescala - LMM<br>Departamento de Ciências Atmosféricas<br>Instituto de Astronomia, Geofísica e Ciências Atmosféricas<br>Universidade de São Paulo<br><br>Phone: +55(11)3091-4698<span name="x"></span><br></div></div></div></body></html>