average cloud data

From: Luo, Chao <chao.luo_at_nyahnyahspammersnyahnyah>
Date: Fri Sep 27 2013 - 13:49:05 MDT

Hi,

I am working on MODIS cloud average using following script, the error always is :
fatal:(f) not reference to a valid file, at line 40. But file is read in by f = addfiles(fils(ii), "r"), and don't know what cause this problem.
Very appreciate your suggestions or help!

Thanks,

cl

here is a simple script I used:

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
;load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"

begin

lon_nbr = 406
lat_nbr = 270

fils = systemfunc("ls ../aqura/MYD06_L2.A2012061*hdf")
nfils = dimsizes(fils)
print("nfils="+nfils)
print("============")
print(fils)

; check how many files
nn = 0
do ii = 0,nfils-1
name= str_split(fils(ii), ".")
time = stringtoint(name(2))
if (time.ge.1100.and.time.le.2200) then
nn = nn + 1
end if
end do

; read in data
cf = new((/lon_nbr,lat_nbr,nn/),float)
avgcf = new((/lon_nbr,lat_nbr/),float)

nc = 0
do ii = 0,nfils-1
name= str_split(fils(ii), ".")
time = stringtoint(name(2))
if (time.ge.1100.and.time.le.2200) then
f = addfiles(fils(ii), "r")
cf(:,:,nc) =f->Cloud_Fraction(:,:)
nc = nc + 1
end if
end do

printVarSummary(cf)

avgcf = dim_avg(cf)

end

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Sep 27 13:49:20 2013

This archive was generated by hypermail 2.1.8 : Tue Oct 01 2013 - 14:41:43 MDT