getScheme | R Documentation |
Field
from a Source
Given a Source
object and a Scheme
object, return an appropriate spatially/temporal/annually-aggregated Field
object with categorical values u based on the
classification contained in the Scheme
, optionally including spatial, temporal and annual cropping.
getScheme(
source,
scheme,
first.year,
last.year,
year.aggregate.method,
spatial.extent,
spatial.extent.id,
spatial.aggregate.method,
subannual.resolution,
subannual.original,
subannual.aggregate.method,
sta.info,
quick.read.file = NULL,
quick.read.autodelete = FALSE,
averaged.source,
verbose = FALSE,
...
)
source |
The |
scheme |
The classification scheme to be used as |
first.year |
The first year (as a numeric) of the data to be return |
last.year |
The last year (as a numeric) of the data to be return |
year.aggregate.method |
A character string describing the method by which to annual aggregate the data. Leave blank to apply no annual aggregation. Can currently be "mean", "sum", "max", "min", "mode", "median", "sd" and "var".
For technical reasons these need to be implemented in the package in the code however it should be easy to implement more, please just contact the author! Note that this aggregation is done before the Scheme is calculated.
See |
spatial.extent |
An extent in space to which this Field should be cropped, supplied as a raster::extent object or an object from which a raster::extent object can be derived - eg. a Raster* object or another Field object. |
spatial.extent.id |
A character string to give an identifier for the spatial extent this ModelField covers. |
spatial.aggregate.method |
A character string describing the method by which to spatially aggregate the data. Leave blank to apply no spatially aggregation. Can currently be "weighted.mean", "w.mean", "mean",
"mode", "median", weighted.sum", "w.sum", "sum", "max", "min", "sd" or "var". For technical reasons these need to be implemented in the package in the code however it should be easy to implement more, please just contact the author!
Note that this aggregation is done before the Scheme is calculated.
See |
subannual.resolution |
A character string specifying the subannual resolution that you want to the data on. Can be "Year", "Month" or "Day". |
subannual.original |
A character string specifying the subannual you want the data to be on before applying the subannual.aggregate.method. Can be "Year", "Month" or "Day". Currently ignored. |
subannual.aggregate.method |
A character string specifying the method by which to aggregagte the data subannually, can be "mean", "sum", "max", "min", "mode", "median", "sd" or "var".
Note that this aggregation is done before the Scheme is calculated.
See |
sta.info |
Optionally an STAInfo object defining the exact spatial-temporal-annual domain over which the data should be retrieved. Can also be a Field object from which the STA info will de derived. If specified the following 9 arguments are ignored (with a warning). |
quick.read.file |
A character string. If set, the function will look for a file of this name (plus the extension ".RData") in the run directory. If if finds one then it reads that. If it doesn't find the appropriate file, then it reads the raw data, performs whatever cropping and aggregating is necessary, and then saves the data in a file of that name (in the run directory) for use next time. (Note: the function also checks that the specified layers, cropping and aggregating found in the file match that which was requested by the arguments here). |
quick.read.autodelete |
If TRUE then the file specified by the above "quick.read.file" argument will be deleted, thus ensuring that the raw data will be read afresh (and saved again). Ignored if valid "quick.read.file" argument not supplied. |
averaged.source |
If a list of |
verbose |
If TRUE give a lot of information for debugging/checking. |
... |
Other arguments that are passed to the getField function for the specific Format or additional arguements for selecting space/time/years. For all Formats, the followings arguments apply:
For the aDGVM(1) Format, the following arguments apply:
For the aDGVM2 Format, the following arguments apply:
|
Note that because there are three types of aggregating available, the resulting Field
object can a wide select of spatio-temporal dimensions.
To check what dimensions you have you can use getDimInfo
A Field
.
Matthew Forrest matthew.forrest@senckenberg.de
aggregateSubannual
, aggregateSpatial
, aggregateYears
, getDimInfo
, getField
# In this example we derive and plot the Smith et al 2014 and the
# Forrest et al 2015 biome classifications
# First define a Source
test.dir <- system.file("extdata", "LPJ-GUESS_Runs", "CentralEurope", package = "DGVMTools")
test.Source <- defineSource(name = "LPJ-GUESS run", dir = test.dir, format = GUESS)
# Smith et al. 2014
Smith2014.biomes <- getScheme(source = test.Source, scheme = Smith2014BiomeScheme,
year.aggregate.method = "mean")
print(plotSpatial(Smith2014.biomes))
# Forrest et al. 2014
Forrest2015.biomes <- getScheme(source = test.Source, scheme = Forrest2015BiomeScheme,
year.aggregate.method = "mean")
print(plotSpatial(Forrest2015.biomes))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.