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")
#> ColOpenData provides open data derived from Departamento Administrativo
#> Nacional de Estadística (DANE), and Instituto de Hidrología,
#> Meteorología y Estudios Ambientales (IDEAM) but with modifications for
#> specific functional needs. These changes may alter the structure,
#> format, or content, meaning the data does not reflect the official
#> dataset. The package is developed independently, with no endorsement or
#> involvement from these institutions or any Colombian government body.
#> The authors of ColOpenData are not liable for how users utilize the
#> data, and users are responsible for any outcomes from their use or
#> analysis of the data.
#> Stored by Universidad de Los Andes under the Epiverse TRACE initiative.
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
# }