addData: addData

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/addData.R

Description

Function to add validation data for a specific magpie outpout to the library.

Usage

1
addData(func,...,data,aggr_type,aggr_args=NULL,datasource,historical=TRUE,unit=NULL,citation=NULL,comment=NULL,ignore.args=NULL,choose.args=NULL,overwrite=FALSE,internal=FALSE,svn_path=NULL)

Arguments

func

Name of the magpie library function that this data belongs to.

...

Values for arguments that func takes. If an argument is not specified the default value are used if existing. Otherwise an error will occur. The two arguments "file" and "level" can be omitted without causing problems.

data

A magpie object containing the data. If uncertainty information is available, one dimension with the following dimnames has to exist:

  • data The column 'data' contains the data values

  • up (optional) upper limit of the error bars

  • lo (optional) lower limit of the error bars

It is only possible to specify both, 'up' and 'lo' or neither of the two.

aggr_type

A string specifying the aggregation type to be used for the dataset. You can see available aggregation types using show_aggrTypes. New aggregation types can be added using add_aggrType.

aggr_args

Sometimes aggr_type will require additional arguments such as weights. They are specified here as a list.

datasource

A string specifying the name of the data source. Must not contain blank spaces.

historical

Flag indicating if the added data is historical (TRUE) or based on other model projections (FALSE)

unit

The unit of the dataset in the format c(10^6,"tC/a")

citation

The citation for the dataset, preferably in bibtex format.

comment

A free text comment. This should contain information about data source and quality.

ignore.args

A vector of strings, specifying arguments for which it does not matter what value they have.

choose.args

A vector of strings. A call of func with a certain value of these arguments requires to return argument specific data from the database (e.g. crops in production).

overwrite

Boolean. By default (FALSE) an error is issued if a dataset named 'datasource' already exists for func(...). If you want to overwrite this a dataset, you have to set this flag to TRUE.

internal

Boolean. By default (FALSE) the library is checked out, updated and committed. If TRUE, only the valdata object in the workspace is modified.

svn_path

Path of the svn repository. If NULL, common paths are being tried.

Details

The function tries to add the desired dataset to the validation library. Additionally, the aggregation routine for data is specified. Each dataset in the library can only have one common aggregation type. Each aggregation level shares one set of aggr_args, so that all entries are aggregated exactly the same way.

Value

No value is returned. Instead the data is saved in the valdata object of the library and the library is updated and committed.

Author(s)

Markus Bonsch

See Also

validationPlot,getData,add_aggrType,show_aggrTypes,addMapping

Examples

1
## Not run: addData(func=land,gdx="fulldata.gdx",ignore.args=c("sum","siclass"),type="crop",data=cropland_object,aggr_type="sum",datasource="FAO",historical=TRUE,comment=c("FAO historical cropland","source:www.fao.org","data_quality: good"))

pik-piam/validation documentation built on Nov. 5, 2019, 12:50 a.m.