[ncl-talk] Getting the average around a gridpoint

Lyndz olagueralyndonmark429 at gmail.com
Wed Feb 2 20:48:45 MST 2022


Dear NCL experts,

I'm extracting the dates of gridpoints that satisfy two conditions:
vorticity > 3e-5 and winds >= 5. Below is my script

------------------------------------------------------------------------------------
;************************************************
; variable and file handling
;************************************************
  fvr  = addfile("../vort/vort_2012.nc","r")       ; open netcdf file
  fwspd  = addfile("../mag/mag_2012.850hPa.nc","r")

;**************************************************
;Extract over a region
;**************************************************
  latS = 5.0
  latN = 25.0
  lonL = 115.0
  lonR = 135.0

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

  time = vr_region&time
  lat  = vr_region&lat
  lon  = vr_region&lon

  if (num(vr_region .gt. 3e-5 .and. wspd_region .ge. 5) .gt. 0) 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) )
      TT = time(i(:,0))
      test = time(i(:,0)) +"  "+ lat(i(:,1)) +"  "+lon(i(:,2))
      delete(x1D)
      delete(i1D)
  end if
  print(test)
  asciiwrite("test.txt",test)
-------------------------------------------------------------------------------------------------

I would like to get the average vorticity and winds of "four" (north south
east west) gridpoints surrounding the gridpoints that I got from the script.

Then only get the dates of the gridpoints with vorticity > 3e-5 and winds
>= 5 and whose surrounding four gridpoints have average vorticity >3e-5 and
winds >=5.

I would like to ask for help on how to do this in NCL.

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/20220203/d5d38cf9/attachment.html>


More information about the ncl-talk mailing list