Project

General

Profile

« Previous | Next » 

Revision 6193eb79

Added by Benoit Parmentier about 10 years ago

scaling up assessment part 1, Asia, overlap with 10x30 degrees tiles

View differences:

climate/research/oregon/interpolation/global_run_scalingup_assessment_part1.R
5 5
#Part 1 create summary tables and inputs for figure in part 2 and part 3.
6 6
#AUTHOR: Benoit Parmentier 
7 7
#CREATED ON: 03/23/2014  
8
#MODIFIED ON: 10/04/2014            
8
#MODIFIED ON: 10/21/2014            
9 9
#Version: 3
10 10
#PROJECT: Environmental Layers project  
11 11
#TO DO:
......
46 46
#Additional libraries not used in workflow
47 47
library(pgirmess)                            # Krusall Wallis test with mulitple options, Kruskalmc {pgirmess}  
48 48
library(colorRamps)
49

  
49
  
50 50
#### FUNCTION USED IN SCRIPT
51

  
51
  
52 52
function_analyses_paper1 <-"contribution_of_covariates_paper_interpolation_functions_07182014.R" #first interp paper
53 53
function_analyses_paper2 <-"multi_timescales_paper_interpolation_functions_08132014.R"
54

  
54
  
55 55
load_obj <- function(f)
56 56
{
57 57
  env <- new.env()
58 58
  nm <- load(f, env)[1]
59 59
  env[[nm]]
60 60
}
61

  
61
  
62 62
create_dir_fun <- function(out_dir,out_suffix){
63 63
  if(!is.null(out_suffix)){
64 64
    out_name <- paste("output_",out_suffix,sep="")
......
459 459

  
460 460
#in_dir1 <- "/data/project/layers/commons/NEX_data/test_run1_03232014/output" #On Atlas
461 461
#in_dir1 <- "/nobackupp4/aguzman4/climateLayers/output20Deg2/"
462
in_dir1 <-"/nobackupp4/aguzman4/climateLayers/output20Deg_75overlap/reg4"
462
#in_dir1 <-"/nobackupp4/aguzman4/climateLayers/output20Deg_75overlap/reg4"
463
in_dir1 <- "/nobackupp4/aguzman4/climateLayers/output1000x3000_km/"
463 464
#/nobackupp4/aguzman4/climateLayers/output10Deg/reg1/finished.txt
464 465
in_dir_list <- list.dirs(path=in_dir1,recursive=FALSE) #get the list regions processed for this run
465
in_dir_list_all <- in_dir_list
466
#if(basename(in_dir_list)[[1]]=="reg?") #add later
467
in_dir_list_all  <- lapply(in_dir_list,function(x){list.dirs(path=x,recursive=F)})
468
#in_dir_list_all <- in_dir_list
466 469
#in_dir_list <- list.dirs(path=in_dir_reg,recursive=FALSE) #get the list of tiles/directories with outputs 
470
in_dir_list <- unlist(in_dir_list_all[c(2)]) #only region 3 has informatation at this stage
467 471

  
468 472
#in_dir_list <- in_dir_list[grep("bak",basename(basename(in_dir_list)),invert=TRUE)] #the first one is the in_dir1
469
in_dir_subset <- in_dir_list[grep("subset",basename(in_dir_reg),invert=FALSE)] #select directory with shapefiles...
473
in_dir_subset <- in_dir_list[grep("subset",basename(in_dir_list),invert=FALSE)] #select directory with shapefiles...
470 474
in_dir_shp <- file.path(in_dir_subset,"shapefiles")
471 475

  
472 476
#select only directories used for predictions
473 477
in_dir_reg <- in_dir_list[grep(".*._.*.",basename(in_dir_list),invert=FALSE)] #select directory with shapefiles...
474
in_dir_reg <- in_dir_list[grep("july_tiffs",basename(in_dir_reg),invert=TRUE)] #select directory with shapefiles...
478
#in_dir_reg <- in_dir_list[grep("july_tiffs",basename(in_dir_reg),invert=TRUE)] #select directory with shapefiles...
475 479
in_dir_list <- in_dir_reg
476 480
#Models used.
477 481
#list_models<-c("y_var ~ s(lat,lon,k=4) + s(elev_s,k=3) + s(LST,k=3)",
......
493 497
# the last directory contains shapefiles 
494 498
y_var_name <- "dailyTmax"
495 499
interpolation_method <- c("gam_CAI")
496
out_prefix<-"run7_global_analyses_10042014"
500
out_prefix<-"run8_global_analyses_10212014"
497 501

  
498 502
#out_dir<-"/data/project/layers/commons/NEX_data/" #On NCEAS Atlas
499 503
out_dir <- "/nobackup/bparmen1/" #on NEX
......
704 708
list_shp_world <- list.files(path=in_dir_shp,pattern=".*.shp",full.names=T)
705 709
l_shp <- unlist(lapply(1:length(list_shp_world),
706 710
                       FUN=function(i){paste(strsplit(list_shp_world[i],"_")[[1]][3:4],collapse="_")}))
707

  
711
l_shp <- gsub(".shp","",l_shp)
708 712
matching_index <- match(basename(in_dir_list),l_shp)
709 713
list_shp_reg_files <- list_shp_world[matching_index]
710 714
df_tile_processed$shp_files <-list_shp_world[matching_index]
......
1004 1008
### This assumes the tree structure has been replicated on Atlas:
1005 1009
#for i in 1:length(df_tiled_processed$tile_coord)
1006 1010
#output_atlas_dir <- "/data/project/layers/commons/NEX_data/output_run3_global_analyses_06192014/output10Deg/reg1"
1007
output_atlas_dir <- "/data/project/layers/commons/NEX_data/output_run5_global_analyses_08252014/output20Deg"
1011
#output_atlas_dir <- "/data/project/layers/commons/NEX_data/output_run5_global_analyses_08252014/output20Deg"
1012
output_atlas_dir <- "/data/project/layers/commons/NEX_data/output_run8_global_analyses_10212014"
1008 1013
#Make directories on ATLAS
1009 1014
#for (i in 1:length(df_tile_processed$tile_coord)){
1010 1015
#  create_dir_fun(file.path(output_atlas_dir,as.character(df_tile_processed$tile_coord[i])),out_suffix=NULL)

Also available in: Unified diff