Use of relational operators on POSIXlt on CRAN macOS flavors
airGR 1.6.9.27 checks return errors on masOS (also see CRAN_v1.6.9.27 tag). Ir works well on Linux and Windows OS.
It seems to be because of the a comparison on POSIXlt dates to return a subset of time series.
In RunModel_GR1A()
example, I think that the TabSeries
time series is not the wanted one.
Maybe 2012-09-01
is selected, so SeriesAggreg()
returns NA values for the last time step. Then, InputsModel()
return an error.
library(airGR)
## loading catchment data
data(L0123001)
## conversion of example data from daily to yearly time step
TabSeries <- data.frame(DatesR = BasinObs$DatesR,
P = BasinObs$P,
E = BasinObs$E,
Qmm = BasinObs$Qmm)
TabSeries <- TabSeries[TabSeries$DatesR < "2012-09-01", ]
BasinObs <- SeriesAggreg(TabSeries, Format = "%Y",
YearFirstMonth = 09,
ConvertFun = c("sum", "sum", "sum"))
## preparation of the InputsModel object
InputsModel <- CreateInputsModel(FUN_MOD = RunModel_GR1A, DatesR = BasinObs$DatesR,
Precip = BasinObs$P, PotEvap = BasinObs$E)
I think that there is a similar problem in "test-SerriesAggreg" (line 64); the GoodValues
time series is not the wanted one. Then expect_equal()
detects a difference.
GoodValues <- apply(BasinObs[BasinObs$DatesR >= "1984-09-01" &
BasinObs$DatesR < "1985-09-01",
c("P", "E", "Qmm")], 2, sum)
TestedValues <- unlist(SeriesAggreg(TabSeries,
Format = "%Y",
YearFirstMonth = 9,
ConvertFun = rep("sum", 3))[1, c("P", "E", "Qmm")])
expect_equal(GoodValues, TestedValues)
Nota: in TabSeries$DatesR < "2012-09-01"
, TabSeries$DatesR
is in UTC and "2012-09-01"
is in local time, this is normally not a problem at the daily time step.