## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.align = "center",
  warning = FALSE,
  message = FALSE,
  eval = FALSE
)

## ----load_package-------------------------------------------------------------
# library(clim4health)

## -----------------------------------------------------------------------------
# c4h_get_help()

## -----------------------------------------------------------------------------
# c4h_get_help(dataset = "reanalysis-era5-land")

## -----------------------------------------------------------------------------
# c4h_get_help(dataset = "reanalysis-era5-land", parameter = "variable")

## -----------------------------------------------------------------------------
# c4h_get(
#   dataset = "reanalysis-era5-land", # data type
#   year = 2011:2025, # load multiple years
#   month = c(2, 3), # load February and March
#   time = 0:23
# ) # load all hours of the day

## -----------------------------------------------------------------------------
# c4h_get(
#   dataset = "seasonal-monthly-single-levels", # data type
#   year = c(2025), # year of initialisation
#   month = c(2), # month of initialisation
#   leadtime_month = c(1, 2)
# ) # leadtime months

## -----------------------------------------------------------------------------
# c4h_get_help("reanalysis-era5-land", "bbox")

## -----------------------------------------------------------------------------
# c4h_get(
#   dataset = "reanalysis-era5-land", # data type
#   bbox = c(4, -73, -4, -70)
# ) # bounding box in order N, W, S, E

## -----------------------------------------------------------------------------
# c4h_get(
#   dataset = "reanalysis-era5-land", # data type
#   variable = "2m_temperature"
# ) # variable name

## -----------------------------------------------------------------------------
# c4h_get(
#   dataset = "reanalysis-era5-land", # data type
#   variable = "2m_temperature", # variable name
#   year = 2010:2012, # years to download
#   outpath = "/path/to/dir/", # directory to save data
#   outname = "era5land_t2m"
# ) # file name stem

## -----------------------------------------------------------------------------
# pat_api <- "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"

## -----------------------------------------------------------------------------
# # Download reanalysis data
# c4h_get(
#   pat = pat_api,
#   dataset = "reanalysis-era5-land-monthly-means",
#   product_type = "monthly_averaged_reanalysis",
#   variable = "2m_temperature",
#   year = c(2010, 2011, 2012),
#   month = c(4, 5),
#   bbox = c(33, -93, -23, -17),
#   outname = "era5land"
# )

## -----------------------------------------------------------------------------
# # Download hindcast data
# c4h_get(
#   pat = pat_api,
#   dataset = "seasonal-monthly-single-levels",
#   originating_centre = c("ecmwf"),
#   system = c("51"),
#   variable = c(
#     "2m_temperature",
#     "2m_dewpoint_temperature",
#     "total_precipitation"
#   ),
#   product_type = c("monthly_mean"),
#   year = c(2010, 2011, 2012),
#   month = c(4),
#   leadtime_month = c(1, 2),
#   bbox = c(33, -93, -23, -17),
#   outpath = "/path/to/dir/",
#   outname = "hindcast"
# )

## -----------------------------------------------------------------------------
# # Download forecast data
# c4h_get(
#   pat = pat_api,
#   dataset = "seasonal-monthly-single-levels",
#   originating_centre = c("ecmwf"),
#   system = c("51"),
#   variable = c("total_precipitation"),
#   product_type = c("monthly_mean"),
#   year = c(2025),
#   month = c(4),
#   leadtime_month = c(1, 2),
#   bbox = c(33, -93, -23, -17),
#   outpath = "/path/to/dir/",
#   outname = "forecast"
# )

