Project

General

Profile

« Previous | Next » 

Revision fae9ccb1

Added by Benoit Parmentier about 10 years ago

run4 assessment NEX part2: generating gam diagnostic for different k values

View differences:

climate/research/oregon/interpolation/global_run_scalingup_assessment_part2.R
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: 08/14/2014            
8
#MODIFIED ON: 08/16/2014            
9 9
#Version: 3
10 10
#PROJECT: Environmental Layers project     
11 11
#COMMENTS: analyses for run 3 global using 2 specific tiles
......
104 104
CRS_WGS84<-c("+proj=longlat +ellps=WGS84 +datum=WGS84 +towgs84=0,0,0") #Station coords WGS84
105 105

  
106 106
region_name <- "world"
107

  
107
# 
108 108
###Table 1: Average accuracy metrics
109 109
###Table 2: daily accuracy metrics for all tiles
110 110
#lf_tables <- list.files(out_dir,)
......
114 114
pred_data_day_info <- read.table(file=file.path(out_dir,paste("pred_data_day_info_",out_prefix,".txt",sep="")),sep=",")
115 115
df_tile_processed <- read.table(file=file.path(out_dir,paste("df_tile_processed_",out_prefix,".txt",sep="")),sep=",")
116 116
#in_dir_list <- file.path(in_dir1,read.table(file.path(in_dir1,"processed.txt"))$V1)
117
gam_diagnostic_df <- read.table(file=file.path(out_dir,"gam_diagnostic_df_run4_global_analyses_08142014.txt"),sep=",")
117 118

  
118 119
########################## START SCRIPT ##############################
119 120

  
......
283 284
}
284 285

  
285 286

  
287
##### Diagnostic gam
288

  
289
gam_diagnostic_df
290

  
291
boxplot(rmse~k,data=subset(gam_diagnostic_df,pred_mod=="mod1"),main="mod1 and term=s(lat,lon)",ylab="RMSE_f",xlab="k")
292
boxplot(rmse~k,data=subset(gam_diagnostic_df,pred_mod=="mod2"),main="mod2 and term=s(lat,lon)",ylab="RMSE_f",xlab="k")
293

  
294
boxplot(rmse~k,data=subset(gam_diagnostic_df,pred_mod=="mod1"),main="mod1 and term=s(elev_s)",ylab="RMSE_f",xlab="k")
295
boxplot(rmse~k,data=subset(gam_diagnostic_df,pred_mod=="mod2"),main="mod2 and term=s(elev_s)",ylab="RMSE_f",xlab="k")
296

  
297
boxplot(rmse~k,data=subset(gam_diagnostic_df,pred_mod=="mod2"),main="mod2 and term=s(LST)",ylab="RMSE_f",xlab="k")
298

  
299
res_pix <-480
300

  
301
png(filename="test.png",
302
    width=0.5*res_pix,height=6*res_pix)
303

  
304
#boxplot(rmse~pred_mod,data=tb,ylim=c(0,5),outline=FALSE)#,names=tb$pred_mod)
305
#title("RMSE per model over all tiles")
306
#bwplot(rmse~k | term + month,data=subset(gam_diagnostic_df,pred_mod=="mod2"),)
307
xyplot(rmse~k | term + month,data=subset(gam_diagnostic_df,pred_mod=="mod2"),type="p")
308
xyplot(rmse~k | term + month,data=subset(gam_diagnostic_df,pred_mod=="mod1"),type="p")
309
xyplot(rmse~k | term + month,data=subset(gam_diagnostic_df,pred_mod=="mod1" & tile_id=="tile_7"),type="b")
310
xyplot(rmse~k | term + month,data=subset(gam_diagnostic_df,pred_mod=="mod2" & tile_id=="tile_7"),type="b")
311
xyplot(rmse~k | term + month,data=subset(gam_diagnostic_df,pred_mod=="mod1" & tile_id=="tile_8"),type="b")
312
xyplot(rmse~k | term + month,data=subset(gam_diagnostic_df,pred_mod=="mod2" & tile_id=="tile_8"),type="b")
313

  
314
xyplot(rmse~k | term + month,group=tile_id ,data=subset(gam_diagnostic_df,pred_mod=="mod1"),type="b",
315
       auto.key=list(space = "top", cex=1.0,columns=8))
316
dev.off()
317

  
318
boxplot(rmse~month,data=subset(gam_diagnostic_df,pred_mod=="mod2"))
319
boxplot(rmse~month,data=subset(gam_diagnostic_df,pred_mod=="mod1"))
320

  
321
gam_diagnostic_df$month <- as.factor(gam_diagnostic_df$month)
322
boxplot(rmse~k,data=subset(gam_diagnostic_df,term=="s(lat,lon)" & pred_mod=="mod1"),main="mod1 and term=s(lat,lon)",ylab="RMSE_f",xlab="k")
323
boxplot(rmse~k,data=subset(gam_diagnostic_df,term=="s(lat,lon)" & pred_mod=="mod2"),main="mod2 and term=s(lat,lon)",ylab="RMSE_f",xlab="k")
324
boxplot(rmse~k,data=subset(gam_diagnostic_df,term=="s(elev_s)" & pred_mod=="mod1"))
325
boxplot(rmse~k,data=subset(gam_diagnostic_df,term=="s(elev_s)" & pred_mod=="mod2"))
326

  
327
boxplot(rmse~k,data=subset(gam_diagnostic_df,term=="s(LST)" & pred_mod=="mod2"))
328

  
329
boxplot(rmse~n,data=subset(gam_diagnostic_df,pred_mod=="mod2"))
330
boxplot(rmse~n,data=subset(gam_diagnostic_df,pred_mod=="mod1"))
331

  
332
boxplot(rmse~k,data=subset(gam_diagnostic_df,term=="s(lat,lon)" & pred_mod=="mod1" & tile_id=="tile_8"))
333
boxplot(rmse~k,data=subset(gam_diagnostic_df,term=="s(lat,lon)" & pred_mod=="mod1" & tile_id=="tile_7"))
334
boxplot(rmse~k,data=subset(gam_diagnostic_df,term=="s(lat,lon)" & pred_mod=="mod2" & tile_id=="tile_8"))
335
boxplot(rmse~k,data=subset(gam_diagnostic_df,term=="s(lat,lon)" & pred_mod=="mod2" & tile_id=="tile_7"))
336
boxplot(rmse~k,data=subset(gam_diagnostic_df,term=="s(elev_s)" & pred_mod=="mod1" & tile_id=="tile_8"))
337
boxplot(rmse~k,data=subset(gam_diagnostic_df,term=="s(elev_s)" & pred_mod=="mod1" & tile_id=="tile_7"))
286 338

  
339
boxplot(rmse~k,data=subset(gam_diagnostic_df,term=="s(elev_s)" & pred_mod=="mod1" & tile_id=="tile_7" & month==1))
340
boxplot(rmse~k,data=subset(gam_diagnostic_df,term=="s(elev_s)" & pred_mod=="mod1" & tile_id=="tile_7" & month==7))
341

  
342
boxplot(rmse~k,data=subset(gam_diagnostic_df,term=="s(lat,lon)" & pred_mod=="mod1" & tile_id=="tile_7" & month==1))
343
boxplot(rmse~k,data=subset(gam_diagnostic_df,term=="s(lat,lon)" & pred_mod=="mod1" & tile_id=="tile_7" & month==7))
344

  
345
boxplot(rmse~month,data=subset(gam_diagnostic_df,pred_mod=="mod1" & tile_id=="tile_7"))
346
boxplot(rmse~month,data=subset(gam_diagnostic_df,pred_mod=="mod2" & tile_id=="tile_7"))
347

  
348
boxplot(rmse~k,data=subset(gam_diagnostic_df,term=="s(lat,lon)" & pred_mod=="mod2"))
349
boxplot(rmse~k,data=subset(gam_diagnostic_df,term=="s(elev_s)" & pred_mod=="mod1"))
350
boxplot(rmse~k,data=subset(gam_diagnostic_df,term=="s(elev_s)" & pred_mod=="mod2"))
351

  
352
plot(n~tile_id,data=gam_diagnostic_df,type="h")
353

  
354

  
355
# 
356
## Figure 3b
357
png(filename=paste("Figure3b_boxplot_overall_region_scaling_",model_name[i],"_",out_prefix,".png",sep=""),
358
    width=col_mfrow*res_pix,height=row_mfrow*res_pix)
359

  
360
boxplot(rmse~pred_mod,data=tb,ylim=c(0,5),outline=FALSE)#,names=tb$pred_mod)
361
title("RMSE per model over all tiles")
362

  
363
dev.off()
287 364

  
288 365
################ 
289 366
### Figure 4: plot predicted tiff for specific date per model

Also available in: Unified diff