Project

General

Profile

« Previous | Next » 

Revision 17673d6a

Added by Benoit Parmentier over 9 years ago

scaling up assessment part2, South America with additional tiles, figures and analyses

View differences:

climate/research/oregon/interpolation/global_run_scalingup_assessment_part2.R
1
##############################  INTERPOLATION OF TEMPERATURES  #######################################
1
  ##############################  INTERPOLATION OF TEMPERATURES  #######################################
2 2
#######################  Script for assessment of scaling up on NEX : part2 ##############################
3 3
#This script uses the worklfow code applied to the globe. Results currently reside on NEX/PLEIADES NASA.
4 4
#Accuracy methods are added in the the function scripts to evaluate results.
5 5
#Analyses, figures, tables and data are also produced in the script.
6 6
#AUTHOR: Benoit Parmentier 
7 7
#CREATED ON: 03/23/2014  
8
#MODIFIED ON: 05/13/2015            
8
#MODIFIED ON: 05/26/2015            
9 9
#Version: 4
10 10
#PROJECT: Environmental Layers project     
11 11
#COMMENTS: analyses for run 10 global analyses,all regions 1500x4500km with additional tiles to increase overlap 
......
381 381
interpolation_method <- c("gam_CAI") #PARAM2
382 382
#out_suffix<-"run10_global_analyses_01282015"
383 383
#out_suffix <- "output_run10_1000x3000_global_analyses_02102015"
384
out_suffix <- "run10_1500x4500_global_analyses_pred_2003_05122015" #PARAM3
385
out_dir <- "/data/project/layers/commons/NEX_data/output_run10_1500x4500_global_analyses_pred_2003_05122015" #PARAM4
384
out_suffix <- "run10_1500x4500_global_analyses_pred_2010_05262015" #PARAM3
385
out_dir <- "/data/project/layers/commons/NEX_data/output_run10_1500x4500_global_analyses_pred_2010_05262015" #PARAM4
386 386
create_out_dir_param <- FALSE #PARAM 5
387 387

  
388 388
mosaic_plot <- FALSE #PARAM6
389 389

  
390 390
#if daily mosaics NULL then mosaicas all days of the year
391 391

  
392
day_to_mosaic <- c("20030101","20030102","20030103","20030104","20030105",
393
                   "20030301","20030302","20030303","20030304","20030305",
394
                   "20030501","20030502","20030503","20030504","20030505",
395
                   "20030701","20030702","20030703","20030704","20030705",
396
                   "20030901","20030902","20030903","20030904","20030905",
397
                   "20031101","20031102","20031103","20031104","20031105") #PARAM7
392
day_to_mosaic <- c("20100829","20100830","20100831",
393
                   "20100901","20100902","20100903")
398 394

  
399
  
400
#CRS_locs_WGS84 <- CRS("+proj=longlat +ellps=WGS84 +datum=WGS84 +towgs84=0,0,0") #Station coords WGS84
401 395
CRS_WGS84 <- CRS("+proj=longlat +ellps=WGS84 +datum=WGS84 +towgs84=0,0,0") #Station coords WGS84 #CONSTANT1
402 396
CRS_locs_WGS84<-CRS("+proj=longlat +ellps=WGS84 +datum=WGS84 +towgs84=0,0,0") #Station coords WGS84
403 397

  
......
471 465

  
472 466
summary_metrics_v_all <- summary_metrics_v 
473 467
#deal with additional tiles...
474
if(reg_modified==T){
475
  
476
  summary_metrics_v_tmp <- summary_metrics_v
477
  #summary_metrics_v_tmp$reg[summary_metrics_v_tmp$reg=="reg_1b"] <- "reg1"
478
  #summary_metrics_v_tmp$reg[summary_metrics_v_tmp$reg=="reg_1c"] <- "reg1"
479
  #summary_metrics_v_tmp$reg[summary_metrics_v_tmp$reg=="reg_3b"] <- "reg3"
480
  summary_metrics_v_tmp$reg[summary_metrics_v_tmp$reg=="reg5b"] <- "reg5"
481

  
482
  summary_metrics_v_tmp$reg_all <- summary_metrics_v$reg
483
  ###
484
  summary_metrics_v<- summary_metrics_v_tmp
485
  
486
  ###
487
  tb_tmp <- tb
488
  #tb_tmp$reg[tb_tmp$reg=="reg_1b"] <- "reg1"
489
  #tb_tmp$reg[tb_tmp$reg=="reg_1c"] <- "reg1"
490
  #tb_tmp$reg[tb_tmp$reg=="reg_3b"] <- "reg3"
491
  tb_tmp$reg[tb_tmp$reg=="reg5b"] <- "reg5"
492

  
493
  ###
494
  tb <- tb_tmp
495
}
468
# if(reg_modified==T){
469
#   
470
#   summary_metrics_v_tmp <- summary_metrics_v
471
#   #summary_metrics_v_tmp$reg[summary_metrics_v_tmp$reg=="reg_1b"] <- "reg1"
472
#   #summary_metrics_v_tmp$reg[summary_metrics_v_tmp$reg=="reg_1c"] <- "reg1"
473
#   #summary_metrics_v_tmp$reg[summary_metrics_v_tmp$reg=="reg_3b"] <- "reg3"
474
#   summary_metrics_v_tmp$reg[summary_metrics_v_tmp$reg=="reg5b"] <- "reg5"
475
# 
476
#   summary_metrics_v_tmp$reg_all <- summary_metrics_v$reg
477
#   ###
478
#   summary_metrics_v<- summary_metrics_v_tmp
479
#   
480
#   ###
481
#   tb_tmp <- tb
482
#   #tb_tmp$reg[tb_tmp$reg=="reg_1b"] <- "reg1"
483
#   #tb_tmp$reg[tb_tmp$reg=="reg_1c"] <- "reg1"
484
#   #tb_tmp$reg[tb_tmp$reg=="reg_3b"] <- "reg3"
485
#   tb_tmp$reg[tb_tmp$reg=="reg5b"] <- "reg5"
486
# 
487
#   ###
488
#   tb <- tb_tmp
489
# }
496 490

  
497 491
table(summary_metrics_v_all$reg)
498 492
table(summary_metrics_v$reg)
......
823 817
}
824 818

  
825 819
## Number of tiles with information:
826
sum(df_tile_processed$metrics_v) #20,number of tiles with raster object
827
length(df_tile_processed$metrics_v) #25,number of tiles in the region
820
sum(df_tile_processed$metrics_v) #26,number of tiles with raster object
821
length(df_tile_processed$metrics_v) #26,number of tiles in the region
828 822
sum(df_tile_processed$metrics_v)/length(df_tile_processed$metrics_v) #80 of tiles with info
829 823

  
830 824
#coordinates
......
1071 1065
#           pattern=paste("^world_mosaics.*.tif$",sep=""),full.names=T) 
1072 1066

  
1073 1067
lf_world_pred <-list.files(path=file.path(out_dir,"mosaics"),    
1074
           pattern=paste("^reg5.*.",out_suffix,".tif$",sep=""),full.names=T) 
1068
           pattern=paste("^reg4.*.",".tif$",sep=""),full.names=T) 
1075 1069

  
1076 1070
#mosaic_list_mean <- test_list 
1077 1071
#out_rastnames <- "world_test_mosaic_20100101"
......
1092 1086
#world_m_list <- mclapply(11:30, list_param=list_param_plot_screen_raster, plot_screen_raster_val,mc.preschedule=FALSE,mc.cores = num_cores) #This is the end bracket from mclapply(...) statement
1093 1087
world_m_list <- mclapply(1:length(l_dates), list_param=list_param_plot_screen_raster, plot_screen_raster_val,mc.preschedule=FALSE,mc.cores = num_cores) #This is the end bracket from mclapply(...) statement
1094 1088

  
1089
s_pred <- stack(lf_raster_fname)
1090

  
1091
res_pix <- 1500
1092
col_mfrow <- 3 
1093
row_mfrow <- 2
1094

  
1095
png(filename=paste("Figure10_levelplot_combined_",region_name,"_",out_suffix,".png",sep=""),
1096
    width=col_mfrow*res_pix,height=row_mfrow*res_pix)
1097

  
1098
levelplot(s_pred,layers=1:6,col.regions=rev(terrain.colors(255)),cex=4)
1099

  
1100
dev.off()
1101

  
1102
#   blues<- designer.colors(6, c( "blue", "white") )
1103
# reds <- designer.colors(6, c( "white","red")  )
1104
# colorTable<- c( blues[-6], reds)
1105
# breaks with a gap of 10 to 17 assigned the white color
1106
# brks<- c(seq( 1, 10,,6), seq( 17, 25,,6)) 
1107
# image.plot( x,y,z,breaks=brks, col=colorTable)
1108
#
1109

  
1095 1110
#lf_world_mask_reg <- vector("list",length=length(lf_world_pred))
1096 1111
#for(i in 1:length(lf_world_pred)){
1097 1112
  #

Also available in: Unified diff