Re: Area average

From: Kim <r4rid_at_nyahnyahspammersnyahnyah>
Date: Tue Mar 02 2010 - 20:25:15 MST

Dear Adam Phillips,
Thanks alot for your continued support. So for your convenience I’m also attaching the code and Fig, may be this will help you to understand the problem. In case of time vs lon (shown in Fig2) I only need the output indicated in Fig 1 and no need the other parts above and below. Because in Fig.2 there is a total output from lat(28:38.5) and lon (60:72) . I want to remove (no need area) as I mentioned in Fig.1, so that I can calculate the actual output of the parameters in time vs lon plot.
thanks again for your continued help,
kim
--- On Tue, 3/2/10, Adam Phillips <asphilli@ucar.edu> wrote:

From: Adam Phillips <asphilli@ucar.edu>
Subject: Re: Area average
To: "Kim" <r4rid@yahoo.com>
Cc: ncl-talk@ucar.edu
Date: Tuesday, March 2, 2010, 2:11 PM

Hi Kim,
I'm afraid I'm not clear as to what you are trying to accomplish. The
code you sent won't work for a few reasons:
1) This line: z3 = z0-(z1+z2) will result in an error as you are
subtracting/adding arrays of different sizes, specifically in the
longitude dimension.
2) As you are creating the z3 array from the equation on the other side
of the = sign, meta-data (coordinate variables, attributes) will not be
assigned to the z3 array. Thus, time = z3&time will result in a fatal
error.

You speak of area-averages (normally calculated via wgt_areaave, as I
wrote in my original email) but then you are using the dim_avg_Wrap
function, which will average only the rightmost dimension.

If you could provide a clearer explanation of what you wish to
accomplish that would prove helpful. This is just a guess: If you need
to take an area average of a region that isn't a box (defined by a
latitudinal range and a longitudinal range), then you can set certain
regions to @_FillValue. For instance, let's say you want to take the
area average from 10:20N, and 5:35E, but don't want to include the
region from 12:15N, and 10:20E... Then you can do something like this:
z0(:,{12:15},{10:20}) = z0@_FillValue
z0Area = wgt_areaave_Wrap(z0(:,{10:20},{5:35}),1.0,1.0,0)
Adam

On 03/02/2010 02:03 AM, Kim wrote:
> Dear Adam Phillips , thanks for your kind help. Particularly, in case of
> time vs long, I 'm feeling difficulty to remove the z1& z2 average area
> from the total average area (z0), so that I can calculate the actual
> area averaged, actually my required fig.is in the form of diagonal.
> However, I made some assumption but could not succeed, because the time
> is a problem. kindly have a look on the said assumption given below:
>
> f = addfile("olr.day.mean.nc","r")
>
> z = short2flt(f->olr(120:243,:,:))
>
> printVarSummary(z)
>
> z0 = dim_avg_Wrap(z(time|:,{lon|60:76},{lat|25:40}))
>
> z1 = dim_avg_Wrap(z(time|:,{lon|60:66},{lat|30:36}))
>
> z2 = dim_avg_Wrap(z(time|:,{lon|70:76},{lat|25:28}))
>
> z3 = z0-(z1+z2)
>
> printVarSummary(z3)
>
> time = z3&time
>
> =================
>
> =================
>
> plot = gsn_csm_hov(wks, z3(:,:) , res )
>
> end
> thanks again and regards,
> kim
> --- On *Mon, 3/1/10, Adam Phillips /<asphilli@ucar.edu>/* wrote:
>
>
>     From: Adam Phillips <asphilli@ucar.edu>
>     Subject: Re: Area average
>     To: "Kim" <r4rid@yahoo.com>
>     Cc: ncl-talk@ucar.edu
>     Date: Monday, March 1, 2010, 8:45 AM
>
>     Hi Kim,
>     I think the following code will do what you want:
>     z2 = z(:,{30:40},{60:72}) ; select specific region
>     delete(z)
>     printVarSummary(z2)
>     z2Area = wgt_areaave_Wrap(z2,1.0,1.0,0) ; create area-avg. timeseries
>     printVarSummary(z2Area)
>     z2_za = dim_avg_Wrap(z2) ; create time x lat array
>     z2_ma = dim_avg_Wrap(z2(time|:,lon|:,lat|:) ; create time x lon array
>     printVarSummary(z2_za)
>     printVarSummary(z2_ma)
>
>     printVarSummary is a wonderful tool that you can use to view the details
>     of an array. printVarSummary will show the metadata associated with an
>     array, as well as the range of the coordinate variables (if there are
>     any).
>
>     As you are area-averging, you should account for the difference in sizes
>     of the grid boxes as the meridians converge at the poles. You can do
>     this
>     by applying gaussian or cosine weights in the area-averaging
>     process. See
>     example 1 here:
>     http://www.ncl.ucar.edu/Document/Functions/Built-in/wgt_areaave.shtml
>
>     If you haven't done so already, I suggest you take a look at the NCL
>     Mini-Language Manual available here:
>     http://www.ncl.ucar.edu/Document/Manuals/
>
>     Good luck,
>     Adam
>
>
>      > Dear NCL users,
>      > I want to calculate only the map area averaged and remove the
>     area outside
>      > the map (sample Fig.attached). I don’t know how to calculate the
>      > required map area and remove the outside area?
>      > Furthermore, how does calculate time vs lon and time series plot
>     of only
>      > map area?
>      > Is it correct if I use this function?
>      > zArea = wgt_areaave_Wrap(z(:,{30:40},{60:72}),1.0,1.0,0)
>      > but how I confirm it is only map area averaged(as indicated in Fig)?
>      > Kindly, your guidance regarding this will be appreciated.
>      > Thanks in advance,
>      > kim
>      > Â
>      >
>      >
>      > _______________________________________________
>      > ncl-talk mailing list
>      > List instructions, subscriber options, unsubscribe:
>      > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>      >
>
>
>

-- 
__________________________________________________
Adam Phillips 
asphilli@ucar.edu
National Center for Atmospheric Research   tel: (303) 497-1726
Climate and Global Dynamics Division         fax: (303) 497-1333
P.O. Box 3000                
Boulder, CO 80307-3000    http://www.cgd.ucar.edu/cas/asphilli



_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Received on Tue Mar 2 20:25:22 2010

This archive was generated by hypermail 2.1.8 : Thu Mar 04 2010 - 15:07:06 MST