[ncl-talk] grid_area_avg

Kunal Bali kunal.bali9 at gmail.com
Wed Oct 11 12:03:23 MDT 2017


Dear NCL users,

Single point coordinates values of 23.0 N and 77.0 E is extracted or print
by using the script below

----------------------------------------------------------------------
; Main code
;----------------------------------------------------------------------
  dir    = "./"
  fnames = systemfunc("ls " + dir + "maiactaot*.nc")
print(fnames)
  a      = addfile(fnames,"r")
  data   = short2flt(a->Optical_Depth_055_grid1km)
  nFill  = num(ismissing(data))
  lat2d  = a->GridLat_grid1km
  lon2d  = a->GridLon_grid1km

;---grid points of interest
  latv = (/23.0/)
  lonv = (/77.0 /)

  nm = getind_latlon2d (lat2d,lon2d, latv, lonv)

  do k=0,dimsizes(latv)-1
     n = nm(k,0)
     m = nm(k,1)
     print(lat2d(n,m)+"   "+lon2d(n,m))   ; grid point location
     print("     "+data(:,n,m))                   ; nearest grid point at
all time steps
     print("-----")
  end do


NOW, I want to extract the square grid box of 100 km around the coordinates
(23N,77E) such as
   latv = (/22, 24.0, 24.0, 22.0, 22.0/)
   lonv = (/76, 76.0, 78.0, 78.0, 76.0 /)


after that I want to do the area mean of the grid box. So that I can get
one single point value of that grid box.
So when I replacing
  latv = (/23.0/)
  lonv = (/77.0/)

with

   latv = (/22, 24.0, 24.0, 22.0, 22.0/)
   lonv = (/76, 76.0, 78.0, 78.0, 76.0 /)

then It's not giving mean of the square grid box.

It shows the something like that (given below), which is incorrect. So
please let me know how can I get the square grid box mean and then extract
as asciiwrite or print?

(0)    23.76603307545667   75.53995171540016
(0)         0.179
(1)         0.142
(2)         -28672
(3)         0.169
(4)         -28672
(5)         -28672
(6)         -28672
(0)    -----
(0)    24.00322458681621   75.99551564353467
(0)         0.171
(1)         0.16
(2)         -28672
(3)         0.17
(4)         -28672
(5)         -28672
(6)         -28672

etc..etc..



regards
Kunal Bali
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171011/f4ef6189/attachment.html>


More information about the ncl-talk mailing list