Revision 64a4bbd5
Added by Benoit Parmentier about 8 years ago
climate/research/oregon/interpolation/global_product_assessment_part0.R | ||
---|---|---|
9 | 9 |
# |
10 | 10 |
#AUTHOR: Benoit Parmentier |
11 | 11 |
#CREATED ON: 10/27/2016 |
12 |
#MODIFIED ON: 11/27/2016
|
|
12 |
#MODIFIED ON: 11/28/2016
|
|
13 | 13 |
#Version: 1 |
14 | 14 |
#PROJECT: Environmental Layers project |
15 | 15 |
#COMMENTS: |
... | ... | |
93 | 93 |
source(file.path(script_path,function_assessment_part3)) #source all functions used in this script |
94 | 94 |
|
95 | 95 |
#Product assessment |
96 |
function_product_assessment_part0_functions <- "global_product_assessment_part0_functions_11272016.R"
|
|
96 |
function_product_assessment_part0_functions <- "global_product_assessment_part0_functions_11292016b.R"
|
|
97 | 97 |
source(file.path(script_path,function_product_assessment_part0_functions)) #source all functions used in this script |
98 | 98 |
##Don't load part 1 and part2, mosaic package does not work on NEX |
99 | 99 |
#function_product_assessment_part1_functions <- "global_product_assessment_part1_functions_09192016b.R" |
... | ... | |
126 | 126 |
infile_mask <- args[14] |
127 | 127 |
in_dir1 <- args[15] #PARAM 15, files containing assessment information |
128 | 128 |
layers_option <- args[16] # PARAM 17 options are: |
129 |
tmp_files <- args[17] |
|
129 | 130 |
|
130 | 131 |
#### values used for testing |
131 |
# var <- "TMAX" # variable being interpolated #PARAM 1, arg 1
|
|
132 |
# in_dir <- "/nobackupp6/aguzman4/climateLayers/out/reg6/assessment" #PARAM2
|
|
133 |
# region_name <- c("reg6") #PARAM 3, arg 3
|
|
134 |
# out_suffix <- "predictions_assessment_reg6_10302016" #PARAM 4
|
|
135 |
# #out_suffix_str <- region_name #PARAM 4, CONST 3
|
|
136 |
# out_dir <- "/nobackupp6/aguzman4/climateLayers/out/reg6/assessment" #PARAM 5
|
|
137 |
# create_out_dir_param <- TRUE #PARAM 12, arg 6
|
|
138 |
# year_predicted <- c(2000) #PARAM 7, arg7
|
|
139 |
# num_cores <- 6 #number of cores used # PARAM 8, arg 8
|
|
140 |
# max_mem <- 1e+07 #PARAM 9
|
|
141 |
# #mosaicing_method <- args[10] #PARAM10
|
|
142 |
# item_no <- 9 #PARAM 10, arg 10
|
|
143 |
# metric_name <- "rmse" # "mae", "r" for MAE, R etc.; can also be ns or nv? #PARAM 11, arg 11
|
|
144 |
# day_start <- "2000101" #PARAM 12, arg 12
|
|
145 |
# day_end <- "20001231" #PARAM 13, arg 13
|
|
146 |
# infile_mask <- "/nobackupp8/bparmen1/NEX_data/regions_input_files/r_mask_LST_reg6.tif" #PARAM 14, arg 14
|
|
147 |
# in_dir1 <- "/nobackupp6/aguzman4/climateLayers/out" # PARAM 15 On NEX
|
|
148 |
# layers_option <- c("var_pred") #PARAM 16, arg 16
|
|
149 |
|
|
132 |
var <- "TMAX" # variable being interpolated #PARAM 1, arg 1 |
|
133 |
in_dir <- "/nobackupp6/aguzman4/climateLayers/out/reg6/assessment" #PARAM2 |
|
134 |
region_name <- c("reg6") #PARAM 3, arg 3 |
|
135 |
out_suffix <- "predictions_assessment_reg6_10302016" #PARAM 4 |
|
136 |
#out_suffix_str <- region_name #PARAM 4, CONST 3 |
|
137 |
out_dir <- "/nobackupp6/aguzman4/climateLayers/out/reg6/assessment" #PARAM 5 |
|
138 |
create_out_dir_param <- TRUE #PARAM 12, arg 6 |
|
139 |
year_predicted <- c(2000) #PARAM 7, arg7 |
|
140 |
num_cores <- 6 #number of cores used # PARAM 8, arg 8 |
|
141 |
max_mem <- 1e+07 #PARAM 9 |
|
142 |
#mosaicing_method <- args[10] #PARAM10 |
|
143 |
item_no <- 9 #PARAM 10, arg 10 |
|
144 |
metric_name <- "rmse" # "mae", "r" for MAE, R etc.; can also be ns or nv? #PARAM 11, arg 11 |
|
145 |
day_start <- "20000101" #PARAM 12, arg 12
|
|
146 |
day_end <- "20001231" #PARAM 13, arg 13 |
|
147 |
infile_mask <- "/nobackupp8/bparmen1/NEX_data/regions_input_files/r_mask_LST_reg6.tif" #PARAM 14, arg 14 |
|
148 |
in_dir1 <- "/nobackupp6/aguzman4/climateLayers/out" # PARAM 15 On NEX |
|
149 |
layers_option <- c("var_pred") #PARAM 16, arg 16 |
|
150 |
tmp_files <- FALSE #PARAM 17, arg 17 |
|
150 | 151 |
|
151 | 152 |
################### |
152 | 153 |
### CONSTANT: not set from command line |
... | ... | |
167 | 168 |
#countries_shp <-"/data/project/layers/commons/NEX_data/countries.shp" #Atlas |
168 | 169 |
countries_shp <- "/nobackupp8/bparmen1/NEX_data/countries.shp" #PARAM 17 |
169 | 170 |
lf_raster <- NULL #list of raster to consider #PARAM 18 |
170 |
scaling <- 0 |
|
171 |
scaling <- 1 |
|
172 |
data_type <- "Int16" |
|
171 | 173 |
#CRS_interp <- "+proj=longlat +ellps=WGS84 +datum=WGS84 +towgs84=0,0,0" #param 3 |
172 | 174 |
#list_models<-c("y_var ~ s(lat,lon,k=5) + s(elev_s,k=3) + s(LST,k=3)") #param 4 |
173 | 175 |
|
... | ... | |
197 | 199 |
|
198 | 200 |
#parse input value range |
199 | 201 |
#values_range <- as.numeric(unlist(strsplit(values_range,","))) |
202 |
#scaling <- 1 |
|
200 | 203 |
scaling <- as.numeric(scaling) |
204 |
#data_type <- "Int16" |
|
201 | 205 |
#i<-1 |
202 | 206 |
|
203 | 207 |
##### prepare list of parameters for call of function |
... | ... | |
205 | 209 |
list_param_predictions_tiles_missing <- list(in_dir1,region_name,y_var_name,interpolation_method,out_suffix,out_dir, |
206 | 210 |
create_out_dir_param,proj_str,year_predicted,file_format,NA_flag_val, |
207 | 211 |
num_cores,plotting_figures,item_no,day_to_mosaic_range,countries_shp,plotting_figures, |
208 |
#threshold_missing_day,
|
|
212 |
scaling, data_type, python_bin,tmp_files,
|
|
209 | 213 |
pred_mod_name,metric_name) |
210 | 214 |
|
211 | 215 |
names(list_param_predictions_tiles_missing) <- c("in_dir1","region_name","y_var_name","interpolation_method","out_suffix","out_dir", |
212 | 216 |
"create_out_dir_param","proj_str","year_predicted","file_format","NA_flag_val", |
213 | 217 |
"num_cores","plotting_figures","item_no","day_to_mosaic_range","countries_shp","plotting_figures", |
214 |
#"threshold_missing_day",
|
|
218 |
"scaling", "data_type", "python_bin","tmp_files",
|
|
215 | 219 |
"pred_mod_name","metric_name") |
216 | 220 |
|
221 |
#Product assessment |
|
222 |
function_product_assessment_part0_functions <- "global_product_assessment_part0_functions_11292016b.R" |
|
223 |
source(file.path(script_path,function_product_assessment_part0_functions)) #source all functions used in this script |
|
224 |
|
|
217 | 225 |
#debug(predictions_tiles_missing_fun) |
218 | 226 |
#Started at 11.06pm |
219 | 227 |
obj_predictions_tiles_missing_fun <- predictions_tiles_missing_fun(list_param=list_param_predictions_tiles_missing) |
Also available in: Unified diff
adding input arguments, data_type, scaling and more