Project

General

Profile

« Previous | Next » 

Revision 2ba31980

Added by Benoit Parmentier over 11 years ago

run TMAX prediction Venezuela for year 2000 with 1981-2010 period and modifications in sourcing and input parameters

View differences:

climate/research/oregon/interpolation/master_script_temp.R
10 10
#STAGE 5: Output analyses-visualization of results for specific dates...
11 11
#
12 12
#AUTHOR: Benoit Parmentier                                                                       
13
#DATE: 03/21/2013                                                                                 
13
#DATE: 03/28/2013                                                                                 
14 14

  
15 15
#PROJECT: NCEAS INPLANT: Environment and Organisms --TASK#363, TASK$568--   
16 16

  
......
43 43

  
44 44
script_path<-"/home/parmentier/Data/IPLANT_project/Venezuela_interpolation/Venezuela_01142013/"
45 45
#list_script_files<-
46
stages_to_run<-c(1,2,3,4,5) #May decide on antoher strategy later on...
46
#stages_to_run<-c(1,2,3,4,5) #May decide on antoher strategy later on...
47
stages_to_run<-c(0,0,3,4,5) #May decide on antoher strategy later on...
47 48

  
48
#####SCRIPT USED FOR THE PREDICTIONS
49
#####SCRIPT USED FOR THE PREDICTIONS: Source all scripts here to avoid confusion on versions being run!!!!
49 50

  
50
#master_script_temp_03192013.R
51
#source(file.path(script_path,"master_script_temp_03282013.R")) #Master script can be run directly...
51 52

  
52 53
#CALLED FROM MASTER SCRIPT:
53 54

  
54 55
#/home/parmentier/Data/IPLANT_project/Venezuela_interpolation/Venezuela_01142013/climatology_03192013.py
55 56
source(file.path(script_path,"covariates_production_temperatures_03212013.R"))
56
source(file.path(script_path,"Database_stations_covariates_processing_function_03132013.R"))
57
source(file.path(script_path,"GAM_fusion_analysis_raster_prediction_multisampling_03182013.R"))
58
source(file.path(script_path,"results_interpolation_date_output_analyses_03182013.R"))
57
source(file.path(script_path,"Database_stations_covariates_processing_function_03242013.R"))
58
source(file.path(script_path,"GAM_fusion_analysis_raster_prediction_multisampling_03272013.R"))
59
source(file.path(script_path,"results_interpolation_date_output_analyses_03272013.R"))
60
#source(file.path(script_path,"results_covariates_database_stations_output_analyses_03272013.R"))
59 61

  
60
#CALLED FROM GAM FUSION ANALYSIS RASTER PREDICTION
62
#FUNCTIONS CALLED FROM GAM FUSION ANALYSIS RASTER PREDICTION ARE FOUND IN...
61 63

  
62 64
source(file.path(script_path,"sampling_script_functions_03122013.R"))
63
source(file.path(script_path,"GAM_fusion_function_multisampling_03142013.R")) #Include GAM_CAI
64
source(file.path(script_path,"GAM_fusion_function_multisampling_validation_metrics_03182013.R"))
65

  
65
source(file.path(script_path,"GAM_fusion_function_multisampling_03192013.R")) #Include GAM_CAI
66
source(file.path(script_path,"GAM_fusion_function_multisampling_validation_metrics_03272013.R"))
66 67

  
67 68
############ STAGE 1: LST Climatology ###############
68 69

  
......
74 75
############ STAGE 2: Covariate production ################
75 76

  
76 77
##Paths to inputs and output
77
var<-"TMIN"
78
#var<-"TMIN"
79
var<-"TMAX"
78 80
in_path <- "/home/parmentier/Data/IPLANT_project/Venezuela_interpolation/Venezuela_01142013/input_data/"
79 81
out_path<- "/home/parmentier/Data/IPLANT_project/Venezuela_interpolation/Venezuela_01142013/output_data/"
80 82

  
......
113 115

  
114 116
############# STAGE 3: Data preparation ###############
115 117

  
116

  
117 118
#Setting up input argurments for script function...
118 119
#set up earlier
120
var <- "TMAX"           # name of the variables to keep: TMIN, TMAX or PRCP --already set up earlier
121

  
119 122
infile_covariates<-"covariates__venezuela_region__VE_01292013.tif" #this is an output from covariate script and used in stage 3 and stage 4
123
#infile_covariates<-"covariates__venezuela_region_TMIN__VE_03192013.tif" #covariates stack for TMIN
124

  
120 125
CRS_locs_WGS84<-CRS("+proj=longlat +ellps=WGS84 +datum=WGS84 +towgs84=0,0,0") #Station coords WGS84: same as earlier
121 126
infile1<- "outline_venezuela_region__VE_01292013.shp"      #This is the shape file of outline of the study area                                                      #It is an input/output of the covariate script
122 127
#covar_names see stage 2
123
var <- "TMAX"           # name of the variables to keep: TMIN, TMAX or PRCP
124 128

  
125 129
#specific to this stage
126 130
db.name <- "ghcn"       # name of the Postgres database
127 131
range_years<-c("2000","2001") #right bound not included in the range!!
128
range_years_clim<-c("1980","2011") #right bound not included in the range!!
132
range_years_clim<-c("1981","2011") #right bound not included in the range!!
129 133
infile2<-"/home/layers/data/climate/ghcn/v2.92-upd-2012052822/ghcnd-stations.txt"                              #This is the textfile of station locations from GHCND
130 134
in_path <- "/home/parmentier/Data/IPLANT_project/Venezuela_interpolation/Venezuela_01142013/input_data/"
131
out_prefix<-"_365d_GAM_fus5_all_lstd_03182013"                #User defined output prefix
132
#qc_flags<-    flags allowe for the query from the GHCND??
133

  
135
out_prefix<-"_365d_GAM_fus5_all_lstd_03282013"                #User defined output prefix
136
qc_flags_stations<-c("0","S")    #flags allowed for screening after the query from the GHCND??
134 137

  
135
#list of 11 parameters for input in the function...
138
#list of 12 parameters for input in the function...
136 139

  
137
list_param_prep<-list(db.name,var,range_years,range_years_clim,infile1,infile2,infile_covariates,CRS_locs_WGS84,in_path,covar_names,out_prefix)
138
cnames<-c("db.name","var","range_years","range_years_clim","infile1","infile2","infile_covariates","CRS_locs_WGS84","in_path","covar_names","out_prefix")
140
list_param_prep<-list(db.name,var,range_years,range_years_clim,infile1,infile2,infile_covariates,CRS_locs_WGS84,in_path,covar_names,qc_flags_stations,out_prefix)
141
cnames<-c("db.name","var","range_years","range_years_clim","infile1","infile2","infile_covariates","CRS_locs_WGS84","in_path","covar_names","qc_flags_stations","out_prefix")
139 142
names(list_param_prep)<-cnames
140 143

  
141 144
##### RUN SCRIPT TO GET STATION DATA WITH COVARIATES #####
......
200 203
                                "list_models","lst_avg","in_path","out_path","script_path",
201 204
                                "interpolation_method")
202 205

  
203
#Source file
204 206

  
205
#Make the function call
207
#Make the function call--names to be change to raster_prediction_obj and raster_prediction_fun
208

  
206 209
raster_prediction_gam_fus_obj <-raster_prediction_gam_fusion(list_param_raster_prediction)
207 210

  
208 211

  

Also available in: Unified diff