<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:13px"><div id="yui_3_16_0_1_1412216820763_11617" dir="ltr"><span id="yui_3_16_0_1_1412216820763_11623">Hi I am writing a script to compute moist potential vorticity using entropy temperature Theta_s, and virtual potential temperature Theta_v. Please help me to check the script if it is coded right. When I drive it, it gives me results but am not sure the way I have coded if it is right. could anyone cross check it</span></div><div id="yui_3_16_0_1_1412216820763_11650" dir="ltr"><span></span>&nbsp;</div><div id="yui_3_16_0_1_1412216820763_11597">*our script to compute MPV700hPa.<br>*###################Day1################################<br>*'open $DATA_DIR/WRF_9KM_Nonhy_Topo${RunDay}.ctl'<br>'open 201112200000_arw_wrfout_d01.ctl'<br>&nbsp;<br>'q file'</div><div id="yui_3_16_0_1_1412216820763_11651">'q dims'</div><div id="yui_3_16_0_1_1412216820763_11652">'pi=3.14159'<br>'dtr=pi/180'<br>'a=6.37122*pow(10,6)'<br>'omega=7.2921*pow(10,-5)'<br>'g=9.81'<br>'R=287'<br>'Cp=1004.5'<br>'L=2.453*pow(10,6)'<br>*'L=2.453e6'<br>'Rv=461'</div><div id="yui_3_16_0_1_1412216820763_11653"><br>* tk&nbsp;&nbsp;&nbsp; = Temp in Kelvin<br>* mixr&nbsp; = water vapour Mixing ratio<br>* u&nbsp;&nbsp;&nbsp;&nbsp; = U-wind in m/s<br>* v&nbsp;&nbsp;&nbsp;&nbsp; = V-wind in m/s<br>* define ug=UGRDprs&nbsp;&nbsp; U-wind in m/s in pressure level<br>* define vg=VGRDprs&nbsp; V-wind in m/s in pressure level<br>*'define ua=U-ug'<br>*'define va=V-vg'</div><div>*PV @700hPa<br>'set lev 800'<br>'define f=2*omega*sin(lat*dtr)'<br>'define p1=lev*100'<br>'define tk1=TMPprs'<br>'define u1=UGRDprs'<br>'define v1=VGRDprs'<br>'define rh1=rhprs'<br>'define thetap1=tk1*pow((100000/p1),0.286)'<br>'define es=6.1173*100*exp((L/Rv)*(1/273.16 - 1/tk1))'<br>'define ep1=rh1*es/100'<br>'WVmixr1=0.622*ep1/(p1)'<br>'define T=tk1'<br>'define VirT1=T*(1+0.61*WVmixr1)'<br>'thetav1=VirT1*pow((100000/p1),0.2857))'<br>'thetas1=thetap1*exp(5.87*WVmixr1)'</div><div>'set lev 600'<br>'define p2=lev*100'<br>'define tk2=TMPprs'<br>'define u2=UGRDprs'<br>'define v2=VGRDprs'<br>'define rh2=rhprs'<br>'define thetap2=tk2*pow((100000/p2),0.286)'<br>'define es=6.1173*100*exp((L/Rv)*(1/273.16 - 1/tk2))'<br>'define ep2=rh2*es/100'<br>'WVmixr2=0.622*ep2/(p2)'<br>'define T=tk2'<br>'define VirT2=T*(1+0.61*WVmixr2)'<br>'thetav2=VirT2*pow((100000/p2),0.2857))'<br>'thetas2=thetap2*exp(5.87*WVmixr2)'<br>********************PV at 700hPa level<br>'set lev 700'<br>'dp=p2-p1'<br>'dudp=(u2-u1)/dp'<br>'dvdp=(v2-v1)/dp'<br>'define p0=lev*100'<br>'define tk0=TMPprs'<br>'define u0=UGRDprs'<br>'define v0=VGRDprs'<br>'vort0=hcurl(u0,v0)'<br>'define Totvort=vort0+f'</div><div>'define alpha0=R*tk0/p0'<br>'define rh0=rhprs'<br>'theta0=tk0*pow((100000/p0),0.2857))'<br>'define es=6.1173*100*exp((L/Rv)*(1/273.16 - 1/tk0))'<br>'de<br>fine ep0=rh0*es/100'<br>'WVmixr0=0.622*ep0/(p0)'<br>'define T=tk0'<br>'define VirT0=T*(1+0.61*WVmixr0)'<br>'thetav0=VirT0*pow((100000/p0),0.2857))'<br>'thetas0=theta0*exp(5.87*WVmixr0)'<br>'dy=cdiff(lat,y)*dtr*a'<br>'dx=cdiff(lon,x)*dtr*a*cos(lat*dtr)'<br>'define dthetas0dx=cdiff(thetas0,x)/dx'<br>'define dthetas0dy=cdiff(thetas0,y)/dy'<br>'define dthetas0dp=(thetas2-thetas1)/dp'<br>'define Totdthedtas=dthetas0dx+dthetas0dy+dthetas0dp'</div><div>'define dthetav0dx=cdiff(thetav0,x)/dx'<br>'define dthetav0dy=cdiff(thetav0,y)/dy'<br>'define dthetav0dp=(thetav2-thetav1)/dp'<br>'define Totdthedtav=dthetav0dx+dthetav0dy+dthetav0dp'</div><div>'term11= -g*Totvort*dthetav0dp*pow(10,6)'<br>'term22=-g*dudp*dthetav0dy*pow(10,6)'<br>'term33=g*dVdp*dthetav0dx*pow(10,6)'<br>'PV7002=term1+term2+term3'</div><div>'term1= -g*Totvort*dthetas0dp*pow(10,6)'</div><div>'term2=-g*dudp*dthetas0dy*pow(10,6)'<br>'term3=g*dVdp*dthetas0dx*pow(10,6)'<br>'PV700=term1+term2+term3'</div><div id="yui_3_16_0_1_1412216820763_11643">*'term1=Totvort*dthetas0dp*e6)'<br>*'term2=dudp*dthetas0dy*e6'<br>*'term3=-dVdp*dthetas0dx*e6'<br>'PV700=term1+term2+term3'</div><div id="yui_3_16_0_1_1412216820763_11642">'set t 7'<br>'set gxout shaded'<br>'set mpdset hires'<br>'set display color white'<br>'set vpage 1.0 8.5 2.0 8.5'<br>'c'<br>*'d mp'd<br>'d theta_s'<br>*'exec colors'<br>*'run colorset.gs'<br>*'set ylint 12'<br>*'set xlint 12'<br>'cbarhov2.gs'<br>'draw title 700hPa-Moist Potential Vorticity '</div><div>'printim 700_mv.png'<br>'set grads off'<br>*'quit'</div><div>*'define MV=TotVort*ept(tmpprs,rhprs.prs)'</div><div><br>&nbsp;</div><div id="yui_3_16_0_1_1412216820763_11614">&nbsp;</div><div id="yui_3_16_0_1_1412216820763_11616"><div id="yui_3_16_0_1_1412216820763_11615">AS EVER
<br>LUHUNGA
<br>
<br>--------------------
<br>Philbert Modest Luhunga
<br>University of Pretoria&nbsp;
<br>Department of Geography,Geoinformatics and Meteorology
<br>Private Bag X20 Hatfield 0028 South Africa
<br>Tel +27 (0) 12 420 5164
<br>Fax +27 (0) 12 420 6385
<br>Mobile:+ 27826228060
<br>Email address: philuhunga@yahoo.com</div></div></div></body></html>