Skip to content

ComprehensiveTemperatureGenerator(yearly = FALSE) always fails in eigen() #9

@twest820

Description

@twest820

Doesn't seem to matter which years the simulation covers or whether the simulation is for a single year, several years, or a decade. This seems unfortunate as it appears the default yearly = TRUE results in repetition of a fixed spline which doesn't account for interannual variability and is discontinuous at the 31 December to 1 January boundary.

> modeledTemperatures = ComprehensiveTemperatureGenerator(station = c("HaneyUBC"),
+   Tx_all = TEMPERATURE_MAX, Tn_all = TEMPERATURE_MIN, 
+   year_min = 1962, year_max = 1990, year_min_sim = 1983, year_max_sim = 1985, extremes = FALSE,
+   p = 2, n_GPCA_iteration = 5, n_GPCA_iteration_residuals = 5,
+   sample = "monthly", yearly = FALSE)
Error in eigen(cor(x_gauss_prev, use = "pairwise.complete.obs")) : 
  infinite or missing values in 'x'
> traceback()
7: stop("infinite or missing values in 'x'")
6: eigen(cor(x_gauss_prev, use = "pairwise.complete.obs"))
5: t(eigen(cor(x_gauss_prev, use = "pairwise.complete.obs"))$vectors)
4: GPCA_iteration(x_prev = x_prev, extremes = extremes)
3: GPCA(x_prev = data, extremes = extremes, n = n_GPCA_iteration)
2: getVARmodel(data = param[["data_for_var"]], suffix = c("_T1", 
       "_T2"), sep = "", p = p, type = type, lag.max = lag.max, 
       ic = ic, activateVARselect = activateVARselect, exogen = exogen, 
       n_GPCA_iteration_residuals = n_GPCA_iteration_residuals, 
       n_GPCA_iteration = n_GPCA_iteration, extremes = extremes)
1: ComprehensiveTemperatureGenerator(station = c("HaneyUBC"), Tx_all = TEMPERATURE_MAX, 
       Tn_all = TEMPERATURE_MIN, year_min = 1962, year_max = 1990, 
       year_min_sim = 1983, year_max_sim = 1985, extremes = FALSE, 
       p = 2, n_GPCA_iteration = 5, n_GPCA_iteration_residuals = 5, 
       option = 2, sample = "monthly", yearly = FALSE)

Workaround: none known, problem persists through R restart and seems to have spread to ComprehensiveTemperatureGenerator() calls with the default value of yearly

Version: RMAWGEN 1.3.7 (current as of this writing)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions