[ncl-talk] Deriving monthly mean from files of ten years data

najib.yusuf at carnasrda.com najib.yusuf at carnasrda.com
Fri Jun 16 08:00:39 MDT 2017



     Dear ncl experts,


     I am trying to derived monthly mean (for example all January, all 
February....all December) mean from 10 files (0-9) years of Julian date, 
so I can plot the mean on the bulk of the data. I tried but I got an 
error;




        ;  to derive the mean of the data
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   wkdir = "./"
   fil_dat  = "AOT_550"
; list all AOT files for different years
   files = systemfunc("ls " + wkdir +"AOT_550*.txt")
   print(files)

; read years (files)
   files10 = files(0:9)
   print(files10)
   f = addfiles(files10, "r")
AOT = addfiles_GetVar(f,files10,"AOT_550")
time = addfiles_GetVar(f,files10,"time")

; get date
t1=calendar_decode2(time,0)
; get day of year
printVarSummary(t1)
ndays = 365
doy = ndays
doy(9) = 365
  print(doy)

; read only  monthly mean (not sure?)
AOT_550_all12 = AOT_550_all12(0:11)
print(AOT_550_all12)

f = addfiles(files12, "r")
AOT = addfiles_GetVar(f,AOT_550_all12,"AOT_550_all")
time = addfiles_GetVar(f,AOT_550_all12,"time")
; get date
t1=calendar_decode2(time,0)
; get day of year
printVarSummary(t1)
doy=day_of_year(floattoint(t1(:,0)),floattoint(t1(:,1)),floattoint(t1(:,2)))
; move to mid-months
doy=doy-15
doy(11:9) = 365 ;
print(doy)
AOT_550_all12 = AOT

printVarSummary(AOT)


Fatal: No valid instance of variable AOT found in the file list….

    Please assist to put me through.

   Thank you for your time.


   Najib




More information about the ncl-talk mailing list