Revision b3344197
Added by Adam Wilson over 11 years ago
climate/procedures/MOD35_Climatology.r | ||
---|---|---|
10 | 10 |
'verbose','v',1,'logical' |
11 | 11 |
), ncol=4, byrow=TRUE)) |
12 | 12 |
|
13 |
tile=opta$tile #tile="h11v08"
|
|
13 |
tile=opta$tile #tile="h00v08"
|
|
14 | 14 |
verbose=opta$verbose #print out extensive information for debugging? |
15 | 15 |
|
16 | 16 |
## set working directory |
17 |
setwd("/u/awilso10/MOD35") |
|
17 |
setwd("/nobackupp1/awilso10/mod35") |
|
18 |
#setwd("/u/awilso10/MOD35") |
|
18 | 19 |
|
19 | 20 |
### directory containing daily files |
20 | 21 |
outdir=paste("daily/",tile,"/",sep="") #directory for separate daily files |
... | ... | |
68 | 69 |
#" -a missing_value,PClear,o,b,255 ", |
69 | 70 |
#" -a _FillValue,PClear,d,b,255 ", |
70 | 71 |
" -a units,time,o,c,\"days since 2000-1-1 0:0:0\" ", |
71 |
" -a title,global,o,c,\"MODIS Cloud Product (MOD35) Daily Timeseries\" ",
|
|
72 |
" -a title,global,o,c,\"MODIS Cloud Product (MOD35) Summaries\" ",
|
|
72 | 73 |
" -a institution,global,o,c,\"Yale University\" ", |
73 |
" -a source,global,o,c,\"MODIS Cloud Mask (MOD35)\" ", |
|
74 |
" -a source,global,o,c,\"MODIS Collection 6 Cloud Mask (MOD35)\" ",
|
|
74 | 75 |
" -a comment,global,o,c,\"Compiled by Adam M. Wilson (adam.wilson@yale.edu)\" ", |
75 | 76 |
outdir2,"/MOD35_",tile,"_daily.nc",sep="")) |
76 | 77 |
|
... | ... | |
91 | 92 |
|
92 | 93 |
myear=as.integer(max(fdly$year)) #this year will be used in all dates of monthly climatologies (and day will = 15) |
93 | 94 |
|
95 |
## Overall Means |
|
96 |
if(verbose) print(paste("Calculating the overall mean:",tile)) |
|
97 |
system(paste("cdo -O -b I8 -v sorttimestamp -setyear,",myear," -setmon,1 -setday,1 -mulc,-1 -subc,100 -timmean -selyear,2009 ",outdir2,"/MOD35_",tile,"_daily.nc ",outdir2,"/MOD35_",tile,"_2009mean.nc",sep=""),wait=T) |
|
98 |
system(paste(ncopath,"ncrename -v PClear,PCloud ",outdir2,"/MOD35_",tile,"_2009mean.nc",sep="")) |
|
99 |
system(paste(ncopath,"ncatted ", |
|
100 |
" -a long_name,PCloud,o,c,\"Mean Probability of Cloud\" ", |
|
101 |
" -a missing_value,PCloud,o,b,255 ", |
|
102 |
" -a _FillValue,PCloud,d,b,255 ", |
|
103 |
outdir2,"/MOD35_",tile,"_2009mean.nc",sep="")) |
|
104 |
|
|
94 | 105 |
## Monthly means |
95 | 106 |
if(verbose) print(paste("Calculating the monthly means:",tile)) |
96 | 107 |
system(paste("cdo -O -b I8 -v sorttimestamp -setyear,",myear," -setday,15 -mulc,-1 -subc,100 -ymonmean ",outdir2,"/MOD35_",tile,"_daily.nc ",tsdir,"/MOD35_",tile,"_ymonmean.nc",sep=""),wait=T) |
... | ... | |
110 | 121 |
#system(paste("scp summary/MOD35_",tile,".nc adamw@acrobates.eeb.yale.edu:/data/personal/adamw/projects/interp/data/modis/mod35/",sep="")) |
111 | 122 |
#system(paste("ncdump -h ",tsdir,"/MOD35_",tile,"_ymonmean.nc ",sep="")) |
112 | 123 |
|
113 |
|
|
114 | 124 |
## Monthly standard deviation |
115 | 125 |
if(verbose) print(paste("Calculating the monthly SD:",tile)) |
116 | 126 |
system(paste("cdo -O -b I8 sorttimestamp -setyear,",myear," -setday,15 -ymonstd -mulc,-1 -subc,100 -monmean ", |
Also available in: Unified diff
Move file outputs to /nobackupp1 instead of lou due to quota increase. First full 2009 summary