Title: | Interface package for GDX files in R |
---|---|
Description: | A wrapper package for the gamstransfer package extending its functionality and allowing to read GDX files directly in R. It is emulating the basic features of the readGDX function in the gdx package but now based on gamstransfer instead of gdxrrw which served as a basis for gdx. |
Authors: | Jan Philipp Dietrich [aut, cre] (Potsdam Institute for Climate Impact Research, <https://orcid.org/0000-0002-4309-6431>) |
Maintainer: | Jan Philipp Dietrich <[email protected]> |
License: | BSD_2_clause + file LICENSE |
Version: | 0.3.2 |
Built: | 2024-11-29 04:53:25 UTC |
Source: | https://github.com/pik-piam/gdx2 |
This function creates a GAMS file with scaling of variables. The scaling is calculated based on a gdx file containing all variables of a run.
calcScaling(gdx, file = NULL, magnitude = 2)
calcScaling(gdx, file = NULL, magnitude = 2)
gdx |
path to a gdx file |
file |
A file name the scaling GAMS code should be written to. If NULL the code is returned by the function |
magnitude |
The order of magnitude for which variables should be scaled. All variables with average absolute values which are either below 10e(-magnitude) or above 10e(magnitude) will be scaled. |
A vector with the scaling GAMS code if file=NULL, otherwise nothing is returned.
Jan Philipp Dietrich
## Not run: calcScaling("fulldata.gdx") ## End(Not run)
## Not run: calcScaling("fulldata.gdx") ## End(Not run)
Function to read gdx files in R. It is a stripped-down reimplementation of
readGDX which is now based on magclass structures and uses
gamstransfer
as basis.
readGDX( gdx, ..., format = "simplest", type = NULL, react = "warning", followAlias = FALSE, spatial = NULL, temporal = NULL, magpieCells = TRUE, select = NULL, restoreZeros = TRUE, addAttributes = TRUE )
readGDX( gdx, ..., format = "simplest", type = NULL, react = "warning", followAlias = FALSE, spatial = NULL, temporal = NULL, magpieCells = TRUE, select = NULL, restoreZeros = TRUE, addAttributes = TRUE )
gdx |
file name of a gdx file |
... |
search strings defining the objects that should be read from gdx file, with *-autocompletion. Can also be vectors containing more than one search strings |
format |
Output format. Five choices are currently available
|
type |
Type of objects that should be extracted. Available options are "Parameter", "Set", "Alias", "Variable" and "Equation". If NULL all types will be considered. |
react |
determines the reaction, when the object you would like to read in does not exist. Available options are "warning" (NULL is returned and a warning is send that the object is missing), "silent" (NULL is returned, but no warning is given) and "error" (The function throws out an error) |
followAlias |
bolean deciding whether the alias or its linked set should be returned. |
spatial |
argument to determine the spatial columns in the dataframe to
be converted to a magclass object. Defaults to NULL.
See |
temporal |
argument to determine the temporal columns in the dataframe to
be converted to a magclass object. Defaults to NULL.
See |
magpieCells |
(boolean) determines whether a set "j" gets special treatment by replacing underscores in the set elements with dots. Active by default for historical reasons. Can be ignored in most cases. Makes only a difference, if 1) GDX element depends on set "j", 2) set "j" contains underscores. |
select |
preselection of subsets in the data coming from the gdx using
the function |
restoreZeros |
Defines whether 0s, which are typically not stored in a gdx file, should be restored or ignored in the output. By default they will be restored. If possible, it is recommended to use restore_zeros=TRUE. It is faster but more memory consuming. If you get memory errors you should use restore_zeros=FALSE |
addAttributes |
Boolean which controls whether the description and gdxMetadata should be added as attributes or not |
The gdx objects read in the format set with the argument
format
.
Jan Philipp Dietrich
## Not run: readGDX("bla.gdx", "blub*") ## End(Not run)
## Not run: readGDX("bla.gdx", "blub*") ## End(Not run)