Skip to contents

Given a forecast and observations, verify that:

  • forecast is valid

  • observations are valid

  • forecast time type matches observations time type

Usage

validate_fcst_obs_pair(fcst, obs)

Arguments

fcst

A forecast object (see output of create_forecast()).

obs

An observations data frame.

Value

NULL if valid. Error otherwise

Examples

# compatible time types
casteval:::validate_fcst_obs_pair(
  create_forecast(data.frame(time=1:10, val=11:20)),
  data.frame(time=101:110, val_obs=111:120)
)

# incompatible time types
try(casteval:::validate_fcst_obs_pair(
  create_forecast(data.frame(time=1:10, val=11:20)),
  data.frame(time=lubridate::ymd("2024-01-01"), val_obs=5)
))
#> Error in casteval:::validate_fcst_obs_pair(create_forecast(data.frame(time = 1:10,  : 
#>   observations time type must match forecast time type