<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: &quot;times new roman&quot;, &quot;new york&quot;, times, serif;"><br></div><div style="font-family: &quot;times new roman&quot;, &quot;new york&quot;, times, serif;">use</div><div style="font-family: &quot;times new roman&quot;, &quot;new york&quot;, times, serif;"><span style="font-family: Helvetica, Arial, sans-serif;">write (thermo.ctl,'vars &nbsp;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: &quot;times new roman&quot;, &quot;new york&quot;, 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 &nbsp;^<a href="http://merge_rf79_05_act_0lag.nc" target="_blank">merge_rf79_05_act_0lag.nc</a></div><div>DTYPE &nbsp;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&nbsp;</div><div>TDEF 164 LINEAR 12:00Z03aug1979 1dy</div><div>TITLE &nbsp;<a href="http://merge_rf79_05_act_0lag.nc" target="_blank">merge_rf79_05_act_0lag.nc</a> &nbsp;720x361 grid</div><div>OPTIONS yrev zrev</div><div>UNDEF &nbsp;-32767</div><div>VARS &nbsp;4</div><div>v &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;7 &nbsp;t,z,y,x &nbsp;V component of wind &nbsp;[m s**-1]</div><div>u &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;7 &nbsp;t,z,y,x &nbsp;U component of wind &nbsp;[m s**-1]</div><div>t &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;7 &nbsp;t,z,y,x &nbsp;Temperature &nbsp;[K]</div><div>w &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;7 &nbsp;t,z,y,x &nbsp;Vertical velocity &nbsp;[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: &nbsp;thermo.ctl</div><div>Open Error: &nbsp;Looking for "endvars", found "res &nbsp; 7 &nbsp;99 &nbsp;residuo of diabatic heating &nbsp;(q) &nbsp;[k/dia] " instead.</div><div>&nbsp; --&gt; The invalid description file record is:</div><div>&nbsp; --&gt; res &nbsp; 7 &nbsp;99 &nbsp;residuo of diabatic heating &nbsp;(Q) &nbsp;[K/dia]</div><div>&nbsp; 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 &nbsp; &nbsp; &nbsp;--&gt; m</div><div>*Rgas &nbsp; &nbsp;--&gt; 287.05 J/Kg K</div><div>*Cp &nbsp; &nbsp; &nbsp;--&gt; 1004 &nbsp; J/Kg K</div><div>*dt &nbsp; &nbsp; &nbsp;--&gt; s</div><div>*T &nbsp; &nbsp; &nbsp; --&gt; K</div><div>*u &nbsp; &nbsp; &nbsp; --&gt; m/s</div><div>*v &nbsp; &nbsp; &nbsp; --&gt; m/s</div><div>*P &nbsp; &nbsp; &nbsp; --&gt; Pa</div><div>*W &nbsp; &nbsp; &nbsp; --&gt; 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 &lt;= 164)</div><div><br></div><div>while (l &lt;= 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 &nbsp;= 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)&nbsp;</div><div>* are in hPa, we must multiply the levels (hPa) by 100 to convert it in Pa units&nbsp;</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 &nbsp; = -kp * &nbsp;(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 &nbsp; = 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 &nbsp;-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> &nbsp;720x361 grid')</div><div>write (thermo.ctl,"xdef "720" linear &nbsp; &nbsp;0.0 "0.5"")</div><div>write (thermo.ctl,"ydef "361" linear &nbsp;-90.0 "0.5"")</div><div>write (thermo.ctl,"zdef "7" levels &nbsp;"2" "3" "5" "7" "8.5" "9.25" "10" ")</div><div>write (thermo.ctl,"tdef "164" linear "00Z03aug1979" "12hr" " &nbsp; )</div><div>write (thermo.ctl,'vars &nbsp;4')</div><div>write (thermo.ctl,'ttend 7 &nbsp;99 &nbsp;temperature tendency &nbsp;[K/dia] ')</div><div>write (thermo.ctl,'advh &nbsp;7 &nbsp;99 &nbsp;horiz. temperature advection &nbsp;[K/dia] ')</div><div>write (thermo.ctl,'advv &nbsp;7 &nbsp;99 &nbsp;vertical temperature advection &nbsp;[K/dia] ')</div><div>write (thermo.ctl,'qd &nbsp; &nbsp;7 &nbsp;99 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[K/dia] ')</div><div>write (thermo.ctl,"res &nbsp; "7" &nbsp;99 &nbsp;residuo of diabatic heating &nbsp;(Q) &nbsp;[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: &quot;times new roman&quot;, &quot;new york&quot;, 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>