Project

General

Profile

« Previous | Next » 

Revision f45e920b

Added by Benoit Parmentier over 11 years ago

running Kriging CAI with modified screening of values

View differences:

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

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

  
......
48 48

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

  
51
#source(file.path(script_path,"master_script_temp_0762013.R")) #Master script can be run directly...
51
#source(file.path(script_path,"master_script_temp_08052013.R")) #Master script can be run directly...
52 52

  
53 53
#CALLED FROM MASTER SCRIPT:
54 54

  
......
56 56
clim_script <- file.path(script_path,"climatology_05312013.py") # LST climatology python script
57 57
grass_setting_script <- file.path(script_path,"grass-setup.R") #Set up system shell environment for python+GRASS
58 58
#source(file.path(script_path,"download_and_produce_MODIS_LST_climatology_06112013.R"))
59
source(file.path(script_path,"covariates_production_temperatures_07172013.R"))
59
source(file.path(script_path,"covariates_production_temperatures_08052013.R"))
60 60
source(file.path(script_path,"Database_stations_covariates_processing_function_06112013.R"))
61 61
source(file.path(script_path,"GAM_fusion_analysis_raster_prediction_multisampling_07302013.R"))
62
source(file.path(script_path,"results_interpolation_date_output_analyses_06112013.R"))
62
source(file.path(script_path,"results_interpolation_date_output_analyses_08052013.R"))
63 63
#source(file.path(script_path,"results_covariates_database_stations_output_analyses_04012013.R")) #to be completed
64 64

  
65 65
#FUNCTIONS CALLED FROM GAM ANALYSIS RASTER PREDICTION ARE FOUND IN...
......
78 78
met_stations_outfiles_obj_file<-"/data/project/layers/commons/data_workflow/output_data_365d_gam_fus_lst_test_run_07172013/met_stations_outfiles_obj_gam_fusion__365d_gam_fus_lst_test_run_07172013.RData"
79 79

  
80 80
var<-"TMAX" # variable being interpolated
81
out_prefix<-"_365d_gam_fus_lst_comb3_08022013"                #User defined output prefix
82
out_suffix<-"_OR_08022013"                                       #Regional suffix
81
out_prefix<-"_365d_kriging_cai_lst_comb3_08052013"                #User defined output prefix
82
out_suffix<-"_OR_08052013"                                       #Regional suffix
83 83
out_suffix_modis <-"_05302013"                       #pattern to find tiles produced previously     
84 84

  
85 85
#interpolation_method<-c("gam_fusion","gam_CAI","gam_daily") #other otpions to be added later
86 86
#interpolation_method<-c("gam_CAI") #other otpions to be added later
87
interpolation_method<-c("gam_fusion") #other otpions to be added later
87
#interpolation_method<-c("gam_fusion") #other otpions to be added later
88 88
#interpolation_method<-c("kriging_fusion") #other otpions to be added later
89 89
#interpolation_method<-c("gwr_fusion") #other otpions to be added later
90 90
#interpolation_method<-c("gwr_CAI") #other otpions to be added later
91
#interpolation_method<-c("kriging_CAI") 
91
interpolation_method<-c("kriging_CAI") 
92 92

  
93 93
#interpolation_method<-c("gam_daily") #other otpions to be added later
94 94
#interpolation_method<-c("kriging_daily") #other otpions to be added later
......
108 108
lc_path<-"/data/project/layers/commons/data_workflow/inputs/lc-consensus-global"
109 109
infile_modis_grid<-"/data/project/layers/commons/data_workflow/inputs/modis_grid/modis_sinusoidal_grid_world.shp" #modis grid tiling system, global
110 110
infile_elev<-"/data/project/layers/commons/data_workflow/inputs/dem-cgiar-srtm-1km-tif/srtm_1km.tif"  #elevation at 1km, global extent to be replaced by the new fused product 
111
infile_canheight<-"/data/project/layers/commons/data_workflow/inputs/treeheight-simard2011/Simard_Pinto_3DGlobalVeg_JGR.tif"         #Canopy height, global extent
111
#infile_canheight<-"/data/project/layers/commons/data_workflow/inputs/treeheight-simard2011/Simard_Pinto_3DGlobalVeg_JGR.tif"         #Canopy height, global extent
112
infile_canheight<-"/data/project/layers/commons/data_workflow/inputs/treeheight-simard2011/canheight_int.tif" #changed to INT4S
112 113
infile_distoc <- "/data/project/layers/commons/data_workflow/inputs/distance_to_coast/GMT_intermediate_coast_distance_01d_rev.tif" #distance to coast, global extent at 0.01 deg
113 114
#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
114 115
#infile_reg_outline=""  #input region outline defined by polygon: none for Venezuela
......
253 254
#LC1: Evergreen/deciduous needleleaf trees
254 255

  
255 256
#Combination 3: for paper baseline=s(lat,lon)+s(elev)
256
list_models<-c("y_var ~ s(lat,lon) + s(elev_s)",
257
              "y_var ~ s(lat,lon) + s(elev_s) + s(N_w)",
258
              "y_var ~ s(lat,lon) + s(elev_s) + s(E_w)",
259
              "y_var ~ s(lat,lon) + s(elev_s) + s(LST)",
260
              "y_var ~ s(lat,lon) + s(elev_s) + s(DISTOC)",
261
              "y_var ~ s(lat,lon) + s(elev_s) + s(LC1)",
262
              "y_var ~ s(lat,lon) + s(elev_s) + s(CANHGHT)",
263
              "y_var ~ s(lat,lon) + s(elev_s) + s(LST) + ti(LST,LC1)",
264
              "y_var ~ s(lat,lon) + s(elev_s) + s(LST) + ti(LST,CANHGHT)")
265

  
266
# list_models<-c("y_var ~ lat*lon + elev_s",
267
#               "y_var ~ lat*lon + elev_s + N_w",
268
#               "y_var ~ lat*lon + elev_s + E_w",
269
#               "y_var ~ lat*lon + elev_s + LST",
270
#               "y_var ~ lat*lon + elev_s + DISTOC",
271
#               "y_var ~ lat*lon + elev_s + LC1",
272
#               "y_var ~ lat*lon + elev_s + CANHGHT",
273
#               "y_var ~ lat*lon + elev_s + LST + I(LST*LC1)",
274
#               "y_var ~ lat*lon + elev_s + LST + I(LST*CANHGHT)")
257
# list_models<-c("y_var ~ s(lat,lon) + s(elev_s)",
258
#               "y_var ~ s(lat,lon) + s(elev_s) + s(N_w)",
259
#               "y_var ~ s(lat,lon) + s(elev_s) + s(E_w)",
260
#               "y_var ~ s(lat,lon) + s(elev_s) + s(LST)",
261
#               "y_var ~ s(lat,lon) + s(elev_s) + s(DISTOC)",
262
#               "y_var ~ s(lat,lon) + s(elev_s) + s(LC1)",
263
#               "y_var ~ s(lat,lon) + s(elev_s) + s(CANHGHT)",
264
#               "y_var ~ s(lat,lon) + s(elev_s) + s(LST) + ti(LST,LC1)",
265
#               "y_var ~ s(lat,lon) + s(elev_s) + s(LST) + ti(LST,CANHGHT)")
266

  
267
list_models<-c("y_var ~ lat*lon + elev_s",
268
              "y_var ~ lat*lon + elev_s + N_w",
269
              "y_var ~ lat*lon + elev_s + E_w",
270
              "y_var ~ lat*lon + elev_s + LST",
271
              "y_var ~ lat*lon + elev_s + DISTOC",
272
              "y_var ~ lat*lon + elev_s + LC1",
273
              "y_var ~ lat*lon + elev_s + CANHGHT",
274
              "y_var ~ lat*lon + elev_s + LST + I(LST*LC1)",
275
              "y_var ~ lat*lon + elev_s + LST + I(LST*CANHGHT)")
275 276

  
276 277
#Default name of LST avg to be matched               
277 278
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")  
......
291 292
############## STAGE 5: OUTPUT ANALYSES ##################
292 293

  
293 294
date_selected_results<-c("20100101") 
294

  
295
covar_obj<-load_obj("covar_obj__365d_kriging_cai_lst_comb3_07312013.RData")
296
raster_prediction_obj <- load_obj("raster_prediction_obj_kriging_CAI_dailyTmax_365d_kriging_cai_lst_comb3_07312013.RData")
295 297
list_param_results_analyses<-list(out_path,script_path,raster_prediction_obj,interpolation_method,
296
                                  infile_covariates,covar_names,date_selected_results,var,out_prefix)
298
                                  covar_obj,date_selected_results,var,out_prefix)
297 299
names(list_param_results_analyses)<-c("out_path","script_path","raster_prediction_obj","interpolation_method",
298
                     "infile_covariates","covar_names","date_selected_results","var","out_prefix")
300
                     "covar_obj","date_selected_results","var","out_prefix")
299 301
#plots_assessment_by_date<-function(j,list_param){
300 302
if (stages_to_run[5]==5){
301
  #source(file.path(script_path,"results_interpolation_date_output_analyses_05062013.R"))
303
  #source(file.path(script_path,"results_interpolation_date_output_analyses_08052013.R"))
302 304
  #Use lapply or mclapply
303 305
  summary_v_day <-plots_assessment_by_date(1,list_param_results_analyses)
304 306
  #Call as function...

Also available in: Unified diff