Project

General

Profile

« Previous | Next » 

Revision 78f94710

Added by Adam Wilson over 11 years ago

Discovered possible cause of weird missing data stripes due to identifying missing data as 225.0 rather than 255s

View differences:

climate/procedures/MOD35_Climatology.r
86 86
" -a comment,global,o,c,\"Compiled by Adam M. Wilson (adam.wilson@yale.edu)\" ",
87 87
outdir2,"/MOD35_",tile,"_daily.nc",sep=""))
88 88

  
89
## report on daily file:
90
#ncfile=paste(outdir2,"/MOD35_",tile,"_daily.nc",sep="")
91
system(paste("ncdump -h ",outdir2,"/MOD35_",tile,"_daily.nc | head -20 ",sep=""))
92
system(paste("cdo showyear ",outdir2,"/MOD35_",tile,"_daily.nc",sep=""))
93
system(paste("cdo showmon ",outdir2,"/MOD35_",tile,"_daily.nc",sep=""))
94
#system(paste("cdo showdate ",outdir2,"/MOD35_",tile,"_daily.nc",sep=""))
95

  
96

  
89 97
### produce a monthly timeseries?
90 98
#system(paste("cdo -O monmean ",outdir2,"/MOD35_",tile,"_daily.nc ",tsdir,"/MOD35_",tile,"_monmean.nc",sep=""))
91 99

  
......
101 109

  
102 110
## Monthly means
103 111
if(verbose) print("Calculating the monthly means")
104
system(paste("cdo -O sorttimestamp -setyear,",myear," -setday,15 -mulc,-1 -subc,100 -ymonmean  ",outdir2,"/MOD35_",tile,"_daily.nc ",tsdir,"/MOD35_",tile,"_ymonmean.nc",sep=""),wait=T)
112
system(paste("cdo -O sorttimestamp -setyear,",myear," -setday,15 -mulc,-1 -subc,100 -ymonmean ",outdir2,"/MOD35_",tile,"_daily.nc ",tsdir,"/MOD35_",tile,"_ymonmean.nc",sep=""),wait=T)
105 113

  
106 114
#system(paste("cdo -v -O selindexbox,1,100,1100,1200 ",outdir2,"/MOD35_",tile,"_daily.nc ",tsdir,"/MOD35_",tile,"_dailysmall.nc",sep=""),wait=T)
107 115
#system(paste("cdo -v -O sorttimestamp -setyear,",myear," -setday,15 -mulc,-1 -subc,100 -ymonmean  ",outdir2,"/MOD35_",tile,"_dailysmall.nc ",tsdir,"/MOD35_",tile,"_ymonmean.nc",sep=""),wait=T)
108 116

  
109 117
system(paste("cdo -O sorttimestamp -setyear,",myear," -setday,15 -mulc,-1 -subc,100 -ymonmean  ",outdir2,"/MOD35_",tile,"_daily.nc ",tsdir,"/MOD35_",tile,"_ymonmean.nc",sep=""),wait=T)
110 118

  
111
system(paste("cdo -O sorttimestamp -setyear,",myear," -setday,15 -mulc,-1 -subc,100 -monmean ",datesubset," ",outdir2,"/MOD35_",tile,"_daily.nc ",tsdir,"/MOD35_",tile,"_monmean.nc",sep=""),wait=T)
119
system(paste("cdo -O sorttimestamp -setyear,",myear," -setday,15 -mulc,-1 -subc,100 -monmean   ",outdir2,"/MOD35_",tile,"_daily.nc ",tsdir,"/MOD35_",tile,"_monmean.nc",sep=""),wait=T)
112 120

  
113 121

  
114 122
system(paste("cdo -O sorttimestamp -setyear,",myear," -mulc,-1 -subc,100 -ydrunmean,30 ",datesubset," ",outdir2,"/MOD35_",tile,"_daily.nc ",tsdir,"/MOD35_",tile,"_ydrunmean30.nc",sep=""),wait=T)
......
135 143
" -a units,CF,o,c,\"Proportion (%)\" ",
136 144
tsdir,"/MOD35_",tile,"_ymoncld01.nc",sep=""))
137 145

  
138
## cld == 1
139
if(verbose) print("Calculating the proportion of uncertain days")
140
system(paste("cdo -O  sorttimestamp -setyear,",myear," -setday,15 -nint -mulc,100 -ymonmean  -mulc,1.0 -eqc,1 -selvar,CLD2 ",outdir2,"/MOD35_",tile,"_daily.nc ",tsdir,"/MOD35_",tile,"_ymoncld1.nc",sep=""))
141
system(paste(ncopath,"ncrename -v CLD2,CLD1 ",tsdir,"/MOD35_",tile,"_ymoncld1.nc",sep=""))
142
system(paste(ncopath,"ncatted ",
143
" -a long_name,CLD1,o,c,\"Proportion of Days with Cloud Mask == 1 (uncertain)\" ",
144
" -a units,CLD1,o,c,\"Proportion\" ",
145
tsdir,"/MOD35_",tile,"_ymoncld1.nc",sep=""))
146

  
147

  
148
## cld >= 2 (setting cld==01 to missing because 'uncertain')
149
if(verbose) print("Calculating the proportion of clear days")
150
system(paste("cdo -O  sorttimestamp -setyear,",myear," -setday,15 -nint -mulc,100 -ymonmean  -mulc,1.0 -gtc,1 -setctomiss,1 -selvar,CLD2 ",outdir2,"/MOD35_",tile,"_daily.nc ",tsdir,"/MOD35_",tile,"_ymoncld2.nc",sep=""))
151
system(paste(ncopath,"ncrename -v CLD2,CLD23 ",tsdir,"/MOD35_",tile,"_ymoncld2.nc",sep=""))
152
system(paste(ncopath,"ncatted ",
153
" -a long_name,CLD23,o,c,\"Proportion of Days with Cloud Mask >= 2 (Probably Clear or Certainly Clear)\" ",
154
" -a units,CLD23,o,c,\"Proportion\" ",
155
tsdir,"/MOD35_",tile,"_ymoncld2.nc",sep=""))
156

  
157
## cld >= 1
158
if(verbose) print("Calculating the proportion of clear days")
159
system(paste("cdo -O  sorttimestamp -setyear,",myear," -setday,15 -nint -mulc,100 -ymonmean  -mulc,1.0 -gec,1 -selvar,CLD2 ",outdir2,"/MOD35_",tile,"_daily.nc ",tsdir,"/MOD35_",tile,"_ymoncld13.nc",sep=""))
160
system(paste(ncopath,"ncrename -v CLD2,CLD13 ",tsdir,"/MOD35_",tile,"_ymoncld13.nc",sep=""))
161
system(paste(ncopath,"ncatted ",
162
" -a long_name,CLD13,o,c,\"Proportion of Days with Cloud Mask >= 1\" ",
163
" -a units,CLD13,o,c,\"Proportion\" ",
164
tsdir,"/MOD35_",tile,"_ymoncld13.nc",sep=""))
165

  
166 146
## number of observations
167 147
if(verbose) print("Calculating the number of missing variables")
168
system(paste("cdo -O sorttimestamp  -setyear,",myear," -setday,15 -nint -ymonmean -mulc,100  -eqc,9999 -setmisstoc,9999   -selvar,CLD ",outdir2,"/MOD35_",tile,"_daily.nc ",tsdir,"/MOD35_",tile,"_ymonmiss.nc",sep=""))
169
system(paste(ncopath,"ncrename -v PClear,CF_pmiss ",tsdir,"/MOD35_",tile,"_ymonmiss.nc",sep=""))
148
system(paste("cdo -O sorttimestamp  -setyear,",myear," -setday,15 -ymonmean -mulc,100  -eqc,9999 -setmisstoc,9999   -selvar,PClear ",outdir2,"/MOD35_",tile,"_daily.nc ",tsdir,"/MOD35_",tile,"_ymonmiss.nc",sep=""))
149
system(paste(ncopath,"ncrename -v PClear,Pmiss ",tsdir,"/MOD35_",tile,"_ymonmiss.nc",sep=""))
170 150
system(paste(ncopath,"ncatted ",
171
" -a long_name,CF_pmiss,o,c,\"Proportion of Days with missing data for CF\" ",
172
" -a units,CF_pmiss,o,c,\"Proportion (%)\" ",
173
tsdir,"/MOD35_",tile,"_ymonmiss.nc",sep=""))
151
             " -a long_name,Pmiss,o,c,\"Proportion of Days with missing data\" ",
152
             " -a units,Pmiss,o,c,\"Proportion (%)\" ",
153
             tsdir,"/MOD35_",tile,"_ymonmiss.nc",sep=""))
174 154

  
175 155
## TODO: fix projection information so GDAL can read it correctly.
176 156
## clean up variables?
......
179 159
if(verbose) print("Append all monthly climatologies into a single file")
180 160
system(paste(ncopath,"ncks -O ",tsdir,"/MOD35_",tile,"_ymonmean.nc  ",tsdir,"/MOD35_",tile,"_ymon.nc",sep=""))
181 161
system(paste(ncopath,"ncks -A ",tsdir,"/MOD35_",tile,"_ymonstd.nc  ",tsdir,"/MOD35_",tile,"_ymon.nc",sep=""))
182
system(paste(ncopath,"ncks -A ",tsdir,"/MOD35_",tile,"_ymoncld0.nc  ",tsdir,"/MOD35_",tile,"_ymon.nc",sep=""))
183 162
system(paste(ncopath,"ncks -A ",tsdir,"/MOD35_",tile,"_ymoncld01.nc  ",tsdir,"/MOD35_",tile,"_ymon.nc",sep=""))
184
system(paste(ncopath,"ncks -A ",tsdir,"/MOD35_",tile,"_ymoncld1.nc  ",tsdir,"/MOD35_",tile,"_ymon.nc",sep=""))
185
system(paste(ncopath,"ncks -A ",tsdir,"/MOD35_",tile,"_ymoncld2.nc  ",tsdir,"/MOD35_",tile,"_ymon.nc",sep=""))
186 163
system(paste(ncopath,"ncks -A ",tsdir,"/MOD35_",tile,"_ymonmiss.nc  ",tsdir,"/MOD35_",tile,"_ymon.nc",sep=""))
187 164

  
188 165
## append sinusoidal grid from one of input files as CDO doesn't transfer all attributes

Also available in: Unified diff