diff --git a/inst/doc/plot_maps.R b/inst/doc/plot_maps.R index 94692db2d515d5ecd9e4ba08026be47e024fa874..c5970008b3e3d69e4a73af77d91ed5c4008c2ed1 100755 --- a/inst/doc/plot_maps.R +++ b/inst/doc/plot_maps.R @@ -9,7 +9,7 @@ comprms <- T # Root Mean Square Error comprmsss <- T # Root Mean Square Skill Score compratrms <- T # Ratio RMSE expid1 / expid2 -var <- args[1] # tos/tas/prlr +var <- args[1] # tos/tas/pr season <- args[2] # Year/DJF/MAM/JJA/SON ly <- args[3] # ly1/ly2-5/ly6-9 for Forecast year 1 / years 2 to 5 / years # 6 to 9 @@ -20,7 +20,7 @@ year0 <- 1960 # first start date yearf <- 2005 # last start date intsdate <- 5 # interval between start dates -obs <- switch(var, 'tas' = 'ghcnersstgiss', 'tos' = 'ersst_v3b', 'prlr' = 'gpcc1x1_v6') +obs <- switch(var, 'tas' = 'ghcnersstgiss', 'tos' = 'ersst_v3b', 'pr' = 'gpcc1x1_v6') syears <- seq(year0, yearf, intsdate) imon2 <- paste("0", as.character(mon0), sep = "") sdates <- paste(as.character(syears), substr(imon2, nchar(imon2) - 1, @@ -70,7 +70,7 @@ if (file.exists(savename)) { 'SON' = 9), switch(season, 'Year' = (mon0 + 12 - 2) %% 12 + 1, 'DJF' = 2, 'MAM' = 5, 'JJA' = 8, 'SON' = 11)), 4), 4, 1) - if (var == 'prlr') { + if (var == 'pr') { toto_exp <- toto_exp * 1000 * 3600 * 24 toto_obs <- toto_obs * 1000 * 3600 * 24 } @@ -96,13 +96,13 @@ if (compcor) { toptitle = paste('Correlation Coefficient', lstexpid[jexp], switch(season, 'Year' = 'annual', season), switch(var, 'tas' = 'near surface temperature', - 'tos' = 'sea surface temperature', 'prlr' = 'precipitation'), + 'tos' = 'sea surface temperature', 'pr' = 'precipitation'), switch(var, 'tas' = 'GHCNv2+ERSSTv3b+GISTEMP', - 'tas' = 'ERSSTv3b', 'prlr' = 'GPCC'), switch(ly, + 'tas' = 'ERSSTv3b', 'pr' = 'GPCC'), switch(ly, 'ly1' = 'Year1', 'ly2-5' = 'Year2-5', 'ly6-9' = 'Year6-9')), sizetit = 0.8, brks = lims, cols = cols, colNA = switch(var, - 'prlr' = 'white', grey(0.4)), filled.continents = switch(var, - 'tas' = F, 'tos' = T, 'prlr' = F), dots = t(flag), intylat = 45) + 'pr' = 'white', grey(0.4)), filled.continents = switch(var, + 'tas' = F, 'tos' = T, 'pr' = F), dots = t(flag), intylat = 45) dev.off() } } @@ -121,13 +121,13 @@ if (comprms) { toptitle = paste('RMSE', lstexpid[jexp], switch(season, 'Year' = 'annual', season), switch(var, 'tas' = 'near surface temperature', - 'tos' = 'sea surface temperature', 'prlr' = 'precipitation'), + 'tos' = 'sea surface temperature', 'pr' = 'precipitation'), switch(var, 'tas' = 'GHCNv2+ERSSTv3b+GISTEMP', - 'tas' = 'ERSSTv3b', 'prlr' = 'GPCC'), switch(ly, + 'tas' = 'ERSSTv3b', 'pr' = 'GPCC'), switch(ly, 'ly1' = 'Year1', 'ly2-5' = 'Year2-5', 'ly6-9' = 'Year6-9')), sizetit = 0.8, brks = lims, cols = cols, colNA = switch(var, - 'prlr' = 'white', grey(0.4)), filled.continents = switch(var, - 'tas' = F, 'tos' = T, 'prlr' = F), intylat = 45) + 'pr' = 'white', grey(0.4)), filled.continents = switch(var, + 'tas' = F, 'tos' = T, 'pr' = F), intylat = 45) dev.off() } } @@ -147,13 +147,13 @@ if (comprmsss) { toptitle = paste('RMSSS', lstexpid[jexp], switch(season, 'Year' = 'annual', season), switch(var, 'tas' = 'near surface temperature', - 'tos' = 'sea surface temperature', 'prlr' = 'precipitation'), + 'tos' = 'sea surface temperature', 'pr' = 'precipitation'), switch(var, 'tas' = 'GHCNv2+ERSSTv3b+GISTEMP', - 'tas' = 'ERSSTv3b', 'prlr' = 'GPCC'), switch(ly, + 'tas' = 'ERSSTv3b', 'pr' = 'GPCC'), switch(ly, 'ly1' = 'Year1', 'ly2-5' = 'Year2-5', 'ly6-9' = 'Year6-9')), sizetit = 0.8, brks = lims, cols = cols, colNA = switch(var, - 'prlr' = 'white', grey(0.4)), filled.continents = switch(var, - 'tas' = F, 'tos' = T, 'prlr' = F), dots = t(flag), intylat = 45) + 'pr' = 'white', grey(0.4)), filled.continents = switch(var, + 'tas' = F, 'tos' = T, 'pr' = F), dots = t(flag), intylat = 45) dev.off() } } @@ -173,12 +173,12 @@ if (compratrms) { lstexpid[1], '/ RMSE', lstexpid[2], switch(season, 'Year' = 'annual', season), switch(var, 'tas' = 'near surface temperature', - 'tos' = 'sea surface temperature', 'prlr' = 'precipitation'), + 'tos' = 'sea surface temperature', 'pr' = 'precipitation'), switch(var, 'tas' = 'GHCNv2+ERSSTv3b+GISTEMP', 'tas' = 'ERSSTv3b', - 'prlr' = 'GPCC'), switch(ly, 'ly1' = 'Year1', 'ly2-5' = 'Year2-5', + 'pr' = 'GPCC'), switch(ly, 'ly1' = 'Year1', 'ly2-5' = 'Year2-5', 'ly6-9' = 'Year6-9')), sizetit = 0.8, brks = lims, cols = cols, - colNA = switch(var, 'prlr' = 'white', grey(0.4)), - filled.continents = switch(var, 'tas' = F, 'tos' = T, 'prlr' = F), + colNA = switch(var, 'pr' = 'white', grey(0.4)), + filled.continents = switch(var, 'tas' = F, 'tos' = T, 'pr' = F), dots = t(flag), intylat = 45) dev.off() } diff --git a/inst/doc/plot_timeseries.R b/inst/doc/plot_timeseries.R index dc18d90ebb026788f61378c29630c8da3d5c324d..a536733d4c3ad2d3e9646f71f1c30111057c5036 100755 --- a/inst/doc/plot_timeseries.R +++ b/inst/doc/plot_timeseries.R @@ -10,12 +10,12 @@ comprms <- TRUE compspread <- TRUE plotano <- TRUE -var <- args[1] # siextent/siarea/sivol/tos/tas/prlr/ohcsum0/ohcsum0-17/ohcsum18-22/ohcsum23-46/vsftmyz +var <- args[1] # siextent/siarea/sivol/tos/tas/pr/ohcsum/ohcsum0-17/ohcsum18-22/ohcsum23-46/vsftmyz pole <- args[2] # N/S only for siarea/siextent nltimemax <- 124 # number of leadtimes max in the experiments (in months) nltimeout <- 60 # number of leadtimes to postprocess(in months) lstexpid <- c('i00k', 'b02p') # list of ids -grid <- '320x160' # atmospheric grid for tos/prlr (ocean/land only) +grid <- '320x160' # atmospheric grid for tos/pr (ocean/land only) vertnem <- 'L42' # Number of vertical levels in nemo mon0 <- 11 # initial month year0 <- 1960 # first start date @@ -26,15 +26,15 @@ runmeanlen <- 12 # length of the window for running mean (in months) obs <- switch(var, 'siarea' = c('hadisst_v1.1'), 'siextent' = c('hadisst_v1.1'), 'tas' = c('ncep-reanalysis', 'era40'), 'tos' = c('ersst_v3b', 'hadisst_v1.1'), - 'prlr' = c('cru_v3.0', 'gpcc1x1_v6'), 'ohcsum0' = c('nemovar_system4'), + 'pr' = c('cru_v3.0', 'gpcc1x1_v6'), 'ohcsum' = c('nemovar_system4'), 'ohcsum18-22' = c('nemovar_system4'), 'ohcsum23-46' = c('nemovar_system4'), 'ohcsum0-17' = c('nemovar_system4'), 'vsftmyz' = c('nemovar_system4'), 'sivol' = 'piomas') toptitle2 <- switch(var, 'siarea' = "sea ice area", 'siextent' = "sea ice extent", 'sivol' = "sea ice volume", 'tas' = "global T2m", 'tos' = "global SST (60S-65N)", - 'prlr' = 'land precipitation (60S-65N)', - 'ohcsum0' = "global ocean heat content", + 'pr' = 'land precipitation (60S-65N)', + 'ohcsum' = "global ocean heat content", 'ohcsum0-17' = 'global 800m-bottom ocean heat content', 'ohcsum18-22' = 'global 350m-800m ocean heat content', 'ohcsum23-46' = 'global 0-350m ocean heat content', @@ -42,7 +42,7 @@ toptitle2 <- switch(var, 'siarea' = "sea ice area", 'siextent' = "sea ice extent ) ytitle1 <- switch(var, 'siarea' = "Millions km2", 'siextent' = "Millions km2", 'sivol' = 'Thousands km3', 'tas' = 'K', 'tos' = 'K', - 'prlr' = 'mm/day', 'ohcsum0' = '10e22 Joules', + 'pr' = 'mm/day', 'ohcsum' = '10e22 Joules', 'ohcsum0-17' = '10e22 Joules', 'ohcsum18-22' = '10e22 Joules', 'ohcsum23-46' = '10e22 Joules', 'vsftmyz' = 'Sv') @@ -65,13 +65,13 @@ if (file.exists(paste(savename, '.sav', sep = ''))) { stop("Missing experimental or observational data in backup file. Remove the backup to try retrieving again.") } } else { - if (var == 'prlr' | var == 'tos' ) { + if (var == 'pr' | var == 'tos' ) { cat("Retrieving mask files...\n") fnc <- nc_open(paste('/esnas/exp/ecearth/constant/land_sea_mask_', grid, '.nc', sep = '')) mask <- ncvar_get(fnc, 'LSM') nc_close(fnc) - if (var == 'prlr') { + if (var == 'pr') { fnc <- nc_open('/esnas/obs/dwd/gpcc1x1_v6/constant/land_sea_mask.nc' ) mask_gpcc <- ncvar_get(fnc, 'lsm') @@ -99,7 +99,7 @@ if (file.exists(paste(savename, '.sav', sep = ''))) { lstmaskobs <- list(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) } - latbnd <- switch(var, 'tos' = c(-60, 65), 'prlr' = c(-60, 65), c(-90, 90)) + latbnd <- switch(var, 'tos' = c(-60, 65), 'pr' = c(-60, 65), c(-90, 90)) varname <- switch(var, 'siarea' = paste(var, tolower(pole), sep = ''), 'siextent' = paste(var, tolower(pole), sep = ''), 'sivol' = paste(var, tolower(pole), sep = ''), @@ -134,11 +134,11 @@ if (file.exists(paste(savename, '.sav', sep = ''))) { toto1$mod <- toto1beta lstexpid <- c(lstload, 'b02p') } - if (var == 'prlr') { + if (var == 'pr') { toto1$mod <- toto1$mod * 1000 * 3600 * 24 toto1$obs <- toto1$obs * 1000 * 3600 * 24 } - if (var == 'ohcsum0' | var == 'ohcsum0-17' | var == 'ohcsum18-22' | var == 'ohcsum23-46') { + if (var == 'ohcsum' | var == 'ohcsum0-17' | var == 'ohcsum18-22' | var == 'ohcsum23-46') { toto1$mod <- toto1$mod / 1e22 toto1$obs <- toto1$obs / 1e22 }