Revision 2a793f82
Added by Benoit Parmentier almost 9 years ago
climate/research/oregon/interpolation/master_script_stage_8.R | ||
---|---|---|
10 | 10 |
#STAGE 5: Output analyses: assessment of results for specific dates... (tile based) |
11 | 11 |
#STAGE 6: Assessement of predictions by tiles and region: summary tables and figures |
12 | 12 |
#STAGE 7: Mosaicing of predictions and accuracy layer productions |
13 |
#STAGE 8: Comparison of predictions across regions and years with figure generation. |
|
13 |
#STAGE 8: Comparison of predictions across regions and years with figures generation.
|
|
14 | 14 |
#AUTHOR: Benoit Parmentier |
15 | 15 |
#CREATED ON: 12/29/2015 |
16 |
#MODIFIED ON: 02/08/2016
|
|
16 |
#MODIFIED ON: 02/09/2016
|
|
17 | 17 |
#PROJECT: NCEAS-IPLANT-NASA: Environment Layers |
18 | 18 |
|
19 | 19 |
#First source these files: |
... | ... | |
105 | 105 |
|
106 | 106 |
#CALLED FROM MASTER SCRIPT: |
107 | 107 |
|
108 |
script_path <- "/nobackupp8/bparmen1/env_layers_scripts" #path to script |
|
108 |
#script_path <- "/nobackupp8/bparmen1/env_layers_scripts" #path to script
|
|
109 | 109 |
script_path <- "/home/parmentier/Data/IPLANT_project/env_layers_scripts" |
110 | 110 |
function_assessment_part1_functions <- "global_run_scalingup_assessment_part1_functions_02112015.R" #PARAM12 |
111 | 111 |
function_assessment_part1a <-"global_run_scalingup_assessment_part1a_01042016.R" |
112 | 112 |
function_assessment_part2 <- "global_run_scalingup_assessment_part2_02072016.R" |
113 | 113 |
function_assessment_part2_functions <- "global_run_scalingup_assessment_part2_functions_01032016.R" |
114 |
function_assessment_part3 <- "global_run_scalingup_assessment_part3_02082016.R"
|
|
114 |
function_assessment_part3 <- "global_run_scalingup_assessment_part3_02092016.R"
|
|
115 | 115 |
source(file.path(script_path,function_assessment_part1_functions)) #source all functions used in this script |
116 | 116 |
source(file.path(script_path,function_assessment_part1a)) #source all functions used in this script |
117 | 117 |
source(file.path(script_path,function_assessment_part2)) #source all functions used in this script |
... | ... | |
148 | 148 |
#master directory containing the definition of tile size and tiles predicted |
149 | 149 |
#in_dir1 <- "/nobackupp6/aguzman4/climateLayers/out/" #param 5, arg 2 |
150 | 150 |
in_dir <- args[2] #param 5, arg 2 |
151 |
in_dir <- "/data/project/layers/commons/NEX_data/reg4_assessment"
|
|
151 |
in_dir <- "/data/project/layers/commons/NEX_data/reg5_assessment"
|
|
152 | 152 |
|
153 | 153 |
#in_dir <- "" #PARAM 0 |
154 | 154 |
#y_var_name <- "dailyTmax" #PARAM1 |
... | ... | |
158 | 158 |
#region_names <- c("reg23","reg4") #selected region names, |
159 | 159 |
#run assessment by region, this is a unique region only |
160 | 160 |
region_name <- args[3] #param 6, arg 3 |
161 |
region_name <- c("reg4") #param 6, arg 3
|
|
161 |
region_name <- c("reg5") #param 6, arg 3
|
|
162 | 162 |
|
163 | 163 |
#out_prefix <- "run_global_analyses_pred_12282015" #param 7, arg 4 |
164 | 164 |
#out_dir <- "/nobackupp8/bparmen1/" #param 8, arg 5 |
165 | 165 |
#out_dir <-paste(out_dir,"_",out_prefix,sep="") |
166 | 166 |
create_out_dir_param <- TRUE #param 9, arg 6 |
167 | 167 |
out_prefix <- args[4] #param 7, arg 4 |
168 |
out_suffix <- args[4] #param 7, arg 4s |
|
169 |
out_suffix <- "global_analyses_overall_assessment_reg4_02072016" |
|
168 |
out_suffix <- "global_analyses_overall_assessment_reg5_02092016" |
|
170 | 169 |
|
171 | 170 |
out_dir <- args[5] #param 8, arg 5 |
172 |
out_dir <- "/data/project/layers/commons/NEX_data/reg4_assessment"
|
|
171 |
out_dir <- "/data/project/layers/commons/NEX_data/reg5_assessment"
|
|
173 | 172 |
|
174 | 173 |
#out_dir <-paste(out_dir,"_",out_prefix,sep="") |
175 | 174 |
create_out_dir_param <- args[6] #param 9, arg 6 |
... | ... | |
203 | 202 |
max_mem <- args[9] #param 21 |
204 | 203 |
max_mem <- 1e+07 |
205 | 204 |
#in_dir_list_filename <- args[10] #param 22 |
206 |
in_dir_list_filename <- "/data/project/layers/commons/NEX_data/reg4_assessment/stage6_reg4_in_dir_list_02072016.txt"
|
|
205 |
in_dir_list_filename <- "/data/project/layers/commons/NEX_data/reg5_assessment/stage6_reg5_in_dir_list_02092016.txt"
|
|
207 | 206 |
#in_dir_list_filename <- "/data/project/layers/commons/NEX_data/reg4_assessment/stage6_reg4_in_dir_list_02072016.txt" |
208 | 207 |
run_figure_by_year <- args[11] # param 10, arg 7, if true will create figures for individual years... |
209 | 208 |
run_figure_by_year <- TRUE # param 10, arg 7, if true will create figures for individual years... |
... | ... | |
212 | 211 |
proj_str <- CRS_interp |
213 | 212 |
list_in_dir <- as.list(read.table(in_dir_list_filename,stringsAsFactors=F)[,1]) |
214 | 213 |
|
214 |
#removed df_assessment_file_names from parameters, note the difference compared to part2 |
|
215 | 215 |
list_param_run_assessment_combined_region_plotting_prediction <-list( |
216 | 216 |
in_dir_list_filename, |
217 | 217 |
in_dir,y_var_name, interpolation_method, out_suffix, |
218 | 218 |
out_dir, create_out_dir_param, mosaic_plot, proj_str, file_format, NA_flag_val, |
219 | 219 |
multiple_region, countries_shp, plot_region, num_cores, |
220 |
region_name, df_assessment_files_name, threshold_missing_day,list_year_predicted)
|
|
220 |
region_name, threshold_missing_day,list_year_predicted) |
|
221 | 221 |
|
222 | 222 |
names(list_param_run_assessment_combined_region_plotting_prediction) <- c( |
223 | 223 |
"in_dir_list_filename", |
224 | 224 |
"in_dir","y_var_name","interpolation_method","out_suffix", |
225 | 225 |
"out_dir","create_out_dir_param","mosaic_plot","proj_str","file_format","NA_flag_val", |
226 | 226 |
"multiple_region","countries_shp","plot_region","num_cores", |
227 |
"region_name","df_assessment_files_name","threshold_missing_day","year_predicted")
|
|
227 |
"region_name","threshold_missing_day","year_predicted") |
|
228 | 228 |
|
229 | 229 |
i <- 1 #this select the first year of list_year_predicted |
230 | 230 |
#Step 1: run figures production by region using table (part2 assessment script) |
... | ... | |
237 | 237 |
#Step 1: run individual figure production if needed: |
238 | 238 |
if(run_figure_by_year==TRUE){ |
239 | 239 |
#debug(run_assessment_plotting_prediction_fun) |
240 |
#Make this a function!!! needs to be call in parallel with mclapply, it takes 3 to 4 minutes by year |
|
240 | 241 |
l_list_param_run_assessment_part2_plotting <- vector("list",length=length(list_in_dir)) |
241 | 242 |
list_df_assessment_files <- lapply(list_in_dir,FUN=function(x,y){list.files(path=file.path(y,x),pattern="df_assessment_files_.*.txt",full.names=T)},y=in_dir) |
242 | 243 |
for(j in 1:length(list_in_dir)){ |
Also available in: Unified diff
debugging call to assessment part2 in stage 8