From e6743a284a476e06dd87dd04d2a59dcfd7fcaf99 Mon Sep 17 00:00:00 2001 From: aho Date: Tue, 30 Nov 2021 10:31:24 +0100 Subject: [PATCH] Include 'laf', 'con2', 'nn' methods. --- R/CDORemap.R | 17 +++++++++++------ man/CDORemap.Rd | 9 ++++----- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/R/CDORemap.R b/R/CDORemap.R index 19e0197..00824de 100644 --- a/R/CDORemap.R +++ b/R/CDORemap.R @@ -20,8 +20,7 @@ #' provided, it must have at least a longitude and a latitude dimensions, #' identified by the array dimension names. The names for these dimensions #' must be one of the recognized by s2dverification (can be checked with -#' \code{s2dverification:::.KnownLonNames()} and -#' \code{s2dverification:::.KnownLatNames()}). +#' \code{s2dv:::.KnownLonNames()} and \code{s2dv:::.KnownLatNames()}). #'@param lons Numeric vector or array of longitudes of the centers of the grid #' cells. Its size must match the size of the longitude/latitude dimensions #' of the input array. @@ -33,9 +32,9 @@ #' NetCDF file which to read the target grid from (a single grid must be #' defined in such file). #'@param method Character string specifying an interpolation method -#' (recognized by CDO; e.g.: 'con', 'bil', 'bic', 'dis'). The following -#' long names are also supported: 'conservative', 'bilinear', 'bicubic' and -#' 'distance-weighted'. +#' (recognized by CDO; e.g.: 'con', 'bil', 'bic', 'dis', 'con2', 'laf', 'nn'). +#' The following long names are also supported: 'conservative', 'bilinear', +#' 'bicubic' and 'distance-weighted'. #'@param avoid_writes The step of permutation is needed when the input array #' has more than 3 dimensions and none of the longitude or latitude dimensions #' in the right-most position (CDO would not accept it without permuting @@ -390,8 +389,14 @@ CDORemap <- function(data_array = NULL, lons, lats, grid, method, method <- 'con' } else if (method %in% c('dis', 'distance-weighted')) { method <- 'dis' + } else if (method %in% 'nn') { + method <- 'nn' + } else if (method %in% 'laf') { + method <- 'laf' + } else if (method %in% 'con2') { + method <- 'con2' } else { - stop("Unsupported CDO remap method. 'bilinear', 'bicubic', 'conservative' or 'distance-weighted' supported only.") + stop("Unsupported CDO remap method. Only 'bilinear', 'bicubic', 'conservative', 'distance-weighted', 'nn', 'laf', and 'con2' are supported.") } # Check avoid_writes if (!is.logical(avoid_writes)) { diff --git a/man/CDORemap.Rd b/man/CDORemap.Rd index c7a00a8..b49f944 100644 --- a/man/CDORemap.Rd +++ b/man/CDORemap.Rd @@ -21,8 +21,7 @@ CDORemap( provided, it must have at least a longitude and a latitude dimensions, identified by the array dimension names. The names for these dimensions must be one of the recognized by s2dverification (can be checked with -\code{s2dverification:::.KnownLonNames()} and -\code{s2dverification:::.KnownLatNames()}).} +\code{s2dv:::.KnownLonNames()} and \code{s2dv:::.KnownLatNames()}).} \item{lons}{Numeric vector or array of longitudes of the centers of the grid cells. Its size must match the size of the longitude/latitude dimensions @@ -38,9 +37,9 @@ NetCDF file which to read the target grid from (a single grid must be defined in such file).} \item{method}{Character string specifying an interpolation method -(recognized by CDO; e.g.: 'con', 'bil', 'bic', 'dis'). The following -long names are also supported: 'conservative', 'bilinear', 'bicubic' and -'distance-weighted'.} +(recognized by CDO; e.g.: 'con', 'bil', 'bic', 'dis', 'con2', 'laf', 'nn'). +The following long names are also supported: 'conservative', 'bilinear', +'bicubic' and 'distance-weighted'.} \item{avoid_writes}{The step of permutation is needed when the input array has more than 3 dimensions and none of the longitude or latitude dimensions -- GitLab