Revision 7f46c991
Added by Benoit Parmentier over 11 years ago
climate/research/oregon/interpolation/master_script_temp.R | ||
---|---|---|
10 | 10 |
#STAGE 5: Output analyses: assessment of results for specific dates... |
11 | 11 |
# |
12 | 12 |
#AUTHOR: Benoit Parmentier |
13 |
#DATE: 06/20/2013
|
|
13 |
#DATE: 06/28/2013
|
|
14 | 14 |
|
15 | 15 |
#PROJECT: NCEAS INPLANT: Environment and Organisms --TASK#363, TASK$568-- |
16 | 16 |
|
... | ... | |
35 | 35 |
library(fields) # NCAR Spatial Interpolation methods such as kriging, splines |
36 | 36 |
library(raster) # Hijmans et al. package for raster processing |
37 | 37 |
library(rasterVis) |
38 |
library(spgwr) |
|
38 | 39 |
library(reshape) |
39 | 40 |
library(plotrix) |
40 | 41 |
|
... | ... | |
52 | 53 |
modis_download_script <- file.path(script_path,"modis_download_05142013.py") # LST modis download python script |
53 | 54 |
clim_script <- file.path(script_path,"climatology_05312013.py") # LST climatology python script |
54 | 55 |
grass_setting_script <- file.path(script_path,"grass-setup.R") #Set up system shell environment for python+GRASS |
55 |
source(file.path(script_path,"download_and_produce_MODIS_LST_climatology_05302013.R"))
|
|
56 |
#source(file.path(script_path,"download_and_produce_MODIS_LST_climatology_06112013.R"))
|
|
56 | 57 |
source(file.path(script_path,"covariates_production_temperatures_06272013.R")) |
57 |
source(file.path(script_path,"Database_stations_covariates_processing_function_05212013.R"))
|
|
58 |
source(file.path(script_path,"Database_stations_covariates_processing_function_06112013.R"))
|
|
58 | 59 |
source(file.path(script_path,"GAM_fusion_analysis_raster_prediction_multisampling_06082013.R")) |
59 |
source(file.path(script_path,"results_interpolation_date_output_analyses_06102013.R"))
|
|
60 |
source(file.path(script_path,"results_interpolation_date_output_analyses_06112013.R"))
|
|
60 | 61 |
#source(file.path(script_path,"results_covariates_database_stations_output_analyses_04012013.R")) #to be completed |
61 | 62 |
|
62 | 63 |
#FUNCTIONS CALLED FROM GAM ANALYSIS RASTER PREDICTION ARE FOUND IN... |
63 | 64 |
|
64 | 65 |
source(file.path(script_path,"sampling_script_functions_03122013.R")) |
65 |
source(file.path(script_path,"GAM_fusion_function_multisampling_05212013.R")) #Include GAM_CAI
|
|
66 |
source(file.path(script_path,"GAM_fusion_function_multisampling_06112013.R")) #Include GAM_CAI
|
|
66 | 67 |
source(file.path(script_path,"interpolation_method_day_function_multisampling_06082013.R")) #Include GAM_day |
67 | 68 |
source(file.path(script_path,"GAM_fusion_function_multisampling_validation_metrics_05062013.R")) |
68 | 69 |
|
... | ... | |
70 | 71 |
stages_to_run<-c(0,2,3,4,5) #May decide on antoher strategy later on... |
71 | 72 |
|
72 | 73 |
var<-"TMAX" # variable being interpolated |
73 |
out_prefix<-"_365d_gwr_day_lst_06192013" #User defined output prefix
|
|
74 |
out_suffix<-"_OR_06192013"
|
|
74 |
out_prefix<-"_365d_gam_fus_lst_06282013" #User defined output prefix
|
|
75 |
out_suffix<-"_OR_06282013"
|
|
75 | 76 |
out_suffix_modis <-"_05302013" #use tiles produce previously |
76 | 77 |
|
77 | 78 |
#interpolation_method<-c("gam_fusion","gam_CAI","gam_daily") #other otpions to be added later |
78 | 79 |
#interpolation_method<-c("gam_CAI") #other otpions to be added later |
79 |
#interpolation_method<-c("gam_fusion") #other otpions to be added later
|
|
80 |
interpolation_method<-c("gam_fusion") #other otpions to be added later |
|
80 | 81 |
#interpolation_method<-c("gam_daily") #other otpions to be added later |
81 | 82 |
#interpolation_method<-c("kriging_daily") #other otpions to be added later |
82 |
interpolation_method<-c("gwr_daily") #other otpions to be added later |
|
83 |
#interpolation_method<-c("gwr_daily") #other otpions to be added later
|
|
83 | 84 |
|
84 | 85 |
#out_path <- paste("/home/parmentier/Data/IPLANT_project/Venezuela_interpolation/Venezuela_01142013/output_data", |
85 | 86 |
# out_prefix,"/",sep="") |
... | ... | |
101 | 102 |
#infile_reg_outline<- "/home/parmentier/Data/IPLANT_project/Venezuela_interpolation/Venezuela_01142013/outline_venezuela_region__VE_01292013.shp" |
102 | 103 |
#infile_covariates<-"/home/parmentier/Data/IPLANT_project/Venezuela_interpolation/Venezuela_01142013/covariates__venezuela_region_TMIN__VE_03192013.tif" #covariates stack for TMIN |
103 | 104 |
#infile_covariates<- "/home/parmentier/Data/IPLANT_project/Venezuela_interpolation/Venezuela_01142013/covariates_Oregon_region_TMAX__OR_04052013.tif" #Oregon covar TMAX from earlier codes...for continuity |
104 |
infile_reg_outline="" #input region outline defined by polygon: none for Venezuela |
|
105 |
#infile_reg_outline="" #input region outline defined by polygon: none for Venezuela
|
|
105 | 106 |
#This is the shape file of outline of the study area #It is an input/output of the covariate script |
106 |
#infile_reg_outline <- "/home/parmentier/Data/IPLANT_project/Oregon_interpolation/Oregon_03142013/OR83M_state_outline.shp" #input region outline defined by polygon: Oregon |
|
107 |
#infile_reg_outline <-"OR83M_state_outline.shp" #remove this parameter!!! |
|
108 |
ref_rast_name<-"" #local raster name defining resolution, exent, local projection--. set on the fly?? |
|
107 |
infile_reg_outline <- "/home/parmentier/Data/IPLANT_project/Oregon_interpolation/Oregon_03142013/OR83M_state_outline.shp" #input region outline defined by polygon: Oregon |
|
108 |
#ref_rast_name<-"" #local raster name defining resolution, exent, local projection--. set on the fly?? |
|
109 | 109 |
#this may be redundant with infile_reg_outline |
110 |
#ref_rast_name<-"/home/parmentier/Data/IPLANT_project/Oregon_interpolation/Oregon_03142013/mean_day244_rescaled.rst" #local raster name defining resolution, exent: oregon
|
|
110 |
ref_rast_name<-"/home/parmentier/Data/IPLANT_project/Oregon_interpolation/Oregon_03142013/mean_day244_rescaled.rst" #local raster name defining resolution, exent: oregon |
|
111 | 111 |
buffer_dist<-0 #not in use yet, must change climatology step to make sure additional tiles are downloaded and LST averages |
112 | 112 |
#must also be calculated for neighbouring tiles. |
113 | 113 |
|
... | ... | |
116 | 116 |
#list_tiles_modis <- c("h11v08,h11v07,h12v07,h12v08,h10v07,h10v08") #tile for Venezuela and surrounding area |
117 | 117 |
list_tiles_modis <- c("h08v04,h09v04") #tiles for Oregon |
118 | 118 |
|
119 |
CRS_interp<-"+proj=sinu +lon_0=0 +x_0=0 +y_0=0 +a=6371007.181 +b=6371007.181 +units=m +no_defs"; |
|
120 |
#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";
|
|
119 |
#CRS_interp<-"+proj=sinu +lon_0=0 +x_0=0 +y_0=0 +a=6371007.181 +b=6371007.181 +units=m +no_defs";
|
|
120 |
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"; |
|
121 | 121 |
#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"; |
122 | 122 |
|
123 | 123 |
#"+proj=lcc +lat_1=43 +lat_2=45.5 +lat_0=41.75 +lon_0=-120.5 +x_0=400000 +y_0=0 +datum=NAD83 +units=m +no_defs +ellps=GRS80" |
... | ... | |
135 | 135 |
covar_names<-c(rnames,lc_names,lst_names) |
136 | 136 |
|
137 | 137 |
list_val_range <-c("lon,-180,180","lat,-90,90","N,-1,1","E,-1,1","N_w,-1,1","E_w,-1,1","elev_s,0,6000","slope,0,90", |
138 |
"aspect,0,360","DISTOC,-0,10000000","CANHEIGHT,0,255","LC1,0,100","LC3,0,100","mm_01,-15,50",
|
|
138 |
"aspect,0,360","DISTOC,-0,10000000","CANHEIGHT,0,255","LC2,0,100","LC6,0,100","mm_01,-15,50",
|
|
139 | 139 |
"mm_02,-15,50","mm_03,-15,50","mm_04,-15,50","mm_05,-15,50","mm_06,-15,50","mm_07,-15,50", |
140 | 140 |
"mm_08,-15,50","mm_09,-15,50","mm_10,-15,50","mm_11,-15,50","mm_12,-15,50") |
141 | 141 |
|
... | ... | |
237 | 237 |
|
238 | 238 |
#Models to run...this can be change for each run |
239 | 239 |
|
240 |
list_models<-c("y_var ~ elev_s", |
|
241 |
"y_var ~ LST", |
|
242 |
"y_var ~ elev_s*LST") |
|
240 |
list_models<-c("y_var ~ s(elev_s)", |
|
241 |
"y_var ~ s(LST)", |
|
242 |
"y_var ~ s(elev_s,LST)", |
|
243 |
"y_var ~ s(lat) + s(lon)+ s(elev_s)", |
|
244 |
"y_var ~ s(lat,lon,elev_s)", |
|
245 |
"y_var ~ s(lat,lon) + s(elev_s) + s(N_w,E_w) + s(LST)", |
|
246 |
"y_var ~ s(lat,lon) + s(elev_s) + s(N_w,E_w) + s(LST) + s(LC2)", |
|
247 |
"y_var ~ s(lat,lon) + s(elev_s) + s(N_w,E_w) + s(LST) + s(LC6)", |
|
248 |
"y_var ~ s(lat,lon) + s(elev_s) + s(N_w,E_w) + s(LST) + s(DISTOC)") |
|
249 |
|
|
250 |
#list_models<-c("y_var ~ elev_s", |
|
251 |
# "y_var ~ LST", |
|
252 |
# "y_var ~ elev_s*LST") |
|
243 | 253 |
# "y_var ~ lat + lon + elev_s", |
244 | 254 |
# "y_var ~ lat*lon*elev_s", |
245 | 255 |
# "y_var ~ lat*lon + elev_s + N_w*E_w + LST", |
Also available in: Unified diff
testing screening using GAM predictions in Oregon