defineSource: Define a Source object that represents a model run or data...

View source: R/defineSource.R

defineSourceR Documentation

Define a Source object that represents a model run or data set, setting up all the required metadata (only).

Description

This function is preferred to a new("Source",...) initialisation because it does both the initialisations (including some defaults) and also performs some extra checks.

Usage

defineSource(
  id,
  name,
  dir,
  format,
  quantities = NULL,
  defined.layers = list(),
  lonlat.offset = c(0, 0),
  year.offset = 0,
  london.centre = TRUE,
  forcing.data = "Not specified",
  land.use.included = FALSE,
  contact = "Not specified",
  institute = "Not specified",
  ...
)

Arguments

id

A unique character string to identify this particular data. Recommended to be alphanumeric because it is used to construct file names and to use underscores and full stops (periods) for separating characters where need be. For example, "Standard_v4.0" or "Saatchi2011.HD" (can be derived from name if a name is supplied, otherwise mandatory)

name

A character string describing this run, ie. "LPJ-GUESS v3.1" (can be derived from id if an id is supplied, otherwise mandatory)

dir

The location of this source on the file system (Mandatory)

format

A Format object to describe the type of source. Can be GUESS, aDGVM, aDGVM2 or NetCDF (NOTE no quotes since these are actual R objects not strings).

quantities

A list of Quantity object what we expect to have in this Source. The option allows the over-riding the default quantities in the Format object. Not 100% sure why this might be useful though.

defined.layers

A list of PFT objects which includes all the PFTs used is this model run (Mandatory)

lonlat.offset

A numeric of length 1 or 2 to define the offsets to Lon and Lat to centre the localities, somewhat legacy for old LPJ-GUESS runs.

year.offset

A numeric of length 1 to match be added to the years to convert them to calendar years, somewhat legacy for old LPJ-GUESS runs.

london.centre

If TRUE, ensure that the longitudes are (-180,180) instead of (0,360)

forcing.data

A character string identifying the climate or other data used to produce this model run

land.use.included

If TRUE it can be assumed that land use has been simulated for this run and so no correction for land use need be applied before benchmarking.

contact

Name and email address of responsible person (default to OS username).

institute

Name of the institute (default "none").

...

extra arguments, not used yet Note that that format, dir and one of id or name are compulsory, the rest will be filled with dummy/default values if left blank. Take care with lon.lat.offset and year.offset which are initialised to 0 which is unsuitable for aDGVM1 and some LPJ-GUESS configurations.

Details

Note that no actual data is stored in the resultant Source object, rather this object should be used in calls to getField to get data as a Field object.

Value

A Source object

Author(s)

Matthew Forrest matthew.forrest@senckenberg.de

See Also

Source


MagicForrest/DGVMTools documentation built on Aug. 23, 2024, 8:05 a.m.