-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Hi, this issue took me some debugging to sort out so I thought I'd log it in case it's helpful for others. It happens the weather station I'm working with began operation on 1 October 1961. So, in modifying the example call for ComprehensiveTemperatureGenerator(), I left year_min = 1961. This results in an error within setComprehensiveTemperatureGeneratorParameters() because these lines of code assume the *mes data frames and *spline data frames are the same size:
Tn_mes_res <- Tn_mes - Tn_spline
Tx_mes_res <- Tx_mes - Tx_spline
Tm_mes_res <- Tm_mes - SplineAdvTmHowever, because there is no data for January through September in 1961, the spline frames are 273 rows longer than the mes frames and the first subtraction fails due to dimensional incompatibility (1 October is Julian day 274 for non-leap years).
Workaround: Pass complete years of data to RMAWGEN functions using this code path. In my case there's little difficulty in setting the start year to 1962 but hopefully one could also pad data with NAs in order to obtain matching mes and spline dimensions without affecting parameter estimates in the VAR model.
Summary of repro:
generation00 = ComprehensiveTemperatureGenerator(station = c("HaneyUBC"),
Tx_all = TEMPERATURE_MAX, Tn_all = TEMPERATURE_MIN, year_min = 1961, year_max = 1990,
p = 2, n_GPCA_iteration = 5, n_GPCA_iteration_residuals = 5,
sample = "monthly", year_min_sim = 1982, year_max_sim = 1983)
Error in Ops.data.frame(Tn_mes, Tn_spline) :
‘-’ only defined for equally-sized data framesVersion: RMAWGEN 1.3.7 (current as of this writing)