Project

General

Profile

« Previous | Next » 

Revision d214f9c8

Added by Benoit Parmentier almost 9 years ago

raster prediction stage 4 modifying and debugging to avoid duplication of climatology step

View differences:

climate/research/oregon/interpolation/GAM_fusion_analysis_raster_prediction_multisampling.R
13 13
#For multiple time scale methods, the interpolation is done first at the monthly time scale then delta surfaces are added.
14 14
#AUTHOR: Benoit Parmentier                                                                        
15 15
#CREATED ON: 04/01/2013  
16
#MODIFIED ON: 12/21/2015  
16
#MODIFIED ON: 12/29/2015  
17 17
#PROJECT: NCEAS INPLANT: Environment and Organisms --TASK#568--     
18 18
#
19 19
# TO DO:
......
268 268
  if (interpolation_method %in% c("gam_fusion","kriging_fusion","gwr_fusion")){
269 269
    clim_method_mod_obj_file <- file.path(out_path_clim,paste(interpolation_method,"_mod_",y_var_name,out_prefix,".RData",sep=""))
270 270
    if(!file.exists(clim_method_mod_obj_file)){
271
      list_param_runClim_KGFusion<-list(j,s_raster,covar_names,lst_avg,list_models,dst,sampling_month_obj,var,y_var_name, out_prefix,out_path)
271
      list_param_runClim_KGFusion<-list(j,s_raster,covar_names,lst_avg,list_models,dst,sampling_month_obj,var,y_var_name, out_prefix,out_path_clim)
272 272
      names(list_param_runClim_KGFusion)<-c("list_index","covar_rast","covar_names","lst_avg","list_models","dst","sampling_month_obj","var","y_var_name","out_prefix","out_path")
273 273
      #debug(runClim_KGFusion)
274 274
      #test<-runClim_KGFusion(1,list_param=list_param_runClim_KGFusion)
275 275
      clim_method_mod_obj<-mclapply(1:length(sampling_month_obj$ghcn_data), list_param=list_param_runClim_KGFusion, runClim_KGFusion,mc.preschedule=FALSE,mc.cores = num_cores) #This is the end bracket from mclapply(...) statement
276 276
    
277
      save(clim_method_mod_obj,file= file.path(out_path,paste(interpolation_method,"_mod_",y_var_name,out_prefix,".RData",sep="")))
277
      save(clim_method_mod_obj,file= file.path(out_path_clim,paste(interpolation_method,"_mod_",y_var_name,out_prefix,".RData",sep="")))
278 278
      #Use function to extract list
279 279
    }else{
280 280
      clim_method_mod_obj <- load_obj(clim_method_mod_obj_file) #load the existing file
......
294 294
    clim_method_mod_obj_file <- file.path(out_path_clim,paste(interpolation_method,"_mod_",y_var_name,out_prefix,".RData",sep=""))
295 295
    if(!file.exists(clim_method_mod_obj_file)){
296 296
      num_cores2 = as.integer(num_cores) + 2
297
      list_param_runClim_KGCAI<-list(j,s_raster,covar_names,lst_avg,list_models,dst,sampling_month_obj,var,y_var_name, out_prefix,out_path)
297
      list_param_runClim_KGCAI<-list(j,s_raster,covar_names,lst_avg,list_models,dst,sampling_month_obj,var,y_var_name, out_prefix,out_path_clim)
298 298
      names(list_param_runClim_KGCAI)<-c("list_index","covar_rast","covar_names","lst_avg","list_models","dst","sampling_month_obj","var","y_var_name","out_prefix","out_path")
299 299
      clim_method_mod_obj<-mclapply(1:length(sampling_month_obj$ghcn_data), list_param=list_param_runClim_KGCAI, runClim_KGCAI,mc.preschedule=FALSE,mc.cores = num_cores2) #This is the end bracket from mclapply(...) statement
300 300
      #test<-runClim_KGCAI(1,list_param=list_param_runClim_KGCAI)
301 301

  
302
      save(clim_method_mod_obj,file= file.path(out_path,paste(interpolation_method,"_mod_",y_var_name,out_prefix,".RData",sep="")))
302
      save(clim_method_mod_obj,file= file.path(out_path_clim,paste(interpolation_method,"_mod_",y_var_name,out_prefix,".RData",sep="")))
303 303
    }else{
304 304
      clim_method_mod_obj <- load_obj(clim_method_mod_obj_file) #load the existing file
305 305
    }

Also available in: Unified diff