Project

General

Profile

« Previous | Next » 

Revision 8374dddd

Added by Benoit Parmentier over 8 years ago

mosaicing script shell script for job, modifications and clean up with comments

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/10/2016            
8
#MODIFIED ON: 04/11/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
......
60 60
  #8) metric_name: metric or columns to use for additional mosaicing: "rmse" #RMSE, MAE etc. #PARAM 8
61 61
  #9) pred_mod_name : model name used e.g. "mod1" #PARAM 9
62 62
  #10) var_pred : variable for use in residuals mapping (e.g. "res_mod1") #PARAM 10
63
  #11) create_out_dir_param: if TRUE then create a new dir #PARAM 11
64
  #12) day_to_mosaic_range: start and end date for daily mosaics, if NULL then mosaic all days of the year #PARAM 12
65
  #13) proj_str :porjection used by tiles e.g. CRS_WGS84 #PARAM 13
66
  #14) file_format: output file format used for raster eg ".tif" #PARAM 14
67
  #15) NA_value: NA value used e.g. -9999 #PARAM 15
68
  #16) num_cores: number of cores #PARAM 16                 
69
  #17) region_names: selected region names e.g. reg4 #PARAM 17 
70
  #18) use_autokrige: use_autokrige if FALSE use kriging from Fields package #PARAM 18
71
  #19) infile_mask: input file mask used for the region under process #PARAM 19
72
  #20) tb_accuracy_name: daily accuracy from testing/validation stations by tiles #PARAM 20
73
  #21) data_month_s_name: training stations for climatology time steps  #PARAM 21
74
  #22) data_day_v_name:  testing stations for daily predictions combined #PARAM 22
75
  #23) data_day_s_name: training stations for daily predictions cominbed #PARAM 23
76
  #24) df_tile_processed_name: processed tiles from the accuracy assessment ##PARAM 24
77
  #25) mosaic_python: python script used in the mosoicing (gdalmerge script from Alberto Guzmann) #PARAM 25
78
  #26) python_bin: directory for general python "/usr/bin" #PARAM 26
79
  #27) algorithm: python or R, if R use mosaic function for R, if python use modified gdal merge, PARAM 27
80
  #28) match_extent : if "FALSE" try without matching geographic extent #PARAM 28 
81
  #29) list_models : if NULL use y~1 formula #PARAM 29
82
  #30) layers_option: mosaic to create as a layer from var_pred (e.g. TMax), res_training, res_testing, ac_testing
83
  #31) tmp_files: if TRUE keep temporary files generated during mosaicing
63
  #11) out_dir: output directory #PARAM 11
64
  #12) create_out_dir_param: if TRUE then create a new dir #PARAM 12
65
  #13) day_to_mosaic_range: start and end date for daily mosaics, if NULL then mosaic all days of the year #PARAM 12
66
  #14) year_predicted: year of the prediction being mosaiced (process is done by year)
67
  #15) proj_str :porjection used by tiles e.g. CRS_WGS84 #PARAM 13
68
  #16) file_format: output file format used for raster eg ".tif" #PARAM 14
69
  #17) NA_value: NA value used e.g. -9999 #PARAM 15
70
  #18) num_cores: number of cores #PARAM 16                 
71
  #19) use_autokrige: use_autokrige if FALSE use kriging from Fields package #PARAM 18
72
  #20) infile_mask: input file mask used for the region under process #PARAM 19
73
  #21) tb_accuracy_name: daily accuracy from testing/validation stations by tiles #PARAM 20
74
  #22) data_month_s_name: training stations for climatology time steps  #PARAM 21
75
  #23) data_day_v_name:  testing stations for daily predictions combined #PARAM 22
76
  #24) data_day_s_name: training stations for daily predictions cominbed #PARAM 23
77
  #25) df_tile_processed_name: processed tiles from the accuracy assessment ##PARAM 24
78
  #26) mosaic_python: python script used in the mosoicing (gdalmerge script from Alberto Guzmann) #PARAM 25
79
  #27) python_bin: directory for general python "/usr/bin" #PARAM 26
80
  #28) algorithm: python or R, if R use mosaic function for R, if python use modified gdal merge, PARAM 27
81
  #29) match_extent : if "FALSE" try without matching geographic extent #PARAM 28 
82
  #30) list_models : if NULL use y~1 formula #PARAM 29
83
  #31) layers_option: mosaic to create as a layer from var_pred (e.g. TMax), res_training, res_testing, ac_testing
84
  #32) tmp_files: if TRUE keep temporary files generated during mosaicing
84 85
  
85 86
  ###OUTPUT
86 87
  # 
......
127 128
  metric_name <- list_param_run_mosaicing_prediction$metric_name # "rmse" #RMSE, MAE etc. #PARAM 8
128 129
  pred_mod_name <- list_param_run_mosaicing_prediction$pred_mod_name #"mod1" #PARAM 9
129 130
  var_pred <- list_param_run_mosaicing_prediction$var_pred # "res_mod1" #used in residuals mapping #PARAM 10
131
  out_dir <- list_param_run_mosaicing_prediction$out_dir #PARAM 11
130 132
  create_out_dir_param <- list_param_run_mosaicing_prediction$create_out_dir_param # FALSE #PARAM 12
131 133
  
132 134
  #if daily mosaics NULL then mosaicas all days of the year #PARAM 13
133 135
  day_to_mosaic_range <- list_param_run_mosaicing_prediction$day_to_mosaic_range # c("19920101","19920102","19920103") #,"19920104","19920105") #PARAM9, two dates note in /tiles for now on NEX
134
  
136
  year_processed <- list_param_run_mosaicing_prediction$year_predicted
135 137
  #CRS_WGS84 <- CRS("+proj=longlat +ellps=WGS84 +datum=WGS84 +towgs84=0,0,0") #Station coords WGS84 #CONSTANT1
136 138
  #CRS_locs_WGS84<-CRS("+proj=longlat +ellps=WGS84 +datum=WGS84 +towgs84=0,0,0") #Station coords WGS84
137 139
  proj_str <- list_param_run_mosaicing_prediction$proj_str# CRS_WGS84 #PARAM 8 #check this parameter
......
552 554
  #list of mosaiced files: get the list of files now to include in the output object!!
553 555
  mosaicing_prediction_obj <- list(list_mosaic_obj,layers_option) #debugged
554 556
  names(mosaicing_prediction_obj) <- c("list_mosaic_obj","layers_option")
555
  return(run_mosaicing_prediction_obj)
556
  
557
  fname_mosaicing_prediction_obj <- file.path(out_dir,paste("mosaicing_prediction_obj_",out_suffix_str,".RData",sep=""))
558
  save(mosaicing_prediction_obj,file= fname_mosaicing_prediction_obj)
559

  
560
  return(mosaicing_prediction_obj)
557 561
}
558 562

  
559 563
###############

Also available in: Unified diff