summariseNC: Summarise values of one or multiple NetCDF Files over time...

View source: R/summariseNC.R

summariseNCR Documentation

Summarise values of one or multiple NetCDF Files over time and/or space

Description

Summarise spatial/spatio-temporal measurements of one or multiple NetCDF files to a raster stack or data.frame with desired spatial and temporal resolution

Usage

summariseNC(
  files,
  startdate = NA,
  enddate = NA,
  ext = NA,
  group_col = c("year", "month"),
  name = NA,
  cores = NA,
  filename1 = "",
  filename2 = "",
  overwrite = FALSE
)

Arguments

files

character. A filepath or list of filepaths. Filepath should lead to a NetCDF file.

startdate

integer. Start year.

enddate

integer. End year.

ext

extent. If present the NetCDF file is subset by this extent.

group_col

character. Columns to use for group_at call, one of week, month, year, c("week", "year") or c("month", "year")

name

character. Name of variable, can be one of pr, tas, tasmax, tasmin, sfcWind, hurs, huss, dis

cores

integer. Number of cores for parallel computing. If this argument is not provided, at least half the number of availabe cores will be used.

filename1

character. Output filename of the averaged data. If this argument is not provided, result will not be written to disk.

filename2

character. Output filename of the coefficient of variation. If this argument is not provided, the coefficient of variation will not be written to disk.

overwrite

logical. If TRUE, existing files will be overwritten.

Value

A raster stack with monthly layers of aggregated data over the specified time period and area.

See Also

[aggregateNC]

Examples

files <- list.files(paste0(system.file(package="processNC"), "/extdata"), 
                    pattern="tas.*\\.nc", full.names=TRUE)
summariseNC(files=files[4], group_col=c("year", "month"), 
            startdate=2001, enddate=2010, cores=1)
summariseNC(files=files[4], group_col=c("year", "week"), 
            startdate=2001, enddate=2010, cores=1)
summariseNC(files=files[4], group_col="year", 
            startdate=2001, enddate=2010, cores=1)
summariseNC(files=files[4], group_col="month", 
            startdate=2001, enddate=2010, cores=1)
summariseNC(files=files[4], group_col="week", 
            startdate=2001, enddate=2010, cores=1)

RS-eco/processNC documentation built on Aug. 7, 2023, 8:12 a.m.