extract_brick_files: Obsolete: Extract RasterBrick from List of Filenames

View source: R/extract_brick_files.R

extract_brick_filesR Documentation

Obsolete: Extract RasterBrick from List of Filenames

Description

This function relied on the 'dims' function of raster::brick, this argument required bugs fixes by Kassel to work. This worked well for over a year. However, as of Aug 2021, the method stopped working. No reliable work around has been found for bricks, as bricks such as for GPP are much larger than the WCF raster files.

Usage

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

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/sflddata documentation built on April 19, 2022, 11:19 a.m.