Re: regional average

From: Saji Njarackalazhikam Hameed <saji_at_nyahnyahspammersnyahnyah>
Date: Tue, 14 Aug 2007 10:46:05 +0900

Oops! i realize i made yet another mistake..
Thanks Dennis for pointing out the right solution!
i must have gotten up on the wrong side!

saji
...

* Dennis Shea <shea_at_ucar.edu> [2007-08-13 19:37:30 -0600]:

> Another approach ...
>
>
> Let, q(time,lat,lon) and use coordinate subscripting.
>
>
>
> no weighting
>
> qAvg = wgt_areaave_Wrap(q(:,{lat1:lat2),{lon1:lon2}),1.0,1.0, 0)
>
> With cosine weighting
>
> wgt = lat
> wgt = cos(lat*0.01745329)
> qAvg = wgt_areaave_Wrap(q(:,{lat1:lat2),{lon1:lon2}) \
> ,wgty({lat1:lat2}),1.0, 0)
> printVarSummary(qAvg)
>
>
> http://www.ncl.ucar.edu/Document/Functions/Contributed/wgt_areaave_Wrap.shtml
>
>
>
>
> Saji Njarackalazhikam Hameed wrote:
>> Oops! step 2 should be like this:
>> lon1=150
>> lon2=220
>> lat1=30
>> lat2=40
>>> o
>>> data_time=dim_avg_Wrap(data({lat|lat1:lat2},{lon|lon1:lon2},time|:))
>> saji
>> ..
>> * Saji Njarackalazhikam Hameed <saji_at_apcc21.net> [2007-08-14 09:32:54
>> +0900]:
>>> Hi Chao,
>>>
>>> 1. Hope data has meta-information. If not :
>>> o describe your "data" first - maybe like this
>>> data!0="time"
>>> data!1="lat"
>>> data!2="lon"
>>> ntim=dimsizes(data(:,0,0)) data&time=ispan(1,ntim,1) ;
>>> should put more meaningful time info
>>> data&lat=lat
>>> data&lon=lon
>>>
>>> 2. Make a time series:
>>> o data_time=dim_avg_Wrap(data(lat|:,lon|:,time|:))
>>>
>>> 3. Too many loops make any scripting language run slow!
>>>
>>> Hope it helps,
>>>
>>> saji
>>>
>>> * cluo_at_uci.edu <cluo_at_uci.edu> [2007-08-13 17:07:05 -0700]:
>>>
>>>> Dear NCLers,
>>>>
>>>> I am trying to plot time series of regional average. I have three
>>>> dimensional data like data(ntim, nlat,nlon), and I want to do average
>>>> from
>>>> region 30-40N and 150E-140W. I use the script like:
>>>>
>>>> data_time = new ((/ntim/),typeof(data), getFillValue(data))
>>>> n = 0
>>>> do ilat = 0, nlat-1
>>>> do ilon = 0, mlon-1
>>>> if (lat(ilat).ge.30.and.lat(ilat).le.40.) then
>>>> if (lon(ilon).ge.150.and.lon(ilon).le.220.) then
>>>> if (.not.ismissing(data(:,ilat,ilon))) then
>>>> data_time(:) =data(:,ilat,ilon)
>>>> n = n + 1
>>>> end if
>>>> end if
>>>> end if
>>>> end do
>>>> end do
>>>> data_time(:) =data_time(:)/n
>>>>
>>>> This script runs too slow. I am wondering if there are some functions
>>>> can
>>>> be used to do regional average.
>>>>
>>>> Thanks for any information!
>>>>
>>>> Chao
>>>>
>>>> _______________________________________________
>>>> ncl-talk mailing list
>>>> ncl-talk_at_ucar.edu
>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>> --
>>> Saji N. Hameed
>>>
>>> APEC Climate Center +82 51 668 7470
>>> National Pension Corporation Busan Building 12F Yeonsan 2-dong,
>>> Yeonje-gu, BUSAN 611705 saji_at_apcc21.net
>>> KOREA
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
Saji N. Hameed
APEC Climate Center          				+82 51 668 7470
National Pension Corporation Busan Building 12F         
Yeonsan 2-dong, Yeonje-gu, BUSAN 611705			saji_at_apcc21.net
KOREA
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Aug 13 2007 - 19:46:05 MDT

This archive was generated by hypermail 2.2.0 : Thu Aug 16 2007 - 09:43:43 MDT