Skip to content

Fix Analogs with new lonL and latL parameters

Hi @bertvs

In this development branch is the fix I have implemented for the case you detected.

Here is a code showing an example. The first one (with the current version on CRAN) fails while using the version from this branch works.

expL <- rnorm(1:200)
dim(expL) <- c(member=10,lat = 4, lon = 5)
obsL <- c(rnorm(1:180),expL[1,,]*1.2)
dim(obsL) <- c(time = 10,lat = 4, lon = 5)
time_obsL <- paste(rep("01", 10), rep("01", 10), 1994 : 2003, sep = "-")
time_expL <- time_obsL[1]
lon <- seq(-1, 5, 1.5)
lat <- seq(30, 35, 1.5)
expLL <- CSTools::s2dv_cube(data = expL, lat = lat, lon = lon,
                  Dates = list(start = time_expL, end = time_expL))
obsLL <- CSTools::s2dv_cube(data = obsL, lat = lat, lon = lon,
                  Dates = list(start = time_obsL, end = time_obsL))
region <- c(2, 3.5, 31.5, 33.5)
# CASE CRAN version
downscaled_field <- CSTools::CST_Analogs(expL = expLL, obsL = obsLL,
                        region = region,
                         criteria = 'Local_dist') #FAILS
# CASE development branch version
library(ClimProjDiags); library(multiApply); library(abind)
source("/esarchive/scratch/nperez/git/cstools/R/CST_Analogs.R") #load development version
downscaled_field <- CST_Analogs(expL = expLL, obsL = obsLL,
                        region = region,
                         criteria = 'Local_dist') # works

It should work also for your case. To ensure, could you please check it and report here any problem you may found?

Thanks,

Núria

Merge request reports

Loading