Revision 5b2c0bc6
Added by Benoit Parmentier over 8 years ago
climate/research/oregon/interpolation/master_script_stage_7.R | ||
---|---|---|
14 | 14 |
|
15 | 15 |
#AUTHOR: Benoit Parmentier |
16 | 16 |
#CREATED ON: 01/01/2016 |
17 |
#MODIFIED ON: 04/05/2016
|
|
17 |
#MODIFIED ON: 04/08/2016
|
|
18 | 18 |
#PROJECT: NCEAS INPLANT: Environment and Organisms |
19 | 19 |
|
20 | 20 |
#First source these files: |
... | ... | |
60 | 60 |
|
61 | 61 |
#script_path <- "/home/parmentier/Data/IPLANT_project/env_layers_scripts" |
62 | 62 |
script_path <- "/nobackupp8/bparmen1/env_layers_scripts" #path to script |
63 |
function_mosaicing_functions <- "global_run_scalingup_mosaicing_function_04062016b.R" #PARAM12
|
|
64 |
function_mosaicing <-"global_run_scalingup_mosaicing_04062016.R"
|
|
63 |
function_mosaicing_functions <- "global_run_scalingup_mosaicing_function_04072016.R" #PARAM12
|
|
64 |
function_mosaicing <-"global_run_scalingup_mosaicing_04072016b.R"
|
|
65 | 65 |
source(file.path(script_path,function_mosaicing)) #source all functions used in this script |
66 | 66 |
source(file.path(script_path,function_mosaicing_functions)) #source all functions used in this script |
67 | 67 |
|
... | ... | |
76 | 76 |
source(file.path(script_path,function_assessment_part2_functions)) #source all functions used in this script |
77 | 77 |
source(file.path(script_path,function_assessment_part3)) #source all functions used in this script |
78 | 78 |
|
79 |
### Parameters and arguments ### |
|
79 |
### Parameters, constants and arguments ### |
|
80 |
stages_to_run<-c(0,0,0,0,0,0,7) #this is stage, other stages are stored in files. |
|
80 | 81 |
|
82 |
CRS_locs_WGS84<-CRS("+proj=longlat +ellps=WGS84 +datum=WGS84 +towgs84=0,0,0") #Station coords WGS84 |
|
83 |
|
|
84 |
#####mosaicing parameters |
|
85 |
|
|
86 |
#Data is on ATLAS or NASA NEX |
|
87 |
|
|
88 |
var <- args[1] # variable being interpolated #param 1, arg 1 |
|
89 |
var<-"TMAX" # variable being interpolated #param 1, arg 1 |
|
90 |
|
|
81 | 91 |
var<-"TMAX" # variable being interpolated |
82 | 92 |
if (var == "TMAX") { |
83 | 93 |
y_var_name <- "dailyTmax" |
... | ... | |
88 | 98 |
y_var_month <- "TMin" |
89 | 99 |
} |
90 | 100 |
|
91 |
CRS_locs_WGS84<-CRS("+proj=longlat +ellps=WGS84 +datum=WGS84 +towgs84=0,0,0") #Station coords WGS84 |
|
92 |
|
|
93 |
#####mosaicing parameters |
|
94 |
|
|
95 |
#Data is on ATLAS or NASA NEX |
|
96 |
#PARAM 1 |
|
101 |
#PARAM 2 |
|
97 | 102 |
#in_dir <- "/data/project/layers/commons/NEX_data/output_run10_1500x4500_global_analyses_pred_1992_12072015" #NCEAS |
98 | 103 |
#in_dir <- "/nobackupp8/bparmen1/output_run10_1500x4500_global_analyses_pred_1992_12072015" #NEX |
99 | 104 |
in_dir <- "/nobackupp6/aguzman4/climateLayers/out/" |
100 | 105 |
|
101 |
y_var_name <- "dailyTmax" #PARAM2 |
|
102 | 106 |
interpolation_method <- c("gam_CAI") #PARAM3 |
107 |
|
|
103 | 108 |
region_name <- "reg4" #PARAM 4 #reg4 South America, Africa reg5,Europe reg2, North America reg1, Asia reg3 |
104 | 109 |
mosaicing_method <- c("unweighted","use_edge_weights") #PARAM5 |
105 | 110 |
#out_suffix <- paste(region_name,"_","run10_1500x4500_global_analyses_pred_1991_04052016",sep="") #PARAM 6 |
... | ... | |
128 | 133 |
NA_flag_val <- NA_value #PARAM 16 |
129 | 134 |
|
130 | 135 |
num_cores <- 6 #PARAM 17 |
131 |
region_names <- c("reg23","reg4") #selected region names, ##PARAM 18 |
|
136 |
#region_names <- c("reg23","reg4") #selected region names, ##PARAM 18
|
|
132 | 137 |
use_autokrige <- F #PARAM 19 |
133 | 138 |
proj_str <- CRS_locs_WGS84 |
134 | 139 |
|
... | ... | |
162 | 167 |
#max number of cells to read in memory |
163 | 168 |
max_mem<-args[11] |
164 | 169 |
#in_dir_tiles <- file.path(in_dir,"tiles") #this is valid both for Atlas and NEX |
170 |
layers_option <- c("var_pred") #options are: |
|
171 |
#res_training, res_testing,ac_training, ac_testing, var_pred |
|
165 | 172 |
|
166 | 173 |
#rasterOptions(maxmemory=1e+07,timer=TRUE) |
167 | 174 |
list_param_run_mosaicing_prediction <- list(in_dir,y_var_name,interpolation_method,region_name, |
168 | 175 |
mosaicing_method,out_suffix,out_suffix_str,metric_name,pred_mod_name,var_pred, |
169 | 176 |
create_out_dir_param,day_to_mosaic_range,proj_str,file_format,NA_value,num_cores, |
170 | 177 |
use_autokrige,infile_mask,df_assessment_files_name,mosaic_python, |
171 |
python_bin,algorithm,match_extent,list_models) |
|
178 |
python_bin,algorithm,match_extent,list_models,layers_option)
|
|
172 | 179 |
param_names <- c("in_dir","y_var_name","interpolation_method","region_name", |
173 | 180 |
"mosaicing_method","out_suffix","out_suffix_str","metric_name","pred_mod_name","var_pred", |
174 | 181 |
"create_out_dir_param","day_to_mosaic_range","proj_str","file_format","NA_value","num_cores", |
175 | 182 |
"use_autokrige","infile_mask","df_assessment_files_name","mosaic_python", |
176 |
"python_bin","algorithm","match_extent","list_models") |
|
183 |
"python_bin","algorithm","match_extent","list_models","layers_option")
|
|
177 | 184 |
names(list_param_run_mosaicing_prediction) <- param_names |
178 | 185 |
#list_param_run_mosaicing_prediction |
179 | 186 |
#debug(run_mosaicing_prediction_fun) |
180 | 187 |
#debug(debug_fun_test) |
181 | 188 |
#debug_fun_test(list_param_raster_prediction) |
182 | 189 |
i <- 1 #this select the first year of list_year_predicted |
183 |
function_mosaicing_functions <- "global_run_scalingup_mosaicing_function_04062016b.R" #PARAM12
|
|
184 |
function_mosaicing <-"global_run_scalingup_mosaicing_04062016.R"
|
|
185 |
source(file.path(script_path,function_mosaicing)) #source all functions used in this script |
|
186 |
source(file.path(script_path,function_mosaicing_functions)) #source all functions used in this script |
|
190 |
#function_mosaicing_functions <- "global_run_scalingup_mosaicing_function_04072016.R" #PARAM12
|
|
191 |
#function_mosaicing <-"global_run_scalingup_mosaicing_04072016.R"
|
|
192 |
#source(file.path(script_path,function_mosaicing)) #source all functions used in this script
|
|
193 |
#source(file.path(script_path,function_mosaicing_functions)) #source all functions used in this script
|
|
187 | 194 |
|
188 | 195 |
if (stages_to_run[7]==7){ |
189 | 196 |
assessment_prediction_obj <- run_mosaicing_prediction_fun(i,list_param_run_mosaicing_prediction) |
Also available in: Unified diff
testing mosaicing stage 7 and fixing inputs