Re: avg of rainfall lying inside a basin boundary

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Tue Nov 22 2011 - 07:42:40 MST

See example 4 at:

http://www.ncl.ucar.edu/Applications/shapefiles.shtml

This shows you how to use gc_inout to traverse a lat/lon boundary and
determine whether your grid lat/lon values fall inside or outside of
this boundary.

You can use this information to set your corresponding data values to
missing outside the boundary.

--Mary

On Nov 21, 2011, at 9:15 PM, jagan TNAU wrote:

> Dear Mary,
>
> Is there any possibilities to make average of values of grid points
> that lies inside boundaries of region when using shapefiles.
>
> On Tue, Nov 22, 2011 at 12:51 AM, Mary Haley <haley@ucar.edu> wrote:
> Dear Abhishek,
>
> I tried to run your script, but it has some other data sets that you
> didn't provide: d1.nc, d2.nc
>
> I think you should be able to simply your code a bit by using
> wrf_user_ll_to_ij to get the indexes of the two corners of the
> basin, and then you can call "avg" on this subset of your data.
>
> For example, instead of the "where" calls and the "do" loop,
> something like this might work (UNTESTED):
>
> latMin = min(lm_lat);-20
> latMax = max(lm_lat) ;60
> lonMin = min(lm_lon);110
> lonMax = max(lm_lon);270
> . . .
>
> ll_min_ij = wrf_user_ll_to_ij(a, lonMin, latMin, res) - 1
> ll_max_ij = wrf_user_ll_to_ij(a, lonMax, latMax, res) - 1
>
> prc_avg =
> avg(prc(ll_min_ij(1):ll_max_ij(1),ll_min_ij(0):ll_max_ij(0)))
>
>
> --Mary
>
>
>
> On Nov 17, 2011, at 11:59 PM, Abhishek Gupta wrote:
>
> > i want to calculate avg of all values lying inside a basin
> boundary .I am little bit confuse for using where function. here I
> am attaching my ncl script & coordinate point of basin .
> boundary.plz help me
> >
> >
> > --
> > Abhishek Kumar Gupta,
> > Junior Research Fellow,
> > India Meteorological Department,
> > Lodi Road ,New Delhi-110003,
> > India
> >
> >
> <
> lm
> .dat
> ><mh_wrf.ncl><um.dat>_______________________________________________
> > ncl-talk mailing list
> > List instructions, subscriber options, unsubscribe:
> > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
>
> --
> With regards
>
> Dr.R.Jagannathan
> Professor of Agronomy,
> Department of Agronomy
> Tamil Nadu Agricultural University,
> Coimbatore - 641 003 India
>
> PHONE: Mob: +91 94438 89891
>
> DO NOT PRINT THIS E-MAIL UNLESS NECESSARY. THE ENVIRONMENT CONCERNS
> US ALL.

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Nov 22 07:42:47 2011

This archive was generated by hypermail 2.1.8 : Tue Nov 22 2011 - 14:17:52 MST