<div dir="ltr"><div>It looks like the error is occurring at the <b>if (num())</b> statement, not the <b>ind_resolve</b> statement.  You have <b>if (num (...))</b>, but I think you meant to say <b>if (num (...) .gt. 0)</b>.  Without this change, you are sending an integer to the if statement.  If requires a logical.</div><div><br></div><div>Otherwise it looks like you are applying <b>ind_resolve</b> correctly for this purpose.</div><div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Sep 21, 2021 at 11:05 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-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 dir="ltr"><div>Dear NCL experts,</div><div><br></div><div>I would like to ask for help in applying the <b>ind_resolve()</b> in my ncl script:</div><div><br></div><div>My sample data can be found here:</div><div><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><br></div><div>-----------------------------------------------------------------------------------------------------</div><div>Here's my script so far:</div><div><br></div><div><font color="#0000ff">;************************************************</font><br><font color="#0000ff">; variable and file handling</font><br><font color="#0000ff">;************************************************</font><br><font color="#0000ff">  fvr  = addfile("<a href="http://vort_ndjf_2008.nc" target="_blank">vort_ndjf_2008.nc</a>","r")       ; open netcdf file</font><br><font color="#0000ff">  fwspd  = addfile("<a href="http://wspd_ndjf_2008.nc" target="_blank">wspd_ndjf_2008.nc</a>","r")</font><br><br><font color="#0000ff">;**************************************************</font><br><font color="#0000ff">;Extract over a region</font><br><font color="#0000ff">;**************************************************</font><br><font color="#0000ff">  latS = 12.5</font><br><font color="#0000ff">  latN = 20.0</font><br><font color="#0000ff">  lonL = 120.0</font><br><font color="#0000ff">  lonR = 135.0</font><br><br><font color="#0000ff">  vr_region=fvr->vr(:,{latS:latN},{lonL:lonR})     ;select subregion</font><br><font color="#0000ff">  wspd_region=fwspd->wspd(:,{latS:latN},{lonL:lonR})</font><br><br><font color="#0000ff">  if (num((vr_region .gt. 3e-5) .and. (wspd_region .ge. 5))) then</font><br><font color="#0000ff">      x1D = ndtooned(vr_region)</font><br><font color="#0000ff">      y1D = ndtooned(wspd_region)</font><br><font color="#0000ff">   </font><b><font color="#ff0000">   i1D = ind(x1D.gt.3e-5 .and. y1D.ge.5)</font></b><br><font color="#ff0000"><b>      i   = ind_resolve(i1D, dimsizes(vr_region) )</b></font><br><font color="#0000ff">      print(time(i(:,0)) +"  "+ lat(i(:,1)) +"  "+lon(i(:,2)) )</font><br><font color="#0000ff">      delete(x1D)</font><br><font color="#0000ff">      delete(i1D)</font><br><font color="#0000ff">  end if</font></div><div>-------------------------------------------------------------------------------------</div><div>I would like to:</div><div><br></div><div>1. Get the lat lon (location) of the grids with vorticity >3e-5 AND wind speed >= 5 5. I am getting an error <font color="#ff0000">fatal:Conditional statements (if and do while) require SCALAR logical values, see all and any function, </font><font color="#000000">at the ind_resolve() line. Any suggestions on how to fix this in NCL?</font></div><div><font color="#000000"><br></font></div><div><font color="#000000">2. The output of the above script should be a list of coordinates. How can I get the average of the gridpoints around (4 gridpoints) these coordinates per time step, while <b>excluding</b> these coordinates in the averaging?</font></div><div><font color="#000000"><br></font></div><div><font color="#000000">I'll appreciate any help on this matter..</font></div><div><font color="#000000"><br></font></div><div><font color="#000000">-Lyndz</font></div></div></div></div></div></div></div></div></div></div></div></div></div></blockquote></div></div>