Project

General

Profile

« Previous | Next » 

Revision c1352601

Added by Adam Wilson about 11 years ago

Updated MOD35_Climatology to use percentages instead of classes, but there are too many zeros in result

View differences:

climate/procedures/MOD35_L2_process.r
182 182
## Process the gridded files to align exactly with MODLAND tile and produce a daily summary of multiple swaths
183 183
  
184 184
## Identify output file
185
  ncfile=paste(outdir,"/MOD35_",tile,"_",date,".nc",sep="")  #this is the 'final' daily output file
185
ncfile=paste(outdir,"/MOD35_",tile,"_",date,".nc",sep="")  #this is the 'final' daily output file
186 186

  
187 187
## function to convert binary to decimal to assist in identifying correct values
188 188
## this is helpful when defining QA handling below, but isn't used in processing
......
243 243
                CM_cloud_",i," =  if((CM1_",i," / 2^0) % 2==1,(CM1_",i," / 2^1) % 2^2,-9999)
244 244
                Pclear1_",i," = if(CM_cloud_",i,"==0,0,if(CM_cloud_",i,"==1,66,if(CM_cloud_",i,"==2,95,if(CM_cloud_",i,"==3,99,-9999))))
245 245
                Pclear_",i," = if(QA_useful_",i,"==1,Pclear1_",i,",-9999)
246
                CM_path_",i," =   ((CM1_",i," / 2^6) % 2^2) 
247 246
EOF",sep=""))
248 247

  
248
     #                CM_path_",i," =   ((CM1_",i," / 2^6) % 2^2) 
249

  
249 250
     execGRASS("r.null",map=paste("Pclear_",i,sep=""),setnull="-9999")
250 251
     execGRASS("r.null",map=paste("CM_cloud_",i,sep=""),setnull="-9999")
251 252
   
252 253
    
253 254
 } #end loop through sub daily files
254 255

  
255
#### Now generate daily averages (or maximum in case of cloud flag)
256
  
256
#### Now generate daily minimum p(clear)
257 257
  system(paste("r.mapcalc <<EOF
258 258
         Pclear_daily=int((min(",paste("if(isnull(Pclear_",1:nfs,"),9999,Pclear_",1:nfs,")",sep="",collapse=","),"))) 
259 259
EOF",sep=""))
260 260

  
261
#         CLD_daily=int((min(",paste("if(isnull(CM_cloud_",1:nfs,"),9999,CM_cloud_",1:nfs,")",sep="",collapse=","),"))) 
262 261

  
263 262
## reset null values
264
#execGRASS("r.null",map="CLD_daily",setnull="9999")
265 263
execGRASS("r.null",map="Pclear_daily",setnull="9999")
266 264

  
267 265

  
......
292 290
system(paste(ncopath,"ncks -A ",tempdir(),"/time.nc ",ncfile,sep=""))
293 291
## add other attributes
294 292
  system(paste(ncopath,"ncrename -v Band1,PClear ",ncfile,sep=""))
295
  system(paste(ncopath,"ncatted -a scale_factor,PClear,o,d,1 -a units,PClear,o,c,\"Probability (%)\" -a missing_value,PClear,o,d,255 -a long_name,PClear,o,c,\"Probability of Clear Sky\" ",ncfile,sep=""))
293
  system(paste(ncopath,"ncatted -a scale_factor,PClear,o,d,1 -a units,PClear,o,c,\"Probability (%)\" -a missing_value,PClear,o,d,255 -a _FillValue,PClear,o,d,255 -a long_name,PClear,o,c,\"Probability of Clear Sky\" ",ncfile,sep=""))
296 294

  
297 295
                                        #  system(paste(ncopath,"ncatted -a sourcecode,global,o,c,",script," ",ncfile,sep=""))
298 296
   

Also available in: Unified diff