Aggregate time series downloaded climate data to day, month or year.
Only observations under the tags TSSM_CON
, TMN_CON
,
TMX_CON
, PTPM_CON
, and BSHG_CON
can be aggregated,
since are the ones where methodology for aggregation is explicitly provided
by the source.
Examples
# \donttest{
lat <- c(4.172817, 4.172817, 4.136050, 4.136050, 4.172817)
lon <- c(-74.749121, -74.686169, -74.686169, -74.749121, -74.749121)
polygon <- sf::st_polygon(x = list(cbind(lon, lat)))
geometry <- sf::st_sfc(polygon)
roi <- sf::st_as_sf(geometry)
ptpm <- download_climate_geom(roi, "2022-11-01", "2022-12-31", "PTPM_CON")
#> Original data is retrieved from the Institute of Hydrology, Meteorology
#> and Environmental Studies (Instituto de Hidrología, Meteorología y
#> Estudios Ambientales - IDEAM).
#> Reformatted by package authors.
#> Stored by Universidad de Los Andes under the Epiverse TRACE iniative.
monthly_ptpm <- aggregate_climate(ptpm, "month")
head(monthly_ptpm)
#> # A tibble: 2 × 6
#> station longitude latitude date tag value
#> <dbl> <chr> <chr> <date> <chr> <dbl>
#> 1 21190290 -74.71311111 4.16102778 2022-11-01 PTPM_CON 192
#> 2 21190290 -74.71311111 4.16102778 2022-12-01 PTPM_CON 69
# }