Project

General

Profile

« Previous | Next » 

Revision d6efbe11

Added by Benoit Parmentier over 8 years ago

listing of files using glob and minor clean up to mosaicing function script

View differences:

climate/research/oregon/interpolation/global_run_scalingup_mosaicing.R
5 5
#Analyses, figures, tables and data are also produced in the script.
6 6
#AUTHOR: Benoit Parmentier 
7 7
#CREATED ON: 04/14/2015  
8
#MODIFIED ON: 04/20/2016            
8
#MODIFIED ON: 04/22/2016            
9 9
#Version: 6
10 10
#PROJECT: Environmental Layers project     
11 11
#COMMENTS: analyses run for reg4 1991 for test of mosaicing using 1500x4500km and other tiles
......
250 250
  #lf_mosaic <- lapply(1:length(day_to_mosaic),FUN=function(i){list.files(path=file.path(in_dir_tiles_tmp),    
251 251
  #                                                                                  pattern=paste("gam_CAI_dailyTmax_predicted_",pred_mod_name,".*.",day_to_mosaic[i],".*.tif$",sep=""),full.names=T,recursive=F)})
252 252
  #Using changes from Alberto
253
  lf_mosaic <- lapply(1:length(day_to_mosaic),FUN=function(i){
253
  #lf_mosaic <- lapply(1:length(day_to_mosaic),FUN=function(i){
254
  #  searchStr = paste(in_dir_tiles_tmp,"/*/",year_processed,"/gam_CAI_dailyTmax_predicted_",pred_mod_name,"*",day_to_mosaic[i],"*.tif",sep="")
255
  #  #print(searchStr)
256
  #  Sys.glob(searchStr)})
257
  # Making listing of files faster with multicores use
258
  lf_mosaic <- mclapply(1:length(day_to_mosaic),FUN=function(i){
254 259
    searchStr = paste(in_dir_tiles_tmp,"/*/",year_processed,"/gam_CAI_dailyTmax_predicted_",pred_mod_name,"*",day_to_mosaic[i],"*.tif",sep="")
255
    #print(searchStr)
256
    Sys.glob(searchStr)})
257
  
258
  browser()
260
    Sys.glob(searchStr)},mc.preschedule=FALSE,mc.cores = num_cores)
261
  #browser()
259 262
  
260 263
  #########################################################################
261 264
  ##################### PART 2: produce the mosaic ##################
......
458 461
    
459 462
    if(layers_option=="var_pred"){
460 463
      
461
      mosaic_method <- "use_edge_weights" #this is distance from edge
464
      #mosaic_method <- "use_edge_weights" #this is distance from edge
465
      mosaic_method <- mosaicing_method
462 466
      out_suffix_tmp <- paste(interpolation_method,y_var_name,day_to_mosaic[i],out_suffix,sep="_")
463 467
      #debug(mosaicFiles)
464 468
      #can also loop through methods!!!

Also available in: Unified diff