debasish_at_gi.alaska.edu wrote:
> Hello,
>
> I have 10 years of monthly data (120 files) of precipitation (time, lat, lon).
> Each file contains 6 hourly data.
> For example,
> For January, time dimension is 124 (31X4)
> For February, time dimension is 112 (28X4)
> For March, time dimension is 124 (31X4)
> For April, time dimension is 120 (30X4)
> And so on
> I want to add all these files and creat an array of preciptation
> (year, month, lat, lon) where year=10 and month=12. How do I add those
> file?
>
> Any help would be appreciated
>
===========================
One approach
[1] Use "addfiles" to read the precipitation and time variables
prc6 = f[:]->precip ; 6hrly
[2] Manipulate 'date'
time = prc6&time
date = ut_calendar(time,-3) ; yyyymmddhh
year = date/1000000 ; [*]
mdh = date-(year*1000000) ; mmddhh
mm = mdh/10000 ; [*]
;print(year+" "+mm)
YRSTRT = ....
YRLAST = ....
NYRS = YRLAST-YRSTRT+!
YEAR = ispan(YRSTRT,YRLAST,1) ; [*] unique years
;print(YEAR)
dimp6 = dimsizes(prc6)
ntim = dimp6(0)
nlat = dimp6(1)
mlon = dimp6(2)
NMOS = 12
NTIM = NMOS*NYRS
;print("NTIM="+NTIM+" NYRS="+NYRS)
PRC = new (/ NTIM,nlat,mlon/), typeof(prc6), getFillValue(prc6) ) ; conventional
;PRC = new (/ NYRS,NMOS,nlat,mlon/), typeof(prc6), getFillValue(prc6) )
nt = -1
do nyr=0,NYRS-1
do nmo=0,NMOS-1
NMO = nmo+1
itim = ind(year.eq.YEAR(nyr) .and. mm.eq.NMO)
nt = nt+1
;PRC(nt,:,:) = dim_sum(prc6(lat|:,lon|:,time|itim))
PRC(nyr,nmo,:,:) = dim_sum(prc6(lat|:,lon|:,time|itim))
delete(itim) ; may change size for the next iteration
end do
end do
-- ====================================================== Dennis J. Shea tel: 303-497-1361 | P.O. Box 3000 fax: 303-497-1333 | Climate Analysis Section | Climate & Global Dynamics Div. | National Center for Atmospheric Research | Boulder, CO 80307 | USA email: shea 'at' ucar.edu | ====================================================== _______________________________________________ ncl-talk mailing list List instructions, subscriber options, unsubscribe: http://mailman.ucar.edu/mailman/listinfo/ncl-talkReceived on Mon Jun 01 2009 - 11:24:31 MDT
This archive was generated by hypermail 2.2.0 : Wed Jun 03 2009 - 12:52:48 MDT