<div dir="ltr">First, make sure to include ncl-talk on all of your replies. I was not the only one helping you with this topics, and there is never a guarantee that I can keep helping you in the future.<div><br></div><div>Second, the best way for anyone to analyze the problem will be if you can provide the script causing the error in a form that we can run ourselves as well as the data needed to run the script. If the data is large ( >1 MB, too big to attach to an email for this list), then the data is best uploaded onto NCL's ftp servers - for information on doing that, see <a href="https://www.ncl.ucar.edu/report_bug.shtml#HowToFTP">https://www.ncl.ucar.edu/report_bug.shtml#HowToFTP</a> and let us know the exact filename. No one can look at the file names on the server, so having the exact file name is important.</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 Tue, Jun 16, 2015 at 4:53 AM, Nafiseh Pegahfar <span dir="ltr"><<a href="mailto:pegahfar@alumni.ut.ac.ir" target="_blank">pegahfar@alumni.ut.ac.ir</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Kyle,<br>
Thanks for your guide.<br>
the NCL version is 6.3.0<br>
my code is below.<br>
please note that I have extracted PV and S and theta and dthdp codes from<br>
contributed.ncl and put them in my script and also test their zero value.<br>
no zero value happened for none of them, but again previous error<br>
occurred.<br>
<br>
;*************************************************<br>
; PV<br>
;<br>
;<br>
;************************************************<br>
;load "/usr/share/ncarg/nclscripts/csm/gsn_code.ncl"<br>
;load "/usr/share/ncarg/nclscripts/csm/gsn_csm.ncl"<br>
;load "/usr/share/ncarg/nclscripts/csm/contributed.ncl"<br>
load "/usr/share/ncarg/nclscripts/csm/shea_util.ncl"<br>
<br>
;************************************************<br>
<br>
;************************************************<br>
begin<br>
<br>
;************************************************<br>
; add data from file<br>
;**************************<br>
a=<br>
addfile("/home/pegahfar/inio/haiyan/data/grb2/gfsanl_4_20131103_0000_000.grb2","r")<br>
; Open the next file<br>
<br>
;************************************************<br>
; read the variable from the files<br>
<br>
;************************************************<br>
<br>
;************************************************<br>
; 300<br>
;************************************************<br>
U = a->UGRD_P0_L100_GLL0(:,::-1,:) ; (time,lev,lat,lon) or (lev,lat,lon)<br>
V = a->VGRD_P0_L100_GLL0(:,::-1,:) ; (time,lev,lat,lon) or (lev,lat,lon)<br>
T = a->TMP_P0_L100_GLL0(:,::-1,:) ; K<br>
P = (a->lv_ISBL0)<br>
P = (P )*100<br>
P @units = "Pa"<br>
m=dimsizes(P )<br>
print ("dimsizes(P )="+dimsizes(P ))<br>
<br>
L = T &lat_0<br>
;"""""""""""""""""""""""""""""""""""""""""""""<br>
;s = -(t/theta)*dthdp<br>
;""""""""""""""""""""""""""""""""""""""""""'<br>
theta_test=0.0<br>
theta = T *(100000./conform(T ,P ,0))^0.286<br>
;print("theta ="+theta )<br>
theta_zero_test = where(theta.eq.0, theta_test+5, theta_test)<br>
print("theta_test="+theta_test)<br>
<br>
T_test=0<br>
T_zero_test = where(T.eq.0, T_test+5, T_test)<br>
print(" T_test="+ T_test)<br>
;print("T ="+T )<br>
<br>
dthdp_test=0<br>
dthdp = center_finite_diff_n (theta ,P ,False,0,0)<br>
dthdp_zero_test = where(dthdp.eq.0, dthdp_test+5, dthdp_test)<br>
print("dthdp_test="+dthdp_test)<br>
;print("dthdp ="+dthdp )<br>
<br>
s_test=0<br>
s = -(T/theta)*dthdp<br>
s_zero_test = where(s.eq.0, s_test+5, s_test)<br>
print("s_test="+s_test)<br>
<br>
PV = pot_vort_isobaric(P ,U ,V ,T ,L , 1, 0)<br>
printVarSummary (PV )<br>
PV_300 = PV ({3000000},:,:)<br>
print ("PV_300"+PV_300)<br>
<br>
<br>
;*************************************smothing***********************************************<br>
<br>
<br>
PV_300_smth = smth9_Wrap(PV_300, 0.50, 0.25, True) ; heavy local smoothing<br>
<br>
end<br>
<span class="im HOEnZb"><br>
<br>
<br>
> Hi Nafiseh, I've had this issue on rare occasions before, but not for<br>
> some time - the division by zero that I traced down stemmed from the<br>
> calculation of the static stability of a layer that went to zero or very<br>
> close to zero, I can't remember the exact details. Go ahead and let us<br>
> know if the error is still present in the 6.3.0 version of NCL with the<br>
> officially-supported version of pot_vort_isobaric. If so, I'll see if the<br>
> fix that I wrote a while back is applicable here and if Dennis would be<br>
> willing to implement it in the future. The good news is that the function<br>
> is in contributed.ncl, which means that we may be able to send you a fixed<br>
> contributed.ncl file and you can have the fix instantly. But this depends<br>
> on whether the issue is the same, so please let us know your version of<br>
> NCL and we may ask you to share your data to examine the problem a bit<br>
> closer. Kyle ---------------------------------------- Kyle S. Griffin<br>
> Department of Atmospheric and Oceanic Sciences University of Wisconsin -<br>
> Madison Room 1421 1225 W Dayton St, Madison, WI 53706 Email:<br>
</span><div class="HOEnZb"><div class="h5">> <a href="mailto:ksgriffin2@wisc.edu">ksgriffin2@wisc.edu</a> On Sat, Jun 13, 2015 at 8:02 AM, Dennis Shea wrote:<br>
> > I am not sure why you would get a 'zero' from the quantity. > > === > ><br>
> What version of NCL are you using? > > %> ncl -V > > === > Many functions<br>
> in the shea_util.ncl library are preceded by > > ><br>
> ;------------------------------------------------------------------------------------<br>
> > ;----------------------- Unsupported: DJS ><br>
> ----------------------------------- > ><br>
> ;-----------------------------------------------------------------------------------<br>
> > > This means ... that I won't support them. They are developmental. > ><br>
> ++++++++++++++++++++++++++++++++++++++++++++++++++ > > The 6.3.0 release<br>
> (March, 2015) has two supported and documented > potential vorticity<br>
> functions. > ><br>
> <a href="http://www.ncl.ucar.edu/current_release.shtml" rel="noreferrer" target="_blank">http://www.ncl.ucar.edu/current_release.shtml</a> > > [Click on<br>
> 'pot_vort_isobaric'] > > Can you please download the latest version of NCL<br>
> and use the appropriate > function from that library ? > > Actually, the<br>
> versions in shea_util.ncl was deleted. The 6.3.0 function is > located in<br>
> contributed.ncl > > Cheers > > > > > Can you > > > > > > On Sat, Jun 13,<br>
> 2015 at 3:09 AM, Nafiseh Pegahfar < > <a href="mailto:pegahfar@alumni.ut.ac.ir">pegahfar@alumni.ut.ac.ir</a>> wrote: ><br>
> >> >> I write a ncl code to calculate PV(potential vorticity) at 300 mb<br>
> using >> gfs data. >> after running I recievd the error of >><br>
> """""""""""""""""""""""""""""""""""""""""""""""""""""""" >> fatal:divide:<br>
> Division by 0, Can't continue >> fatal:Div: operator failed, can't<br>
> continue >> fatal:["Execute.c":8575]:Execute: Error occurred at or near<br>
> line 3892 in >> file /usr/share/ncarg/nclscripts/csm/shea_util.ncl >> >><br>
> fatal:["Execute.c":8575]:Execute: Error occurred at or near line 3909 in<br>
> >> file /usr/share/ncarg/nclscripts/csm/shea_util.ncl >> >><br>
> fatal:["Execute.c":8575]:Execute: Error occurred at or near line 133 in >><br>
> file PVcode_version6_3.ncl >><br>
> """""""""""""""""""""""""""""""""""""""""""""""""""""""''' >> >> I checked<br>
> 3892 line in shea_util.ncl it was "con = R/(s*conform(t,p,npr))" >> while<br>
> s= -(t/theta)*dthdp. I checked "s","t","theta","dthdp" and >><br>
> "conform(t,p,npr)". non of them was zero. >> >> please help me what to do.<br>
> >> some of my code is : >> >> U_00 = a->UGRD_P0_L100_GLL0(:,::-1,:) ;<br>
> (time,lev,lat,lon) or >> (lev,lat,lon) V_00 =<br>
> a->VGRD_P0_L100_GLL0(:,::-1,:) ; >> (time,lev,lat,lon) or >><br>
> (lev,lat,lon) >> T_00 = a->TMP_P0_L100_GLL0(:,::-1,:) ; K >> P_00 =<br>
> (a->lv_ISBL0) >> P_00 = (P_00)*100 >> P_00@units = "Pa" >><br>
> m=dimsizes(P_00) >> print ("dimsizes(P_00)="+dimsizes(P_00)) >> >> L =<br>
> T_00&lat_0 >> >> ;""""""""""""""""""""""""""""""""""""""""""""" >> ;check<br>
> "conform(T_00,P_00,0)" >> ;""""""""""""""""""""""""""""""""""""""""""' >><br>
> conform_00=conform(T_00,P_00,0) >> test=0.0 >> conform_00_zero_test =<br>
> where(conform_00.eq.0, test+5, test) >> print("test="+test) >> >><br>
> ;""""""""""""""""""""""""""""""""""""""""""""" >> ;check "s=<br>
> -(t/theta)*dthdp" >> ;""""""""""""""""""""""""""""""""""""""""""' >><br>
> theta_test=0.0 >> theta_00= T_00*(100000./conform(T_00,P_00,0))^0.286 >><br>
> ;print("theta_00="+theta_00) >> theta00_zero_test = where(theta_00.eq.0,<br>
> theta_test+5, theta_test) >> print("theta_test="+theta_test) >> >><br>
> T_test=0 >> T00_zero_test = where(T_00.eq.0, T_test+5, T_test) >> print("<br>
> T_test="+ T_test) >> ;print("T_00="+T_00) >> >> dthdp_test=0 >> dthdp_00 =<br>
> center_finite_diff_n (theta_00,P_00,False,0,0) >> dthdp_00_zero_test =<br>
> where(dthdp_00.eq.0, dthdp_test+5, dthdp_test) >><br>
> print("dthdp_test="+dthdp_test) >> ;print("dthdp_00="+dthdp_00) >><br>
> ;""""""""""""""""""""""""""""""""""""""""""""""""""""""""""' >> >> PV_00 =<br>
> pot_vort_isobaric(P_00 ,U_00 ,V_00 ,T_00 ,L , 1, 0) >> printVarSummary<br>
> (PV_00) >> PV_00_300 = PV_00 ({3000000},:,:) >> print<br>
> ("PV_00_300"+PV_00_300) >> >> >> ================================= >> Best<br>
> Regards >> Nafiseh Pegahfar >> Assistant Professor >> Iranian National<br>
> Institute for Oceanography and Atmospheric Science >><br>
> (<a href="http://www.inio.ac.ir" rel="noreferrer" target="_blank">http://www.inio.ac.ir</a>) >> Phone: (0098)21- 66944873-5 Ext. 315 >> Fax:<br>
> (0098)21- 66944869 >> Email: (<a href="mailto:pegahfar@ut.ac.ir">pegahfar@ut.ac.ir</a>) >><br>
> (<a href="mailto:pegahfar@inio.ac.ir">pegahfar@inio.ac.ir</a>) >> ================================= >> >> >> >><br>
> ================================= >> Best Regards >> Nafiseh Pegahfar >><br>
> Assistant Professor >> Iranian National Institute for Oceanography and<br>
> Atmospheric Science >> (<a href="http://www.inio.ac.ir" rel="noreferrer" target="_blank">http://www.inio.ac.ir</a>) >> Phone: (0098)21-<br>
> 66944873-5 Ext. 315 >> Fax: (0098)21- 66944869 >> Email:<br>
> (<a href="mailto:pegahfar@ut.ac.ir">pegahfar@ut.ac.ir</a>) >> (<a href="mailto:pegahfar@inio.ac.ir">pegahfar@inio.ac.ir</a>) >><br>
> ================================= >> >><br>
> _______________________________________________ >> ncl-talk mailing list<br>
> >> <a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a> >> List instructions, subscriber options,<br>
> unsubscribe: >> <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a> >> > > ><br>
> _______________________________________________ > ncl-talk mailing list ><br>
> <a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a> > 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>
<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">pegahfar@ut.ac.ir</a>)<br>
(<a href="mailto:pegahfar@inio.ac.ir">pegahfar@inio.ac.ir</a>)<br>
=================================<br>
<br>
</div></div></blockquote></div><br></div>