<div dir="ltr">Hi Daniel,<div><br></div><div>OK, I finally read your email in all the detail I should have the first time and found what should likely be an easy fix (this is the 3rd time I've written this email - probably shouldn't reply to the list at this hour!). </div><div><br></div><div>You're reading a version in from shea_util.ncl, which is an older, out of date, and unsupported version of pot_vort_isobaric (anything in shea_util.ncl is unsupported, technically - and note the file and line numbers in your error message). The safe guards for static stability that you've likely seen Dennis and I discuss in previous posts have been fully implemented in the contributed.ncl version that became officially supported in the 6.3.0 release. I suggest you either comment out your load of shea_util.ncl (if possible) or ensure that you load contributed.ncl after you load shea_util.ncl - this should ensure the older function is redefined when you load contributed.ncl.</div><div><br></div><div>Hope that is an easy fix and that your calculations will work now.</div><div><br></div><div><br></div><div>Kyle</div><br><div class="gmail_quote"><div dir="ltr">On Wed, Mar 9, 2016 at 6:57 PM Daniel Swain <<a href="mailto:danielswain2@gmail.com" target="_blank">danielswain2@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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'm currently attempting to use the built-in NCL function to calculate potential vorticity ("pot_vort_isobaric"). 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">"</span><br style="font-size:12.8px"><span style="font-size:12.8px">fatal:divide: Division by 0, Can't continue</span><br style="font-size:12.8px"><span style="font-size:12.8px">fatal:Div: operator failed, can't continue</span><br style="font-size:12.8px"><span style="font-size:12.8px">fatal:["Execute.c":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:["Execute.c":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">"</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-> Pa conversion should be correct), and that the original latitudes were north->south (so the lat flip should also be correct). I'm assuming this occurring during the static stability calculation (as mentioned in previous ncl-talk discussions), but I'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'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'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>"<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"<br><br>begin</div><div style="font-size:12.8px"><br>infile1 = addfile ("<a href="http://air.2013.nc/" target="_blank">air.2013.nc</a>", "r")<br>infile2 = addfile ("<a href="http://uwnd.2013.nc/" target="_blank">uwnd.2013.nc</a>", "r")<br>infile3 = addfile ("<a href="http://vwnd.2013.nc/" target="_blank">vwnd.2013.nc</a>", "r")<br><br> U = infile2->uwnd ; (time,lev,lat,lon)<br> V = infile3->vwnd<br> T = infile1->air ; K<br><br> lev = T&level ; hPa<br> lev = lev*100 ; convert units<br> lev@units = "Pa"<br><br> U = U(:,:,::-1,:) ; reorder to South -> North<br> V = V(:,:,::-1,:)<br> T = T(:,:,::-1,:)<br><br> lat = T&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("<a href="http://pvort.2013.nc/" target="_blank">pvort.2013.nc</a>","c")<br>outfile1->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">"</div></div>
_______________________________________________<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></div>