Project

General

Profile

« Previous | Next » 

Revision 34e2c563

Added by Benoit Parmentier over 8 years ago

testing code with new flag value and masking file

View differences:

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/23/2016  
17
#MODIFIED ON: 04/24/2016  
18 18
#PROJECT: NCEAS INPLANT: Environment and Organisms                                                                           
19 19

  
20 20
#First source these files:
......
63 63

  
64 64
#script_path <- "/home/parmentier/Data/IPLANT_project/env_layers_scripts"
65 65
script_path <- "/nobackupp8/bparmen1/env_layers_scripts" #path to script
66
function_mosaicing_functions <- "global_run_scalingup_mosaicing_function_04222016b.R" #PARAM12
66
function_mosaicing_functions <- "global_run_scalingup_mosaicing_function_04232016.R" #PARAM12
67 67
function_mosaicing <-"global_run_scalingup_mosaicing_04222016.R"
68 68
source(file.path(script_path,function_mosaicing)) #source all functions used in this script 
69 69
source(file.path(script_path,function_mosaicing_functions)) #source all functions used in this script 
......
117 117
#scaling <- 100 #, param 20, if null use 1
118 118
#values_range <- c(-100,100)
119 119

  
120
var <- "TMAX" # variable being interpolated #param 1, arg 1
121
in_dir <- "/nobackupp6/aguzman4/climateLayers/out/" #PARAM2,arg 2
122
region_name <- "reg4" #PARAM 3, arg 3 #reg4 South America, Africa reg5,Europe reg2, North America reg1, Asia reg3
123
out_suffix <- "reg4_1991" #PARAM 4, arg 4
124
out_suffix_str <- region_name #PARAM 4, CONST 3
125
out_dir <- "/nobackupp8/bparmen1/climateLayers/out/reg4" #PARAM 5,arg 5 use this location for now
126
create_out_dir_param <- TRUE #PARAM 6, arg 6
127
year_predicted <- 1991 #PARAM 7, arg 7
128
num_cores <- 6 #PARAM 8, arg 8         
129
max_mem = 1e+07 #param 9, arg 9
130
mosaicing_method <- "use_edge_weights" #PARAM10, arg 10
131
metric_name <- "rmse" #RMSE, MAE etc. #PARAM 11, arg 11
132
day_start <- "19910101" #PARAM 12 arg 12
133
day_end <- "19910103" #PARAM 13 arg 13
134
#infile_mask <- "/nobackupp8/bparmen1/NEX_data/regions_input_files/r_mask_reg4.tif" #PARAM 14, arg 14
135
infile_mask <- "/nobackupp8/bparmen1/NEX_data/regions_input_files/r_mask_LST.tif"
136
df_assessment_files_name <- "/nobackupp6/aguzman4/climateLayers/out/reg4/assessment/output_reg4_1991/df_assessment_files_reg4_1991_reg4_1991.txt"  # data.frame with all files used in assessmnet, PARAM 15
137
algorithm <- "python" #PARAM 16 #if R use mosaic function for R, if python use modified gdalmerge script from Alberto Guzmann
138
layers_option <- c("var_pred") #arg 17 ,param 17, options are:#res_training, res_testing,ac_training, ac_testing, var_pred
139
tmp_files <- FALSE #arg 18, param 18
140
data_type <- "Int16" #, param 19, use int32 for output layers mosaiced
141
scaling <- 100 #, param 20, if NULL don't rescale values
142
values_range <- c(-100,100) #args 21, if NULL don't screen values
120
# var <- "TMAX" # variable being interpolated #param 1, arg 1
121
# in_dir <- "/nobackupp6/aguzman4/climateLayers/out/" #PARAM2,arg 2
122
# region_name <- "reg4" #PARAM 3, arg 3 #reg4 South America, Africa reg5,Europe reg2, North America reg1, Asia reg3
123
# out_suffix <- "reg4_1991" #PARAM 4, arg 4
124
# out_suffix_str <- region_name #PARAM 4, CONST 3
125
# out_dir <- "/nobackupp8/bparmen1/climateLayers/out/reg4" #PARAM 5,arg 5 use this location for now
126
# create_out_dir_param <- TRUE #PARAM 6, arg 6
127
# year_predicted <- 1991 #PARAM 7, arg 7
128
# num_cores <- 6 #PARAM 8, arg 8         
129
# max_mem = 1e+07 #param 9, arg 9
130
# mosaicing_method <- "use_edge_weights" #PARAM10, arg 10
131
# metric_name <- "rmse" #RMSE, MAE etc. #PARAM 11, arg 11
132
# day_start <- "19910101" #PARAM 12 arg 12
133
# day_end <- "19910103" #PARAM 13 arg 13
134
# #infile_mask <- "/nobackupp8/bparmen1/NEX_data/regions_input_files/r_mask_reg4.tif" #PARAM 14, arg 14
135
# infile_mask <- "/nobackupp8/bparmen1/NEX_data/regions_input_files/r_mask_LST.tif"
136
# df_assessment_files_name <- "/nobackupp6/aguzman4/climateLayers/out/reg4/assessment/output_reg4_1991/df_assessment_files_reg4_1991_reg4_1991.txt"  # data.frame with all files used in assessmnet, PARAM 15
137
# algorithm <- "python" #PARAM 16 #if R use mosaic function for R, if python use modified gdalmerge script from Alberto Guzmann
138
# layers_option <- c("var_pred") #arg 17 ,param 17, options are:#res_training, res_testing,ac_training, ac_testing, var_pred
139
# tmp_files <- FALSE #arg 18, param 18
140
# data_type <- "Int16" #, param 19, use int32 for output layers mosaiced
141
# scaling <- 100 #, param 20, if NULL don't rescale values
142
# values_range <- "-100,100" #args 21, if NULL don't screen values
143
#NA_flag_val <- -32768 #should be here
144

  
143 145

  
144 146
#path_assessment <- NOT USED "/nobackupp6/aguzman4/climateLayers/out/reg4/assessment/output_reg4_1991" #PARAM 14a, arg 14
145 147

  
146 148
### Testing several years on the bridge before running jobs on nodes with qsub
147 149
#Use the following command to run as script via the shell on the bridge 
148
#Rscript /nobackupp8/bparmen1/env_layers_scripts/master_script_stage_7_04202016.R TMAX /nobackupp6/aguzman4/climateLayers/out/ reg4 reg4 /nobackupp8/bparmen1/climateLayers/out/reg4 TRUE 1991 6 1e+07 use_edge_weights rmse 19910101 19910103 /nobackupp8/bparmen1/NEX_data/regions_input_files/mask_reg4_bool.tif /nobackupp6/aguzman4/climateLayers/out/reg4/assessment/output_reg4_1991/df_assessment_files_reg4_1991_reg4_1991.txt python var_pred FALSE Int16 100 -100,100
150
#Rscript /nobackupp8/bparmen1/env_layers_scripts/master_script_stage_7_04232016.R TMAX /nobackupp6/aguzman4/climateLayers/out/ reg4 reg4_1991 /nobackupp8/bparmen1/climateLayers/out/reg4 TRUE 1991 6 1e+07 use_edge_weights rmse 19910101 19910103 /nobackupp8/bparmen1/NEX_data/regions_input_files/r_mask_LST.tif /nobackupp6/aguzman4/climateLayers/out/reg4/assessment/output_reg4_1991/df_assessment_files_reg4_1991_reg4_1991.txt python var_pred FALSE Int16 100 -100,100
149 151

  
150 152
############################
151 153

  
......
222 224
var_pred <- "res_mod1" #used in residuals mapping #PARAM 23
223 225
proj_str<- CRS_WGS84 #PARAM 24 #check this parameter
224 226
file_format <- ".tif" #PARAM 25
225
NA_value <- -9999 #PARAM 26
226
#NA_value <- -32768 #PARAM 26
227
#NA_value <- -9999 #PARAM 26
228
NA_value <- -32768 #PARAM 26
227 229
NA_flag_val <- NA_value #PARAM 26
228 230
use_autokrige <- F #PARAM 28
229 231
#proj_str <- CRS_locs_WGS84 #PARAM 29
......
253 255
  day_to_mosaic_range <- NULL
254 256
}
255 257

  
258
#parse input value range
259
values_range <- as.numeric(unlist(strsplit(values_range,",")))
260
scaling <- as.numeric(scaling)
261

  
256 262
#browser()
257 263

  
258 264
#rasterOptions(maxmemory=1e+07,timer=TRUE)
......
284 290
}
285 291

  
286 292
#runs in 42 minutes for 3 dates but note that beyond date 1, the process is about 11 minutes or so.
287

  
293
#19h09
288 294
###############   END OF SCRIPT   ###################
289 295
#####################################################
290 296

  

Also available in: Unified diff