Project

General

Profile

« Previous | Next » 

Revision ca16094e

Added by Benoit Parmentier over 11 years ago

gam day additional screening for model comparison, paper OR

View differences:

climate/research/oregon/interpolation/interpolation_method_day_function_multisampling.R
236 236
}
237 237

  
238 238
####
239
#TODO:
239
#TODO:Should use interp_day_fun!!
240 240
#Add log file and calculate time and sizes for processes-outputs
241 241
runGAM_day_fun <-function(i,list_param){
242 242

  
......
274 274
  interpolation_method <-list_param$interpolation_method
275 275
  out_prefix<-list_param$out_prefix
276 276
  out_path<-list_param$out_path
277
  
277
  screen_data_training<-list_param$screen_data_training
278 278

  
279 279
  ghcn.subsets<-sampling_obj$ghcn_data_day
280 280
  sampling_dat <- sampling_obj$sampling_dat
......
357 357
  
358 358
  list_formulas<-lapply(list_models,as.formula,env=.GlobalEnv) #mulitple arguments passed to lapply!!
359 359
  
360
  mod_list<-fit_models(list_formulas,data_s) #only gam at this stage
360
  if(screen_data_training==TRUE){
361
    col_names <-unlist(lapply(list_formulas,all.vars)) #extract all covariates names used in the models
362
    col_names<-unique(col_names)
363
    data_fit <- remove_na_spdf(col_names,data_s)
364
  }else{
365
    data_fit <- data_s
366
  }
367
  mod_list<-fit_models(list_formulas,data_fit) #only gam at this stage
368
  #mod_list<-fit_models(list_formulas,data_s) #only gam at this stage
361 369
  cname<-paste("mod",1:length(mod_list),sep="") #change to more meaningful name?
362 370
  names(mod_list)<-cname
363 371
  
......
697 705
  #now fit and predict values for raster image...
698 706
  
699 707
  if (interpolation_method=="gam_daily"){
700
    mod_list<-fit_models(list_formulas,data_s) #only gam at this stage
708
    if(screen_data_training==TRUE){
709
      col_names <-unlist(lapply(list_formulas,all.vars)) #extract all covariates names used in the models
710
      col_names<-unique(col_names)
711
      data_fit <- remove_na_spdf(col_names,data_s)
712
    }else{
713
      data_fit <- data_s
714
    }
715
    #mod_list<-fit_models(list_formulas,data_s) #only gam at this stage
716
    mod_list<-fit_models(list_formulas,data_fit) #only gam at this stage
701 717
    names(mod_list)<-cname
702 718
    rast_day_list<-predict_raster_model(mod_list,s_raster,list_out_filename)
703 719
    names(rast_day_list)<-cname

Also available in: Unified diff