<div dir="ltr"><span style="font-size:12.8px">Hello,</span><br style="font-size:12.8px"><br style="font-size:12.8px"><span style="font-size:12.8px">I&#39;m currently attempting to use the built-in NCL function to calculate potential vorticity (&quot;pot_vort_isobaric&quot;). Unfortunately, I am repeatedly getting a divide by zero error:</span><br style="font-size:12.8px"><br style="font-size:12.8px"><span style="font-size:12.8px">&quot;</span><br style="font-size:12.8px"><span style="font-size:12.8px">fatal:divide: Division by 0, Can&#39;t continue</span><br style="font-size:12.8px"><span style="font-size:12.8px">fatal:Div: operator failed, can&#39;t continue</span><br style="font-size:12.8px"><span style="font-size:12.8px">fatal:[&quot;Execute.c&quot;:8575]:</span><span style="font-size:12.8px">Execute: Error occurred at or near line 3892 in file $NCARG_ROOT/lib/ncarg/</span><span style="font-size:12.8px">nclscripts/csm/shea_util.ncl</span><br style="font-size:12.8px"><span style="font-size:12.8px">fatal:[&quot;Execute.c&quot;:8575]:</span><span style="font-size:12.8px">Execute: Error occurred at or near line 3909 in file $NCARG_ROOT/lib/ncarg/</span><span style="font-size:12.8px">nclscripts/csm/shea_util.ncl</span><br style="font-size:12.8px"><span style="font-size:12.8px">&quot;</span><br style="font-size:12.8px"><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">I have confirmed that my original units are in hPa (thus the *100 hPa-&gt; Pa conversion should be correct), and that the original latitudes were north-&gt;south (so the lat flip should also be correct). I&#39;m assuming this occurring during the static stability calculation (as mentioned in previous ncl-talk discussions), but I&#39;m not sure whether there has yet been a resolution.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">I&#39;ve attempted this with data from different years, but eventually a zero division error always crops up. A short sample script is below, and representative data files have been uploaded to the FTP site with the same names as below.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">I&#39;m currently using NCL version 6.3.0.<br><br>Thanks very much for any advice!</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">~Daniel<br><br>&quot;<br>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl&quot;<br>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl&quot;<br>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl&quot;<br>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl&quot;<br><br>begin</div><div style="font-size:12.8px"><br>infile1 = addfile (&quot;<a href="http://air.2013.nc/" target="_blank">air.2013.nc</a>&quot;, &quot;r&quot;)<br>infile2 = addfile (&quot;<a href="http://uwnd.2013.nc/" target="_blank">uwnd.2013.nc</a>&quot;, &quot;r&quot;)<br>infile3 = addfile (&quot;<a href="http://vwnd.2013.nc/" target="_blank">vwnd.2013.nc</a>&quot;, &quot;r&quot;)<br><br>     U   = infile2-&gt;uwnd   ; (time,lev,lat,lon)<br>     V   = infile3-&gt;vwnd<br>     T   = infile1-&gt;air    ; K<br><br>     lev = T&amp;level  ; hPa<br>     lev = lev*100 ; convert units<br>     lev@units = &quot;Pa&quot;<br><br>     U   = U(:,:,::-1,:)    ; reorder to South -&gt; North<br>     V   = V(:,:,::-1,:)<br>     T   = T(:,:,::-1,:)<br><br>     lat = T&amp;lat<br>     gridType  = 0          ; Gaussian grid<br>     opt = 0<br>     pvort = pot_vort_isobaric(lev,U,V,T,lat, gridType, opt)<br><br>outfile1=addfile(&quot;<a href="http://pvort.2013.nc/" target="_blank">pvort.2013.nc</a>&quot;,&quot;c&quot;)<br>outfile1-&gt;pvort = pvort</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">end</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">&quot;</div></div>