diff --git a/DESCRIPTION b/DESCRIPTION index 99565b9b212ab5ba7e422819baab425f8c4da651..fa9b0be2e353cb6d46b16dbee2a4108d300ba1c1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: s2dverification Title: Set of Common Tools for Forecast Verification -Version: 2.9.0 +Version: 2.10.0 Authors@R: c( person("BSC-CNS", role = c("aut", "cph")), person("Virginie", "Guemas", , "virginie.guemas@bsc.es", role = "aut"), @@ -55,10 +55,10 @@ Imports: Suggests: easyVerification, testthat -License: LGPL-3 +License: Apache License 2.0 URL: https://earth.bsc.es/gitlab/es/s2dverification/-/wikis/home BugReports: https://earth.bsc.es/gitlab/es/s2dverification/-/issues LazyData: true SystemRequirements: cdo Encoding: UTF-8 -RoxygenNote: 5.0.0 +RoxygenNote: 7.0.1 diff --git a/NAMESPACE b/NAMESPACE index 8561a4f02ff2318d1146b35d48cd4102ada054ce..95ef972f2f5b72d9fe2d1a5d1dc36e936ac3899d 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -83,7 +83,6 @@ export(clim.palette) import(GEOmap) import(NbClust) import(SpecsVerification) -import(abind) import(bigmemory) import(geomapdata) import(graphics) diff --git a/NEWS.md b/NEWS.md index 5e12423059279e6f35db1e21f75cdca9a692ca7e..73ad3e02887a7ac95a2d9cc002071de5eef39559 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,13 @@ +# s2dverification 2.10.0 (Release date: 2021-06-15) +- Load(): Remove the last development for the first time step +- Load(): Modify the regrid criteria for the condition that only one data is retrieved and grid is specified and the data grids need to shift (e.g., first lon is 0.5 rather than 0.). Load() regrids the data as long as grid is specified. +- CDORemap(): able to transform irregular curvilinear grids to regular grids. +- StatsSeasAtlHurr(): Fix the statement & to | +- EOF(): Add check for NA handling to ensure the correct result +- PlotEquiMap(): Add parameter 'lake_color', 'contour_draw_label', 'lab_dist_x', and 'lab_dist_y' +- PlotEquiMap(): Bugfix of argument contour_label_scale; Fix the problem that the border grids were plotted half only +- PlotStereoMap(): Bugfix of dots feature; Add contour and arrow features + # s2dverification 2.9.0 (Release date: 2020-10-30) - Correct the time retrieval in Load() when start date and the first lead time in netCDF file do not match. In addition, when the lead time in each data set is not consistent, the retrieved data should change according to diff --git a/R/ACC.R b/R/ACC.R index a00bacf71d7f2f5df67b08cc9c3c1480c1d5c433..4e13794eecaaac77a9e18336a01f001fc73a1439 100644 --- a/R/ACC.R +++ b/R/ACC.R @@ -92,7 +92,7 @@ #' 1.3.0 - 2014-08 (V. Guemas, \email{virginie.guemas@@bsc.es}) - Boostrapping over members\cr #' 1.3.1 - 2014-09 (C. Prodhomme, \email{chloe.prodhomme@@bsc.es}) - Add comments and minor style changes\cr #' 1.3.2 - 2015-02 (N. Manubens, \email{nicolau.manubens@@bsc.es}) - Fixed ACC documentation and examples -#'@import abind +#'@importFrom abind abind #'@importFrom stats qt qnorm quantile #'@export ACC <- function(var_exp, var_obs, lon = NULL, lat = NULL, diff --git a/R/CDORemap.R b/R/CDORemap.R index ea6ff1374333384d7b7298b4d5bb19f1e529b181..4db209cf598a16f9414812d69399c6f3c4c38195 100644 --- a/R/CDORemap.R +++ b/R/CDORemap.R @@ -726,10 +726,45 @@ CDORemap <- function(data_array = NULL, lons, lats, grid, method, if (!is.null(dims_to_iterate)) { slice_indices <- which(slices_to_iterate == i, arr.ind = TRUE) subset <- Subset(data_array, dims_to_iterate, as.list(slice_indices), drop = 'selected') + # Fix issue 259, curvilinear grid, the order of the dimensions in slices and + # coordinates needs to match + if (is_irregular) { + pos_lon <- which(names(dim(subset)) == lon_dim) + pos_lat <- which(names(dim(subset)) == lat_dim) + pos_lon_dim_in_lons <- which(names(dim(lons)) == lon_dim) + pos_lat_dim_in_lons <- which(names(dim(lons)) == lat_dim) + if ((pos_lon > pos_lat && pos_lon_dim_in_lons < pos_lat_dim_in_lons) || + (pos_lon < pos_lat && pos_lon_dim_in_lons > pos_lat_dim_in_lons)) { + new_pos <- 1:length(dim(subset)) + new_pos[pos_lon] <- pos_lat + new_pos[pos_lat] <- pos_lon + subset <- .aperm2(subset, new_pos) + } + # The unlimited dimension should be placed in the last position + if ('time' %in% names(dim(subset)) && + which(names(dim(subset)) == 'time') != length(dim(subset))) { + new_pos <- 2:length(dim(subset)) + new_pos[length(dim(subset))] <- 1 + subset <- .aperm2(subset, new_pos) + } + } # dims_before_crop <- dim(subset) # Make sure subset goes along with metadata ArrayToNetCDF(setNames(list(subset, lons, lats), c('var', lon_var_name, lat_var_name)), tmp_file) } else { + if (is_irregular) { + pos_lon <- which(names(dim(data_array)) == lon_dim) + pos_lat <- which(names(dim(data_array)) == lat_dim) + pos_lon_dim_in_lons <- which(names(dim(lons)) == lon_dim) + pos_lat_dim_in_lons <- which(names(dim(lons)) == lat_dim) + if ((pos_lon > pos_lat && pos_lon_dim_in_lons < pos_lat_dim_in_lons) || + (pos_lon < pos_lat && pos_lon_dim_in_lons > pos_lat_dim_in_lons)) { + new_pos <- 1:length(dim(data_array)) + new_pos[pos_lon] <- pos_lat + new_pos[pos_lat] <- pos_lon + data_array <- .aperm2(data_array, new_pos) + } + } # dims_before_crop <- dim(data_array) ArrayToNetCDF(setNames(list(data_array, lons, lats), c('var', lon_var_name, lat_var_name)), tmp_file) } @@ -818,24 +853,63 @@ CDORemap <- function(data_array = NULL, lons, lats, grid, method, if (return_array) { new_dims <- dim(data_array) new_dims[c(lon_dim, lat_dim)] <- c(found_lon_dim_size, found_lat_dim_size) + lon_pos <- which(names(new_dims) == lon_dim) + lat_pos <- which(names(new_dims) == lat_dim) + # Fix issue 259, expected order from CDO output is lon lat +# If is irregular, lat and lon position need to be checked: + if (is_irregular) { + if (lon_pos > lat_pos) { + new_pos <- 1:length(new_dims) + new_pos[lon_pos] <- lat_pos + new_pos[lat_pos] <- lon_pos + new_dims <- new_dims[new_pos] + } + } result_array <- array(dim = new_dims) store_indices <- as.list(rep(TRUE, length(dim(result_array)))) } } if (return_array) { store_indices[dims_to_iterate] <- as.list(slice_indices) + # If is irregular, the order of dimenesions in result_array and file may be different and need to be checked before reading the temporal file: + if (is_irregular) { + test_dims <- dim(ncvar_get(ncdf_remapped, 'var', + collapse_degen = FALSE)) + test_dims <- test_dims[which(test_dims > 1)] + pos_test_dims <- match(dim(result_array), test_dims) + if (is.unsorted(pos_test_dims, na.rm = TRUE)) { + # pos_new_dims is used later in the code. Don't overwrite + pos_new_dims <- 1:length(dim(result_array)) + pos_new_dims[which(!is.na(pos_test_dims))] <- + match(test_dims, dim(result_array)) + backup_result_array_dims <- dim(result_array) + dim(result_array) <- dim(result_array)[pos_new_dims] + } + } result_array <- do.call('[<-', c(list(x = result_array), store_indices, list(value = ncvar_get(ncdf_remapped, 'var', collapse_degen = FALSE)))) } } else { new_dims <- dim(data_array) new_dims[c(lon_dim, lat_dim)] <- c(found_lon_dim_size, found_lat_dim_size) + result_array <- ncvar_get(ncdf_remapped, 'var', collapse_degen = FALSE) dim(result_array) <- new_dims } nc_close(ncdf_remapped) file.remove(tmp_file2) } + # If is irregular, the order of dimension may need to be recovered after reading all the file: + if (is_irregular & (!is.null(dims_to_iterate))) { + if (exists('pos_new_dims')) { + pos_new_dims <- 1:length(dim(result_array)) + dims_to_change <- match(backup_result_array_dims, dim(result_array)) + pos_new_dims[which(dims_to_change != 1)] <- + dims_to_change[which(dims_to_change != 1)] + result_array <- .aperm2(result_array, pos_new_dims) + } + } + if (!is.null(permutation)) { dim_backup <- dim(result_array) result_array <- aperm(result_array, permutation_back) diff --git a/R/Cluster.R b/R/Cluster.R index da9c62a67f0b0258f67d4a5a2f1eb5bea8ac67ad..1dc0b825c93a70838ee685b27b3ba4889cf9fee9 100644 --- a/R/Cluster.R +++ b/R/Cluster.R @@ -85,7 +85,7 @@ #' a1[i1, ] <- x1 + rnorm(4, mean = mean1, sd = sd1) #'} #' -#'c1p5 <- c0[!(c0 \%in\% c1)] +#'c1p5 <- c0[!(c0 %in% c1)] #'c2 <- c1p5[seq(1, length(c1p5), 2)] #'x2 <- c(2, 2, 4, 4) #'for (i2 in c2) { diff --git a/R/EOF.R b/R/EOF.R index 6ed8c6f751bfba8c52ddfdfd4fbcda87d64bbdee..a1c0c7e3f548fd7f6df218b05c57420fa66a0da9 100644 --- a/R/EOF.R +++ b/R/EOF.R @@ -5,7 +5,9 @@ #'\code{TRUE}. #' #'@param ano Array of anomalies with dimensions (number of timesteps, -#' number of latitudes, number of longitudes). +#' number of latitudes, number of longitudes). NAs could exist but it should +#' be consistent along time_dim. That is, if one grid point has NAs, all the +#' time steps at this point should be NAs. #'@param lon Vector of longitudes of \code{ano}. #'@param lat Vector of latitudes of \code{ano}. #'@param neofs Number of modes to be kept. Default = 15. @@ -152,6 +154,17 @@ EOF <- function(ano, lon, lat, neofs = 15, corr = FALSE) { stop("Inconsistent number of longitudes and input field dimensions.") } + # Check if all the time steps at one grid point are NA-consistent. + # The grid point should have all NAs or no NA along time dim. + if (any(is.na(ano))) { + ano_latlon <- array(ano, dim = c(nt, ny * nx)) # [time, lat*lon] + na_ind <- which(is.na(ano_latlon), arr.ind = T) + if (dim(na_ind)[1] != nt * length(unique(na_ind[, 2]))) { + stop("Detect certain grid points have NAs but not consistent across time ", + "dimension. If the grid point is NA, it should have NA at all time step.") + } + } + # Buildup of the mask mask <- ano[1, , ] mask[!is.finite(mask)] <- NA diff --git a/R/Load.R b/R/Load.R index 9feec5d37bb6aa9cdd00cd2687675c7fca10d63a..6b136ec90e904d15c6da40ba3d6f5b1074932ae2 100644 --- a/R/Load.R +++ b/R/Load.R @@ -840,7 +840,6 @@ #' } #'@import parallel bigmemory methods #'@importFrom stats ts window na.omit -#'@importFrom abind abind #'@export Load <- function(var, exp = NULL, obs = NULL, sdates, nmember = NULL, nmemberobs = NULL, nleadtime = NULL, leadtimemin = 1, @@ -851,7 +850,6 @@ Load <- function(var, exp = NULL, obs = NULL, sdates, nmember = NULL, configfile = NULL, varmin = NULL, varmax = NULL, silent = FALSE, nprocs = NULL, dimnames = NULL, remapcells = 2, path_glob_permissive = 'partial') { - #library(parallel) #library(bigmemory) @@ -1054,6 +1052,7 @@ Load <- function(var, exp = NULL, obs = NULL, sdates, nmember = NULL, if (!is.character(storefreq) || !(storefreq %in% c('monthly', 'daily'))) { stop("Error: parameter 'storefreq' is wrong, can take value 'daily' or 'monthly'.") } + # sampleperiod if (is.null(sampleperiod) || !is.numeric(sampleperiod)) { stop("Error: parameter 'sampleperiod' is wrong. It should be numeric.") @@ -1383,7 +1382,6 @@ Load <- function(var, exp = NULL, obs = NULL, sdates, nmember = NULL, dims2define <- TRUE is_file_per_member_exp <- rep(nmod, FALSE) exp_work_pieces <- list() - first_time_step_list <- NULL jmod <- 1 while (jmod <= nmod) { first_dataset_file_found <- FALSE @@ -1429,21 +1427,6 @@ Load <- function(var, exp = NULL, obs = NULL, sdates, nmember = NULL, if (is_file_per_member_exp[jmod]) { replace_values[["MEMBER_NUMBER"]] <- '*' } - if (jsdate == 1) { - work_piecetime <- list(dataset_type = dataset_type, - filename = .ConfigReplaceVariablesInString(quasi_final_path, - replace_values), - namevar = namevar, grid = grid, remap = remap, - remapcells = remapcells, - is_file_per_member = is_file_per_member_exp[jmod], - is_file_per_dataset = FALSE, - lon_limits = c(lonmin, lonmax), - lat_limits = c(latmin, latmax), dimnames = exp[[jmod]][['dimnames']], - single_dataset = single_dataset) - looking_time <- .LoadDataFile(work_piecetime, explore_dims = TRUE, - silent = silent) - first_time_step_list <- c(first_time_step_list, list(looking_time$time_dim)) - } # If the dimensions of the output matrices are still to define, we try to read # the metadata of the data file that corresponds to the current iteration if (dims2define) { @@ -1548,7 +1531,6 @@ Load <- function(var, exp = NULL, obs = NULL, sdates, nmember = NULL, jsdate <- jsdate + 1 } replace_values[extra_vars] <- NULL - #first_dataset_file_found <- FALSE jmod <- jmod + 1 } if (dims2define && length(exp) > 0) { @@ -1589,52 +1571,7 @@ Load <- function(var, exp = NULL, obs = NULL, sdates, nmember = NULL, } leadtimes <- seq(leadtimemin, leadtimemax, sampleperiod) } - # If there are differences in the first time stamp in exp files: - if (!is.null(exp)) { - in_date <- lapply(first_time_step_list, function(x) { - origin <- as.POSIXct( - paste(strsplit(x$time_units, " ")[[1]][c(3,4)], - collapse = " "), tz = 'UTC') - units <- strsplit(x$time_units, " ")[[1]][1] - if (units == 'hours') { - exp_first_time_step <- as.POSIXct( - x$first_time_step_in_file * - 3600, origin = origin, tz = 'UTC') - } else if (units == 'days') { - exp_first_time_step <- as.POSIXct( - x$first_time_step_in_file * - 86400, origin = origin, tz = 'UTC') - } - day <- as.numeric(format(exp_first_time_step, "%d")) - return(day) - }) - exp_first_time_step <- min(unlist(in_date)) - if (max(unlist(in_date)) > 1) { - leadtimes <- seq(exp_first_time_step, leadtimemax + max(unlist(in_date)) - 1, - sampleperiod) - } - if (leadtimemin > 1 & length(in_date) > 1) { - lags <- lapply(in_date, function(x) {x - in_date[[1]]}) - new_leadtimemin <- lapply(lags, function(x) {leadtimemin - x}) - new_leadtimemax <- lapply(lags, function(x) {leadtimemax - x}) - jmod <- 2 - npieces <- length(exp_work_pieces)/nmod - while (jmod <= nmod) { - jpiece <- 1 - while (jpiece <= npieces) { - exp_work_pieces[[npieces * (jmod - 1) + jpiece]]$leadtimes <- - seq(new_leadtimemin[[jmod]], new_leadtimemax[[jmod]], sampleperiod) - jpiece <- jpiece + 1 - } - jmod <- jmod + 1 - } - } - lag <- 1 - in_date[[1]] - leadtimes <- seq(leadtimemin - lag, leadtimemax #+ max(unlist(in_date)) + lag, - - lag, - sampleperiod) - exp_first_time_step <- leadtimemin - lag - } + # Now we start iterating over observations. We try to find the output matrix # dimensions and we build anyway the work pieces corresponding to the observational # data that time-corresponds the experimental data or the time-steps until the @@ -1698,7 +1635,6 @@ Load <- function(var, exp = NULL, obs = NULL, sdates, nmember = NULL, found_data <- .LoadDataFile(work_piece, explore_dims = TRUE, silent = silent) found_dims <- found_data$dims var_long_name <- found_data$var_long_name - first_time_step_list <- c(first_time_step_list, list(found_data$time_dim)) units <- found_data$units if (!is.null(found_dims)) { is_2d_var <- found_data$is_2d_var @@ -1796,18 +1732,7 @@ Load <- function(var, exp = NULL, obs = NULL, sdates, nmember = NULL, ## This condition must be fulfilled to put all the month time steps ## in the dimension of length nleadtimes. Otherwise it must be cut: #(length(leadtimes) - 1)*sampleperiod + 1 - (jleadtime - 1)*sampleperiod >= days_in_month - day + 1 - - ## The first time step in exp could be different from sdate: - if (jleadtime == 1 & !is.null(exp)) { - if (is.null(first_time_step_list[[1]])) { - stop("Check 'time' variable in the experimental files ", - "since not units or first time step have been found.") - } else { - day <- leadtimes[1] - } - } - obs_file_indices <- seq(day, min(days_in_month, - (length(leadtimes) - jleadtime) * sampleperiod + day), sampleperiod) + obs_file_indices <- seq(day, min(days_in_month, (length(leadtimes) - jleadtime) * sampleperiod + day), sampleperiod) } else { obs_file_indices <- 1 } @@ -1903,8 +1828,7 @@ Load <- function(var, exp = NULL, obs = NULL, sdates, nmember = NULL, } if (storefreq == 'daily') { - startdate <- startdate + 86400 * sampleperiod * - max(obs_file_indices) + startdate <- startdate + 86400 * sampleperiod * length(obs_file_indices) year <- as.integer(substr(startdate, 1, 4)) month <- as.integer(substr(startdate, 6, 7)) day <- as.integer(substr(startdate, 9, 10)) @@ -2218,54 +2142,49 @@ Load <- function(var, exp = NULL, obs = NULL, sdates, nmember = NULL, attr(variable, 'daily_agg_cellfun') <- 'none' attr(variable, 'monthly_agg_cellfun') <- 'none' attr(variable, 'verification_time') <- 'none' - - number_ftime <- NULL + + number_ftime <- NULL if (is.null(var_exp)) { mod_data <- NULL - } else { + } else { dim_reorder <- length(dim_exp):1 dim_reorder[2:3] <- dim_reorder[3:2] old_dims <- dim_exp dim_exp <- dim_exp[dim_reorder] - mod_data <- - aperm(array(bigmemory::as.matrix(var_exp), dim = old_dims), dim_reorder) + mod_data <- aperm(array(bigmemory::as.matrix(var_exp), dim = old_dims), dim_reorder) attr(mod_data, 'dimensions') <- names(dim_exp) names(dim(mod_data)) <- names(dim_exp) number_ftime <- dim_exp[["ftime"]] } - + if (is.null(var_obs)) { obs_data <- NULL - } else { + } else { dim_reorder <- length(dim_obs):1 dim_reorder[2:3] <- dim_reorder[3:2] old_dims <- dim_obs dim_obs <- dim_obs[dim_reorder] - obs_data <- - aperm(array(bigmemory::as.matrix(var_obs), dim = old_dims), dim_reorder) + obs_data <- aperm(array(bigmemory::as.matrix(var_obs), dim = old_dims), dim_reorder) attr(obs_data, 'dimensions') <- names(dim_obs) names(dim(obs_data)) <- names(dim_obs) if (is.null(number_ftime)) { number_ftime <- dim_obs[["ftime"]] } } + if (is.null(latitudes)) { lat <- 0 attr(lat, 'cdo_grid_name') <- 'none' attr(lat, 'first_lat') <- 'none' - attr(lat, 'last_lat') <- 'none' + attr(lat, 'last_lat') <- 'none' } else { lat <- latitudes - attr(lat, 'cdo_grid_name') <- - if (is.null(grid)) - 'none' - else - grid + attr(lat, 'cdo_grid_name') <- if (is.null(grid)) 'none' else grid attr(lat, 'first_lat') <- tail(lat, 1) attr(lat, 'last_lat') <- head(lat, 1) } attr(lat, 'projection') <- 'none' - + if (is.null(longitudes)) { lon <- 0 attr(lon, 'cdo_grid_name') <- 'none' @@ -2275,18 +2194,14 @@ Load <- function(var, exp = NULL, obs = NULL, sdates, nmember = NULL, attr(lon, 'last_lon') <- 'none' } else { lon <- longitudes - attr(lon, 'cdo_grid_name') <- - if (is.null(grid)) - 'none' - else - grid + attr(lon, 'cdo_grid_name') <- if (is.null(grid)) 'none' else grid attr(lon, 'data_across_gw') <- data_across_gw attr(lon, 'array_across_gw') <- array_across_gw attr(lon, 'first_lon') <- lon[which.min(abs(lon - lonmin))] attr(lon, 'last_lon') <- lon[which.min(abs(lon - lonmax))] } attr(lon, 'projection') <- 'none' - + dates <- list() ## we must put a start and end time for each prediction c(start date, forecast time) if (storefreq == 'minutely') { @@ -2298,42 +2213,24 @@ Load <- function(var, exp = NULL, obs = NULL, sdates, nmember = NULL, } else if (storefreq == 'monthly') { store_period <- 'month' } - + addTime <- function(date, period, n = 1) { seq(date, by = paste(n, period), length = 2)[2] } - + # We build dates, a list with components start and end. # Start is a list with as many components as start dates. # Each component is a vector of the initial POSIXct date of each # forecast time step - if (!is.null(exp)) { - if (storefreq == 'daily' & leadtimes[[1]] > 1) { - origin <- leadtimes[[1]] - 1 - leadtimemin <- 1 - } else { - origin <- 0 - } - dates[["start"]] <- do.call(c, lapply(sdates, - function(x) { - do.call(c, lapply((origin:(origin + number_ftime - 1)) * sampleperiod, - function(y) { - addTime(as.POSIXct(x, format = "%Y%m%d", tz = "UTC"), - store_period, y + leadtimemin - 1) - })) - })) - } else { - origin <- 0 - dates[["start"]] <- do.call(c, lapply(sdates, + dates[["start"]] <- do.call(c, lapply(sdates, function(x) { do.call(c, lapply((0:(number_ftime - 1)) * sampleperiod, function(y) { - addTime(as.POSIXct(x, format = "%Y%m%d", tz = "UTC"), - store_period, y + leadtimemin - 1) + addTime(as.POSIXct(x, format = "%Y%m%d", tz = "UTC"), store_period, y + leadtimemin - 1) })) })) - } attr(dates[["start"]], "tzone") <- "UTC" + # end is similar to start, but contains the end dates of each forecast # time step dates[["end"]] <- do.call(c, lapply(dates[["start"]], diff --git a/R/PlotAno.R b/R/PlotAno.R index 922806aa227ec5ab9993a87212f110cb718f9561..a7428899b2e31e56337e928965b6f0ecb188a390 100644 --- a/R/PlotAno.R +++ b/R/PlotAno.R @@ -117,6 +117,11 @@ PlotAno <- function(exp_ano, obs_ano = NULL, sdates, toptitle = rep('', 15), } else { nobs <- 0 } + # sdate check + if (!all(nchar(sdates) == 8)) { + stop ("The parameter 'sdates' must be formatted as YYYYMMDD.") + } + if (is.null(limits) == TRUE) { if (memb) { ll <- min(min(exp_ano, na.rm = TRUE), min(obs_ano, na.rm = TRUE), na.rm = TRUE) diff --git a/R/PlotEquiMap.R b/R/PlotEquiMap.R index 8f3fcb9ab0f754dc7184784d9a4050e212a22e08..3376a1436dfa010cfe05c81e8a002da04c94af71 100644 --- a/R/PlotEquiMap.R +++ b/R/PlotEquiMap.R @@ -64,6 +64,9 @@ #' Takes the value gray(0.5) by default. #'@param coast_width Line width of the coast line of the drawn projected #' continents. Takes the value 1 by default. +#'@param lake_color Colour of the lake or other water body inside continents. +#' It is only functional when 'filled.continents = TRUE'. The default value is +#' 'white'. For now, it is only functional if longitude range is [0, 360]. #'@param contours Array of same dimensions as 'var' to be added to the plot #' and displayed with contours. Parameter 'brks2' is required to define the #' magnitude breaks for each contour curve. Disregarded if 'square = FALSE'. @@ -75,6 +78,8 @@ #' and 'brks2', or if 'square = FALSE'. #'@param contour_lty Line type of the contour curves. Takes 1 (solid) by #' default. See help on 'lty' in par() for other accepted values. +#'@param contour_draw_label A logical value indicating whether to draw the +#' contour labels or not. The default value is TRUE. #'@param contour_label_scale Scale factor for the superimposed labels when #' drawing contour levels. #'@param dots Array of same dimensions as 'var' or with dimensions @@ -111,6 +116,12 @@ #' TRUE by default. #'@param labW Whether to label the longitude axis with a 'W' instead of minus #' for negative values. Defaults to FALSE. +#'@param lab_dist_x A numeric of the distance of the longitude labels to the +#' box borders. The default value is NULL and is automatically adjusted by +#' the function. +#'@param lab_dist_y A numeric of the distance of the latitude labels to the +#' box borders. The default value is NULL and is automatically adjusted by +#' the function. #'@param intylat Interval between latitude ticks on y-axis, in degrees. #' Defaults to 20. #'@param intxlon Interval between latitude ticks on x-axis, in degrees. @@ -221,15 +232,16 @@ PlotEquiMap <- function(var, lon, lat, varu = NULL, varv = NULL, triangle_ends = NULL, col_inf = NULL, col_sup = NULL, colNA = NULL, color_fun = clim.palette(), square = TRUE, filled.continents = NULL, - coast_color = NULL, coast_width = 1, + coast_color = NULL, coast_width = 1, lake_color = NULL, contours = NULL, brks2 = NULL, contour_lwd = 0.5, contour_color = 'black', contour_lty = 1, - contour_label_scale = 1, + contour_draw_label = TRUE, contour_label_scale = 1, dots = NULL, dot_symbol = 4, dot_size = 1, arr_subsamp = floor(length(lon) / 30), arr_scale = 1, arr_ref_len = 15, arr_units = "m/s", arr_scale_shaft = 1, arr_scale_shaft_angle = 1, axelab = TRUE, labW = FALSE, + lab_dist_x = NULL, lab_dist_y = NULL, intylat = 20, intxlon = 20, axes_tick_scale = 1, axes_label_scale = 1, drawleg = TRUE, subsampleg = NULL, @@ -432,6 +444,17 @@ PlotEquiMap <- function(var, lon, lat, varu = NULL, varv = NULL, stop("Parameter 'coast_width' must be numeric.") } + # Check lake_color + if (is.null(lake_color)) { + if (filled.continents) { + lake_color <- 'white' + } + } else { + if (!.IsColor(lake_color)) { + stop("Parameter 'lake_color' must be a valid colour identifier.") + } + } + # Check contours if (!is.null(contours)) { if (dim(contours)[1] != dims[1] || dim(contours)[2] != dims[2]) { @@ -468,6 +491,11 @@ PlotEquiMap <- function(var, lon, lat, varu = NULL, varv = NULL, stop("Parameter 'contour_lty' must be either a number or a character string.") } + # Check contour_draw_label + if (!is.logical(contour_draw_label)) { + stop("Parameter 'contour_draw_label' must be logical.") + } + # Check contour_label_scale if (!is.numeric(contour_label_scale)) { stop("Parameter 'contour_label_scale' must be numeric.") @@ -523,6 +551,16 @@ PlotEquiMap <- function(var, lon, lat, varu = NULL, varv = NULL, if (!is.logical(labW)) { stop("Parameter 'labW' must be logical.") } + if (!is.null(lab_dist_x)) { + if (!is.numeric(lab_dist_x)) { + stop("Parameter 'lab_dist_x' must be numeric.") + } + } + if (!is.null(lab_dist_y)) { + if (!is.numeric(lab_dist_y)) { + stop("Parameter 'lab_dist_y' must be numeric.") + } + } if (!is.numeric(intylat)) { stop("Parameter 'intylat' must be numeric.") } else { @@ -703,13 +741,31 @@ PlotEquiMap <- function(var, lon, lat, varu = NULL, varv = NULL, par(userArgs) par(mar = margins, cex.main = cex_title, cex.axis = cex_axes_labels, mgp = c(0, spaceticklab, 0), las = 0) - plot.window(xlim = range(lonb$x, finite = TRUE), ylim = range(latb$x, finite = TRUE), - xaxs = 'i', yaxs = 'i') + + #NOTE: Here creates the window for later plot. If 'usr' for par() is not specified, + # use the lat/lon as the borders. If 'usr' is specified, use the assigned values. + if (is.null(userArgs$usr)) { + #NOTE: The grids are assumed to be equally spaced + xlim_cal <- c(lonb$x[1] - (lonb$x[2] - lonb$x[1]) / 2, + lonb$x[length(lonb$x)] + (lonb$x[2] - lonb$x[1]) / 2) + ylim_cal <- c(latb$x[1] - (latb$x[2] - latb$x[1]) / 2, + latb$x[length(latb$x)] + (latb$x[2] - latb$x[1]) / 2) + plot.window(xlim = xlim_cal, ylim = ylim_cal, xaxs = 'i', yaxs = 'i') +# Below is Old code. The border grids are only half plotted. +# plot.window(xlim = range(lonb$x, finite = TRUE), ylim = range(latb$x, finite = TRUE), +# xaxs = 'i', yaxs = 'i') + } else { + plot.window(xlim = par("usr")[1:2], ylim = par("usr")[3:4], xaxs = 'i', yaxs = 'i') + } + if (axelab) { + lab_distance_y <- ifelse(is.null(lab_dist_y), spaceticklab + 0.2, lab_dist_y) + lab_distance_x <- ifelse(is.null(lab_dist_x), spaceticklab + cex_axes_labels / 2 - 0.3, lab_dist_x) + axis(2, at = ypos, labels = ylabs, cex.axis = cex_axes_labels, tcl = cex_axes_ticks, - mgp = c(0, spaceticklab + 0.2, 0)) + mgp = c(0, lab_distance_y, 0)) axis(1, at = xpos, labels = xlabs, cex.axis = cex_axes_labels, tcl = cex_axes_ticks, - mgp = c(0, spaceticklab + cex_axes_labels / 2 - 0.3, 0)) + mgp = c(0, lab_distance_x, 0)) } title(toptitle, cex.main = cex_title) rect(par("usr")[1], par("usr")[3], par("usr")[2], par("usr")[4], col = colNA) @@ -725,10 +781,16 @@ PlotEquiMap <- function(var, lon, lat, varu = NULL, varv = NULL, col = c(col_inf_image, cols, col_sup_image)) } if (!is.null(contours)) { +#NOTE: 'labcex' is the absolute size of contour labels. Parameter 'contour_label_scale' +# is provided in PlotEquiMap() but it was not used. Here, 'cex_axes_labels' was used +# and it was calculated from 'axes_label_scale', the size of lat/lon axis label. +# It is changed to use contour_label_scale*par('cex'). contour(lonb$x, latb$x, contours[lonb$ix, latb$ix], levels = brks2, - method = "edge", add = TRUE, - labcex = cex_axes_labels, lwd = contour_lwd, lty = contour_lty, - col = contour_color) + method = "edge", add = TRUE, +# labcex = cex_axes_labels, + labcex = contour_label_scale * par("cex"), + lwd = contour_lwd, lty = contour_lty, + col = contour_color, drawlabels = contour_draw_label) } # @@ -749,7 +811,17 @@ PlotEquiMap <- function(var, lon, lat, varu = NULL, varv = NULL, # Plotting continents # ~~~~~~~~~~~~~~~~~~~~~ # + # maps::map has the global map range [0, 360] or [-180, 180]. + # Set xlim so lon = 0 won't show a straight line when lon = [0, 359]. + # NOTE: It works except Antartic area. Don't know why. ylim is also set + # but it doesn't work. + if (continents == 'world') { # [-180, 180] + xlim_conti <- c(-179.99, 179.99) + } else { # [0, 360] + xlim_conti <- c(0.01, 359.99) + } coast <- map(continents, interior = FALSE, wrap = TRUE, + xlim = xlim_conti, ylim = c(-89.99, 89.99), fill = filled.continents, add = TRUE, plot = FALSE) if (filled.continents) { old_lwd <- par('lwd') @@ -761,7 +833,7 @@ PlotEquiMap <- function(var, lon, lat, varu = NULL, varv = NULL, LAT0 = mean(ylat), LATS = ylat, LONS = xlon) lakes <- which(coastmap$STROKES$col == "blue") coastmap$STROKES$col[which(coastmap$STROKES$col != "blue")] <- continent_color - coastmap$STROKES$col[lakes] <- "white" + coastmap$STROKES$col[lakes] <- lake_color #"white" par(new = TRUE) GEOmap::plotGEOmap(coastmap, PROJ = proj, border = coast_color, add = TRUE, lwd = coast_width) diff --git a/R/PlotStereoMap.R b/R/PlotStereoMap.R index 5572f89a56b3fedb77abcf753b92f85420dca151..cde09859ed1c3519e429efb6fec6837b7efd8cc7 100644 --- a/R/PlotStereoMap.R +++ b/R/PlotStereoMap.R @@ -4,8 +4,8 @@ #'a polar stereographic world projection with coloured grid cells. Only the #'region within a specified latitude interval is displayed. A colour bar #'(legend) can be plotted and adjusted. It is possible to draw superimposed -#'dots, symbols and boxes. A number of options is provided to adjust the -#'position, size and colour of the components. This plot function is +#'dots, symbols, boxes, contours, and arrows. A number of options is provided to +#'adjust the position, size and colour of the components. This plot function is #'compatible with figure layouts if colour bar is disabled. #' #'@param var Array with the values at each cell of a grid on a regular @@ -24,6 +24,10 @@ #'@param lat Numeric vector of latitude locations of the cell centers of the #' grid of 'var', in any order (same as 'var'). Expected to be from a regular #' rectangular or gaussian grid, within the range [-90, 90]. +#'@param varu Array of the zonal component of wind/current/other field with +#' the same dimensions as 'var'. +#'@param varv Array of the meridional component of wind/current/other field +#' with the same dimensions as 'var'. #'@param latlims Latitudinal limits of the figure.\cr #' Example : c(60, 90) for the North Pole\cr #' c(-90,-60) for the South Pole @@ -58,6 +62,24 @@ #' continents. Takes the value gray(0.5) by default. #'@param coast_width Line width of the coast line of the drawn projected #' continents. Takes the value 1 by default. +#'@param contours Array of same dimensions as 'var' to be added to the plot +#' and displayed with contours. Parameter 'brks2' is required to define the +#' magnitude breaks for each contour curve. +#'@param brks2 A numeric value or vector of magnitude breaks where to draw +#' contour curves for the array provided in 'contours'. If it is a number, it +#' represents the number of breaks (n) that defines (n - 1) intervals to +#' classify 'contours'. +#'@param contour_lwd Line width of the contour curves provided via 'contours' +#' and 'brks2'. The default value is 0.5. +#'@param contour_color Line color of the contour curves provided via 'contours' +#' and 'brks2'. +#'@param contour_lty Line type of the contour curves. Takes 1 (solid) by +#' default. See help on 'lty' in par() for other accepted values. +#'@param contour_label_draw A logical value indicating whether to draw the +#' contour labels (TRUE) or not (FALSE) when 'contours' is used. The default +#' value is TRUE. +#'@param contour_label_scale Scale factor for the superimposed labels when +#' drawing contour levels. The default value is 0.6. #'@param dots Array of same dimensions as 'var' or with dimensions #' c(n, dim(var)), where n is the number of dot/symbol layers to add to the #' plot. A value of TRUE at a grid cell will draw a dot/symbol on the @@ -74,6 +96,23 @@ #' layers in 'dots'. Takes 1 by default. #'@param intlat Interval between latitude lines (circles), in degrees. #' Defaults to 10. +#'@param arr_subsamp A number as subsampling factor to select a subset of arrows +#' in 'varu' and 'varv' to be drawn. Only one out of arr_subsamp arrows will +#' be drawn. The default value is 1. +#'@param arr_scale A number as scale factor for drawn arrows from 'varu' and +#' 'varv'. The default value is 1. +#'@param arr_ref_len A number of the length of the refence arrow to be drawn as +#' legend at the bottom of the figure (in same units as 'varu' and 'varv', only +#' affects the legend for the wind or variable in these arrays). The default +#' value is 15. +#'@param arr_units Units of 'varu' and 'varv', to be drawn in the legend. +#' Takes 'm/s' by default. +#'@param arr_scale_shaft A number for the scale of the shaft of the arrows +#' (which also depend on the number of figures and the arr_scale parameter). +#' The default value is 1. +#'@param arr_scale_shaft_angle A number for the scale of the angle of the +#' shaft of the arrows (which also depend on the number of figure and the +#' arr_scale parameter). The default value is 1. #'@param drawleg Whether to plot a color bar (legend, key) or not. #' Defaults to TRUE. #'@param boxlim Limits of a box to be added to the plot, in degrees: @@ -144,15 +183,21 @@ #'@importFrom grDevices dev.cur dev.new dev.off gray #'@importFrom stats median #'@export -PlotStereoMap <- function(var, lon, lat, latlims = c(60, 90), +PlotStereoMap <- function(var, lon, lat, varu = NULL, varv = NULL, latlims = c(60, 90), toptitle = NULL, sizetit = NULL, units = NULL, brks = NULL, cols = NULL, bar_limits = NULL, triangle_ends = NULL, col_inf = NULL, col_sup = NULL, colNA = NULL, color_fun = clim.palette(), filled.continents = FALSE, coast_color = NULL, coast_width = 1, + contours = NULL, brks2 = NULL, contour_lwd = 0.5, + contour_color = 'black', contour_lty = 1, + contour_label_draw = TRUE, contour_label_scale = 0.6, dots = NULL, dot_symbol = 4, dot_size = 0.8, intlat = 10, + arr_subsamp = floor(length(lon) / 30), arr_scale = 1, + arr_ref_len = 15, arr_units = "m/s", + arr_scale_shaft = 1, arr_scale_shaft_angle = 1, drawleg = TRUE, subsampleg = NULL, bar_extra_labels = NULL, draw_bar_ticks = TRUE, draw_separators = FALSE, triangle_ends_scale = 1, @@ -204,17 +249,40 @@ PlotStereoMap <- function(var, lon, lat, latlims = c(60, 90), stop("Parameter 'var' must be a numeric array with two dimensions.") } dims <- dim(var) + + # Check varu and varv + if (!is.null(varu) && !is.null(varv)) { + if (!is.array(varu) || !(length(dim(varu)) == 2)) { + stop("Parameter 'varu' must be a numerical array with two dimensions.") + } + if (!is.array(varv) || !(length(dim(varv)) == 2)) { + stop("Parameter 'varv' must be a numerical array with two dimensions.") + } + } else if (!is.null(varu) || !is.null(varv)) { + stop("Only one of the components 'varu' or 'varv' has been provided. Both must be provided.") + } + + if (!is.null(varu) && !is.null(varv)) { + if (dim(varu)[1] != dims[1] || dim(varu)[2] != dims[2]) { + stop("Parameter 'varu' must have same number of longitudes and latitudes as 'var'.") + } + if (dim(varv)[1] != dims[1] || dim(varv)[2] != dims[2]) { + stop("Parameter 'varv' must have same number of longitudes and latitudes as 'var'.") + } + } + # Transpose the input matrices because the base plot functions work directly # with dimensions c(lon, lat). if (dims[1] != length(lon) || dims[2] != length(lat)) { if (dims[1] == length(lat) && dims[2] == length(lon)) { var <- t(var) + if (!is.null(varu)) varu <- t(varu) + if (!is.null(varv)) varv <- t(varv) if (!is.null(dots)) dots <- aperm(dots, c(1, 3, 2)) dims <- dim(var) } } - # Check lon if (length(lon) != dims[1]) { stop("Parameter 'lon' must have as many elements as the number of cells along longitudes in the input array 'var'.") @@ -225,6 +293,14 @@ PlotStereoMap <- function(var, lon, lat, latlims = c(60, 90), stop("Parameter 'lat' must have as many elements as the number of cells along longitudes in the input array 'var'.") } + # Prepare sorted lon/lat and other arguments + latb <- sort(lat, index.return = TRUE) + lonb <- sort(lon, index.return = TRUE) + latmin <- floor(min(lat) / 10) * 10 + latmax <- ceiling(max(lat) / 10) * 10 + lonmin <- floor(min(lon) / 10) * 10 + lonmax <- ceiling(max(lon) / 10) * 10 + # Check latlims if (!is.numeric(latlims) || length(latlims) != 2) { stop("Parameter 'latlims' must be a numeric vector with two elements.") @@ -234,12 +310,16 @@ PlotStereoMap <- function(var, lon, lat, latlims = c(60, 90), if (max(abs(latlims - center_at)) > 90 + 20) { stop("The range specified in 'latlims' is too wide. 110 degrees supported maximum.") } - dlon <- median(lon[2:dims[1]] - lon[1:(dims[1] - 1)]) / 2 - dlat <- median(lat[2:dims[2]] - lat[1:(dims[2] - 1)]) / 2 + dlon <- median(lonb$x[2:dims[1]] - lonb$x[1:(dims[1] - 1)]) / 2 + dlat <- median(latb$x[2:dims[2]] - latb$x[1:(dims[2] - 1)]) / 2 original_last_lat <- latlims[which.min(abs(latlims))] - last_lat <- lat[which.min(abs(lat - original_last_lat))] - dlat * sign(center_at) + last_lat <- latb$x[which.min(abs(latb$x - original_last_lat))] - dlat * sign(center_at) latlims[which.min(abs(latlims))] <- last_lat + # Subset lat by latlims + lat_plot_ind <- which(lat >= latlims[1] & lat <= latlims[2]) + latb_plot_ind <- which(latb$x >= latlims[1] & latb$x <= latlims[2]) + # Check toptitle if (is.null(toptitle) || is.na(toptitle)) { toptitle <- '' @@ -316,6 +396,69 @@ PlotStereoMap <- function(var, lon, lat, latlims = c(60, 90), if (!is.numeric(coast_width)) { stop("Parameter 'coast_width' must be numeric.") } + # Check contours + if (!is.null(contours)) { + if (!is.array(contours)) { + stop("Parameter 'contours' must be a numeric array.") + } + if (length(dim(contours)) > 2) { + contours <- drop(contours) + dim(contours) <- head(c(dim(contours), 1, 1), 2) + } + if (length(dim(contours)) > 2) { + stop("Parameter 'contours' must be a numeric array with two dimensions.") + } else if (length(dim(contours)) < 2) { + stop("Parameter 'contours' must be a numeric array with two dimensions.") + } + # Transpose the input matrices because the base plot functions work directly + # with dimensions c(lon, lat). + if (dim(contours)[1] == dims[2] & dim(contours)[2] == dims[1]) { + contours <- t(contours) + } else { + stop("Parameter 'contours' must have the same number of longitudes and latitudes as 'var'.") + } + } + + # Check brks2 + if (!is.null(contours)) { + if (is.null(brks2)) { + ll <- signif(min(contours, na.rm = TRUE), 2) + ul <- signif(max(contours, na.rm = TRUE), 2) + brks2 <- unique(signif(seq(ll, ul, length.out = length(brks)), 2)) + + } else if (is.numeric(brks2) & length(brks2) == 1) { + ll <- signif(min(contours, na.rm = TRUE), 2) + ul <- signif(max(contours, na.rm = TRUE), 2) + brks2 <- unique(signif(seq(ll, ul, length.out = brks2), 2)) + } else if (!is.numeric(brks2)) { + stop("Parameter 'brks2' must be a numeric value or vector.") + } + } + + # Check contour_lwd + if (!is.numeric(contour_lwd)) { + stop("Parameter 'contour_lwd' must be numeric.") + } + + # Check contour_color + if (!.IsColor(contour_color)) { + stop("Parameter 'contour_color' must be a valid colour identifier.") + } + + # Check contour_lty + if (!is.numeric(contour_lty) && !is.character(contour_lty)) { + stop("Parameter 'contour_lty' must be either a number or a character string.") + } + + # Check contour_label_draw + if (!is.logical(contour_label_draw)) { + stop("Parameter 'contour_label_draw' must be a logical value.") + } + + # Check contour_label_scale + if (!is.numeric(contour_label_scale)) { + stop("Parameter 'contour_label_scale' must be numeric.") + } # Check dots, dot_symbol and dot_size if (!is.null(dots)) { @@ -345,6 +488,26 @@ PlotStereoMap <- function(var, lon, lat, latlims = c(60, 90), stop("Parameter 'intlat' must be numeric.") } + # Check arrow parameters + if (!is.numeric(arr_subsamp)) { + stop("Parameter 'arr_subsamp' must be numeric.") + } + if (!is.numeric(arr_scale)) { + stop("Parameter 'arr_scale' must be numeric.") + } + if (!is.numeric(arr_ref_len)) { + stop("Parameter 'arr_ref_len' must be numeric.") + } + if (!is.character(arr_units)) { + stop("Parameter 'arr_units' must be character.") + } + if (!is.numeric(arr_scale_shaft)) { + stop("Parameter 'arr_scale_shaft' must be numeric.") + } + if (!is.numeric(arr_scale_shaft_angle)) { + stop("Parameter 'arr_scale_shaft_angle' must be numeric.") + } + # Check legend parameters if (!is.logical(drawleg)) { stop("Parameter 'drawleg' must be logical.") @@ -404,6 +567,9 @@ PlotStereoMap <- function(var, lon, lat, latlims = c(60, 90), title_scale <- title_scale * scale margin_scale <- margin_scale * scale dot_size <- dot_size * scale + arr_scale <- arr_scale * scale + contour_label_scale <- contour_label_scale * scale + contour_lwd <- contour_lwd * scale } } @@ -434,6 +600,10 @@ PlotStereoMap <- function(var, lon, lat, latlims = c(60, 90), bar_extra_margin[1] <- bar_extra_margin[1] + margins[1] bar_extra_margin[3] <- bar_extra_margin[3] + margins[3] + if (!is.null(varu)) { + margins[1] <- margins[1] + 2.2 * units_scale + } + if (drawleg) { layout(matrix(1:2, ncol = 2, nrow = 1), widths = c(8, 2)) } @@ -468,35 +638,93 @@ PlotStereoMap <- function(var, lon, lat, latlims = c(60, 90), col_inf_image <- ifelse(is.null(col_inf), colNA, col_inf) col_sup_image <- ifelse(is.null(col_sup), colNA, col_sup) # Draw the data polygons - for (jx in 1:dims[1]) { - for (jy in 1:dims[2]) { - if (lat[jy] >= latlims[1] && latlims[2] >= lat[jy]) { - coord <- mapproj::mapproject(c(lon[jx] - dlon, lon[jx] + dlon, - lon[jx] + dlon, lon[jx] - dlon), - c(lat[jy] - dlat, lat[jy] - dlat, - lat[jy] + dlat, lat[jy] + dlat)) - if (is.na(var[jx, jy] > 0)) { - col <- colNA - } else if (var[jx, jy] <= brks[1]) { - col <- col_inf_image - } else if (var[jx, jy] >= tail(brks, 1)) { - col <- col_sup_image - } else { - ind <- which(brks[-1] >= var[jx, jy] & var[jx, jy] > brks[-length(brks)]) - col <- cols[ind] + for (jx in 1:dims[1]) { + for (jy in 1:length(lat_plot_ind)) { + coord <- mapproj::mapproject(c(lon[jx] - dlon, lon[jx] + dlon, + lon[jx] + dlon, lon[jx] - dlon), + c(lat[lat_plot_ind][jy] - dlat, lat[lat_plot_ind][jy] - dlat, + lat[lat_plot_ind][jy] + dlat, lat[lat_plot_ind][jy] + dlat)) + if (is.na(var[jx, lat_plot_ind[jy]] > 0)) { + col <- colNA + } else if (var[jx, lat_plot_ind[jy]] <= brks[1]) { + col <- col_inf_image + } else if (var[jx, lat_plot_ind[jy]] >= tail(brks, 1)) { + col <- col_sup_image + } else { + ind <- which(brks[-1] >= var[jx, lat_plot_ind[jy]] & var[jx, lat_plot_ind[jy]] > brks[-length(brks)]) + col <- cols[ind] + } + polygon(coord, col = col, border = NA) + } + } + + # contours + if (!is.null(contours)) { + nbrks2 <- length(brks2) + for (n_brks2 in 1:nbrks2) { + cl <- grDevices::contourLines(x = lonb$x, y = latb$x[latb_plot_ind], + z = contours[lonb$ix, latb$ix[latb_plot_ind]], + levels = brks2[n_brks2]) + if (length(cl) > 0) { + for (i in seq_along(cl)) { + xy <- mapproj::mapproject(cl[[i]]$x, cl[[i]]$y) + xc <- xy$x + yc <- xy$y + nc <- length(xc) + lines(xc, yc, col = contour_color, lwd = contour_lwd, lty = contour_lty) + + # draw label + if (contour_label_draw) { + label_char <- as.character(signif(brks2[n_brks2], 2)) + ## Check if the label has enough space to draw first. + last_slope <- Inf + put_label <- FALSE + for (p1 in 1:nc) { + p2 <- p1 + while (p2 < nc) { + dist <- sqrt((yc[p2] - yc[p1])^2 + (xc[p2] - xc[p1])^2) + if (!is.infinite(dist) & + dist > 1.2 * strwidth(label_char, cex = contour_label_scale)) { + put_label <- TRUE + slope <- (yc[p2] - yc[p1]) / (xc[p2] - xc[p1]) + # flatter is better + if (abs(slope) < abs(last_slope)) { + last_slope <- slope + last_p1 <- p1 + last_p2 <- p2 + } + break # Found a proper space for label. Move to the next p1. + } + p2 <- p2 + 1 # If the dist is not enough, try next p2. + } + } + + ## If label can be put + if (put_label) { + # Label should be at the middle of p1 and p2 + p_label <- (last_p1 + last_p2) / 2 + # string rotation angle is calculated from the slope + srt_label <- atan(last_slope) * 57.2958 # radian to degree + + #NOTE: 'cex' in text() is the scale factor. The actual size will be + # contour_label_scale * par("cex") + text(xc[p_label], yc[p_label], label_char, + cex = contour_label_scale, col = contour_color, srt = srt_label) + } + } } - polygon(coord, col = col, border = NA) } } } + # Draw the dots if (!is.null(dots)) { numbfig <- 1 # for compatibility with PlotEquiMap code - dots <- dots[, , which(lat >= latlims[1] & lat <= latlims[2]), drop = FALSE] - data_avail <- !is.na(var[, which(lat >= latlims[1] & lat <= latlims[2]), drop = FALSE]) + dots <- dots[, , lat_plot_ind, drop = FALSE] + data_avail <- !is.na(var[, lat_plot_ind, drop = FALSE]) for (counter in 1:(dim(dots)[1])) { points <- which(dots[counter, , ] & data_avail, arr.ind = TRUE) - points_proj <- mapproj::mapproject(lon[points[, 1]], lat[points[, 2]]) + points_proj <- mapproj::mapproject(lon[points[, 1]], lat[lat_plot_ind][points[, 2]]) points(points_proj$x, points_proj$y, pch = dot_symbol[counter], cex = dot_size[counter] * 3 / sqrt(sqrt(sum(lat >= latlims[which.min(abs(latlims))]) * length(lon))), @@ -542,6 +770,84 @@ PlotStereoMap <- function(var, lon, lat, latlims = c(60, 90), } } + # + # PlotWind + # ~~~~~~~~~~ + # + if (!is.null(varu) && !is.null(varv)) { + # Create a two dimention array of longitude and latitude + lontab <- InsertDim(lonb$x, 2, length(latb$x[latb_plot_ind])) + lattab <- InsertDim(latb$x[latb_plot_ind], 1, length(lonb$x)) + # Select a subsample of the points to an arrow for each "subsample" grid point + # latmin has the most arrows, and latmax (polar point) has no arrow. + sublon_max <- seq(1, length(lonb$x), arr_subsamp) + sublat_max <- seq(1, length(latb$x[latb_plot_ind]), arr_subsamp) + ## calculate the length of sublon for each lat + arr_num_at_lat <- round(seq(length(sublon_max), 0, length.out = length(lat[lat_plot_ind]))) + ## If south hemisphere, revserse arr_num_at_lat (smaller lat has less arrows) + if (center_at < 0) { + arr_num_at_lat <- rev(arr_num_at_lat) + } + for (n_lat in seq_along(sublat_max)) { + sublat <- sublat_max[n_lat] + if (arr_num_at_lat[sublat] != 0) { + sublon <- round(seq(1, length(lon), length.out = arr_num_at_lat[sublat])) + # end points (start points + varu/varv) + uaux <- lontab[sublon, sublat] + varu[lonb$ix, latb$ix[latb_plot_ind]][sublon, sublat] * 0.5 * arr_scale + vaux <- lattab[sublon, sublat] + varv[lonb$ix, latb$ix[latb_plot_ind]][sublon, sublat] * 0.5 * arr_scale + + # project the start and end points on stereographic + xy0 <- mapproj::mapproject(lontab[sublon, sublat], lattab[sublon, sublat]) + xy1 <- mapproj::mapproject(uaux, vaux) + xc0 <- xy0$x + yc0 <- xy0$y + xc1 <- xy1$x + yc1 <- xy1$y + nc <- length(xc0) + + lenshaft <- 0.18 * arr_scale * arr_scale_shaft + angleshaft <- 12 * arr_scale_shaft_angle + + # Plot Wind + arrows(xc0, yc0, + xc1, yc1, + angle = angleshaft, + length = lenshaft) + } + } + + # Plot an arrow at the bottom of the plot for the legend + # Put arrow at lon = 0, lat = lowest lat (i.e., biggest circle) - (latmax - latmin)/8 + delta_arr_lengend <- (0.5 * arr_scale * arr_ref_len) + posarlon <- c(0 - delta_arr_lengend / 2, 0 + delta_arr_lengend / 2) + posarlat <- rep(min(abs(lat[lat_plot_ind])) - diff(range(lat[lat_plot_ind]))/8, 2) +#NOTE: The following lines put legend at bottom left corner. But it's hard to put it horizontal +# delta_arr_lengend <- (0.5 * arr_scale * arr_ref_len)/sqrt(2) +# posarlat[1] <- posarlat[1] - delta_arr_lengend / 2 +# posarlat[2] <- posarlat[2] + delta_arr_lengend / 2 + ## turn into stereographic + arr_lengend <- mapproj::mapproject(posarlon, posarlat) + + arrows(arr_lengend$x[1], arr_lengend$y[1], + arr_lengend$x[2], arr_lengend$y[2], + length = lenshaft, angle = angleshaft, + xpd = TRUE) + #save the parameter value + xpdsave <- par('xpd') + #desactivate xpd to be able to plot in margen + par(xpd = NA) + #plot text + mtext(paste(as.character(arr_ref_len), arr_units, sep = ""), + line = min(arr_lengend$y) + 1.8 * abs(min(arr_lengend$y)), + side = 1, + at = mean(arr_lengend$x), + cex = units_scale) + #come back to the previous xpd value + par(xpd = xpdsave) + + } + + # # Colorbar # ~~~~~~~~~~ diff --git a/R/StatSeasAtlHurr.R b/R/StatSeasAtlHurr.R index 43d41b651c84e2ebe1429a598210b893c641a7b7..7cee7a0364a5771c422fc2a7e98fda34bc3354d5 100644 --- a/R/StatSeasAtlHurr.R +++ b/R/StatSeasAtlHurr.R @@ -136,7 +136,7 @@ StatSeasAtlHurr <- function(atlano = NULL, tropano = NULL, hrvar = "HR") { # mean. PDI follows a gamma distribution, with sigma = # -0.57. (variance = sigma^2 * mean^2). # ----------------------------------------------------------- - if (hrvar == "HR" && hrvar == "TC") { + if (hrvar == "HR" | hrvar == "TC") { statval$var <- statval$mean } else { sigma <- -0.57 diff --git a/R/Utils.R b/R/Utils.R index 1dbf48727cb3e9f5b1e05e8fc57d53231bd62e5d..afe075cbcc8b4c2af00fa6938a00659254e68b72 100644 --- a/R/Utils.R +++ b/R/Utils.R @@ -322,11 +322,9 @@ if ((grid_lons != common_grid_lons) || (grid_lats != common_grid_lats) || (grid_type != common_grid_type) || - ((lon[1] != first_common_grid_lon) - && !work_piece[['single_dataset']])) { + (lon[1] != first_common_grid_lon)) { if (grid_lons == common_grid_lons && grid_lats == common_grid_lats && - grid_type == common_grid_type && lon[1] != first_common_grid_lon && - !work_piece[['single_dataset']]) { + grid_type == common_grid_type && lon[1] != first_common_grid_lon) { remove_shift <- TRUE } remap_needed <- TRUE @@ -595,9 +593,6 @@ nltime <- fnc$var[[namevar]][['dim']][[match(time_dimname, var_dimnames)]]$len expected_dims <- c(expected_dims, time_dimname) dim_matches <- match(expected_dims, var_dimnames) - first_time_step_in_file <- fnc$var[[namevar]][['dim']][[match(time_dimname, - var_dimnames)]]$vals[1] - time_units <- fnc$var[[namevar]][['dim']][[match(time_dimname, var_dimnames)]]$units } else { if (!is.null(old_members_dimname)) { expected_dims[which(expected_dims == 'lev')] <- old_members_dimname @@ -638,7 +633,7 @@ time_indices <- ts(time_indices, start = c(years[1], mons[1]), end = c(years[length(years)], mons[length(mons)]), frequency = 12) - ltimes_list <- list() + ltimes_list <- list() for (sdate in work_piece[['startdates']]) { selected_time_indices <- window(time_indices, start = c(as.numeric( substr(sdate, 1, 4)), as.numeric(substr(sdate, 5, 6))), @@ -945,9 +940,7 @@ if (explore_dims) { list(dims = dims, is_2d_var = is_2d_var, grid = grid_name, units = units, var_long_name = var_long_name, - data_across_gw = data_across_gw, array_across_gw = array_across_gw, - time_dim = list(first_time_step_in_file = first_time_step_in_file, - time_units = time_units)) + data_across_gw = data_across_gw, array_across_gw = array_across_gw) } else { ###if (!silent && !is.null(progress_connection) && !is.null(work_piece[['progress_amount']])) { ### foobar <- writeBin(work_piece[['progress_amount']], progress_connection) diff --git a/R/zzz.R b/R/zzz.R new file mode 100644 index 0000000000000000000000000000000000000000..ffae1da476c32ddfe16bfbf938afe7c0a7dca35d --- /dev/null +++ b/R/zzz.R @@ -0,0 +1,3 @@ +.onAttach <- function(libname, pkgname){ + packageStartupMessage("Warning: This package has been deprecated. Please consider using the package 's2dv' instead.") +} diff --git a/man/ACC.Rd b/man/ACC.Rd index e3db377ff89f82c9d4d3cab82033aa487320b6b1..61b286f29affa75e73543f58b625e09309479c55 100644 --- a/man/ACC.Rd +++ b/man/ACC.Rd @@ -4,8 +4,16 @@ \alias{ACC} \title{Computes Anomaly Correlation Coefficient} \usage{ -ACC(var_exp, var_obs, lon = NULL, lat = NULL, lonlatbox = NULL, - conf = TRUE, conftype = "parametric", siglev = 0.95) +ACC( + var_exp, + var_obs, + lon = NULL, + lat = NULL, + lonlatbox = NULL, + conf = TRUE, + conftype = "parametric", + siglev = 0.95 +) } \arguments{ \item{var_exp}{Array of experimental anomalies with dimensions: @@ -97,6 +105,10 @@ acc <- ACC(Mean1Dim(ano_exp, 2), Mean1Dim(ano_obs, 2)) PlotACC(acc$ACC, startDates) } } +\references{ +Joliffe and Stephenson (2012). Forecast Verification: A + Practitioner's Guide in Atmospheric Science. Wiley-Blackwell. +} \author{ History:\cr 0.1 - 2013-08 (V. Guemas, \email{virginie.guemas@bsc.es}) - Original code\cr @@ -107,9 +119,4 @@ History:\cr 1.3.1 - 2014-09 (C. Prodhomme, \email{chloe.prodhomme@bsc.es}) - Add comments and minor style changes\cr 1.3.2 - 2015-02 (N. Manubens, \email{nicolau.manubens@bsc.es}) - Fixed ACC documentation and examples } -\references{ -Joliffe and Stephenson (2012). Forecast Verification: A - Practitioner's Guide in Atmospheric Science. Wiley-Blackwell. -} \keyword{datagen} - diff --git a/man/Alpha.Rd b/man/Alpha.Rd index c2350b2aec0fa3b35f5e7aed163d3c3325697d01..26596dc2fa21074017f118cfbf94a113d10ec1a2 100644 --- a/man/Alpha.Rd +++ b/man/Alpha.Rd @@ -42,4 +42,3 @@ History:\cr 1.0 - 2013-09 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - Formatting to CRAN } \keyword{datagen} - diff --git a/man/AnimateMap.Rd b/man/AnimateMap.Rd index 96074b01680e82364e133050b4853fbf54e374ee..5dc756da823a7199bb48d5d990b1acd6f9575b9d 100644 --- a/man/AnimateMap.Rd +++ b/man/AnimateMap.Rd @@ -4,13 +4,33 @@ \alias{AnimateMap} \title{Animate Maps of Forecast/Observed Values or Scores Over Forecast Time} \usage{ -AnimateMap(var, lon, lat, toptitle = rep("", 11), sizetit = 1, units = "", - monini = 1, freq = 12, msk95lev = FALSE, brks = NULL, cols = NULL, - filled.continents = FALSE, lonmin = 0, lonmax = 360, latmin = -90, - latmax = 90, intlon = 20, intlat = 30, drawleg = TRUE, - subsampleg = 1, colNA = "white", equi = TRUE, +AnimateMap( + var, + lon, + lat, + toptitle = rep("", 11), + sizetit = 1, + units = "", + monini = 1, + freq = 12, + msk95lev = FALSE, + brks = NULL, + cols = NULL, + filled.continents = FALSE, + lonmin = 0, + lonmax = 360, + latmin = -90, + latmax = 90, + intlon = 20, + intlat = 30, + drawleg = TRUE, + subsampleg = 1, + colNA = "white", + equi = TRUE, fileout = c("output1_animvsltime.gif", "output2_animvsltime.gif", - "output3_animvsltime.gif"), ...) + "output3_animvsltime.gif"), + ... +) } \arguments{ \item{var}{Matrix of dimensions (nltime, nlat, nlon) or @@ -194,4 +214,3 @@ History:\cr 1.2 - 2015-05 (V. Guemas, \email{virginie.guemas@bsc.es}) - Use of PlotEquiMap and PlotStereoMap } \keyword{dynamic} - diff --git a/man/Ano.Rd b/man/Ano.Rd index 6143be88a1d78f87901e0dc6c7774f26dd4e4055..6461ec77afd67bd26eea92f1211d592dffc11a51 100644 --- a/man/Ano.Rd +++ b/man/Ano.Rd @@ -49,4 +49,3 @@ History:\cr 1.0 - 2013-09 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - Formatting to R CRAN } \keyword{datagen} - diff --git a/man/Ano_CrossValid.Rd b/man/Ano_CrossValid.Rd index 85d1badbe8213a7c3bd5f275d09f36a3d254ce27..700174920026940f1b3397ab185ef7c51a5c9684 100644 --- a/man/Ano_CrossValid.Rd +++ b/man/Ano_CrossValid.Rd @@ -43,4 +43,3 @@ History:\cr 1.0 - 2013-09 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - Formatting to CRAN } \keyword{datagen} - diff --git a/man/ArrayToNetCDF.Rd b/man/ArrayToNetCDF.Rd index 77cbfaf8ccf98c0c4ce48c2ddefc4cd1037e0bd6..4e05d829e52a4bee640f4dc1a86f1f4d4a6dd736 100644 --- a/man/ArrayToNetCDF.Rd +++ b/man/ArrayToNetCDF.Rd @@ -238,4 +238,3 @@ History:\cr 0.0 - 2017-01 (N. Manubens, \email{nicolau.manubens@bsc.es}) - Original code. } \keyword{datagen} - diff --git a/man/BrierScore.Rd b/man/BrierScore.Rd index 5094987c932a3215a59a86fbf896695aee3caacb..e802dc35489615df5bdd0f248a7b1ed903f7f169 100644 --- a/man/BrierScore.Rd +++ b/man/BrierScore.Rd @@ -1,8 +1,8 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/BrierScore.R \name{BrierScore} -\alias{.BrierScore} \alias{BrierScore} +\alias{.BrierScore} \title{Compute Brier Score And Its Decomposition And Brier Skill Score} \usage{ BrierScore(obs, pred, thresholds = seq(0, 1, 0.1)) @@ -85,11 +85,6 @@ bs2 <- veriApply("BrierScore2", bins_ano_exp, Mean1Dim(bins_ano_ob,s 3), tdim = 2, ensdim = 3) } } -\author{ -History:\cr - 0.1 - 2012-04 (L. Rodrigues, \email{lrodrigues@ic3.cat}) - Original code\cr - 0.2 - 2017-02 (A. Hunter, \email{alasdair.hunter@bsc.es}) - Adapted to veriApply() -} \references{ Wilks (2006) Statistical Methods in the Atmospheric Sciences.\cr Stephenson et al. (2008). Two extra components in the Brier score decomposition. @@ -97,5 +92,9 @@ Stephenson et al. (2008). Two extra components in the Brier score decomposition. Ferro and Fricker (2012). A bias-corrected decomposition of the BS. Quarterly Journal of the Royal Meteorological Society, DOI: 10.1002/qj.1924. } +\author{ +History:\cr + 0.1 - 2012-04 (L. Rodrigues, \email{lrodrigues@ic3.cat}) - Original code\cr + 0.2 - 2017-02 (A. Hunter, \email{alasdair.hunter@bsc.es}) - Adapted to veriApply() +} \keyword{datagen} - diff --git a/man/CDORemap.Rd b/man/CDORemap.Rd index b2d5eaa318af16631bb7c813eccd2a635d9f8395..bae7aa55b5490e28c60f4864619ccda2824b245d 100644 --- a/man/CDORemap.Rd +++ b/man/CDORemap.Rd @@ -4,8 +4,17 @@ \alias{CDORemap} \title{Interpolates arrays with longitude and latitude dimensions using CDO} \usage{ -CDORemap(data_array = NULL, lons, lats, grid, method, avoid_writes = TRUE, - crop = TRUE, force_remap = FALSE, write_dir = tempdir()) +CDORemap( + data_array = NULL, + lons, + lats, + grid, + method, + avoid_writes = TRUE, + crop = TRUE, + force_remap = FALSE, + write_dir = tempdir() +) } \arguments{ \item{data_array}{Multidimensional numeric array to be interpolated. If @@ -226,4 +235,3 @@ History:\cr 0.0 - 2017-01 (N. Manubens, \email{nicolau.manubens@bsc.es}) - Original code. } \keyword{datagen} - diff --git a/man/Clim.Rd b/man/Clim.Rd index 1ef5e3dabb76b6bf4fc7b5b3956351de2ef2f265..69f7ceb08cd66b8355e680734b226378522711fb 100644 --- a/man/Clim.Rd +++ b/man/Clim.Rd @@ -63,4 +63,3 @@ History:\cr 1.0 - 2013-09 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - Formatting to R CRAN } \keyword{datagen} - diff --git a/man/Cluster.Rd b/man/Cluster.Rd index 70f22347fd90a91dd1477329c56520b3a4759ab7..4094fcb8f93862fbf7e3aafe67bf3dcbd9019155 100644 --- a/man/Cluster.Rd +++ b/man/Cluster.Rd @@ -92,7 +92,7 @@ for (i1 in c1) { a1[i1, ] <- x1 + rnorm(4, mean = mean1, sd = sd1) } -c1p5 <- c0[!(c0 \\\%in\\\% c1)] +c1p5 <- c0[!(c0 \%in\% c1)] c2 <- c1p5[seq(1, length(c1p5), 2)] x2 <- c(2, 2, 4, 4) for (i2 in c2) { @@ -114,12 +114,11 @@ res2 <- Cluster(var = a1, weights = array(1, dim = dim(a1)[2])) print(res2$cluster) print(res2$centers) } +\references{ +Wilks, 2011, Statistical Methods in the Atmospheric Sciences, 3rd ed., Elsevire, pp 676. +} \author{ History:\cr 1.0 # 2014-10 (N.S. Fuckar, \email{neven.fuckar@bsc.es}) - Original code } -\references{ -Wilks, 2011, Statistical Methods in the Atmospheric Sciences, 3rd ed., Elsevire, pp 676. -} \keyword{datagen} - diff --git a/man/ColorBar.Rd b/man/ColorBar.Rd index 71da02be33f60396c2c0338f4df3634b6fe6f5cd..98c99679c907f1fb9b804408754e67956b915428 100644 --- a/man/ColorBar.Rd +++ b/man/ColorBar.Rd @@ -4,13 +4,30 @@ \alias{ColorBar} \title{Draws a Color Bar} \usage{ -ColorBar(brks = NULL, cols = NULL, vertical = TRUE, subsampleg = NULL, - bar_limits = NULL, var_limits = NULL, triangle_ends = NULL, - col_inf = NULL, col_sup = NULL, color_fun = clim.palette(), - plot = TRUE, draw_ticks = TRUE, draw_separators = FALSE, - triangle_ends_scale = 1, extra_labels = NULL, title = NULL, - title_scale = 1, label_scale = 1, tick_scale = 1, - extra_margin = rep(0, 4), label_digits = 4, ...) +ColorBar( + brks = NULL, + cols = NULL, + vertical = TRUE, + subsampleg = NULL, + bar_limits = NULL, + var_limits = NULL, + triangle_ends = NULL, + col_inf = NULL, + col_sup = NULL, + color_fun = clim.palette(), + plot = TRUE, + draw_ticks = TRUE, + draw_separators = FALSE, + triangle_ends_scale = 1, + extra_labels = NULL, + title = NULL, + title_scale = 1, + label_scale = 1, + tick_scale = 1, + extra_margin = rep(0, 4), + label_digits = 4, + ... +) } \arguments{ \item{brks}{Can be provided in two formats: @@ -185,4 +202,3 @@ History:\cr (V. Torralba, \email{veronica.torralba@bsc.es}) } \keyword{hplot} - diff --git a/man/Composite.Rd b/man/Composite.Rd index 3d9a3fd8eba3c149af352eb0027b8688dce3e8c4..927d8a561a7394ef282ff1c8a2d311f9d8a7fbb4 100644 --- a/man/Composite.Rd +++ b/man/Composite.Rd @@ -91,4 +91,3 @@ History: 0.1 # 2014-08 (N.S. Fuckar, \email{neven.fuckar@bsc.es}) # Original code } \keyword{datagen} - diff --git a/man/ConfigApplyMatchingEntries.Rd b/man/ConfigApplyMatchingEntries.Rd index 626e385de264d6111c3cfbef55eb3c37915aeb32..74abb1671a8ab3c5055e60f7eb63d76fb2254665 100644 --- a/man/ConfigApplyMatchingEntries.Rd +++ b/man/ConfigApplyMatchingEntries.Rd @@ -4,8 +4,14 @@ \alias{ConfigApplyMatchingEntries} \title{Apply Matching Entries To Dataset Name And Variable Name To Find Related Info} \usage{ -ConfigApplyMatchingEntries(configuration, var, exp = NULL, obs = NULL, - show_entries = FALSE, show_result = TRUE) +ConfigApplyMatchingEntries( + configuration, + var, + exp = NULL, + obs = NULL, + show_entries = FALSE, + show_result = TRUE +) } \arguments{ \item{configuration}{Configuration object obtained from ConfigFileOpen() @@ -63,15 +69,14 @@ configuration <- ConfigEditEntry(configuration, "experiments", 1, match_info <- ConfigApplyMatchingEntries(configuration, 'tas', exp = c('ExampleExperiment2'), show_result = TRUE) } -\author{ -History:\cr - 0.1 - 2015-05 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - First version\cr - 1.0 - 2015-11 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - Removed grid column and storage types -} \seealso{ ConfigApplyMatchingEntries, ConfigEditDefinition, ConfigEditEntry, ConfigFileOpen, ConfigShowSimilarEntries, ConfigShowTable } +\author{ +History:\cr + 0.1 - 2015-05 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - First version\cr + 1.0 - 2015-11 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - Removed grid column and storage types +} \keyword{datagen} - diff --git a/man/ConfigEditDefinition.Rd b/man/ConfigEditDefinition.Rd index b1f7c8821ab97d044bd78e22996c4d9f0984380c..a25a9c3bbd356599a7bb61fad8708c98dd51043f 100644 --- a/man/ConfigEditDefinition.Rd +++ b/man/ConfigEditDefinition.Rd @@ -52,14 +52,13 @@ match_info <- ConfigApplyMatchingEntries(configuration, 'tas', exp = c('ExampleExperiment2'), show_result = TRUE) } -\author{ -History: - 0.1 - 2015-05 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - First version -} \seealso{ [ConfigApplyMatchingEntries()], [ConfigEditDefinition()], [ConfigEditEntry()], [ConfigFileOpen()], [ConfigShowSimilarEntries()], [ConfigShowTable()]. } +\author{ +History: + 0.1 - 2015-05 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - First version +} \keyword{datagen} - diff --git a/man/ConfigEditEntry.Rd b/man/ConfigEditEntry.Rd index 83973231bcc5d40fe2264b789f0beaea3b110dd8..2b13d0b9c72c67b2c7d847212d4eda6114258aa6 100644 --- a/man/ConfigEditEntry.Rd +++ b/man/ConfigEditEntry.Rd @@ -1,22 +1,46 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/ConfigEditEntry.R \name{ConfigEditEntry} -\alias{ConfigAddEntry} \alias{ConfigEditEntry} +\alias{ConfigAddEntry} \alias{ConfigRemoveEntry} \title{Add, Remove Or Edit Entries In The Configuration} \usage{ -ConfigEditEntry(configuration, dataset_type, position, dataset_name = NULL, - var_name = NULL, main_path = NULL, file_path = NULL, - nc_var_name = NULL, suffix = NULL, varmin = NULL, varmax = NULL) +ConfigEditEntry( + configuration, + dataset_type, + position, + dataset_name = NULL, + var_name = NULL, + main_path = NULL, + file_path = NULL, + nc_var_name = NULL, + suffix = NULL, + varmin = NULL, + varmax = NULL +) -ConfigAddEntry(configuration, dataset_type, position = "last", - dataset_name = ".*", var_name = ".*", main_path = "*", - file_path = "*", nc_var_name = "*", suffix = "*", varmin = "*", - varmax = "*") +ConfigAddEntry( + configuration, + dataset_type, + position = "last", + dataset_name = ".*", + var_name = ".*", + main_path = "*", + file_path = "*", + nc_var_name = "*", + suffix = "*", + varmin = "*", + varmax = "*" +) -ConfigRemoveEntry(configuration, dataset_type, dataset_name = NULL, - var_name = NULL, position = NULL) +ConfigRemoveEntry( + configuration, + dataset_type, + dataset_name = NULL, + var_name = NULL, + position = NULL +) } \arguments{ \item{configuration}{Configuration object obtained via ConfigFileOpen() @@ -95,14 +119,13 @@ ConfigShowTable(configuration, "experiments") # Save the configuration ConfigFileSave(configuration, config_file, confirm = FALSE) } +\seealso{ +ConfigApplyMatchingEntries, ConfigEditDefinition, ConfigEditEntry, + ConfigFileOpen, ConfigShowSimilarEntries, ConfigShowTable +} \author{ History:\cr 0.1 - 2015-05 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - First version\cr 1.0 - 2015-11 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - Removed grid column and storage formats } -\seealso{ -ConfigApplyMatchingEntries, ConfigEditDefinition, ConfigEditEntry, - ConfigFileOpen, ConfigShowSimilarEntries, ConfigShowTable -} \keyword{datagen} - diff --git a/man/ConfigFileOpen.Rd b/man/ConfigFileOpen.Rd index 3630c155cc7f9db9f56bd1537df613496370318e..1bdb9a34415fbad7b2df1aa84b234ee96a4fc7c2 100644 --- a/man/ConfigFileOpen.Rd +++ b/man/ConfigFileOpen.Rd @@ -1,8 +1,8 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/ConfigFileOpen.R \name{ConfigFileOpen} -\alias{ConfigFileCreate} \alias{ConfigFileOpen} +\alias{ConfigFileCreate} \alias{ConfigFileSave} \title{Functions To Create Open And Save Configuration File} \usage{ @@ -185,11 +185,6 @@ match_info <- ConfigApplyMatchingEntries(configuration, 'tas', # Finally save the configuration file. ConfigFileSave(configuration, config_file, confirm = FALSE) -} -\author{ -History: - 0.1 - 2015-05 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - First version - 1.0 - 2015-11 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - Removed grid column and storage formats } \references{ [1] \url{https://stat.ethz.ch/R-manual/R-devel/library/base/html/regex.html}\cr @@ -199,5 +194,9 @@ History: ConfigApplyMatchingEntries, ConfigEditDefinition, ConfigEditEntry, ConfigFileOpen, ConfigShowSimilarEntries, ConfigShowTable } +\author{ +History: + 0.1 - 2015-05 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - First version + 1.0 - 2015-11 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - Removed grid column and storage formats +} \keyword{datagen} - diff --git a/man/ConfigShowSimilarEntries.Rd b/man/ConfigShowSimilarEntries.Rd index 312da7957989e611973d690171dd99083ba2d3b1..154bcb282751267b403a60d1472e027fe74413c4 100644 --- a/man/ConfigShowSimilarEntries.Rd +++ b/man/ConfigShowSimilarEntries.Rd @@ -4,10 +4,18 @@ \alias{ConfigShowSimilarEntries} \title{Find Similar Entries In Tables Of Datasets} \usage{ -ConfigShowSimilarEntries(configuration, dataset_name = NULL, - var_name = NULL, main_path = NULL, file_path = NULL, - nc_var_name = NULL, suffix = NULL, varmin = NULL, varmax = NULL, - n_results = 10) +ConfigShowSimilarEntries( + configuration, + dataset_name = NULL, + var_name = NULL, + main_path = NULL, + file_path = NULL, + nc_var_name = NULL, + suffix = NULL, + varmin = NULL, + varmax = NULL, + n_results = 10 +) } \arguments{ \item{configuration}{Configuration object obtained either from @@ -71,11 +79,6 @@ ConfigShowSimilarEntries(configuration, dataset_name = "Exper", var_name = "Vari") } -\author{ -History:\cr - 0.1 - 2015-05 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - First version\cr - 1.0 - 2015-11 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - Removed grid column and storage formats -} \references{ [1] Simon White, string seamness: \url{http://www.catalysoft.com/articles/StrikeAMatch.html} @@ -84,5 +87,9 @@ History:\cr ConfigApplyMatchingEntries, ConfigEditDefinition, ConfigEditEntry, ConfigFileOpen, ConfigShowSimilarEntries, ConfigShowTable } +\author{ +History:\cr + 0.1 - 2015-05 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - First version\cr + 1.0 - 2015-11 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - Removed grid column and storage formats +} \keyword{datagen} - diff --git a/man/ConfigShowTable.Rd b/man/ConfigShowTable.Rd index a06b643e1f1cf9ba5909d923b704ef164b451bb8..566491560743cdeeaf587da90abc68378bf18e62 100644 --- a/man/ConfigShowTable.Rd +++ b/man/ConfigShowTable.Rd @@ -1,8 +1,8 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/ConfigShowTable.R \name{ConfigShowTable} -\alias{ConfigShowDefinitions} \alias{ConfigShowTable} +\alias{ConfigShowDefinitions} \title{Show Configuration Tables And Definitions} \usage{ ConfigShowTable(configuration, dataset_type, line_numbers = NULL) @@ -48,16 +48,15 @@ configuration <- ConfigEditEntry(configuration, "experiments", 1, ConfigShowTable(configuration, 'experiments') ConfigShowDefinitions(configuration) -} -\author{ -History:\cr - 0.1 - 2015-05 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - First version\cr - 1.0 - 2015-11 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - Removed grid column and storage formats } \seealso{ [ConfigApplyMatchingEntries()], [ConfigEditDefinition()], [ConfigEditEntry()], [ConfigFileOpen()], [ConfigShowSimilarEntries()], [ConfigShowTable()]. } +\author{ +History:\cr + 0.1 - 2015-05 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - First version\cr + 1.0 - 2015-11 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - Removed grid column and storage formats +} \keyword{datagen} - diff --git a/man/Consist_Trend.Rd b/man/Consist_Trend.Rd index d067dcd7069e1fe2ee1b28bb612aba1668761f3c..124e5e3d393dd1f214fdba9b3ef3b34fbfe00aba 100644 --- a/man/Consist_Trend.Rd +++ b/man/Consist_Trend.Rd @@ -80,4 +80,3 @@ History:\cr 1.0 - 2013-09 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - Formatting to R CRAN } \keyword{datagen} - diff --git a/man/Corr.Rd b/man/Corr.Rd index e311813de042355a4499b46d3dd6d9d6fb11c1f9..11a40d79c5da033cc51a52c917066385256451c4 100644 --- a/man/Corr.Rd +++ b/man/Corr.Rd @@ -1,16 +1,24 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/Corr.R \name{Corr} -\alias{.Corr} \alias{Corr} +\alias{.Corr} \title{Computes the correlation coefficient between an array of forecasts and their corresponding observations} \usage{ -Corr(var_exp, var_obs, posloop = 1, poscor = 2, compROW = NULL, - limits = NULL, siglev = 0.95, method = "pearson", conf = TRUE, - pval = TRUE) +Corr( + var_exp, + var_obs, + posloop = 1, + poscor = 2, + compROW = NULL, + limits = NULL, + siglev = 0.95, + method = "pearson", + conf = TRUE, + pval = TRUE +) -.Corr(exp, obs, siglev = 0.95, method = "pearson", conf = TRUE, - pval = TRUE) +.Corr(exp, obs, siglev = 0.95, method = "pearson", conf = TRUE, pval = TRUE) } \arguments{ \item{var_exp}{Array of experimental data.} @@ -131,4 +139,3 @@ History:\cr 1.3 - 2017-02 (A. Hunter, \email{alasdair.hunter@bsc.es}) - Adapted to veriApply() } \keyword{datagen} - diff --git a/man/EOF.Rd b/man/EOF.Rd index bd0b31e43a41999b50a7f9fe93d9f3ff9a4a00c7..4ad3d80d452e7a5b7d4143925cecc181bb116861 100644 --- a/man/EOF.Rd +++ b/man/EOF.Rd @@ -8,7 +8,9 @@ EOF(ano, lon, lat, neofs = 15, corr = FALSE) } \arguments{ \item{ano}{Array of anomalies with dimensions (number of timesteps, -number of latitudes, number of longitudes).} +number of latitudes, number of longitudes). NAs could exist but it should +be consistent along time_dim. That is, if one grid point has NAs, all the +time steps at this point should be NAs.} \item{lon}{Vector of longitudes of \code{ano}.} @@ -82,6 +84,9 @@ ano <- Ano_CrossValid(sampleData$mod, sampleData$obs) eof <- EOF(Mean1Dim(ano$ano_exp, 2)[1, , 1, , ], sampleData$lon, sampleData$lat) PlotEquiMap(eof$EOFs[1, , ], sampleData$lon, sampleData$lat) +} +\seealso{ +ProjectField, NAO, PlotBoxWhisker } \author{ History:\cr @@ -115,8 +120,4 @@ weighted by cos(lat)\cr EOF * PC\cr 1.0 - 2016-03 (N. Manubens, \email{nicolau.manubens@bsc.es}) - Formatting to R CRAN } -\seealso{ -ProjectField, NAO, PlotBoxWhisker -} \keyword{datagen} - diff --git a/man/Enlarge.Rd b/man/Enlarge.Rd index 76f5cccf81c2f0da4c788adfc437ebb2c9f4c408..47aed320edf6297d50315c45d129c1c6031c2b17 100644 --- a/man/Enlarge.Rd +++ b/man/Enlarge.Rd @@ -29,4 +29,3 @@ History:\cr 1.1 - 2015-03 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - Improved\cr } \keyword{datagen} - diff --git a/man/Eno.Rd b/man/Eno.Rd index ba4f2088a3b8de234afe763c71bc401dfd70f4b1..ea70bc5ea4ddbe8e9879c28a64c4b373dbef5665 100644 --- a/man/Eno.Rd +++ b/man/Eno.Rd @@ -60,4 +60,3 @@ History:\cr 1.0 - 2013-09 (N. Manubens, \email{nicolau.manubens at ic3.cat}) - Formatting to R CRAN } \keyword{datagen} - diff --git a/man/EnoNew.Rd b/man/EnoNew.Rd index cc2de7608632685dc4fdb75128adbfb94cfc7492..32bf55fd0957f2d3bd20228c0843d126045ffd94 100644 --- a/man/EnoNew.Rd +++ b/man/EnoNew.Rd @@ -55,16 +55,15 @@ sampleData <- s2dverification:::.LoadSampleData('tos', c('experiment'), eno <- EnoNew(sampleData$mod[1, 1, , 1, 2, 3]) print(eno) -} -\author{ -History:\cr -0.1 - 2012-06 (V. Guemas, \email{virginie.guemas at ic3.cat}) - Original code\cr -1.0 - 2013-09 (N. Manubens, \email{nicolau.manubens at ic3.cat}) - Formatting to CRAN } \references{ Guemas V, Auger L, Doblas-Reyes FJ, Rust H, Ribes A, 2014, Dependencies in Statistical Hypothesis Tests for Climate Time Series. Bulletin of the American Meteorological Society, 95 (11), 1666-1667. } +\author{ +History:\cr +0.1 - 2012-06 (V. Guemas, \email{virginie.guemas at ic3.cat}) - Original code\cr +1.0 - 2013-09 (N. Manubens, \email{nicolau.manubens at ic3.cat}) - Formatting to CRAN +} \keyword{datagen} - diff --git a/man/Filter.Rd b/man/Filter.Rd index 3e40f105c3e557f1fcb68516e019e1845d705c1a..21807f5d2313175e31aca46756ad2bc8d0a06fdd 100644 --- a/man/Filter.Rd +++ b/man/Filter.Rd @@ -48,4 +48,3 @@ History:\cr 1.0 - 2012-02 (N. Manubens, \email{nicolau.manubens at ic3.cat}) - Formatting to CRAN } \keyword{datagen} - diff --git a/man/FitAcfCoef.Rd b/man/FitAcfCoef.Rd index 6ca5144422f5d4ed43c94753bd58c50013e2fc5d..6de266e5e60218dfe3c74829263a6d3abc557b70 100644 --- a/man/FitAcfCoef.Rd +++ b/man/FitAcfCoef.Rd @@ -38,4 +38,3 @@ History:\cr 1.0 - 2013-09 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - Formatting to CRAN } \keyword{datagen} - diff --git a/man/FitAutocor.Rd b/man/FitAutocor.Rd index ff3ab9433d2460d631c384a80c358945d364d48a..2d623603a0fde1d97d62350ccb76db58367bc870 100644 --- a/man/FitAutocor.Rd +++ b/man/FitAutocor.Rd @@ -35,4 +35,3 @@ History:\cr 1.0 - 2013-09 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - Formatting to CRAN } \keyword{datagen} - diff --git a/man/GenSeries.Rd b/man/GenSeries.Rd index 9a49ed9d222a53effea4e3f1f73592778047e186..549b259e71cb27518c7c4e00e6f9003cd05c844f 100644 --- a/man/GenSeries.Rd +++ b/man/GenSeries.Rd @@ -34,4 +34,3 @@ History:\cr 1.0 - 2012-04 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - Formatting to CRAN } \keyword{datagen} - diff --git a/man/Histo2Hindcast.Rd b/man/Histo2Hindcast.Rd index 7000628a8ca108cd47e8fee055300871ec6ea695..0f9bd18b04a70ff49bed9951c66d0d0ff812d2d5 100644 --- a/man/Histo2Hindcast.Rd +++ b/man/Histo2Hindcast.Rd @@ -79,4 +79,3 @@ History:\cr 1.0 - 2013-09 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - Formatting to CRAN } \keyword{datagen} - diff --git a/man/IniListDims.Rd b/man/IniListDims.Rd index 422a4c76089e9398225a5b7b438b494ee30635d7..7136994522626193a5de29e3b0f04c765d52290d 100644 --- a/man/IniListDims.Rd +++ b/man/IniListDims.Rd @@ -39,4 +39,3 @@ History:\cr 1.1 - 2015-03 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - Improved } \keyword{datagen} - diff --git a/man/InsertDim.Rd b/man/InsertDim.Rd index 4cdc5377dc69001eed6ff3cfe93192d5086ecb08..e7e50d146f10b9cef81f00b3470c3dbaa46fa216 100644 --- a/man/InsertDim.Rd +++ b/man/InsertDim.Rd @@ -34,4 +34,3 @@ History:\cr 1.1 - 2015-03 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - Improvements } \keyword{datagen} - diff --git a/man/LeapYear.Rd b/man/LeapYear.Rd index 12b02b49a48ed2ec974e35b24d94fbd803aa40aa..7504a27e1424573fb4d0c20e3991037c6fec2561 100644 --- a/man/LeapYear.Rd +++ b/man/LeapYear.Rd @@ -27,4 +27,3 @@ History:\cr 1.0 - 2013-09 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - Formatting to CRAN } \keyword{datagen} - diff --git a/man/Load.Rd b/man/Load.Rd index c721e6139f4cbe77b263fe0e626de71feea35997..6554f58ba65272533049e25a45906b2562021915 100644 --- a/man/Load.Rd +++ b/man/Load.Rd @@ -4,15 +4,36 @@ \alias{Load} \title{Loads Experimental And Observational Data} \usage{ -Load(var, exp = NULL, obs = NULL, sdates, nmember = NULL, - nmemberobs = NULL, nleadtime = NULL, leadtimemin = 1, - leadtimemax = NULL, storefreq = "monthly", sampleperiod = 1, - lonmin = 0, lonmax = 360, latmin = -90, latmax = 90, - output = "areave", method = "conservative", grid = NULL, - maskmod = vector("list", 15), maskobs = vector("list", 15), - configfile = NULL, varmin = NULL, varmax = NULL, silent = FALSE, - nprocs = NULL, dimnames = NULL, remapcells = 2, - path_glob_permissive = "partial") +Load( + var, + exp = NULL, + obs = NULL, + sdates, + nmember = NULL, + nmemberobs = NULL, + nleadtime = NULL, + leadtimemin = 1, + leadtimemax = NULL, + storefreq = "monthly", + sampleperiod = 1, + lonmin = 0, + lonmax = 360, + latmin = -90, + latmax = 90, + output = "areave", + method = "conservative", + grid = NULL, + maskmod = vector("list", 15), + maskobs = vector("list", 15), + configfile = NULL, + varmin = NULL, + varmax = NULL, + silent = FALSE, + nprocs = NULL, + dimnames = NULL, + remapcells = 2, + path_glob_permissive = "partial" +) } \arguments{ \item{var}{Short name of the variable to load. It should coincide with the @@ -883,4 +904,3 @@ History:\cr 1.4 - 2016-01 (N. Manubens, \email{nicolau.manubens@bsc.es}) - Added subsetting capabilities } \keyword{datagen} - diff --git a/man/Mean1Dim.Rd b/man/Mean1Dim.Rd index 613fc468ed0a3f67019b2688f47e398951c8d8ab..6b45e1a7848884425c1584d4b73b4642990e2d39 100644 --- a/man/Mean1Dim.Rd +++ b/man/Mean1Dim.Rd @@ -36,4 +36,3 @@ History:\cr 1.0 - 2013-09 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - Formatting to R CRAN } \keyword{datagen} - diff --git a/man/MeanListDim.Rd b/man/MeanListDim.Rd index 98e07c8eccbaeba6fbc41394fc0a5a809ee0805a..2fdf8981fbfb3cd2520d2eaba3c28253df771184 100644 --- a/man/MeanListDim.Rd +++ b/man/MeanListDim.Rd @@ -33,4 +33,3 @@ History:\cr 1.1 - 2015-03 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - Improved memory usage } \keyword{datagen} - diff --git a/man/NAO.Rd b/man/NAO.Rd index 24d58830e7363fee6ed12b2e9aa70a63eb6dd475..34f363392d34fd2ce8f2ea8c637fd06b7929935c 100644 --- a/man/NAO.Rd +++ b/man/NAO.Rd @@ -4,8 +4,14 @@ \alias{NAO} \title{Computes the North Atlantic Oscillation (NAO) Index} \usage{ -NAO(ano_exp = NULL, ano_obs = NULL, lon, lat, ftime_average = 2:4, - obsproj = TRUE) +NAO( + ano_exp = NULL, + ano_obs = NULL, + lon, + lat, + ftime_average = 2:4, + obsproj = TRUE +) } \arguments{ \item{ano_exp}{Array of North Atlantic SLP (20N-80N, 80W-40E) forecast @@ -113,6 +119,11 @@ PlotBoxWhisker(nao$NAO_exp, nao$NAO_obs, "NAO index, DJF", "NAO index (PC1) TOS" } } +\references{ +Doblas-Reyes, F.J., Pavan, V. and Stephenson, D. (2003). The skill of + multi-model seasonal forecasts of the wintertime North Atlantic Oscillation. + Climate Dynamics, 21, 501-514. DOI: 10.1007/s00382-003-0350-4 +} \author{ History:\cr 0.1 - 2013-08 (F. Lienert, \email{flienert@ic3.cat}) - Original code\cr @@ -127,10 +138,4 @@ History:\cr 1.0 - 2016-03 (N. Manubens, \email{nicolau.manubens@bsc.es}) - Formatted to CRAN } -\references{ -Doblas-Reyes, F.J., Pavan, V. and Stephenson, D. (2003). The skill of - multi-model seasonal forecasts of the wintertime North Atlantic Oscillation. - Climate Dynamics, 21, 501-514. DOI: 10.1007/s00382-003-0350-4 -} \keyword{datagen} - diff --git a/man/Plot2VarsVsLTime.Rd b/man/Plot2VarsVsLTime.Rd index 8ba44e4ee8838e58042d9bb6d0fa39cc306433e1..11af98a77e95fcf32bf86d6840ad173e1639a0b4 100644 --- a/man/Plot2VarsVsLTime.Rd +++ b/man/Plot2VarsVsLTime.Rd @@ -4,12 +4,30 @@ \alias{Plot2VarsVsLTime} \title{Plot Two Scores With Confidence Intervals In A Common Plot} \usage{ -Plot2VarsVsLTime(var1, var2, toptitle = "", ytitle = "", monini = 1, - freq = 12, nticks = NULL, limits = NULL, listexp = c("exp1", "exp2", - "exp3"), listvars = c("var1", "var2"), biglab = FALSE, hlines = NULL, - leg = TRUE, siglev = FALSE, sizetit = 1, show_conf = TRUE, - fileout = "output_plot2varsvsltime.eps", width = 8, height = 5, - size_units = "in", res = 100, ...) +Plot2VarsVsLTime( + var1, + var2, + toptitle = "", + ytitle = "", + monini = 1, + freq = 12, + nticks = NULL, + limits = NULL, + listexp = c("exp1", "exp2", "exp3"), + listvars = c("var1", "var2"), + biglab = FALSE, + hlines = NULL, + leg = TRUE, + siglev = FALSE, + sizetit = 1, + show_conf = TRUE, + fileout = "output_plot2varsvsltime.eps", + width = 8, + height = 5, + size_units = "in", + res = 100, + ... +) } \arguments{ \item{var1}{Matrix of dimensions (nexp/nmod, nltime).} @@ -120,4 +138,3 @@ History:\cr - Original code } \keyword{dynamic} - diff --git a/man/PlotACC.Rd b/man/PlotACC.Rd index fc66200a0388b94d810c868be5335b9dcf1c18fe..289fbf17381e4edb17fce6aaeee5ba0cac623b19 100644 --- a/man/PlotACC.Rd +++ b/man/PlotACC.Rd @@ -4,11 +4,27 @@ \alias{PlotACC} \title{Plot Plumes/Timeseries Of Anomaly Correlation Coefficients} \usage{ -PlotACC(ACC, sdates, toptitle = "", sizetit = 1, ytitle = "", - limits = NULL, legends = NULL, freq = 12, biglab = FALSE, - fill = FALSE, linezero = FALSE, points = TRUE, vlines = NULL, - fileout = "output_PlotACC.eps", width = 8, height = 5, - size_units = "in", res = 100, ...) +PlotACC( + ACC, + sdates, + toptitle = "", + sizetit = 1, + ytitle = "", + limits = NULL, + legends = NULL, + freq = 12, + biglab = FALSE, + fill = FALSE, + linezero = FALSE, + points = TRUE, + vlines = NULL, + fileout = "output_PlotACC.eps", + width = 8, + height = 5, + size_units = "in", + res = 100, + ... +) } \arguments{ \item{ACC}{ACC matrix with with dimensions:\cr @@ -122,4 +138,3 @@ History:\cr 1.0 - 2013-09 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - Formatting to CRAN } \keyword{dynamic} - diff --git a/man/PlotAno.Rd b/man/PlotAno.Rd index dd05931046ca62108d5b8916ba2c5f6f13e92054..2ff2c46c8bc0a2bbc6045669e73d4c9773f18e28 100644 --- a/man/PlotAno.Rd +++ b/man/PlotAno.Rd @@ -4,12 +4,30 @@ \alias{PlotAno} \title{Plot Raw Or Smoothed Anomalies} \usage{ -PlotAno(exp_ano, obs_ano = NULL, sdates, toptitle = rep("", 15), - ytitle = rep("", 15), limits = NULL, legends = NULL, freq = 12, - biglab = FALSE, fill = TRUE, memb = TRUE, ensmean = TRUE, - linezero = FALSE, points = FALSE, vlines = NULL, sizetit = 1, - fileout = paste0("output", 1:5, "_plotano.eps"), width = 8, height = 5, - size_units = "in", res = 100, ...) +PlotAno( + exp_ano, + obs_ano = NULL, + sdates, + toptitle = rep("", 15), + ytitle = rep("", 15), + limits = NULL, + legends = NULL, + freq = 12, + biglab = FALSE, + fill = TRUE, + memb = TRUE, + ensmean = TRUE, + linezero = FALSE, + points = FALSE, + vlines = NULL, + sizetit = 1, + fileout = paste0("output", 1:5, "_plotano.eps"), + width = 8, + height = 5, + size_units = "in", + res = 100, + ... +) } \arguments{ \item{exp_ano}{Array containing the experimental data:\cr @@ -109,4 +127,3 @@ History:\cr 1.0 - 2013-09 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - Formatting to CRAN } \keyword{dynamic} - diff --git a/man/PlotBoxWhisker.Rd b/man/PlotBoxWhisker.Rd index a536686be6087cfb54b8c967ef4bfbbe80a37e3b..9d602103bc5d38ecbc9ad5d380a17be33d5fabdb 100644 --- a/man/PlotBoxWhisker.Rd +++ b/man/PlotBoxWhisker.Rd @@ -4,10 +4,24 @@ \alias{PlotBoxWhisker} \title{Box-And-Whisker Plot of Time Series with Ensemble Distribution} \usage{ -PlotBoxWhisker(exp, obs, toptitle = "", ytitle = "", monini = 1, - yearini = 0, freq = 1, expname = "exp 1", obsname = "obs 1", - drawleg = TRUE, fileout = "output_PlotBoxWhisker.ps", width = 8, - height = 5, size_units = "in", res = 100, ...) +PlotBoxWhisker( + exp, + obs, + toptitle = "", + ytitle = "", + monini = 1, + yearini = 0, + freq = 1, + expname = "exp 1", + obsname = "obs 1", + drawleg = TRUE, + fileout = "output_PlotBoxWhisker.ps", + width = 8, + height = 5, + size_units = "in", + res = 100, + ... +) } \arguments{ \item{exp}{Forecast array of multi-member time series, e.g., the NAO index @@ -119,6 +133,9 @@ PlotBoxWhisker(nao$NAO_exp, nao$NAO_obs, "NAO index, DJF", "NAO index (PC1) TOS" monini = 12, yearini = 1985, freq = 1, "Exp. A", "Obs. X") } +} +\seealso{ +EOF, ProjectField, NAO } \author{ History:\cr @@ -127,8 +144,4 @@ History:\cr normalization for sake of clarity. 1.0 - 2016-03 (N. Manubens, \email{nicolau.manubens@bsc.es}) - Formatting to R CRAN } -\seealso{ -EOF, ProjectField, NAO -} \keyword{datagen} - diff --git a/man/PlotClim.Rd b/man/PlotClim.Rd index 7ee001ee198eb506524cde9c967557dc3ec9ebc1..f4fd7e1ac21cbaa886f8822a44fd268ff344aca4 100644 --- a/man/PlotClim.Rd +++ b/man/PlotClim.Rd @@ -4,11 +4,26 @@ \alias{PlotClim} \title{Plots Climatologies} \usage{ -PlotClim(exp_clim, obs_clim = NULL, toptitle = "", ytitle = "", - monini = 1, freq = 12, limits = NULL, listexp = c("exp1", "exp2", - "exp3"), listobs = c("obs1", "obs2", "obs3"), biglab = FALSE, - leg = TRUE, sizetit = 1, fileout = "output_plotclim.eps", width = 8, - height = 5, size_units = "in", res = 100, ...) +PlotClim( + exp_clim, + obs_clim = NULL, + toptitle = "", + ytitle = "", + monini = 1, + freq = 12, + limits = NULL, + listexp = c("exp1", "exp2", "exp3"), + listobs = c("obs1", "obs2", "obs3"), + biglab = FALSE, + leg = TRUE, + sizetit = 1, + fileout = "output_plotclim.eps", + width = 8, + height = 5, + size_units = "in", + res = 100, + ... +) } \arguments{ \item{exp_clim}{Matrix containing the experimental data with dimensions:\cr @@ -87,4 +102,3 @@ History:\cr 1.0 - 2013-09 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - Formatting to CRAN } \keyword{datagen} - diff --git a/man/PlotEquiMap.Rd b/man/PlotEquiMap.Rd index cb33fc60f2562236a2ef4025c056f28977a15bcc..ee2e56b672a753f0025fa6451b2c144ee2c76811 100644 --- a/man/PlotEquiMap.Rd +++ b/man/PlotEquiMap.Rd @@ -4,25 +4,76 @@ \alias{PlotEquiMap} \title{Maps A Two-Dimensional Variable On A Cylindrical Equidistant Projection} \usage{ -PlotEquiMap(var, lon, lat, varu = NULL, varv = NULL, toptitle = NULL, - sizetit = NULL, units = NULL, brks = NULL, cols = NULL, - bar_limits = NULL, triangle_ends = NULL, col_inf = NULL, - col_sup = NULL, colNA = NULL, color_fun = clim.palette(), - square = TRUE, filled.continents = NULL, coast_color = NULL, - coast_width = 1, contours = NULL, brks2 = NULL, contour_lwd = 0.5, - contour_color = "black", contour_lty = 1, contour_label_scale = 1, - dots = NULL, dot_symbol = 4, dot_size = 1, - arr_subsamp = floor(length(lon)/30), arr_scale = 1, arr_ref_len = 15, - arr_units = "m/s", arr_scale_shaft = 1, arr_scale_shaft_angle = 1, - axelab = TRUE, labW = FALSE, intylat = 20, intxlon = 20, - axes_tick_scale = 1, axes_label_scale = 1, drawleg = TRUE, - subsampleg = NULL, bar_extra_labels = NULL, draw_bar_ticks = TRUE, - draw_separators = FALSE, triangle_ends_scale = 1, bar_label_digits = 4, - bar_label_scale = 1, units_scale = 1, bar_tick_scale = 1, - bar_extra_margin = rep(0, 4), boxlim = NULL, boxcol = "purple2", - boxlwd = 5, margin_scale = rep(1, 4), title_scale = 1, numbfig = NULL, - fileout = NULL, width = 8, height = 5, size_units = "in", res = 100, - ...) +PlotEquiMap( + var, + lon, + lat, + varu = NULL, + varv = NULL, + toptitle = NULL, + sizetit = NULL, + units = NULL, + brks = NULL, + cols = NULL, + bar_limits = NULL, + triangle_ends = NULL, + col_inf = NULL, + col_sup = NULL, + colNA = NULL, + color_fun = clim.palette(), + square = TRUE, + filled.continents = NULL, + coast_color = NULL, + coast_width = 1, + lake_color = NULL, + contours = NULL, + brks2 = NULL, + contour_lwd = 0.5, + contour_color = "black", + contour_lty = 1, + contour_draw_label = TRUE, + contour_label_scale = 1, + dots = NULL, + dot_symbol = 4, + dot_size = 1, + arr_subsamp = floor(length(lon)/30), + arr_scale = 1, + arr_ref_len = 15, + arr_units = "m/s", + arr_scale_shaft = 1, + arr_scale_shaft_angle = 1, + axelab = TRUE, + labW = FALSE, + lab_dist_x = NULL, + lab_dist_y = NULL, + intylat = 20, + intxlon = 20, + axes_tick_scale = 1, + axes_label_scale = 1, + drawleg = TRUE, + subsampleg = NULL, + bar_extra_labels = NULL, + draw_bar_ticks = TRUE, + draw_separators = FALSE, + triangle_ends_scale = 1, + bar_label_digits = 4, + bar_label_scale = 1, + units_scale = 1, + bar_tick_scale = 1, + bar_extra_margin = rep(0, 4), + boxlim = NULL, + boxcol = "purple2", + boxlwd = 5, + margin_scale = rep(1, 4), + title_scale = 1, + numbfig = NULL, + fileout = NULL, + width = 8, + height = 5, + size_units = "in", + res = 100, + ... +) } \arguments{ \item{var}{Array with the values at each cell of a grid on a regular @@ -95,6 +146,10 @@ Takes the value gray(0.5) by default.} \item{coast_width}{Line width of the coast line of the drawn projected continents. Takes the value 1 by default.} +\item{lake_color}{Colour of the lake or other water body inside continents. +It is only functional when 'filled.continents = TRUE'. The default value is +'white'. For now, it is only functional if longitude range is [0, 360].} + \item{contours}{Array of same dimensions as 'var' to be added to the plot and displayed with contours. Parameter 'brks2' is required to define the magnitude breaks for each contour curve. Disregarded if 'square = FALSE'.} @@ -111,6 +166,9 @@ and 'brks2', or if 'square = FALSE'.} \item{contour_lty}{Line type of the contour curves. Takes 1 (solid) by default. See help on 'lty' in par() for other accepted values.} +\item{contour_draw_label}{A logical value indicating whether to draw the +contour labels or not. The default value is TRUE.} + \item{contour_label_scale}{Scale factor for the superimposed labels when drawing contour levels.} @@ -159,6 +217,14 @@ TRUE by default.} \item{labW}{Whether to label the longitude axis with a 'W' instead of minus for negative values. Defaults to FALSE.} +\item{lab_dist_x}{A numeric of the distance of the longitude labels to the +box borders. The default value is NULL and is automatically adjusted by +the function.} + +\item{lab_dist_y}{A numeric of the distance of the latitude labels to the +box borders. The default value is NULL and is automatically adjusted by +the function.} + \item{intylat}{Interval between latitude ticks on y-axis, in degrees. Defaults to 20.} @@ -288,4 +354,3 @@ History:\cr and adapted to new ColorBar. } \keyword{dynamic} - diff --git a/man/PlotLayout.Rd b/man/PlotLayout.Rd index e4cf4ecfd7edd11be269ccd363618247b03ddf2e..3cb81d158c3e244526bd9c4481465dc54e5f18a2 100644 --- a/man/PlotLayout.Rd +++ b/man/PlotLayout.Rd @@ -4,20 +4,52 @@ \alias{PlotLayout} \title{Arrange and Fill Multi-Pannel Layouts With Optional Colour Bar} \usage{ -PlotLayout(fun, plot_dims, var, ..., special_args = NULL, nrow = NULL, - ncol = NULL, toptitle = NULL, row_titles = NULL, col_titles = NULL, - bar_scale = 1, title_scale = 1, title_margin_scale = 1, - title_left_shift_scale = 1, subtitle_scale = 1, - subtitle_margin_scale = 1, brks = NULL, cols = NULL, drawleg = "S", - titles = NULL, subsampleg = NULL, bar_limits = NULL, - triangle_ends = NULL, col_inf = NULL, col_sup = NULL, - color_fun = clim.colors, draw_bar_ticks = TRUE, draw_separators = FALSE, - triangle_ends_scale = 1, bar_extra_labels = NULL, units = NULL, - units_scale = 1, bar_label_scale = 1, bar_tick_scale = 1, - bar_extra_margin = rep(0, 4), bar_left_shift_scale = 1, - bar_label_digits = 4, extra_margin = rep(0, 4), fileout = NULL, - width = NULL, height = NULL, size_units = "in", res = 100, - close_device = TRUE) +PlotLayout( + fun, + plot_dims, + var, + ..., + special_args = NULL, + nrow = NULL, + ncol = NULL, + toptitle = NULL, + row_titles = NULL, + col_titles = NULL, + bar_scale = 1, + title_scale = 1, + title_margin_scale = 1, + title_left_shift_scale = 1, + subtitle_scale = 1, + subtitle_margin_scale = 1, + brks = NULL, + cols = NULL, + drawleg = "S", + titles = NULL, + subsampleg = NULL, + bar_limits = NULL, + triangle_ends = NULL, + col_inf = NULL, + col_sup = NULL, + color_fun = clim.colors, + draw_bar_ticks = TRUE, + draw_separators = FALSE, + triangle_ends_scale = 1, + bar_extra_labels = NULL, + units = NULL, + units_scale = 1, + bar_label_scale = 1, + bar_tick_scale = 1, + bar_extra_margin = rep(0, 4), + bar_left_shift_scale = 1, + bar_label_digits = 4, + extra_margin = rep(0, 4), + fileout = NULL, + width = NULL, + height = NULL, + size_units = "in", + res = 100, + close_device = TRUE +) } \arguments{ \item{fun}{Plot function (or name of the function) to be called on the @@ -48,6 +80,12 @@ applied to each of them. NAs can be passed to the list: a NA will yield a blank cell in the layout, which can be populated after (see .SwitchToFigure).} +\item{\dots}{Parameters to be sent to the plotting function 'fun'. If +multiple arrays are provided in 'var' and multiple functions are provided +in 'fun', the parameters provided through \dots will be sent to all the +plot functions, as common parameters. To specify concrete arguments for +each of the plot functions see parameter 'special_args'.} + \item{special_args}{List of sub-lists, each sub-list having specific extra arguments for each of the plot functions provided in 'fun'. If you want to fix a different value for each plot in the layout you can do so by @@ -164,12 +202,6 @@ the layout and a 'fileout' has been specified. This is useful to avoid closing the device when saving the layout into a file and willing to add extra elements or figures. Takes TRUE by default. Disregarded if no 'fileout' has been specified.} - -\item{\dots}{Parameters to be sent to the plotting function 'fun'. If -multiple arrays are provided in 'var' and multiple functions are provided -in 'fun', the parameters provided through \dots will be sent to all the -plot functions, as common parameters. To specify concrete arguments for -each of the plot functions see parameter 'special_args'.} } \value{ \item{brks}{ @@ -249,4 +281,3 @@ History:\cr 0.1 - 2016-08 (N. Manubens, \email{nicolau.manubens@bsc.es}) - Original code } \keyword{dynamic} - diff --git a/man/PlotMatrix.Rd b/man/PlotMatrix.Rd index 70c1211e9dd333d8dc947671add5f6ef55c4f9cc..88458856d6b7a32538a52a639132168fdbbf1dc1 100644 --- a/man/PlotMatrix.Rd +++ b/man/PlotMatrix.Rd @@ -4,12 +4,28 @@ \alias{PlotMatrix} \title{Function to convert any numerical table to a grid of coloured squares.} \usage{ -PlotMatrix(var, brks = NULL, cols = NULL, toptitle = NULL, - title.color = "royalblue4", xtitle = NULL, ytitle = NULL, - xlabels = NULL, xvert = FALSE, ylabels = NULL, line = 3, - figure.width = 1, legend = TRUE, legend.width = 0.15, - xlab_dist = NULL, ylab_dist = NULL, fileout = NULL, size_units = "px", - res = 100, ...) +PlotMatrix( + var, + brks = NULL, + cols = NULL, + toptitle = NULL, + title.color = "royalblue4", + xtitle = NULL, + ytitle = NULL, + xlabels = NULL, + xvert = FALSE, + ylabels = NULL, + line = 3, + figure.width = 1, + legend = TRUE, + legend.width = 0.15, + xlab_dist = NULL, + ylab_dist = NULL, + fileout = NULL, + size_units = "px", + res = 100, + ... +) } \arguments{ \item{var}{A numerical matrix containing the values to be displayed in a @@ -93,4 +109,3 @@ PlotMatrix(var = matrix(rnorm(n = 120, mean = 0.3), 10, 12), xlabels = c("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")) } - diff --git a/man/PlotSection.Rd b/man/PlotSection.Rd index f74473190242d1630ab85d8b0e7b0fdbefc387e5..3dbe4fa14f06cf491136de25c765e960dbd38db5 100644 --- a/man/PlotSection.Rd +++ b/man/PlotSection.Rd @@ -4,10 +4,26 @@ \alias{PlotSection} \title{Plots A Vertical Section} \usage{ -PlotSection(var, horiz, depth, toptitle = "", sizetit = 1, units = "", - brks = NULL, cols = NULL, axelab = TRUE, intydep = 200, - intxhoriz = 20, drawleg = TRUE, fileout = NULL, width = 8, - height = 5, size_units = "in", res = 100, ...) +PlotSection( + var, + horiz, + depth, + toptitle = "", + sizetit = 1, + units = "", + brks = NULL, + cols = NULL, + axelab = TRUE, + intydep = 200, + intxhoriz = 20, + drawleg = TRUE, + fileout = NULL, + width = 8, + height = 5, + size_units = "in", + res = 100, + ... +) } \arguments{ \item{var}{Matrix to plot with (longitude/latitude, depth) dimensions.} @@ -75,4 +91,3 @@ History:\cr 1.0 - 2013-09 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - Formatting to CRAN } \keyword{dynamic} - diff --git a/man/PlotStereoMap.Rd b/man/PlotStereoMap.Rd index 3bf2f69c44f509a9afbbcb34f6fa9f9dfcc0d198..297358e0b5908e9ff70914ea5533d9f5f718189e 100644 --- a/man/PlotStereoMap.Rd +++ b/man/PlotStereoMap.Rd @@ -4,19 +4,68 @@ \alias{PlotStereoMap} \title{Maps A Two-Dimensional Variable On A Polar Stereographic Projection} \usage{ -PlotStereoMap(var, lon, lat, latlims = c(60, 90), toptitle = NULL, - sizetit = NULL, units = NULL, brks = NULL, cols = NULL, - bar_limits = NULL, triangle_ends = NULL, col_inf = NULL, - col_sup = NULL, colNA = NULL, color_fun = clim.palette(), - filled.continents = FALSE, coast_color = NULL, coast_width = 1, - dots = NULL, dot_symbol = 4, dot_size = 0.8, intlat = 10, - drawleg = TRUE, subsampleg = NULL, bar_extra_labels = NULL, - draw_bar_ticks = TRUE, draw_separators = FALSE, triangle_ends_scale = 1, - bar_label_digits = 4, bar_label_scale = 1, units_scale = 1, - bar_tick_scale = 1, bar_extra_margin = rep(0, 4), boxlim = NULL, - boxcol = "purple2", boxlwd = 5, margin_scale = rep(1, 4), - title_scale = 1, numbfig = NULL, fileout = NULL, width = 6, - height = 5, size_units = "in", res = 100, ...) +PlotStereoMap( + var, + lon, + lat, + varu = NULL, + varv = NULL, + latlims = c(60, 90), + toptitle = NULL, + sizetit = NULL, + units = NULL, + brks = NULL, + cols = NULL, + bar_limits = NULL, + triangle_ends = NULL, + col_inf = NULL, + col_sup = NULL, + colNA = NULL, + color_fun = clim.palette(), + filled.continents = FALSE, + coast_color = NULL, + coast_width = 1, + contours = NULL, + brks2 = NULL, + contour_lwd = 0.5, + contour_color = "black", + contour_lty = 1, + contour_label_draw = TRUE, + contour_label_scale = 0.6, + dots = NULL, + dot_symbol = 4, + dot_size = 0.8, + intlat = 10, + arr_subsamp = floor(length(lon)/30), + arr_scale = 1, + arr_ref_len = 15, + arr_units = "m/s", + arr_scale_shaft = 1, + arr_scale_shaft_angle = 1, + drawleg = TRUE, + subsampleg = NULL, + bar_extra_labels = NULL, + draw_bar_ticks = TRUE, + draw_separators = FALSE, + triangle_ends_scale = 1, + bar_label_digits = 4, + bar_label_scale = 1, + units_scale = 1, + bar_tick_scale = 1, + bar_extra_margin = rep(0, 4), + boxlim = NULL, + boxcol = "purple2", + boxlwd = 5, + margin_scale = rep(1, 4), + title_scale = 1, + numbfig = NULL, + fileout = NULL, + width = 6, + height = 5, + size_units = "in", + res = 100, + ... +) } \arguments{ \item{var}{Array with the values at each cell of a grid on a regular @@ -38,6 +87,12 @@ longitude range can also be provided, e.g. \code{lon = c(0:50, 300:360)} grid of 'var', in any order (same as 'var'). Expected to be from a regular rectangular or gaussian grid, within the range [-90, 90].} +\item{varu}{Array of the zonal component of wind/current/other field with +the same dimensions as 'var'.} + +\item{varv}{Array of the meridional component of wind/current/other field +with the same dimensions as 'var'.} + \item{latlims}{Latitudinal limits of the figure.\cr Example : c(60, 90) for the North Pole\cr c(-90,-60) for the South Pole} @@ -82,6 +137,31 @@ continents. Takes the value gray(0.5) by default.} \item{coast_width}{Line width of the coast line of the drawn projected continents. Takes the value 1 by default.} +\item{contours}{Array of same dimensions as 'var' to be added to the plot +and displayed with contours. Parameter 'brks2' is required to define the +magnitude breaks for each contour curve.} + +\item{brks2}{A numeric value or vector of magnitude breaks where to draw +contour curves for the array provided in 'contours'. If it is a number, it +represents the number of breaks (n) that defines (n - 1) intervals to +classify 'contours'.} + +\item{contour_lwd}{Line width of the contour curves provided via 'contours' +and 'brks2'. The default value is 0.5.} + +\item{contour_color}{Line color of the contour curves provided via 'contours' +and 'brks2'.} + +\item{contour_lty}{Line type of the contour curves. Takes 1 (solid) by +default. See help on 'lty' in par() for other accepted values.} + +\item{contour_label_draw}{A logical value indicating whether to draw the +contour labels (TRUE) or not (FALSE) when 'contours' is used. The default +value is TRUE.} + +\item{contour_label_scale}{Scale factor for the superimposed labels when +drawing contour levels. The default value is 0.6.} + \item{dots}{Array of same dimensions as 'var' or with dimensions c(n, dim(var)), where n is the number of dot/symbol layers to add to the plot. A value of TRUE at a grid cell will draw a dot/symbol on the @@ -102,6 +182,29 @@ layers in 'dots'. Takes 1 by default.} \item{intlat}{Interval between latitude lines (circles), in degrees. Defaults to 10.} +\item{arr_subsamp}{A number as subsampling factor to select a subset of arrows +in 'varu' and 'varv' to be drawn. Only one out of arr_subsamp arrows will +be drawn. The default value is 1.} + +\item{arr_scale}{A number as scale factor for drawn arrows from 'varu' and +'varv'. The default value is 1.} + +\item{arr_ref_len}{A number of the length of the refence arrow to be drawn as +legend at the bottom of the figure (in same units as 'varu' and 'varv', only +affects the legend for the wind or variable in these arrays). The default +value is 15.} + +\item{arr_units}{Units of 'varu' and 'varv', to be drawn in the legend. +Takes 'm/s' by default.} + +\item{arr_scale_shaft}{A number for the scale of the shaft of the arrows +(which also depend on the number of figures and the arr_scale parameter). +The default value is 1.} + +\item{arr_scale_shaft_angle}{A number for the scale of the angle of the +shaft of the arrows (which also depend on the number of figure and the +arr_scale parameter). The default value is 1.} + \item{drawleg}{Whether to plot a color bar (legend, key) or not. Defaults to TRUE.} @@ -172,8 +275,8 @@ Map longitude-latitude array (on a regular rectangular or gaussian grid) on a polar stereographic world projection with coloured grid cells. Only the region within a specified latitude interval is displayed. A colour bar (legend) can be plotted and adjusted. It is possible to draw superimposed -dots, symbols and boxes. A number of options is provided to adjust the -position, size and colour of the components. This plot function is +dots, symbols, boxes, contours, and arrows. A number of options is provided to +adjust the position, size and colour of the components. This plot function is compatible with figure layouts if colour bar is disabled. } \examples{ @@ -192,4 +295,3 @@ History:\cr border and Constantin boxes. } \keyword{dynamic} - diff --git a/man/PlotVsLTime.Rd b/man/PlotVsLTime.Rd index 2c71e9fac1915afa9d9fcba50006d360da2a44c7..402414d1238eb6334fc81a3394f1e32c3a6fbbc9 100644 --- a/man/PlotVsLTime.Rd +++ b/man/PlotVsLTime.Rd @@ -4,12 +4,29 @@ \alias{PlotVsLTime} \title{Plots A Score Along The Forecast Time With Its Confidence Interval} \usage{ -PlotVsLTime(var, toptitle = "", ytitle = "", monini = 1, freq = 12, - nticks = NULL, limits = NULL, listexp = c("exp1", "exp2", "exp3"), - listobs = c("obs1", "obs2", "obs3"), biglab = FALSE, hlines = NULL, - leg = TRUE, siglev = FALSE, sizetit = 1, show_conf = TRUE, - fileout = "output_plotvsltime.eps", width = 8, height = 5, - size_units = "in", res = 100, ...) +PlotVsLTime( + var, + toptitle = "", + ytitle = "", + monini = 1, + freq = 12, + nticks = NULL, + limits = NULL, + listexp = c("exp1", "exp2", "exp3"), + listobs = c("obs1", "obs2", "obs3"), + biglab = FALSE, + hlines = NULL, + leg = TRUE, + siglev = FALSE, + sizetit = 1, + show_conf = TRUE, + fileout = "output_plotvsltime.eps", + width = 8, + height = 5, + size_units = "in", + res = 100, + ... +) } \arguments{ \item{var}{Matrix containing any Prediction Score with dimensions:\cr @@ -133,4 +150,3 @@ History:\cr 1.0 - 2013-11 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - Formatting to CRAN } \keyword{dynamic} - diff --git a/man/ProbBins.Rd b/man/ProbBins.Rd index 6df49cc2e5abe05617b29c2a9c59845609a2441c..56cf05117f2952f9ac907bcc24962475adf2bbc7 100644 --- a/man/ProbBins.Rd +++ b/man/ProbBins.Rd @@ -4,8 +4,15 @@ \alias{ProbBins} \title{Computes Probabilistic Information of a Forecast Relative to a Threshold or a Quantile} \usage{ -ProbBins(ano, fcyr = "all", thr, quantile = TRUE, posdates = 3, - posdim = 2, compPeriod = "Full period") +ProbBins( + ano, + fcyr = "all", + thr, + quantile = TRUE, + posdates = 3, + posdim = 2, + compPeriod = "Full period" +) } \arguments{ \item{ano}{Array of anomalies from Ano().\cr @@ -86,4 +93,3 @@ History:\cr 2.1 - 2017-02 (V. Torralba and N. Manubens, \email{veronica.torralba@bsc.es}) - Fix bug with cross-validation } \keyword{datagen} - diff --git a/man/ProjectField.Rd b/man/ProjectField.Rd index 7b2e9e93741e3119af030346dc6b0af59f3fec83..7dd7712388e55444eb61390eeb1c09336ff0fae6 100644 --- a/man/ProjectField.Rd +++ b/man/ProjectField.Rd @@ -74,6 +74,9 @@ for (i in 1:dim(sampleData$mod)[2]) { ylim = c(-15000, 15000)) } +} +\seealso{ +EOF, NAO, PlotBoxWhisker } \author{ History:\cr @@ -105,8 +108,4 @@ multiplied by W. Getting input dimensions. 1.0 - 2016-03 (N. Manubens, \email{nicolau.manubens@bsc.es}) - Formatting to R CRAN\cr (J.-P. Baudouin, \email{jean.baudouin@bsc.es}) - Example code and testing } -\seealso{ -EOF, NAO, PlotBoxWhisker -} \keyword{datagen} - diff --git a/man/RMS.Rd b/man/RMS.Rd index 715f84d10e82bf233cf2e6016668006a965067ea..877300fac14749d3b1e11ee1c676bb6867849e35 100644 --- a/man/RMS.Rd +++ b/man/RMS.Rd @@ -1,12 +1,20 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/RMS.R \name{RMS} -\alias{.RMS} \alias{RMS} +\alias{.RMS} \title{Computes Root Mean Square Error} \usage{ -RMS(var_exp, var_obs, posloop = 1, posRMS = 2, compROW = NULL, - limits = NULL, siglev = 0.95, conf = TRUE) +RMS( + var_exp, + var_obs, + posloop = 1, + posRMS = 2, + compROW = NULL, + limits = NULL, + siglev = 0.95, + conf = TRUE +) .RMS(exp, obs, siglev = 0.95, conf = TRUE) } @@ -119,4 +127,3 @@ History:\cr 1.1 - 2017-02 (A. Hunter, \email{alasdair.hunter@bsc.es}) - Adapted to veriApply() } \keyword{datagen} - diff --git a/man/RMSSS.Rd b/man/RMSSS.Rd index f602702bf715d5adca99971942cb90a4facd47b3..8bc0d803da2c58c058ac2ea8bbbf14b43ddf821c 100644 --- a/man/RMSSS.Rd +++ b/man/RMSSS.Rd @@ -1,8 +1,8 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/RMSSS.R \name{RMSSS} -\alias{.RMSSS} \alias{RMSSS} +\alias{.RMSSS} \title{Computes Root Mean Square Skill Score} \usage{ RMSSS(var_exp, var_obs, posloop = 1, posRMS = 2, pval = TRUE) @@ -93,4 +93,3 @@ History:\cr 1.1 - 2017-02 (A. Hunter, \email{alasdair.hunter@bsc.es}) - Adapted to veriApply() } \keyword{datagen} - diff --git a/man/RatioRMS.Rd b/man/RatioRMS.Rd index 44d13dbb5b33126c309e549849313102e315ddce..b1abbca19a8e5aa634f0b1989d59f485e44daa0e 100644 --- a/man/RatioRMS.Rd +++ b/man/RatioRMS.Rd @@ -1,8 +1,8 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/RatioRMS.R \name{RatioRMS} -\alias{.RatioRMS} \alias{RatioRMS} +\alias{.RatioRMS} \title{Computes the Ratio Between The RMSE of Two Experiments} \usage{ RatioRMS(var_exp1, var_exp2, var_obs, posRMS = 1, pval = TRUE) @@ -121,4 +121,3 @@ History:\cr 1.1 - 2017-02 (A. Hunter, \email{alasdair.hunter@bsc.es}) - Adapted to veriApply() } \keyword{datagen} - diff --git a/man/RatioSDRMS.Rd b/man/RatioSDRMS.Rd index 0948474075c4bc25f572dafd0ab3180373ba0d6a..97efe6da3b7d968a90164e1cb1eb7816643f231a 100644 --- a/man/RatioSDRMS.Rd +++ b/man/RatioSDRMS.Rd @@ -1,8 +1,8 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/RatioSDRMS.R \name{RatioSDRMS} -\alias{.RatioSDRMS} \alias{RatioSDRMS} +\alias{.RatioSDRMS} \title{Computes the ratio between the ensemble spread and RMSE} \usage{ RatioSDRMS(var_exp, var_obs, pval = TRUE) @@ -86,4 +86,3 @@ History:\cr 1.1 - 2017-02 (A. Hunter, \email{alasdair.hunter@bsc.es}) - Adapted to veriApply() } \keyword{datagen} - diff --git a/man/Regression.Rd b/man/Regression.Rd index 55646576e5b0c180225038f0f15230c6dfdd0243..a376315037f7d308ae1e5363e347b7ca9b858aa0 100644 --- a/man/Regression.Rd +++ b/man/Regression.Rd @@ -73,4 +73,3 @@ History:\cr 1.0 - 2013-09 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - Formatting to CRAN } \keyword{datagen} - diff --git a/man/SVD.Rd b/man/SVD.Rd index 698df95279d18f964609fc037ec947a7a53e8ad0..bbbcaa493b7d8fb40e723594297483c50740fc36 100644 --- a/man/SVD.Rd +++ b/man/SVD.Rd @@ -4,8 +4,15 @@ \alias{SVD} \title{Single Value Decomposition (Maximum Covariance Analysis)} \usage{ -SVD(vary, varx, laty = NULL, latx = NULL, nmodes = 15, corr = FALSE, - weight = TRUE) +SVD( + vary, + varx, + laty = NULL, + latx = NULL, + nmodes = 15, + corr = FALSE, + weight = TRUE +) } \arguments{ \item{vary}{Array containing the anomalies field for the predictor. The @@ -117,4 +124,3 @@ History:\cr 1.0 - 2016-04 (N. Manubens, \email{nicolau.manubens@bsc.es}) - Formatting to R CRAN } \keyword{datagen} - diff --git a/man/Season.Rd b/man/Season.Rd index cc97941c4dcf956e61c2e3c6442275949ec87ae0..76f640534ce29f128b8ed64bae3a702e275d906b 100644 --- a/man/Season.Rd +++ b/man/Season.Rd @@ -54,4 +54,3 @@ History:\cr 1.0 - 2013-09 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - Formatting to CRAN } \keyword{datagen} - diff --git a/man/SelIndices.Rd b/man/SelIndices.Rd index dbf34da2a73fd7f756eded28a3b00df186d777bb..ab3ca88e669ad19a9b6305e80e28f8b7872c0dcc 100644 --- a/man/SelIndices.Rd +++ b/man/SelIndices.Rd @@ -37,4 +37,3 @@ History:\cr 1.0 - 2013-09 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - Formatting to CRAN } \keyword{datagen} - diff --git a/man/Smoothing.Rd b/man/Smoothing.Rd index 4fa9c596f8ff9cb7272922b85b67a1dc1966d3da..492370e99ad377be5a1e68f160599d941898b77a 100644 --- a/man/Smoothing.Rd +++ b/man/Smoothing.Rd @@ -47,4 +47,3 @@ History:\cr making it able to work on arrays of any number of dimensions. } \keyword{datagen} - diff --git a/man/Spectrum.Rd b/man/Spectrum.Rd index de5a2e5efa5acf10a5f6b15174269247778cf02d..a3fce568488da7efaf1dbe8ca146762c89831541 100644 --- a/man/Spectrum.Rd +++ b/man/Spectrum.Rd @@ -48,4 +48,3 @@ History:\cr 1.0 - 2013-09 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - Formatting to CRAN } \keyword{datagen} - diff --git a/man/Spread.Rd b/man/Spread.Rd index f84cecf3e1219702108a872ed42021c05fa072ff..a9f3125b7fe5f86a9bc7dd0d2a308f2855c8616f 100644 --- a/man/Spread.Rd +++ b/man/Spread.Rd @@ -93,4 +93,3 @@ History:\cr 1.0 - 2013-09 (N. Manubens, \email{nicolau.manubens@ic3.cat}) - Formatting to CRAN } \keyword{datagen} - diff --git a/man/StatSeasAtlHurr.Rd b/man/StatSeasAtlHurr.Rd index 9822eb907ff56ae7f2298336d22cd1b902bcff14..053698f7747b1ecca9c8beea92c4a1974afcbb65 100644 --- a/man/StatSeasAtlHurr.Rd +++ b/man/StatSeasAtlHurr.Rd @@ -66,10 +66,6 @@ hr_count <- StatSeasAtlHurr(atlano = AtlAno, hrvar = 'HR') print(hr_count$mean) -} -\author{ -History:\cr -0.1 - 2015-11 (Louis-Philippe Caron, \email{louis-philippe.caron@bsc.es}) - Original code } \references{ Villarini et al. (2010) Mon Wea Rev, 138, 2681-2705.\cr @@ -81,5 +77,8 @@ Caron, L.-P. et al. (2014) Multi-year prediction skill of Atlantic hurricane activity in CMIP5 decadal hindcasts. Climate Dynamics, 42, 2675-2690. doi:10.1007/s00382-013-1773-1. } +\author{ +History:\cr +0.1 - 2015-11 (Louis-Philippe Caron, \email{louis-philippe.caron@bsc.es}) - Original code +} \keyword{datagen} - diff --git a/man/Subset.Rd b/man/Subset.Rd index bccec4acf17b1ceddc50bd0930ef588086ac6d51..570cd7324cdb62f6d999d11be12654b9cc62c0a0 100644 --- a/man/Subset.Rd +++ b/man/Subset.Rd @@ -45,4 +45,3 @@ PlotLayout(PlotEquiMap, c('lat', 'lon'), subset, } \keyword{datagen} - diff --git a/man/ToyModel.Rd b/man/ToyModel.Rd index ca47b4498808f86c340cfb70b6bdb0670560a0fa..5eee0393bdc163c2390970b08018886d8e1689af 100644 --- a/man/ToyModel.Rd +++ b/man/ToyModel.Rd @@ -7,8 +7,18 @@ components of a forecast: (1) predictabiltiy (2) forecast error (3) non-stationarity and (4) ensemble generation. The forecast can be computed for real observations or observations generated artifically.} \usage{ -ToyModel(alpha = 0.1, beta = 0.4, gamma = 1, sig = 1, trend = 0, - nstartd = 30, nleadt = 4, nmemb = 10, obsini = NULL, fxerr = NULL) +ToyModel( + alpha = 0.1, + beta = 0.4, + gamma = 1, + sig = 1, + trend = 0, + nstartd = 30, + nleadt = 4, + nmemb = 10, + obsini = NULL, + fxerr = NULL +) } \arguments{ \item{alpha}{Predicabiltiy of the forecast on the observed residuals @@ -125,4 +135,3 @@ History:\cr 1.1 - 2016-02 (O.Bellprat) - Include security check for parameters } \keyword{datagen} - diff --git a/man/Trend.Rd b/man/Trend.Rd index 3b7f7bfdd541cac1246494570807500ac8718caa..b4e0ba36b0cc7d47ccb532a529d7e0d0bc5f592e 100644 --- a/man/Trend.Rd +++ b/man/Trend.Rd @@ -1,8 +1,8 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/Trend.R \name{Trend} -\alias{.Trend} \alias{Trend} +\alias{.Trend} \title{Computes the Trend of the Ensemble Mean} \usage{ Trend(var, posTR = 2, interval = 1, siglev = 0.95, conf = TRUE) @@ -78,4 +78,3 @@ History:\cr 2.0 - 2017-02 (A. Hunter, \email{alasdair.hunter@bsc.es}) - Adapt to veriApply() } \keyword{datagen} - diff --git a/man/UltimateBrier.Rd b/man/UltimateBrier.Rd index 46fe124cff765e9e9fbf3e6b3228b4b4c3d1ef55..518a60cce1ec42fec96a4d02c1a29b69a559ec3d 100644 --- a/man/UltimateBrier.Rd +++ b/man/UltimateBrier.Rd @@ -4,9 +4,17 @@ \alias{UltimateBrier} \title{Computes Brier Scores} \usage{ -UltimateBrier(ano_exp, ano_obs, posdatasets = 1, posmemb = 2, - posdates = 3, quantile = TRUE, thr = c(5/100, 95/100), type = "BS", - decomposition = TRUE) +UltimateBrier( + ano_exp, + ano_obs, + posdatasets = 1, + posmemb = 2, + posdates = 3, + quantile = TRUE, + thr = c(5/100, 95/100), + type = "BS", + decomposition = TRUE +) } \arguments{ \item{ano_exp}{Array of forecast anomalies, as provided by \code{Ano()}. @@ -124,4 +132,3 @@ History:\cr N. Manubens, \email{nicolau.manubens@bsc.es}) - First version } \keyword{datagen} - diff --git a/man/clim.palette.Rd b/man/clim.palette.Rd index 95f8407c38a0b3791540a5ffff7fe0dccef8bd09..e67994f8a18be8e7bac0b69deeeae125cd89052e 100644 --- a/man/clim.palette.Rd +++ b/man/clim.palette.Rd @@ -1,8 +1,8 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/clim.palette.R \name{clim.palette} -\alias{clim.colors} \alias{clim.palette} +\alias{clim.colors} \title{Generate Climate Color Palettes} \usage{ clim.palette(palette = "bluered") @@ -35,4 +35,3 @@ History:\cr 0.0 - 2016-01 (N. Manubens, \email{nicolau.manubens@bsc.es}) - Original code. } \keyword{datagen} - diff --git a/man/s2dverification.Rd b/man/s2dverification.Rd index 47acf220b8bc3e319180fc219cb23a0cd24acd74..415c48962c1128e34ec4bef01eb58d7b6c00d5d9 100644 --- a/man/s2dverification.Rd +++ b/man/s2dverification.Rd @@ -26,6 +26,14 @@ Check an overview of the package functionalities and its modules at \url{https://earth.bsc.es/gitlab/es/s2dverification/-/wikis/home}. For more information load the package and check the help for each function or the documentation attached to the package. +} +\seealso{ +Useful links: +\itemize{ + \item \url{https://earth.bsc.es/gitlab/es/s2dverification/-/wikis/home} + \item Report bugs at \url{https://earth.bsc.es/gitlab/es/s2dverification/-/issues} +} + } \author{ Nicolau Manubens \email{nicolau.manubens@bsc.es} @@ -33,4 +41,3 @@ Nicolau Manubens \email{nicolau.manubens@bsc.es} \keyword{datagen} \keyword{dynamic} \keyword{package} - diff --git a/man/sampleDepthData.Rd b/man/sampleDepthData.Rd index 974fe6bdc33cf7e07cca62405a43b9bc5573d29b..3292f5c6e792f698d2619c23bd820d106419751c 100644 --- a/man/sampleDepthData.Rd +++ b/man/sampleDepthData.Rd @@ -32,4 +32,3 @@ Its name within IC3 local database is 'i00k'. Nicolau Manubens \email{nicolau.manubens@bsc.es} } \keyword{data} - diff --git a/man/sampleMap.Rd b/man/sampleMap.Rd index d33ab829cb4d95e150113d8e9fe143d3f8418f5f..7286b8a63e358e5edac6ada60c49316c9bd412d8 100644 --- a/man/sampleMap.Rd +++ b/man/sampleMap.Rd @@ -47,4 +47,3 @@ Check the documentation on 'Load()' in the package 's2dverification' for more in Nicolau Manubens \email{nicolau.manubens@bsc.es} } \keyword{datasets} - diff --git a/man/sampleTimeSeries.Rd b/man/sampleTimeSeries.Rd index ce2c63955470cb54b35aede1ced82b66df891871..4871a928b6fff32d509cdd94b6abe047ac44cf2e 100644 --- a/man/sampleTimeSeries.Rd +++ b/man/sampleTimeSeries.Rd @@ -51,4 +51,3 @@ Check the documentation on 'Load()' in the package 's2dverification' for more in Nicolau Manubens \email{nicolau.manubens@bsc.es} } \keyword{datasets} - diff --git a/s2dverification-manual.pdf b/s2dverification-manual.pdf index 67373123d612604dcdd3746f955af9a30fe4f665..150ed6359212b3979fbf89c5523372f4147d7e18 100644 Binary files a/s2dverification-manual.pdf and b/s2dverification-manual.pdf differ