<div dir="ltr">Hi Nafiseh,<div><br></div><div>I&#39;ve had this issue on rare occasions before, but not for some time - the division by zero that I traced down stemmed from the calculation of the static stability of a layer that went to zero or very close to zero, I can&#39;t remember the exact details.</div><div><br></div><div>Go ahead and let us know if the error is still present in the 6.3.0 version of NCL with the officially-supported version of pot_vort_isobaric. If so, I&#39;ll see if the fix that I wrote a while back is applicable here and if Dennis would be willing to implement it in the future. The good news is that the function is in contributed.ncl, which means that we may be able to send you a fixed contributed.ncl file and you can have the fix instantly. But this depends on whether the issue is the same, so please let us know your version of NCL and we may ask you to share your data to examine the problem a bit closer.</div><div><br></div><div><br></div><div>Kyle</div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr">----------------------------------------<div>Kyle S. Griffin</div><div>Department of Atmospheric and Oceanic Sciences</div><div>University of Wisconsin - Madison</div><div>Room 1421</div><div>1225 W Dayton St, Madison, WI 53706</div><div>Email: <a href="mailto:ksgriffin2@wisc.edu" target="_blank">ksgriffin2@wisc.edu</a></div></div></div></div>
<br><div class="gmail_quote">On Sat, Jun 13, 2015 at 8:02 AM, Dennis Shea <span dir="ltr">&lt;<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>I am not sure why you would get a &#39;zero&#39; from the quantity.<br><br>===<br><br></div>What version of NCL are you using?<br><br></div>%&gt; ncl -V<br><br>===<br></div>Many functions in the shea_util.ncl library are preceded by<br><div><br>;------------------------------------------------------------------------------------<br>;----------------------- Unsupported: DJS -----------------------------------<br>;-----------------------------------------------------------------------------------<br><br></div><div>This means ... that I won&#39;t support them. They are developmental.<br><br>++++++++++++++++++++++++++++++++++++++++++++++++++<br><br></div><div>The 6.3.0 release (March, 2015) has two  supported and documented potential vorticity functions.<br><br>               <a href="http://www.ncl.ucar.edu/current_release.shtml" target="_blank">http://www.ncl.ucar.edu/current_release.shtml</a><br><br></div><div>[Click on &#39;pot_vort_isobaric&#39;]<br><br></div><div>Can you please download the latest version of NCL and use the appropriate function from that library ?<br><br></div><div>Actually, the versions in shea_util.ncl was deleted. The 6.3.0 function is located in contributed.ncl<br><br></div><div>Cheers<br><br></div><div><br><br></div><div><br></div><div>Can you <br></div><div><br><br><br></div><div><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jun 13, 2015 at 3:09 AM, Nafiseh Pegahfar <span dir="ltr">&lt;<a href="mailto:pegahfar@alumni.ut.ac.ir" target="_blank">pegahfar@alumni.ut.ac.ir</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
I write a ncl code to calculate PV(potential vorticity) at 300 mb using<br>
gfs data.<br>
after running I recievd the error of<br>
&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;<br>
fatal:divide: Division by 0, Can&#39;t continue<br>
fatal:Div: operator failed, can&#39;t continue<br>
fatal:[&quot;Execute.c&quot;:8575]:Execute: Error occurred at or near line 3892 in<br>
file /usr/share/ncarg/nclscripts/csm/shea_util.ncl<br>
<br>
fatal:[&quot;Execute.c&quot;:8575]:Execute: Error occurred at or near line 3909 in<br>
file /usr/share/ncarg/nclscripts/csm/shea_util.ncl<br>
<br>
fatal:[&quot;Execute.c&quot;:8575]:Execute: Error occurred at or near line 133 in<br>
file PVcode_version6_3.ncl<br>
&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&#39;&#39;&#39;<br>
<br>
I checked 3892 line in shea_util.ncl it was &quot;con = R/(s*conform(t,p,npr))&quot;<br>
while s= -(t/theta)*dthdp. I checked &quot;s&quot;,&quot;t&quot;,&quot;theta&quot;,&quot;dthdp&quot; and<br>
&quot;conform(t,p,npr)&quot;. non of them was zero.<br>
<br>
please help me what to do.<br>
some of my code is :<br>
<br>
U_00   = a-&gt;UGRD_P0_L100_GLL0(:,::-1,:) ; (time,lev,lat,lon) or<br>
(lev,lat,lon) V_00   = a-&gt;VGRD_P0_L100_GLL0(:,::-1,:)   ;<br>
(time,lev,lat,lon) or<br>
(lev,lat,lon)<br>
T_00   = a-&gt;TMP_P0_L100_GLL0(:,::-1,:) ; K<br>
P_00   = (a-&gt;lv_ISBL0)<br>
P_00   = (P_00)*100<br>
P_00@units = &quot;Pa&quot;<br>
m=dimsizes(P_00)<br>
print (&quot;dimsizes(P_00)=&quot;+dimsizes(P_00))<br>
<br>
L = T_00&amp;lat_0<br>
<br>
;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;<br>
;check &quot;conform(T_00,P_00,0)&quot;<br>
;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&#39;<br>
conform_00=conform(T_00,P_00,0)<br>
test=0.0<br>
conform_00_zero_test = where(conform_00.eq.0, test+5, test)<br>
print(&quot;test=&quot;+test)<br>
<br>
;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;<br>
;check  &quot;s= -(t/theta)*dthdp&quot;<br>
;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&#39;<br>
theta_test=0.0<br>
theta_00= T_00*(100000./conform(T_00,P_00,0))^0.286<br>
;print(&quot;theta_00=&quot;+theta_00)<br>
theta00_zero_test = where(theta_00.eq.0, theta_test+5, theta_test)<br>
print(&quot;theta_test=&quot;+theta_test)<br>
<br>
T_test=0<br>
T00_zero_test = where(T_00.eq.0, T_test+5, T_test)<br>
print(&quot; T_test=&quot;+ T_test)<br>
;print(&quot;T_00=&quot;+T_00)<br>
<br>
dthdp_test=0<br>
dthdp_00 = center_finite_diff_n (theta_00,P_00,False,0,0)<br>
dthdp_00_zero_test = where(dthdp_00.eq.0, dthdp_test+5, dthdp_test)<br>
print(&quot;dthdp_test=&quot;+dthdp_test)<br>
;print(&quot;dthdp_00=&quot;+dthdp_00)<br>
;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&#39;<br>
<br>
PV_00 = pot_vort_isobaric(P_00 ,U_00 ,V_00 ,T_00 ,L , 1, 0)<br>
printVarSummary (PV_00)<br>
PV_00_300 = PV_00 ({3000000},:,:)<br>
print (&quot;PV_00_300&quot;+PV_00_300)<br>
<br>
<br>
=================================<br>
Best Regards<br>
Nafiseh Pegahfar<br>
Assistant Professor<br>
Iranian National Institute for Oceanography and Atmospheric Science<br>
(<a href="http://www.inio.ac.ir" rel="noreferrer" target="_blank">http://www.inio.ac.ir</a>)<br>
Phone: (0098)21- 66944873-5 Ext. 315<br>
Fax: (0098)21- 66944869<br>
Email: (<a href="mailto:pegahfar@ut.ac.ir" target="_blank">pegahfar@ut.ac.ir</a>)<br>
          (<a href="mailto:pegahfar@inio.ac.ir" target="_blank">pegahfar@inio.ac.ir</a>)<br>
=================================<br>
<br>
<br>
<br>
=================================<br>
Best Regards<br>
Nafiseh Pegahfar<br>
Assistant Professor<br>
Iranian National Institute for Oceanography and Atmospheric Science<br>
(<a href="http://www.inio.ac.ir" rel="noreferrer" target="_blank">http://www.inio.ac.ir</a>)<br>
Phone: (0098)21- 66944873-5 Ext. 315<br>
Fax: (0098)21- 66944869<br>
Email: (<a href="mailto:pegahfar@ut.ac.ir" target="_blank">pegahfar@ut.ac.ir</a>)<br>
          (<a href="mailto:pegahfar@inio.ac.ir" target="_blank">pegahfar@inio.ac.ir</a>)<br>
=================================<br>
<br>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
</blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>