From 1a46c4629066b32a9081806dec4a80f71167052f Mon Sep 17 00:00:00 2001 From: nperez Date: Tue, 14 May 2019 12:26:02 +0200 Subject: [PATCH 1/3] lower limit legend bug fix --- R/PlotMostLikelyQuantileMap.R | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/R/PlotMostLikelyQuantileMap.R b/R/PlotMostLikelyQuantileMap.R index c8abb372..e1c3ea9c 100644 --- a/R/PlotMostLikelyQuantileMap.R +++ b/R/PlotMostLikelyQuantileMap.R @@ -418,6 +418,7 @@ PlotCombinedMap <- function(maps, lon, lat, #---------------------- # Identify the most likely map #---------------------- + brks_norm <- seq(0, 1, length.out = length(brks)) if (is.function(map_select_fun)) { range_width <- display_range[2] - display_range[1] ml_map <- apply(maps, c(lat_dim, lon_dim), function(x) { @@ -427,10 +428,14 @@ PlotCombinedMap <- function(maps, lon, lat, res <- which(x == map_select_fun(x)) if (length(res) > 0) { res <- res[1] - if (map_select_fun(x) < display_range[1] || map_select_fun(x) > display_range[2]) { + if (map_select_fun(x) < display_range[1] || + map_select_fun(x) > display_range[2]) { res <- -0.5 } else { res <- res + (map_select_fun(x) - display_range[1]) / range_width + if (map_select_fun(x) == display_range[1]) { + res <- res + brks_norm[2] / (num_brks * 2) + } } } else { res <- -0.5 @@ -478,7 +483,7 @@ PlotCombinedMap <- function(maps, lon, lat, for (k in 2:nmap) { tcols <- append(tcols, c(col_unknown_map, cols[[k]])) } - brks_norm <- seq(0, 1, length.out = length(brks)) + tbrks <- c(-1, brks_norm + rep(1:nmap, each = length(brks))) PlotEquiMap(var = ml_map, lon = lon, lat = lat, brks = tbrks, cols = tcols, drawleg = FALSE, -- GitLab From ad54ede2fe844374da4fc7e4654b8edf3ea68077 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ver=C3=B3nica=20Torralba-Fern=C3=A1ndez?= Date: Fri, 17 May 2019 11:22:43 +0200 Subject: [PATCH 2/3] bugfix in bar_titles --- R/PlotMostLikelyQuantileMap.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/PlotMostLikelyQuantileMap.R b/R/PlotMostLikelyQuantileMap.R index e1c3ea9c..96bb4ef9 100644 --- a/R/PlotMostLikelyQuantileMap.R +++ b/R/PlotMostLikelyQuantileMap.R @@ -168,9 +168,9 @@ PlotMostLikelyQuantileMap <- function(probs, lon, lat, cat_dim = 'bin', # Check bar_titles if (is.null(bar_titles)) { if (nprobs == 3) { - bar_titles <- list("Below normal (%)", "Normal (%)", "Above normal (%)") + bar_titles <- c("Below normal (%)", "Normal (%)", "Above normal (%)") } else if (nprobs == 5) { - bar_titles <- list("Low (%)", "Below normal (%)", + bar_titles <- c("Low (%)", "Below normal (%)", "Normal (%)", "Above normal (%)", "High (%)") } else { bar_titles <- paste0("Cat. ", 1:nprobs, " (%)") -- GitLab From a01fe1894d0e9737790119fa6df34b1165135c62 Mon Sep 17 00:00:00 2001 From: nperez Date: Wed, 29 May 2019 17:03:31 +0200 Subject: [PATCH 3/3] Update documentation --- DESCRIPTION | 2 +- man/CST_BiasCorrection.Rd | 2 +- man/CST_Calibration.Rd | 2 +- man/PlotForecastPDF.Rd | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 5b527779..dfe40ba0 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: CSTools Title: Assessing Skill of Climate Forecasts on Seasonal-to-Decadal Timescales -Version: 1.0.0 +Version: 1.0.1 Authors@R: c( person("BSC-CNS", role = c("cph")), person("Louis-Philippe", "Caron", , "louis-philippe.caron@bsc.es", role = "aut", comment = c(ORCID = "0000-0001-5221-0147")), diff --git a/man/CST_BiasCorrection.Rd b/man/CST_BiasCorrection.Rd index 485199ea..e8a82af0 100644 --- a/man/CST_BiasCorrection.Rd +++ b/man/CST_BiasCorrection.Rd @@ -41,4 +41,4 @@ Verónica Torralba, \email{veronica.torralba@bsc.es} \references{ Torralba, V., F.J. Doblas-Reyes, D. MacLeod, I. Christel and M. Davis (2017). Seasonal climate prediction: a new source of information for the management of wind energy resources. Journal of Applied Meteorology and Climatology, 56, 1231-1247, doi:10.1175/JAMC-D-16-0204.1. (CLIM4ENERGY, EUPORIAS, NEWA, RESILIENCE, SPECS) } -\encoding{UTF-8} + diff --git a/man/CST_Calibration.Rd b/man/CST_Calibration.Rd index c8419076..396d87ca 100644 --- a/man/CST_Calibration.Rd +++ b/man/CST_Calibration.Rd @@ -34,4 +34,4 @@ Doblas-Reyes F.J, Hagedorn R, Palmer T.N. The rationale behind the success of mu \seealso{ \code{\link{CST_Load}} } -\encoding{UTF-8} + diff --git a/man/PlotForecastPDF.Rd b/man/PlotForecastPDF.Rd index bed0bd31..3d1d65c3 100644 --- a/man/PlotForecastPDF.Rd +++ b/man/PlotForecastPDF.Rd @@ -49,4 +49,4 @@ PlotForecastPDF(fcsts2, c(-0.66, 0.66), extreme.limits = c(-1.2, 1.2), \author{ Llorenç Lledó \email{llledo@bsc.es} } -\encoding{UTF-8} + -- GitLab