From a006b35dbaab99089e0997df5684d837852f9129 Mon Sep 17 00:00:00 2001 From: nperez Date: Thu, 4 Jun 2020 16:53:52 +0200 Subject: [PATCH 1/9] Version of CST_RFWeights using s2dv_cube objects and working on N-dim arrays --- R/CST_RFWeights.R | 58 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 45 insertions(+), 13 deletions(-) diff --git a/R/CST_RFWeights.R b/R/CST_RFWeights.R index 16415a57..5037742a 100644 --- a/R/CST_RFWeights.R +++ b/R/CST_RFWeights.R @@ -17,16 +17,23 @@ #' high-resolution gridded climatology from observations, or a reconstruction such as those which #' can be downloaded from the WORLDCLIM (http://www.worldclim.org) or CHELSA (http://chelsa-climate.org) #' websites. The latter data will need to be converted to NetCDF format before being used (see for example the GDAL tools (https://www.gdal.org). +#' It could also be a 's2dv_cube' object. #' @param nf Refinement factor for downscaling (the output resolution is increased by this factor). #' @param lon Vector of longitudes. #' @param lat Vector of latitudes. #' The number of longitudes and latitudes is expected to be even and the same. If not #' the function will perform a subsetting to ensure this condition. #' @param varname Name of the variable to be read from \code{climfile}. -#' @param fsmooth Logical to use smooth conservation (default) or large-scale box-average conservation. -#' @return A matrix containing the weights with dimensions (lon, lat). +#' @param fsmooth Logical to use smooth conservation (default) or large-scale box-average conservation. +#' @param lonname a character string indicating the name of the longitudinal dimension set as 'lon' by default. +#' @param latname a character string indicating the name of the latitudinal dimension set as 'lat' by default. +#' @param ncores an integer that indicates the number of cores for parallel computations using multiApply function. The default value is one. +#' +#' @return A multidimensional array containing the weights with at least dimensions (lon, lat). +#' #' @import ncdf4 #' @import rainfarmr +#' @import multiApply #' @importFrom utils tail #' @importFrom utils head #' @examples @@ -42,8 +49,12 @@ #' } #' @export -CST_RFWeights <- function(climfile, nf, lon, lat, varname = "", fsmooth=TRUE) { - +CST_RFWeights <- function(climfile, nf, lon, lat, varname = NULL, fsmooth = TRUE, + lonname = 'lon', latname = 'lat', ncores = NULL) { + if (!is.null(varname) & !is.character(varname)) { + stop("Parameter 'varname' must be a character string indicating the name ", + "of the variable to be read from the file.") + } # Ensure input grid is square and with even dimensions if ((length(lat) != length(lon)) | (length(lon) %% 2 == 1)) { warning("Input data are expected to be on a square grid", @@ -57,17 +68,38 @@ CST_RFWeights <- function(climfile, nf, lon, lat, varname = "", fsmooth=TRUE) { " lat: [", lat[1], ", ", lat[length(lat)], "]")) } - ncin <- nc_open(climfile) - latin <- ncvar_get(ncin, grep("lat", attributes(ncin$dim)$names, - value = TRUE)) - lonin <- ncvar_get(ncin, grep("lon", attributes(ncin$dim)$names, - value = TRUE)) - if (varname == "") { - varname <- grep("bnds", attributes(ncin$var)$names, - invert = TRUE, value = TRUE)[1] + if (is.character(climfile)) { + ncin <- nc_open(climfile) + latin <- ncvar_get(ncin, grep("lat", attributes(ncin$dim)$names, + value = TRUE)) + lonin <- ncvar_get(ncin, grep("lon", attributes(ncin$dim)$names, + value = TRUE)) + if (varname == "") { + varname <- grep("bnds", attributes(ncin$var)$names, + invert = TRUE, value = TRUE)[1] + } + zclim <- ncvar_get(ncin, varname) + nc_close(ncin) + } else if (inherits(climfile, "s2dv_cube")) { + zclim <- climfile$data + latin <- climfile$lat + lonin <- climfile$lon + } else { + stop("Parameter 'climfile' is expected to be a character string indicating ", + "the path to the files or an object of class 's2dv_cube'.") } - zclim <- ncvar_get(ncin, varname) + result <- RF_Weights(zclim, latin, lonin, nf, lat, lon, fsmooth = fsmooth, + lonname = lonname, latname = latname, ncores = ncores) + #s2dv_cube(data = result, lon = , lat = ?) +} +RF_Weights <- function(zclim, latin, loin, nf, lat, lon, fsmooth, + lonname = 'lon', latname = 'lat', ncores = NULL) { + x <- Apply(list(zclim), target = c(latname, lonname), fun = rf_weights, + latin = latin, lonin = loin, nf = nf, lat = lat, lon = lon, + fsmooth = fsmooth, ncores = ncores)$output1 +} +rf_weights <- function(zclim, latin, lonin, nf, lat, lon, fsmooth = TRUE) { # Check if lon and lat need to be reversed if (lat[1] > lat[2]) { lat <- rev(lat) -- GitLab From 04ebd36b2011efc1026a2a03b0b9431f2d613a5f Mon Sep 17 00:00:00 2001 From: nperez Date: Tue, 22 Sep 2020 18:17:48 +0200 Subject: [PATCH 2/9] CST_RFWeights new check --- R/CST_RFWeights.R | 13 +++++++++---- man/CST_RFWeights.Rd | 23 ++++++++++++++++++++--- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/R/CST_RFWeights.R b/R/CST_RFWeights.R index 5037742a..9db7c412 100644 --- a/R/CST_RFWeights.R +++ b/R/CST_RFWeights.R @@ -49,11 +49,16 @@ #' } #' @export -CST_RFWeights <- function(climfile, nf, lon, lat, varname = NULL, fsmooth = TRUE, +CST_RFWeights <- function(climfile, nf, lon = NULL, lat = NULL, varname = NULL, fsmooth = TRUE, lonname = 'lon', latname = 'lat', ncores = NULL) { - if (!is.null(varname) & !is.character(varname)) { - stop("Parameter 'varname' must be a character string indicating the name ", - "of the variable to be read from the file.") + if (!inherits(climfile, "s2dv_cube")) { + if (!is.null(varname) & !is.character(varname)) { + stop("Parameter 'varname' must be a character string indicating the name ", + "of the variable to be read from the file.") + } + } else { + lon <- climfile$lon + lat <- climfile$lat } # Ensure input grid is square and with even dimensions if ((length(lat) != length(lon)) | (length(lon) %% 2 == 1)) { diff --git a/man/CST_RFWeights.Rd b/man/CST_RFWeights.Rd index ef5ebe4d..0d34201d 100644 --- a/man/CST_RFWeights.Rd +++ b/man/CST_RFWeights.Rd @@ -4,7 +4,17 @@ \alias{CST_RFWeights} \title{Compute climatological weights for RainFARM stochastic precipitation downscaling} \usage{ -CST_RFWeights(climfile, nf, lon, lat, varname = "", fsmooth = TRUE) +CST_RFWeights( + climfile, + nf, + lon = NULL, + lat = NULL, + varname = NULL, + fsmooth = TRUE, + lonname = "lon", + latname = "lat", + ncores = NULL +) } \arguments{ \item{climfile}{Filename of a fine-scale precipitation climatology. @@ -15,7 +25,8 @@ Suitable climatology files could be for example a fine-scale precipitation clima from a high-resolution regional climate model (see e.g. Terzago et al. 2018), a local high-resolution gridded climatology from observations, or a reconstruction such as those which can be downloaded from the WORLDCLIM (http://www.worldclim.org) or CHELSA (http://chelsa-climate.org) -websites. The latter data will need to be converted to NetCDF format before being used (see for example the GDAL tools (https://www.gdal.org).} +websites. The latter data will need to be converted to NetCDF format before being used (see for example the GDAL tools (https://www.gdal.org). +It could also be a 's2dv_cube' object.} \item{nf}{Refinement factor for downscaling (the output resolution is increased by this factor).} @@ -28,9 +39,15 @@ the function will perform a subsetting to ensure this condition.} \item{varname}{Name of the variable to be read from \code{climfile}.} \item{fsmooth}{Logical to use smooth conservation (default) or large-scale box-average conservation.} + +\item{lonname}{a character string indicating the name of the longitudinal dimension set as 'lon' by default.} + +\item{latname}{a character string indicating the name of the latitudinal dimension set as 'lat' by default.} + +\item{ncores}{an integer that indicates the number of cores for parallel computations using multiApply function. The default value is one.} } \value{ -A matrix containing the weights with dimensions (lon, lat). +A multidimensional array containing the weights with at least dimensions (lon, lat). } \description{ Compute climatological ("orographic") weights from a fine-scale precipitation climatology file. -- GitLab From e695c63014345ff7fb7aed2fe9a3d8ad6fdc0946 Mon Sep 17 00:00:00 2001 From: nperez Date: Wed, 23 Sep 2020 12:10:36 +0200 Subject: [PATCH 3/9] correct use of lat and lon in rfweights --- R/CST_RFWeights.R | 18 ++++++++---------- man/CST_RFWeights.Rd | 4 ++-- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/R/CST_RFWeights.R b/R/CST_RFWeights.R index 9db7c412..cdde46da 100644 --- a/R/CST_RFWeights.R +++ b/R/CST_RFWeights.R @@ -19,7 +19,7 @@ #' websites. The latter data will need to be converted to NetCDF format before being used (see for example the GDAL tools (https://www.gdal.org). #' It could also be a 's2dv_cube' object. #' @param nf Refinement factor for downscaling (the output resolution is increased by this factor). -#' @param lon Vector of longitudes. +#' @param lon Vector of longitudes. #' @param lat Vector of latitudes. #' The number of longitudes and latitudes is expected to be even and the same. If not #' the function will perform a subsetting to ensure this condition. @@ -49,16 +49,14 @@ #' } #' @export -CST_RFWeights <- function(climfile, nf, lon = NULL, lat = NULL, varname = NULL, fsmooth = TRUE, +CST_RFWeights <- function(climfile, nf, lon, lat, varname = NULL, + fsmooth = TRUE, lonname = 'lon', latname = 'lat', ncores = NULL) { if (!inherits(climfile, "s2dv_cube")) { if (!is.null(varname) & !is.character(varname)) { - stop("Parameter 'varname' must be a character string indicating the name ", - "of the variable to be read from the file.") + stop("Parameter 'varname' must be a character string indicating the name", + " of the variable to be read from the file.") } - } else { - lon <- climfile$lon - lat <- climfile$lat } # Ensure input grid is square and with even dimensions if ((length(lat) != length(lon)) | (length(lon) %% 2 == 1)) { @@ -90,12 +88,12 @@ CST_RFWeights <- function(climfile, nf, lon = NULL, lat = NULL, varname = NULL, latin <- climfile$lat lonin <- climfile$lon } else { - stop("Parameter 'climfile' is expected to be a character string indicating ", - "the path to the files or an object of class 's2dv_cube'.") + stop("Parameter 'climfile' is expected to be a character string indicating", + " the path to the files or an object of class 's2dv_cube'.") } result <- RF_Weights(zclim, latin, lonin, nf, lat, lon, fsmooth = fsmooth, lonname = lonname, latname = latname, ncores = ncores) - #s2dv_cube(data = result, lon = , lat = ?) + #s2dv_cube(data = result, lon = lon, lat = lat) } RF_Weights <- function(zclim, latin, loin, nf, lat, lon, fsmooth, lonname = 'lon', latname = 'lat', ncores = NULL) { diff --git a/man/CST_RFWeights.Rd b/man/CST_RFWeights.Rd index 0d34201d..2f098a5f 100644 --- a/man/CST_RFWeights.Rd +++ b/man/CST_RFWeights.Rd @@ -7,8 +7,8 @@ CST_RFWeights( climfile, nf, - lon = NULL, - lat = NULL, + lon, + lat, varname = NULL, fsmooth = TRUE, lonname = "lon", -- GitLab From 841c6a4ca6f4a6e4eae594b1e16173d28a29ef9d Mon Sep 17 00:00:00 2001 From: nperez Date: Mon, 28 Sep 2020 13:25:18 +0200 Subject: [PATCH 4/9] reverse target_dims in Apply --- R/CST_RFWeights.R | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/R/CST_RFWeights.R b/R/CST_RFWeights.R index cdde46da..bd7cd86d 100644 --- a/R/CST_RFWeights.R +++ b/R/CST_RFWeights.R @@ -73,9 +73,9 @@ CST_RFWeights <- function(climfile, nf, lon, lat, varname = NULL, if (is.character(climfile)) { ncin <- nc_open(climfile) - latin <- ncvar_get(ncin, grep("lat", attributes(ncin$dim)$names, + latin <- ncvar_get(ncin, grep(latname, attributes(ncin$dim)$names, value = TRUE)) - lonin <- ncvar_get(ncin, grep("lon", attributes(ncin$dim)$names, + lonin <- ncvar_get(ncin, grep(lonname, attributes(ncin$dim)$names, value = TRUE)) if (varname == "") { varname <- grep("bnds", attributes(ncin$var)$names, @@ -91,14 +91,19 @@ CST_RFWeights <- function(climfile, nf, lon, lat, varname = NULL, stop("Parameter 'climfile' is expected to be a character string indicating", " the path to the files or an object of class 's2dv_cube'.") } + # Check dim names and order + if (length(names(dim(zclim))) < 1) { + stop("The dataset provided in 'climfile' requires dimension names.") + } + result <- RF_Weights(zclim, latin, lonin, nf, lat, lon, fsmooth = fsmooth, lonname = lonname, latname = latname, ncores = ncores) #s2dv_cube(data = result, lon = lon, lat = lat) } RF_Weights <- function(zclim, latin, loin, nf, lat, lon, fsmooth, lonname = 'lon', latname = 'lat', ncores = NULL) { - x <- Apply(list(zclim), target = c(latname, lonname), fun = rf_weights, - latin = latin, lonin = loin, nf = nf, lat = lat, lon = lon, + x <- Apply(list(zclim), target = c(lonname, latname), fun = rf_weights, + latin = latin, lonin = lonin, nf = nf, lat = lat, lon = lon, fsmooth = fsmooth, ncores = ncores)$output1 } -- GitLab From f45ba54a33c5689ee8ae41377d22a99758cb6724 Mon Sep 17 00:00:00 2001 From: Jost von Hardenberg Date: Mon, 28 Sep 2020 14:21:09 +0200 Subject: [PATCH 5/9] CST_RFWeights returns s2dv_cube object --- R/CST_RFWeights.R | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/R/CST_RFWeights.R b/R/CST_RFWeights.R index 16415a57..c590b4ca 100644 --- a/R/CST_RFWeights.R +++ b/R/CST_RFWeights.R @@ -24,7 +24,7 @@ #' the function will perform a subsetting to ensure this condition. #' @param varname Name of the variable to be read from \code{climfile}. #' @param fsmooth Logical to use smooth conservation (default) or large-scale box-average conservation. -#' @return A matrix containing the weights with dimensions (lon, lat). +#' @return An object of class 's2dv_cube' containing in matrix \code{data} the weights with dimensions (lon, lat). #' @import ncdf4 #' @import rainfarmr #' @importFrom utils tail @@ -114,5 +114,13 @@ CST_RFWeights <- function(climfile, nf, lon, lat, varname = "", fsmooth=TRUE) { ww <- ww[, seq(dim(ww)[2], 1)] } attributes(dim(ww))$names <- c("lon", "lat") - return(ww) + + grid <- lon_lat_fine(lon, lat, nf) + res <- list() + res$data <- ww + res$lon <- grid$lon + res$lat <- grid$lat + class(res) <- 's2dv_cube' + + return(res) } -- GitLab From a72f191939b87b332370ae0318929e922960abb4 Mon Sep 17 00:00:00 2001 From: nperez Date: Mon, 28 Sep 2020 15:39:34 +0200 Subject: [PATCH 6/9] compiling documentation with devtools --- man/CST_RFWeights.Rd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/CST_RFWeights.Rd b/man/CST_RFWeights.Rd index 2f098a5f..acae8c6a 100644 --- a/man/CST_RFWeights.Rd +++ b/man/CST_RFWeights.Rd @@ -47,7 +47,7 @@ the function will perform a subsetting to ensure this condition.} \item{ncores}{an integer that indicates the number of cores for parallel computations using multiApply function. The default value is one.} } \value{ -A multidimensional array containing the weights with at least dimensions (lon, lat). +An object of class 's2dv_cube' containing in matrix \code{data} the weights with dimensions (lon, lat). } \description{ Compute climatological ("orographic") weights from a fine-scale precipitation climatology file. -- GitLab From 0c323f03575587179c6883d7648f250b4e3b2459 Mon Sep 17 00:00:00 2001 From: nperez Date: Mon, 28 Sep 2020 16:01:25 +0200 Subject: [PATCH 7/9] RF_Weights exposed to users --- R/CST_RFWeights.R | 48 +++++++++++++++++++++++++++++----- man/RF_Weights.Rd | 65 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+), 6 deletions(-) create mode 100644 man/RF_Weights.Rd diff --git a/R/CST_RFWeights.R b/R/CST_RFWeights.R index ccc02ed9..fc3635aa 100644 --- a/R/CST_RFWeights.R +++ b/R/CST_RFWeights.R @@ -97,21 +97,57 @@ CST_RFWeights <- function(climfile, nf, lon, lat, varname = NULL, result <- RF_Weights(zclim, latin, lonin, nf, lat, lon, fsmooth = fsmooth, lonname = lonname, latname = latname, ncores = ncores) - grid <- lon_lat_fine(lon, lat, nf) if (inherits(climfile, "s2dv_cube")) { - climfile$data <- result - climfile$lon <- grid$lon - climfile$lat <- grid$lat + climfile$data <- result$data + climfile$lon <- result$lon + climfile$lat <- result$lat } else { - climfile <- s2dv_cube(data = result, lon = grid$lon, lat = grid$lat) + climfile <- s2dv_cube(data = result, lon = result$lon, lat = result$lat) } return(climfile) } -RF_Weights <- function(zclim, latin, loin, nf, lat, lon, fsmooth, +#' Compute climatological weights for RainFARM stochastic precipitation downscaling +#' +#' @author Jost von Hardenberg - ISAC-CNR, \email{j.vonhardenberg@isac.cnr.it} +#' +#' @description Compute climatological ("orographic") weights from a fine-scale precipitation climatology file. +#' @references Terzago, S., Palazzi, E., & von Hardenberg, J. (2018). +#' Stochastic downscaling of precipitation in complex orography: +#' A simple method to reproduce a realistic fine-scale climatology. +#' Natural Hazards and Earth System Sciences, 18(11), +#' 2825-2840. http://doi.org/10.5194/nhess-18-2825-2018 . +#' @param zclim a multi-dimensional array with named dimension containing at least one precipiation field with spatial dimensions. +#' @param lonin a vector indicating the longitudinal coordinates corresponding to the \code{zclim} parameter. +#' @param latin a vector indicating the latitudinal coordinates corresponding to the \code{zclim} parameter. +#' @param nf Refinement factor for downscaling (the output resolution is increased by this factor). +#' @param lon Vector of longitudes. +#' @param lat Vector of latitudes. +#' The number of longitudes and latitudes is expected to be even and the same. If not +#' the function will perform a subsetting to ensure this condition. +#' @param varname Name of the variable to be read from \code{climfile}. +#' @param fsmooth Logical to use smooth conservation (default) or large-scale box-average conservation. +#' @param lonname a character string indicating the name of the longitudinal dimension set as 'lon' by default. +#' @param latname a character string indicating the name of the latitudinal dimension set as 'lat' by default. +#' @param ncores an integer that indicates the number of cores for parallel computations using multiApply function. The default value is one. +#' +#' @return An object of class 's2dv_cube' containing in matrix \code{data} the weights with dimensions (lon, lat). +#' @import ncdf4 +#' @import rainfarmr +#' @import multiApply +#' @importFrom utils tail +#' @importFrom utils head +#' @examples +#' a <- array(1:2500, c(lat = 50, lon = 50)) +#' res <- RF_Weights(a, seq(0.1 ,5, 0.1), seq(0.1 ,5, 0.1), +#' nf = 5, lat = 1:5, lon = 1:5) + +RF_Weights <- function(zclim, latin, lonin, nf, lat, lon, fsmooth = TRUE, lonname = 'lon', latname = 'lat', ncores = NULL) { x <- Apply(list(zclim), target = c(lonname, latname), fun = rf_weights, latin = latin, lonin = lonin, nf = nf, lat = lat, lon = lon, fsmooth = fsmooth, ncores = ncores)$output1 + grid <- lon_lat_fine(lon, lat, nf) + return(list(data = x, lon = grid$lon, lat = grid$lat)) } rf_weights <- function(zclim, latin, lonin, nf, lat, lon, fsmooth = TRUE) { diff --git a/man/RF_Weights.Rd b/man/RF_Weights.Rd new file mode 100644 index 00000000..7e8d735d --- /dev/null +++ b/man/RF_Weights.Rd @@ -0,0 +1,65 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/CST_RFWeights.R +\name{RF_Weights} +\alias{RF_Weights} +\title{Compute climatological weights for RainFARM stochastic precipitation downscaling} +\usage{ +RF_Weights( + zclim, + latin, + lonin, + nf, + lat, + lon, + fsmooth = TRUE, + lonname = "lon", + latname = "lat", + ncores = NULL +) +} +\arguments{ +\item{zclim}{a multi-dimensional array with named dimension containing at least one precipiation field with spatial dimensions.} + +\item{latin}{a vector indicating the latitudinal coordinates corresponding to the \code{zclim} parameter.} + +\item{lonin}{a vector indicating the longitudinal coordinates corresponding to the \code{zclim} parameter.} + +\item{nf}{Refinement factor for downscaling (the output resolution is increased by this factor).} + +\item{lat}{Vector of latitudes. +The number of longitudes and latitudes is expected to be even and the same. If not +the function will perform a subsetting to ensure this condition.} + +\item{lon}{Vector of longitudes.} + +\item{fsmooth}{Logical to use smooth conservation (default) or large-scale box-average conservation.} + +\item{lonname}{a character string indicating the name of the longitudinal dimension set as 'lon' by default.} + +\item{latname}{a character string indicating the name of the latitudinal dimension set as 'lat' by default.} + +\item{ncores}{an integer that indicates the number of cores for parallel computations using multiApply function. The default value is one.} + +\item{varname}{Name of the variable to be read from \code{climfile}.} +} +\value{ +An object of class 's2dv_cube' containing in matrix \code{data} the weights with dimensions (lon, lat). +} +\description{ +Compute climatological ("orographic") weights from a fine-scale precipitation climatology file. +} +\examples{ +a <- array(1:2500, c(lat = 50, lon = 50)) +res <- RF_Weights(a, seq(0.1 ,5, 0.1), seq(0.1 ,5, 0.1), + nf = 5, lat = 1:5, lon = 1:5) +} +\references{ +Terzago, S., Palazzi, E., & von Hardenberg, J. (2018). +Stochastic downscaling of precipitation in complex orography: +A simple method to reproduce a realistic fine-scale climatology. +Natural Hazards and Earth System Sciences, 18(11), +2825-2840. http://doi.org/10.5194/nhess-18-2825-2018 . +} +\author{ +Jost von Hardenberg - ISAC-CNR, \email{j.vonhardenberg@isac.cnr.it} +} -- GitLab From cdfa6a7bad38ffeac5d7be490733665796eff542 Mon Sep 17 00:00:00 2001 From: nperez Date: Mon, 28 Sep 2020 16:16:43 +0200 Subject: [PATCH 8/9] added export to NAMESPACE --- NAMESPACE | 1 + R/CST_RFWeights.R | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/NAMESPACE b/NAMESPACE index 9f9a0e34..9c82b08e 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -35,6 +35,7 @@ export(PlotPDFsOLE) export(PlotTriangles4Categories) export(RFSlope) export(RFTemp) +export(RF_Weights) export(RainFARM) export(RegimesAssign) export(SaveExp) diff --git a/R/CST_RFWeights.R b/R/CST_RFWeights.R index fc3635aa..56d943da 100644 --- a/R/CST_RFWeights.R +++ b/R/CST_RFWeights.R @@ -140,7 +140,7 @@ CST_RFWeights <- function(climfile, nf, lon, lat, varname = NULL, #' a <- array(1:2500, c(lat = 50, lon = 50)) #' res <- RF_Weights(a, seq(0.1 ,5, 0.1), seq(0.1 ,5, 0.1), #' nf = 5, lat = 1:5, lon = 1:5) - +#' @export RF_Weights <- function(zclim, latin, lonin, nf, lat, lon, fsmooth = TRUE, lonname = 'lon', latname = 'lat', ncores = NULL) { x <- Apply(list(zclim), target = c(lonname, latname), fun = rf_weights, -- GitLab From 77aa7c039b5df548e1645c2f11596f85dc7dbe57 Mon Sep 17 00:00:00 2001 From: nperez Date: Wed, 28 Oct 2020 10:23:38 +0100 Subject: [PATCH 9/9] News updated --- NEWS.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index c8dfc43f..cf9eae22 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,7 +2,9 @@ **Submission date to CRAN: XX-12-2020** - New features: + PlotPDFsOLE includes parameters to modify legend style - + CST_RFSlope handless missing values in the temporal dimension and new ncores parameter for parallel computation + + CST_RFSlope handless missing values in the temporal dimension and new 'ncores' parameter allows parallel computation + + CST_RFWeights accepts s2dv_cube objects as input and new 'ncores' paramenter allows parallel computation + + RFWeights is exposed to users - Fixes: + PlotForecastPDF correctly displays terciles labels -- GitLab