extract_brick_files: Extract RasterBrick from List of Filenames

Description Usage Arguments Value Examples

View source: R/extract_brick_files.R

Description

Extract RasterBrick from List of Filenames

Usage

1
2
3
4
5
6
7
8
extract_brick_files(
  files,
  varname,
  roi,
  dims = 1:3,
  timeconvertfun = function(t) lubridate::as_date(as.POSIXlt(t, origin =
    lubridate::origin))
)

Arguments

files

A character list of filenames

varname

Character. Variable name to extract from each file.

roi

The region to extract. A raster 'extent' object.

dims

The order of dimensions that the variable is saved in. dims = c(1, 2, 3) is longitude, latitude, time. dims = c(2, 1, 3) is latitude, longitude, time.

timeconvertfun

A function that converts from time values, as given in the netCDF file, to time objects

Value

A rasterBrick object. The extents of the brick object are snapped to the smallest region containing all cells that intersect roi.

Examples

1
2
3
4
5
6
7
8
roi <- extent(148.0779, 148.2011, -35.26581, -35.13167)
files <- build_filename_list("http://dapds00.nci.org.au/thredds/dodsC/ub8/au/OzWALD",
      "8day/GPP",
      "OzWALD",
      "GPP",
      2000:2018,
      "nc")
b <- extract_brick_files(files, "GPP", roi, dims = c(2, 1, 3))

sustainablefarms/linking-data documentation built on Oct. 28, 2020, 2:41 a.m.