Skip to contents

A wrapper function for metnordic_aggregate() which aggregates files from a start to end date (in parallel). You must supply a variable type and a method of aggregation (eg. mean). This function is designed to take input from metnordic_download_daterange() and provides input for metnordic_merge_daily()

Usage

metnordic_aggregate_daterange(
  directory,
  variable,
  method,
  start,
  end,
  outpath,
  overwrite = TRUE,
  n_cores = NULL,
  verbose = TRUE
)

Arguments

directory

String: Path to the source files (as downloaded by metnordic_download() or metnordic_download_daterange())

variable

String: MET Nordic variable to aggregate (eg. "precipitation_amount", (see more))

method

String: method of aggregation ("mean", "min", "max", "sum")

start

String: start of the date range to aggregate (eg. "2015-01-01")

end

String: end of the date range to aggregate (eg. "2015-12-31")

outpath

String: path to directory of to be created files

overwrite

Logical: overwrite existing files? (optional, default TRUE)

n_cores

Numeric: max number of cores to perform operation with. (optional)

verbose

Logical: print to console? (optional)

Value

Returns a named list with file paths to each aggregated file. FALSE indicates a file failed to be aggregated, likely due to not having 24hrs (24 individual files) to aggregated from.

Details

Currently supported are the following types of aggregation: "mean" "min" "max" "sum". Operations are performed in paralell on multiple cores. You can control the number of cores used with the num_cores parameters.