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-talkReceived on Mon Aug 13 2007 - 18:32:54 MDT
This archive was generated by hypermail 2.2.0 : Thu Aug 16 2007 - 09:43:43 MDT