R/schemas.R

Defines functions forecast_schema score_schema

Documented in score_schema

#' Score schema in arrow format
#' @export
score_schema <- function() {
  arrow::schema(
    datetime = arrow::timestamp("us", timezone="UTC"), 
    family=arrow::string(),
    variable = arrow::string(), 
    prediction=arrow::float64(), 
    reference_datetime= arrow::string(), # arrow::timestamp("us", timezone="UTC"),
    site_id=arrow::string(),
    model_id = arrow::string(),
    observation=arrow::float64(),
    crps = arrow::float64(),
    logs = arrow::float64(),
    mean = arrow::float64(),
    median = arrow::float64(),
    sd = arrow::float64(),
    quantile97.5 = arrow::float64(),
    quantile02.5 = arrow::float64(),
    quantile90 = arrow::float64(),
    quantile10= arrow::float64(),
    pubDate = arrow::string()
  )
}


forecast_schema <- function() { 
  arrow::schema(target_id = arrow::string(), 
                datetime = arrow::timestamp("us", timezone = "UTC"), 
                parameter=arrow::string(),
                variable = arrow::string(), 
                prediction=arrow::float64(),
                family=arrow::string(),
                reference_datetime=arrow::string(),
                site_id=arrow::string(),
                model_id = arrow::string(),
                date=arrow::string(),
                pubDate = arrow::string()
                
  )
}
eco4cast/score4cast documentation built on Nov. 21, 2023, 12:25 p.m.