Project

General

Profile

« Previous | Next » 

Revision a2f26ded

Added by Benoit Parmentier over 11 years ago

adding gwr fusion method, modifications raster prediction function

View differences:

climate/research/oregon/interpolation/GAM_fusion_analysis_raster_prediction_multisampling.R
8 8
#2)Constant sampling: use the same sample over the runs
9 9
#3)over dates: run over for example 365 dates without mulitsampling
10 10
#4)use seed number: use seed if random samples must be repeatable
11
#5)possibilty of running GAM+FUSION or GAM+CAI and other options added
12
#The interpolation is done first at the monthly time scale then delta surfaces are added.
11
#5)possibilty of running single and multiple time scale methods:
12
   # gam_daily, kriging_daily,gwr_daily,gam_CAI,gam_fusion,kriging_fusion,gwr_fusion and other options added.
13
#For multiple time scale methods, the interpolation is done first at the monthly time scale then delta surfaces are added.
13 14
#AUTHOR: Benoit Parmentier                                                                        
14
#DATE: 07/26/2013                                                                                 
15
#DATE: 07/30/2013                                                                                 
15 16
#PROJECT: NCEAS INPLANT: Environment and Organisms --TASK#568--     
16 17
#
17 18
# TO DO:
18
# 1) modify to make it general for any method i.e. make call to method e.g. gam_fus, gam_cai etc.
19
# 2) simplify and bundle validation steps, make it general--method_mod_validation
20
# 3) solve issues with log file recordings
21
# 4) output location folder on the fly???
19
#Add methods to for CAI
22 20

  
23 21
###################################################################################################
24 22

  
......
27 25
  ##Function to predict temperature interpolation with 21 input parameters
28 26
  #9 parameters used in the data preparation stage and input in the current script
29 27
  #1)list_param_data_prep: used in earlier code for the query from the database and extraction for raster brick
30
  #2)infile_monthly:
31
  #3)infile_daily
32
  #4)infile_locs:
28
  #2)infile_monthly: monthly averages with covariates for GHCND stations obtained after query
29
  #3)infile_daily: daily GHCND stations with covariates, obtained after query
30
  #4)infile_locs: vector file with station locations for the processing/study area (ESRI shapefile)
33 31
  #5)infile_covariates: raster covariate brick, tif file
34 32
  #6)covar_names: covar_names #remove at a later stage...
35 33
  #7)var: variable being interpolated-TMIN or TMAX
......
197 195
    clim_yearlist<-list_tmp
198 196
  }
199 197
  
200
  
198
  #to be added gwr_CAI and kriging_CAI
201 199
  if (interpolation_method=="gam_CAI"){
202 200
    list_param_runClim_KGCAI<-list(j,s_raster,covar_names,lst_avg,list_models,dst,var,y_var_name, out_prefix,out_path)
203 201
    names(list_param_runClim_KGCAI)<-c("list_index","covar_rast","covar_names","lst_avg","list_models","dst","var","y_var_name","out_prefix","out_path")
......
230 228
      file=log_fname,sep="\n")
231 229
  
232 230
  #TODO : Same call for all functions!!! Replace by one "if" for all multi time scale methods...
233
  if (interpolation_method %in% c("gam_CAI","gam_fusion","kriging_fusion")){
231
  #The methods could be defined earlier as constant??
232
  if (interpolation_method %in% c("gam_CAI","gam_fusion","kriging_fusion","gwr_fusion")){
234 233
    #input a list:note that ghcn.subsets is not sampling_obj$data_day_ghcn
235 234
    i<-1
236 235
    list_param_run_prediction_daily_deviation <-list(i,clim_yearlist,sampling_obj,dst,var,y_var_name, interpolation_method,out_prefix,out_path)

Also available in: Unified diff