Project

General

Profile

« Previous | Next » 

Revision a156c854

Added by Benoit Parmentier almost 9 years ago

adding sourcing of relevant script for stage 6 assessment and debugging

View differences:

climate/research/oregon/interpolation/master_script_stage_6.R
11 11
#STAGE 6: Assessement of predictions by tiles and regions with mosaicing of predictions and accuracy
12 12
#AUTHOR: Benoit Parmentier                                                                        
13 13
#CREATED ON: 12/29/2015  
14
#MODIFIED ON: 12/31/2015  
14
#MODIFIED ON: 01/03/2015  
15 15
#PROJECT: NCEAS INPLANT: Environment and Organisms                                                                           
16 16

  
17 17
## TODO:
......
50 50
#CALLED FROM MASTER SCRIPT:
51 51

  
52 52
script_path <- "/nobackupp8/bparmen1/env_layers_scripts" #path to script
53
function_assessment_part1_script <- "global_run_scalingup_assessment_part1_functions_02112015.R" #PARAM12
54
function_assessment_part1a <-"global_run_scalingup_assessment_part1a_12312015.R"
55
source(file.path(script_path,function_assessment_part1_script)) #source all functions used in this script 
53
function_assessment_part1_functions <- "global_run_scalingup_assessment_part1_functions_02112015.R" #PARAM12
54
function_assessment_part1a <-"global_run_scalingup_assessment_part1a_01042016.R"
55
function_assessment_part2 <- "global_run_scalingup_assessment_part2_01042016.R"
56
function_assessment_part2_functions <- "global_run_scalingup_assessment_part2_functions_01032016.R"
57
source(file.path(script_path,function_assessment_part1_functions)) #source all functions used in this script 
56 58
source(file.path(script_path,function_assessment_part1a)) #source all functions used in this script 
59
source(file.path(script_path,function_assessment_part2)) #source all functions used in this script 
60
source(file.path(script_path,function_assessment_part2_functions)) #source all functions used in this script 
57 61

  
58 62
### Parameters and arguments ###
59 63
  
60 64
var<-"TMAX" # variable being interpolated
65
if (var == "TMAX") {
66
  y_var_name <- "dailyTmax"
67
  y_var_month <- "TMax"
68
}
69
if (var == "TMIN") {
70
  y_var_name <- "dailyTmin"
71
  y_var_month <- "TMin"
72
}
61 73

  
62 74
#interpolation_method<-c("gam_fusion") #other otpions to be added later
63 75
interpolation_method<-c("gam_CAI")
......
74 86
#/nobackupp6/aguzman4/climateLayers/out_15x45/1982
75 87

  
76 88
#region_names <- c("reg23","reg4") #selected region names, #PARAM2
77
region_name <- c("reg4") #run assessment by region
89
region_name <- c("reg4") #run assessment by region, this is a unique region only
78 90
#region_names <- c("reg1","reg2","reg3","reg4","reg5","reg6") #selected region names, #PARAM2
79 91
interpolation_method <- c("gam_CAI") #PARAM4
80 92
out_prefix <- "run_global_analyses_pred_12282015" #PARAM5
......
86 98
#CRS_interp <-"+proj=lcc +lat_1=43 +lat_2=45.5 +lat_0=41.75 +lon_0=-120.5 +x_0=400000 +y_0=0 +ellps=GRS80 +units=m +no_defs";
87 99
CRS_locs_WGS84<-CRS("+proj=longlat +ellps=WGS84 +datum=WGS84 +towgs84=0,0,0") #Station coords WGS84
88 100

  
89
list_year_predicted <- 1984:2004
101
#list_year_predicted <- 1984:2004
102
list_year_predicted <- c("2014")
90 103
#year_predicted <- list_year_predicted[1]
91 104

  
92 105
file_format <- ".tif" #format for mosaiced files #PARAM10
93 106
NA_flag_val <- -9999  #No data value, #PARAM11
94 107
num_cores <- 6 #number of cores used #PARAM13
95

  
96
list_param_run_assessment_prediction <- list(in_dir1,region_name,interpolation_method,out_prefix,
97
                                          out_dir,create_out_dir_param,CRS_locs_WGS84,
98
                                             list_year_predicted,file_format,NA_flag_val,num_cores)
99
list_names <- c("in_dir1","region_name","interpolation_method","out_prefix",
100
                                      "out_dir","create_out_dir_param","CRS_locs_WGS84",
101
                                      "list_year_predicted","file_format","NA_flag_val","num_cores")
108
plotting_figures <- TRUE #running part2 of assessment to generate figures...
109
  
110
##Additional parameters used in part 2, some these may be removed as code is simplified
111
mosaic_plot <- FALSE #PARAM14
112
day_to_mosaic <- c("19920102","19920103","19920103") #PARAM15
113
multiple_region <- TRUE #PARAM16
114
countries_shp <- "/nobackupp8/bparmen1/NEX_data/countries.shp" #PARAM17
115
#countries_shp <-"/data/project/layers/commons/NEX_data/countries.shp" #Atlas
116
plot_region <- TRUE  #PARAM18
117
threshold_missing_day <- c(367,365,300,200)#PARAM19
118

  
119
list_param_run_assessment_prediction <- list(in_dir1,region_name,y_var_name,interpolation_method,out_prefix,
120
                                  out_dir,create_out_dir_param,CRS_locs_WGS84,list_year_predicted,
121
                                  file_format,NA_flag_val,num_cores,plotting_figures,
122
                                  mosaic_plot,day_to_mosaic,multiple_region,countries_shp,plot_region)
123
list_names <- c("in_dir1","region_name","y_var_name","interpolation_method","out_prefix",
124
                                  "out_dir","create_out_dir_param","CRS_locs_WGS84","list_year_predicted",
125
                                  "file_format","NA_flag_val","num_cores","plotting_figures",
126
                                  "mosaic_plot","day_to_mosaic","multiple_region","countries_shp","plot_region")
127
                                      
102 128

  
103 129
names(list_param_run_assessment_prediction)<-list_names
104 130
  
......
114 140
  assessment_prediction_obj <- run_assessment_prediction_fun(i,list_param_run_assessment_prediction)
115 141
}
116 142

  
143
## Add stage 7 (mosaicing) here??
144
#i <- 1 #this select the first year of list_year_predicted
145
#if (stages_to_run[7]==7){
146
#  assessment_prediction_obj <- run_assessment_prediction_fun(i,list_param_run_assessment_prediction)
147
#}
148

  
117 149
###############   END OF SCRIPT   ###################
118 150
#####################################################
119 151

  

Also available in: Unified diff