<div dir="ltr"><div dir="ltr"><div>The question is whether the zero contour line is within a certain grid domain.  This can be approximated by checking whether the domain contains a mixture of grid points both above and below zero.  If there is a mix, then there is a zero contour line somewhere in the domain.</div><div><br></div><div>One way to do this is to count the number of grid points greater than zero, and also the number of grid points less than zero.  See documentation for the <b>dim_sum_n</b> function.</div><div><br></div><div>    subset = vp(:, {2:25}, {100:130})</div><div>    above = dim_sum_n ( (subset.gt.0), (/ 1,2 /) )<br>    below = dim_sum_n ( (subset.lt.0), (/ 1,2 /) )<br></div><div><br></div><div>This gives you two count arrays above(time) and below(time).  At each time step, if there is no zero crossing, then one of the two counts should be zero, and the other count should be the total number of grid points in the domain.  Anything else means that there is at least one zero crossing within the domain.</div><div><br></div><div>This method also works for irregularly shaped regions defined by a polyline loop, or a shapefile.</div><div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Feb 14, 2021 at 2:17 AM Lyndz via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu">ncl-talk@mailman.ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Dear NCL-experts,</div><div><br></div><div>I am calculating the velocity potential using the attached script:</div><div>The U and V components of winds both have the following dimensions:</div><div><br></div><div>





<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">Dimensions and sizes:<span style="white-space:pre-wrap">     </span>[time | 31] x [lat | 73] x [lon | 144]</span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><br></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;color:rgb(0,0,0)"><font face="arial, sans-serif">I uploaded the files here:</font></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;color:rgb(0,0,0)"><a href="https://www.dropbox.com/sh/t88oab9txej73u1/AAAkDCcsTC3_eHg8uBc0vhtda?dl=0" target="_blank">https://www.dropbox.com/sh/t88oab9txej73u1/AAAkDCcsTC3_eHg8uBc0vhtda?dl=0</a><font face="arial, sans-serif"><br></font></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;color:rgb(0,0,0)"><br></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;color:rgb(0,0,0)"><br></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;color:rgb(0,0,0)">(a) Is it possible to get all of the dates whenever the <b>0 </b>contour line is within the domain (100-130E,2-25N) of the plot using NCL? See attached plot for the March 15 2020 case.</p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;color:rgb(0,0,0)"><br></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;color:rgb(0,0,0)">If possible, I would like to ask how to do this in NCL.</p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;color:rgb(0,0,0)"><br></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;color:rgb(0,0,0)">I'll appreciate any help on this.</p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;color:rgb(0,0,0)"><br></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;color:rgb(0,0,0)"><br></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;color:rgb(0,0,0)">Sincerely,</p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;color:rgb(0,0,0)"><br></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;color:rgb(0,0,0)">Lyndz</p></div></div></div></div></div></div></div></div></div></div></div></div></blockquote></div></div></div>