Project

General

Profile

« Previous | Next » 

Revision 0dd27bee

Added by Benoit Parmentier over 8 years ago

running debug for Africa with slight clean up of function script for mosaicing

View differences:

climate/research/oregon/interpolation/global_run_scalingup_mosaicing_function.R
4 4
#Different options to explore mosaicing are tested. This script only contains functions.
5 5
#AUTHOR: Benoit Parmentier 
6 6
#CREATED ON: 04/14/2015  
7
#MODIFIED ON: 06/23/2016            
7
#MODIFIED ON: 07/05/2016            
8 8
#Version: 2
9 9
#PROJECT: Environmental Layers project     
10
#COMMENTS: first commit of function script to test mosaicing using 1500x4500km and other tiles
10
#COMMENTS: Bug solved for reg5, problem in matching rmse val and number of files in predictions by tiles
11 11
#TODO:
12 12
#1) Make this is a script/function callable from the shell/bash
13 13
#2) Improve performance: there will be a need to improve efficiency for the workflow.
......
711 711
      out_mosaic_name_weights_m  <- file.path(out_dir_str,paste("r_weights_sum_m_",mosaic_method,"_weighted_mean_",out_suffix_str_tmp,".tif",sep=""))
712 712
      out_mosaic_name_prod_weights_m <- file.path(out_dir_str,paste("r_prod_weights_sum_m_",mosaic_method,"_weighted_mean_",out_suffix_str_tmp,".tif",sep=""))
713 713

  
714
      #in_file_to_mosaics <- filename_list_mosaics        
715
      #in_dir_mosaics <- file.path(in_dir1,region_names[i])
716
      #out_dir_mosaics <- "/nobackupp6/aguzman4/climateLayers/output1000x3000_km/reg5/mosaicsMean"
717
      #Can be changed to have mosaics in different dir..
718
      #out_dir_mosaics <- out_dir
719
      #prefix_str <- "reg4_1500x4500"
720
      #tile_size <- basename(dirname(in_dir[[i]]))
721
      #tile_size <- basename(in_dir1)
722

  
723
      #prefix_str <- paste(region_names[i],"_",tile_size,sep="")
724 714
      #mod_str <- "mod1" #use mod2 which corresponds to model with LST and elev
725 715
      #out_mosaic_name <- paste(region,"_mosaics_",mod_str,"_",tile_size,"_",day_to_mosaic[i],"_",out_prefix,".tif",sep="")
726 716
      
......
731 721
      #browser()
732 722
      #python /nobackupp6/aguzman4/climateLayers/sharedCode/gdal_merge_sum.py 
733 723
      #--config GDAL_CACHEMAX=1500 --overwrite=TRUE -o  outputname.tif --optfile input.txt
734
      #r_weights_sum_raster_name <- mosaic_python_merge(module_path=mosaic_python,
735
      #                                                 module_name="gdal_merge_sum.py",
736
      #                                                 input_file=filename_list_mosaics_weights_m,
737
      #                                                 out_mosaic_name=out_mosaic_name_weights_m)
738
      #mosaic_python_merge <- function(NA_flag_val,module_path,module_name,input_file,out_mosaic_name){
739 724
      mosaic_weights_obj <- mosaic_python_merge(NA_flag_val=NA_flag_val,
740 725
                                                module_path=mosaic_python,
741 726
                                                module_name="gdal_merge_sum.py",
......
774 759
      names(list_param_raster_match) <- c("lf_files","rast_ref","file_format","python_bin","out_suffix","out_dir_str")
775 760

  
776 761
      #undebug(raster_match)
777
      #r_test <- raster_match(1,list_param_raster_match)
778 762
      #r_test <- raster(raster_match(1,list_param_raster_match))
779 763

  
780 764
      list_weights_m <- mclapply(1:length(lf_files),FUN=raster_match,list_param=list_param_raster_match,mc.preschedule=FALSE,mc.cores = num_cores)                           
......
1638 1622
  
1639 1623
  ###This can be a new function here with mclapply!!!
1640 1624
  ## Addtional loop...
1641
  #j <- 1 #loops across tiles from set of files/tiles
1642 1625

  
1626
  #Makes sure both list have the same number of element, this is done beforehand
1643 1627
  lf <- df_raster_pred_tiles$files
1644 1628
  
1645 1629
  ##Make this loop a function later on, testing right now

Also available in: Unified diff