Project

General

Profile

« Previous | Next » 

Revision 9634f124

Added by Benoit Parmentier over 11 years ago

master script adding GAM CAI method and parameters for Venezuela region

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: 04/05/2013                                                                                 
13
#DATE: 04/21/2013                                                                                 
14 14

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

  
......
55 55
#/home/parmentier/Data/IPLANT_project/Venezuela_interpolation/Venezuela_01142013/climatology_03192013.py
56 56
source(file.path(script_path,"covariates_production_temperatures_03212013.R"))
57 57
source(file.path(script_path,"Database_stations_covariates_processing_function_04042013.R"))
58
source(file.path(script_path,"GAM_fusion_analysis_raster_prediction_multisampling_04052013.R"))
59
source(file.path(script_path,"results_interpolation_date_output_analyses_03272013.R"))
58
source(file.path(script_path,"GAM_fusion_analysis_raster_prediction_multisampling_04162013.R"))
59
#source(file.path(script_path,"results_interpolation_date_output_analyses_04162013.R"))
60 60
#source(file.path(script_path,"results_covariates_database_stations_output_analyses_04012013.R"))
61 61

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

  
64 64
source(file.path(script_path,"sampling_script_functions_03122013.R"))
65
source(file.path(script_path,"GAM_fusion_function_multisampling_04022013.R")) #Include GAM_CAI
66
source(file.path(script_path,"GAM_fusion_function_multisampling_validation_metrics_03272013.R"))
65
source(file.path(script_path,"GAM_fusion_function_multisampling_04162013.R")) #Include GAM_CAI
66
source(file.path(script_path,"GAM_fusion_function_multisampling_validation_metrics_04162013.R"))
67 67

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

  
......
76 76

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

  
84 84

  
85 85
lc_path<-"/home/layers/data/land-cover/lc-consensus-global"
......
87 87

  
88 88
infile_elev<-"/home/layers/data/terrain/dem-cgiar-srtm-1km-tif/srtm_1km.tif"  #this is the global file: replace later with the input produced by the DEM team
89 89
infile_canheight<-"/home/layers/data/land-cover/treeheight-simard2011/Simard_Pinto_3DGlobalVeg_JGR.tif"              #Canopy height
90
#list_tiles_modis <- c('h11v08','h11v07','h12v07','h12v08','h10v07','h10v08') #tile for Venezuel and surrounding area
91
list_tiles_modis <- c("h08v04","h09v04") #tiles for Oregon
90
list_tiles_modis <- c('h11v08','h11v07','h12v07','h12v08','h10v07','h10v08') #tile for Venezuel and surrounding area
91
#list_tiles_modis <- c("h08v04","h09v04") #tiles for Oregon
92 92

  
93
#infile_reg_outline=""  #input region outline defined by polygon: none for Venezuel
94
infile_reg_outline <- "OR83M_state_outline.shp"  #input region outline defined by polygon: Oregon
93
infile_reg_outline=""  #input region outline defined by polygon: none for Venezuel
94
#infile_reg_outline <- "OR83M_state_outline.shp"  #input region outline defined by polygon: Oregon
95 95

  
96
#CRS_interp<-"+proj=sinu +lon_0=0 +x_0=0 +y_0=0 +a=6371007.181 +b=6371007.181 +units=m +no_defs";
97
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";
96
CRS_interp<-"+proj=sinu +lon_0=0 +x_0=0 +y_0=0 +a=6371007.181 +b=6371007.181 +units=m +no_defs";
97
#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";
98 98

  
99 99
CRS_locs_WGS84<-CRS("+proj=longlat +ellps=WGS84 +datum=WGS84 +towgs84=0,0,0") #Station coords WGS84
100
out_region_name<-"_oregon_region" #generated on the fly
101
out_suffix<-"_OR_04042013"
102
#ref_rast_name<-""  #local raster name defining resolution, exent, local projection--. set on the fly??
103
ref_rast_name<-"mean_day244_rescaled.rst"  #local raster name defining resolution, exent: oregon
100
out_region_name<-"_venezuela_region" #generated on the fly
101
out_suffix<-"_VE_04162013"
102
ref_rast_name<-""  #local raster name defining resolution, exent, local projection--. set on the fly??
103
#ref_rast_name<-"mean_day244_rescaled.rst"  #local raster name defining resolution, exent: oregon
104 104

  
105 105
#The names of covariates can be changed...these names should be output/input from covar script!!!
106 106
rnames<-c("x","y","lon","lat","N","E","N_w","E_w","elev_s","slope","aspect","CANHEIGHT","DISTOC")
107
#lc_names<-c("LC1","LC2","LC3","LC4","LC5","LC6","LC7","LC8","LC9","LC10","LC11","LC12")
108
lc_names<-c("LC1","LC2","LC3","LC4","LC5","LC6","LC7","LC8","LC9","LC10") #use older version for continuity check to be changed
107
lc_names<-c("LC1","LC2","LC3","LC4","LC5","LC6","LC7","LC8","LC9","LC10","LC11","LC12")
108
#lc_names<-c("LC1","LC2","LC3","LC4","LC5","LC6","LC7","LC8","LC9","LC10") #use older version for continuity check to be changed
109 109
lst_names<-c("mm_01","mm_02","mm_03","mm_04","mm_05","mm_06","mm_07","mm_08","mm_09","mm_10","mm_11","mm_12",
110 110
             "nobs_01","nobs_02","nobs_03","nobs_04","nobs_05","nobs_06","nobs_07","nobs_08",
111 111
             "nobs_09","nobs_10","nobs_11","nobs_12")
......
131 131
#set up earlier
132 132
#var <- "TMIN"           # name of the variables to keep: TMIN, TMAX or PRCP --already set up earlier
133 133

  
134
#infile_covariates<-"covariates__venezuela_region__VE_01292013.tif" #this is an output from covariate script and used in stage 3 and stage 4
134
infile_covariates<-"covariates__venezuela_region__VE_01292013.tif" #this is an output from covariate script and used in stage 3 and stage 4
135 135
#infile_covariates<-"covariates__venezuela_region_TMIN__VE_03192013.tif" #covariates stack for TMIN
136
infile_covariates<- "covariates_Oregon_region_TMAX__OR_04052013.tif" #Oregon covar TMAX from earlier codes...for continuity
136
#infile_covariates<- "covariates_Oregon_region_TMAX__OR_04052013.tif" #Oregon covar TMAX from earlier codes...for continuity
137 137

  
138
CRS_locs_WGS84<-CRS("+proj=longlat +ellps=WGS84 +datum=WGS84 +towgs84=0,0,0") #Station coords WGS84: same as earlier
139
#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
138
#CRS_locs_WGS84<-CRS("+proj=longlat +ellps=WGS84 +datum=WGS84 +towgs84=0,0,0") #Station coords WGS84: same as earlier
139
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
140 140
#infile_reg_outline <- "OR83M_state_outline.shp"  #input region outline defined by polygon: Oregon
141
infile1 <-"OR83M_state_outline.shp" #remove this parameter!!!
141
#infile1 <-"OR83M_state_outline.shp" #remove this parameter!!!
142 142

  
143 143
#covar_names see stage 2
144 144

  
......
148 148
range_years_clim<-c("2000","2011") #right bound not included in the range!!
149 149
infile2<-"/home/layers/data/climate/ghcn/v2.92-upd-2012052822/ghcnd-stations.txt"                              #This is the textfile of station locations from GHCND
150 150
#in_path <- "/home/parmentier/Data/IPLANT_project/Venezuela_interpolation/Venezuela_01142013/input_data/"
151
out_prefix<-"_365d_GAM_fus5_all_lstd_04042013"                #User defined output prefix
152
#qc_flags_stations<-c("0","S")    #flags allowed for screening after the query from the GHCND??
153
qc_flags_stations<-c("0")   #flags allowed for screening after the query from the GHCND??
151
out_prefix<-"_365d_GAM_CAI_all_lst_04162013"                #User defined output prefix
152
qc_flags_stations<-c("0","S")    #flags allowed for screening after the query from the GHCND??
153
#qc_flags_stations<-c("0")   #flags allowed for screening after the query from the GHCND??
154 154

  
155 155
#list of 12 parameters for input in the function...
156 156

  
......
195 195
               "y_var ~ s(lat) + s(lon)+ s(elev_s)",
196 196
               "y_var ~ s(lat,lon,elev_s)",
197 197
               "y_var ~ s(lat,lon) + s(elev_s) + s(N_w,E_w) + s(LST)", 
198
               "y_var ~ s(lat,lon) + s(elev_s) + s(N_w,E_w) + s(LST) + s(LC1)",
199
               "y_var ~ s(lat,lon) + s(elev_s) + s(N_w,E_w) + s(LST) + s(LC2)", 
198
               "y_var ~ s(lat,lon) + s(elev_s) + s(N_w,E_w) + s(LST) + s(LC2)",
199
               "y_var ~ s(lat,lon) + s(elev_s) + s(N_w,E_w) + s(LST) + s(LC6)", 
200 200
               "y_var ~ s(lat,lon) + s(elev_s) + s(N_w,E_w) + s(LST) + s(DISTOC)")
201 201

  
202 202
#Choose interpolation method...
203
interpolation_method<-c("gam_fusion","gam_CAI") #other otpions to be added later
203
#interpolation_method<-c("gam_fusion","gam_CAI") #other otpions to be added later
204
interpolation_method<-c("gam_CAI") #other otpions to be added later
205

  
204 206

  
205 207
#Default name of LST avg to be matched               
206 208
lst_avg<-c("mm_01","mm_02","mm_03","mm_04","mm_05","mm_06","mm_07","mm_08","mm_09","mm_10","mm_11","mm_12")  
......
222 224
                                "interpolation_method")
223 225

  
224 226

  
225
#Make the function call--names to be change to raster_prediction_obj and raster_prediction_fun
226

  
227
raster_prediction_gam_fus_obj <-raster_prediction_gam_fusion(list_param_raster_prediction)
227
raster_prediction_obj <-raster_prediction_fun(list_param_raster_prediction)
228 228

  
229 229

  
230 230
############## STAGE 5: OUTPUT ANALYSES ##################

Also available in: Unified diff