[ncl-talk] grid_area_avg
Kunal Bali
kunal.bali9 at gmail.com
Thu Oct 12 13:19:54 MDT 2017
Dear Haley Ma'am,
Thanks for providing the information and example.
But if I follow the getind_latlon2d function as I did, then it seems like I
followed the same procedure as given in the example
http://www.ncl.ucar.edu/Document/Functions/Contributed/getind_latlon2d.shtml
But still I am not getting the mean of the grid box on every time step or
am I reading incorrectly the result ?
regards
Kunal Bali
On Fri, Oct 13, 2017 at 12:11 AM, Mary Haley <haley at ucar.edu> wrote:
> Kunal,
>
> I created an example for you, showing three ways you can subset a WRF grid
> (since I already had a similar example). It shows how to use the
> getind_latlon2d function.
>
> You have to be careful with subsetting curvilinear data, because
> specifying a lat/lon box to take an average over can mean two different
> things. You will be able to see the difference when you look at the graphic.
>
> See example wrf_gsn_10.ncl at:
>
> http://www.ncl.ucar.edu/Applications/wrfgsn.shtml#ex10
>
> --Mary
>
>
>
> On Wed, Oct 11, 2017 at 12:03 PM, Kunal Bali <kunal.bali9 at gmail.com>
> wrote:
>
>> 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
>>
>>
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171013/8871c052/attachment.html>
More information about the ncl-talk
mailing list