<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi Atul,<br class=""><br class="">Include an if-loop to only run chpOnset if B2 and B1 are not equal (thus no division by zero). If they are equal you could include an else portion and declare "chpOnset = 9.96921e+36”, making it a missing value.<br class=""><br class="">Toni<br class=""><div class="">
<div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div><br class=""><br class=""><b class="">Toni Klemm, Ph.D.<br class=""></b>Postdoctoral Research Associate<br class="">Department of Ecosystem Science and Management<br class="">College of Agriculture and Life Sciences<br class="">Texas A&M University, College Station, TX<br class=""><a href="http://www.toni-klemm.de" class="">www.toni-klemm.de</a> | <a href="http://www.twitter.com/toniklemm" class="">@toniklemm</a><br class="">Editorial Board member, <a href="http://www.eccforum.org" class="">Early Career Climate Forum</a><br class=""><br class=""><br class=""><br class=""><br class=""><br class=""><br class=""><br class=""></div></div></div></div>
</div>
<br class=""><blockquote type="cite" class="">On Sep 10, 2019, at 12:57 AM, Atul Saini via ncl-talk <<a href="mailto:ncl-talk@ucar.edu" class="">ncl-talk@ucar.edu</a>> wrote:<br class=""><br class="">Hi NCL,<br class=""><br class="">While running the following code-<br class=""><br class="">a=addfile("Data_File.nc","r")<br class="">x=a->tym(0:4,:,:)<br class="">X=sqrt(x)<br class="">y=a->rf(0:4,:,:)<br class="">Y=sqrt(y)<br class="">v=a->tym(5:9,:,:)<br class="">V=sqrt(v)<br class="">w=a->rf(5:9,:,:)<br class="">W=sqrt(w)<br class="">A1=((dim_sum_n(y,0))*(dim_sum_n(X,0)))-(dim_sum_n(x,0))*(dim_sum_n(x*y,0))/(100*(dim_sum_n(X,0))-(sqrt(dim_sum_n(x,0))))<br class=""><br class="">A2=((dim_sum_n(w,0))*(dim_sum_n(V,0)))-(dim_sum_n(v,0))*(dim_sum_n(v*w,0))/(100*(dim_sum_n(V,0))-(sqrt(dim_sum_n(v,0))))<br class=""><br class="">B1= (100*(dim_sum_n(x*y,0)))-(dim_sum_n(y,0))/(100*(dim_sum_n(X,0))-(sqrt(dim_sum_n(x,0))))<br class=""><br class="">B2= (100*(dim_sum_n(v*w,0)))-(dim_sum_n(w,0))/(100*(dim_sum_n(V,0))-(sqrt(dim_sum_n(v,0))))<br class=""><br class="">chpOnset = ((A1-A2)/(B2-B1))<br class="">print(chpOnset)<br class=""><br class="">I am receiving the following error-<br class="">fatal:divide: Division by 0, Can't continue<br class="">fatal:Div: operator failed, can't continue<br class=""><br class="">Please help, what should be done here?<br class=""><br class="">Regards,<br class=""><br class=""><br class=""> <br class=""><span id="cid:f_k0dezfwf0"><Data_File.nc></span>_______________________________________________<br class="">ncl-talk mailing list<br class=""><a href="mailto:ncl-talk@ucar.edu" class="">ncl-talk@ucar.edu</a><br class="">List instructions, subscriber options, unsubscribe:<br class="">https://urldefense.proofpoint.com/v2/url?u=http-3A__mailman.ucar.edu_mailman_listinfo_ncl-2Dtalk&d=DwICAg&c=u6LDEWzohnDQ01ySGnxMzg&r=zmhRVp0i4wZ5_1Ujh0fnRXAExHgKLTQu0rZLW7PxKA4&m=i-1nT_UhpTjL9AKGdDm3lDt4Lby1v-EFWn-4jeJ703Y&s=yB0EgGvVdxmWZT-DJgktgjRkcOMSd0xAadSqj-YayB0&e=<br class=""></blockquote><br class=""></body></html>