[ncl-talk] Problem with ind_resolve() and getting average around a gridpoint

Lyndz olagueralyndonmark429 at gmail.com
Tue Sep 21 11:04:01 MDT 2021


Dear NCL experts,

I would like to ask for help in applying the *ind_resolve()* in my ncl
script:

My sample data can be found here:
https://www.dropbox.com/sh/t88oab9txej73u1/AAAkDCcsTC3_eHg8uBc0vhtda?dl=0
-----------------------------------------------------------------------------------------------------
Here's my script so far:

;************************************************
; variable and file handling
;************************************************
  fvr  = addfile("vort_ndjf_2008.nc","r")       ; open netcdf file
  fwspd  = addfile("wspd_ndjf_2008.nc","r")

;**************************************************
;Extract over a region
;**************************************************
  latS = 12.5
  latN = 20.0
  lonL = 120.0
  lonR = 135.0

  vr_region=fvr->vr(:,{latS:latN},{lonL:lonR})     ;select subregion
  wspd_region=fwspd->wspd(:,{latS:latN},{lonL:lonR})

  if (num((vr_region .gt. 3e-5) .and. (wspd_region .ge. 5))) then
      x1D = ndtooned(vr_region)
      y1D = ndtooned(wspd_region)
   *   i1D = ind(x1D.gt.3e-5 .and. y1D.ge.5)*
*      i   = ind_resolve(i1D, dimsizes(vr_region) )*
      print(time(i(:,0)) +"  "+ lat(i(:,1)) +"  "+lon(i(:,2)) )
      delete(x1D)
      delete(i1D)
  end if
-------------------------------------------------------------------------------------
I would like to:

1. Get the lat lon (location) of the grids with vorticity >3e-5 AND wind
speed >= 5 5. I am getting an error fatal:Conditional statements (if and do
while) require SCALAR logical values, see all and any function, at the
ind_resolve() line. Any suggestions on how to fix this in NCL?

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 *excluding* these coordinates in the averaging?

I'll appreciate any help on this matter..

-Lyndz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210922/b7b8bc00/attachment.html>


More information about the ncl-talk mailing list