<div dir="ltr"><div>Hi Lyndz,</div><div>I think the problem is that one of your ind conditions results in missing and hence this error message. You have to decide what to do when this sort of situation arises. The attached adds an if statement that could be useful in such scenarios but I am not sure if that is what you want.</div><div>Cheers,</div><div>Rashed<br></div><div> <br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Apr 17, 2021 at 6:30 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:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><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 Sir Dennis and NCL-experts,</div><div><br></div><div>I am getting this error: </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"><span style="font-variant-ligatures:no-common-ligatures"><b><font color="#ff0000">fatal:Argument type mismatch on argument (0) of (ind_resolve) can not coerce</font></b></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;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">occurring near at the ncol line..</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)"><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)"><font face="arial, sans-serif">Here's a sample file that I am using:</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)"><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)"><a href="https://www.dropbox.com/s/4nu4jh2v7uz6r45/mslp_jan16_2017.nc?dl=0" target="_blank">https://www.dropbox.com/s/4nu4jh2v7uz6r45/mslp_jan16_2017.nc?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)">Attached is the updated script.</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)">Any ideas on how to solve 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)">--Lyndz</p></div></div></div></div></div></div></div></div></div></div></div></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Apr 17, 2021 at 2:52 AM Dennis Shea <<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div></div><div>[1] The following has an error<br></div><div><br></div><div> dpdx_region=dpdx(:,{latS:latN},{lonL:lonR})<br> <b>dpdx_region</b>=dpdy(:,{latS:latN},{lonL:lonR}) ; should be <b><span style="color:rgb(0,0,255)">dpdy_region</span> <=====</b><br> px2py2_region=px2py2(:,{latS:latN},{lonL:lonR})</div><div><br></div><div>[2] I don't see the need for your use of <a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/dim_num_n.shtml" target="_blank"><b>dim_num_n</b></a></div><div><br></div><div>[4] <a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/ind_resolve.shtml" target="_blank"><b>ind_resolve</b></a> is what you should use. Arrays must be made 1D. <br></div><div> **** LOOK AT THE EXAMPLES****<br></div><div><br></div><div> dpdx_region_1d = <b>ndtooned</b>(dpdx_region)</div><div> dpdy_region_1d = <b>ndtooned</b>(dpdy_region)</div><div> px2py2_region_1d = <b>ndtooned</b>(px2py2_region)</div><div><br></div><div>[5] It is *highly* unlikely that the derivatives will be exactly 0.0 but ....<br></div><div> <br></div><div> n_col = ind_resolve(ind(dpdx_region_1d.eq. 0) .and. ind(dpdy_region_1d .eq. 0) .and. ind(px2py2_region_1d.eq. 0) )</div><div><br></div><div> printVarSummary(n_col)<br></div><div> <br></div><div><br></div><div>I'll stop there!<br></div><div><br></div><div><br></div><div><br></div><div><br><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Apr 16, 2021 at 2:38 AM Lyndz via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid 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 dir="ltr"><div>Dear NCL-experts,</div><div><br></div><div><b>[1] Details</b></div><div>I have three variables dpdx, dpdy, and px2py2 with the following dimensions and sizes:</div><div><i><span style="color:rgb(0,0,0);font-family:Menlo;font-size:11px;font-variant-ligatures:no-common-ligatures">Dimensions and sizes:</span><span style="color:rgb(0,0,0);font-family:Menlo;font-size:11px;font-variant-ligatures:no-common-ligatures;white-space:pre-wrap"> </span><span style="color:rgb(0,0,0);font-family:Menlo;font-size:11px;font-variant-ligatures:no-common-ligatures">[time | 124] x [lat | 73] x [lon | 144]</span></i></div><div><font face="arial, sans-serif" color="#000000"><span style="font-variant-ligatures:no-common-ligatures">These variables were derived using spherical harmonics.</span></font></div><div><i><span style="color:rgb(0,0,0);font-family:Menlo;font-size:11px;font-variant-ligatures:no-common-ligatures"><br></span></i></div><div><font face="arial, sans-serif" color="#000000"><span style="font-variant-ligatures:no-common-ligatures"><b>[2] Problem and what I have done so far</b></span></font></div><div><font face="arial, sans-serif" color="#000000"><span style="font-variant-ligatures:no-common-ligatures"><b><br></b></span></font></div><div>(a) I want to get the dates when any gridpoint in a specified domain satisfies the following conditions: </div><div>dpdx = 0 <b>.and.</b> dpdy = 0 <b>.and. </b>px2py2 <b>.lt.</b> 0</div><div><br></div><div>(b) get the coordinates of these points, if possible. </div><div><br></div><div>I have the following lines in my script:</div><div><br></div><div>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><span style="font-size:11px"> </span><font size="1">latS = 5.0</font></span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><font size="1"><span> </span>latN = 30.0</font></span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><font size="1"><span> </span>lonL = 120.0</font></span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><font size="1"><span> </span>lonR = 160.0</font></span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><font size="1"><span> </span>dpdx_region=dpdx(:,{latS:latN},{lonL:lonR})</font></span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><font size="1"><span> </span>dpdx_region=dpdy(:,{latS:latN},{lonL:lonR})</font></span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><font size="1"><span> </span>px2py2_region=px2py2(:,{latS:latN},{lonL:lonR})</font></span></p></div><div><br></div><div>I am stuck here. I dont know what index I should use to get the dates and how to get their coordinates.</div><div><br></div><div>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"><font size="1"><font color="#000000"> </font><font color="#ff0000">dpdx_thres<span> </span>= dim_num_n((dpdx_region .eq. 0),(/1,2/))</font></font></span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"><font size="1" color="#ff0000"><span> </span>dpdy_thres<span> </span>= dim_num_n((dpdy_region .eq. 0),(/1,2/))</font></span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"><font size="1" color="#ff0000"><span> px2py2</span>_thres<span> </span>= dim_num_n((px2py2_region .lt. 0),(/1,2/))</font></span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"><font size="1" color="#ff0000"><span> </span>n_thres<span> </span>= ind(dpdx_thres .gt. 0 .and. dpdy_thres .gt. 0 .and. px2py2_thres .gt. 0 ) ;time indices but i'm not sure if this is correct!</font></span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo;color:rgb(0,0,0);min-height:13px"><font size="1"><span style="font-variant-ligatures:no-common-ligatures"></span><br></font></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><font size="1"><span> </span>print(n_thres)</font></span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><font size="1"><span> </span>print("=====")</font></span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo;color:rgb(0,0,0);min-height:13px"><font size="1"><span style="font-variant-ligatures:no-common-ligatures"></span><br></font></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><font size="1"><span> </span>if(ismissing(nt_thres(0))) then</font></span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><font size="1"><span> </span>print("++++++++++++++")</font></span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><font size="1"><span> </span>print(" NO values exceed threshold="+threshold)</font></span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><font size="1"><span> </span>print("++++++++++++++")</font></span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><font size="1"><span> </span>exit</font></span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><font size="1"><span> </span>end if</font></span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><font size="1"><br></font></span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><font size="1"><br></font></span></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"><span style="font-variant-ligatures:no-common-ligatures">I am attaching my script. </span></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)"><font face="arial, sans-serif"><span style="font-variant-ligatures:no-common-ligatures"><br></span></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)"><font face="arial, sans-serif"><span style="font-variant-ligatures:no-common-ligatures">I'll appreciate any help on this!</span></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)"><font face="arial, sans-serif"><span style="font-variant-ligatures:no-common-ligatures"><br></span></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)"><font face="arial, sans-serif"><span style="font-variant-ligatures:no-common-ligatures">Sincerely,</span></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)"><font face="arial, sans-serif"><span style="font-variant-ligatures:no-common-ligatures"><b><i>Lyndz</i></b></span></font></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><font size="1"><br></font></span></p></div></div></div></div></div></div></div></div></div></div></div></div></div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="https://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">https://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote></div>
</blockquote></div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="https://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">https://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote></div>