Reads a MAgPIE-file and converts it to a 3D array of the structure (cells,years,datacolumn)
read.magpie(
file_name,
file_folder = "",
file_type = NULL,
as.array = FALSE,
comment.char = "*",
check.names = FALSE,
...
)MAgPIE-object
file name including file ending (wildcards are supported). Optionally also the full path can be specified here (instead of splitting it to file\_name and file\_folder)
folder the file is located in (alternatively you can also specify the full path in file\_name - wildcards are supported)
format the data is stored in. Currently 13 formats are available: "rds" (recommended compressed format), "cs2" & "cs2b" (cellular standard MAgPIE format), "csv" (regional standard MAgPIE format), "cs3" (multidimensional format compatible to GAMS), "cs4" (alternative multidimensional format compatible to GAMS, in contrast to cs3 it can also handle sparse data), "csvr", "cs2r", "cs3r" and "cs4r" which are the same formats as the previous mentioned ones with the only difference that they have a REMIND compatible format, "m" (binary MAgPIE format "magpie"), "mz" (compressed binary MAgPIE format "magpie zipped") "put" (format used primarily for the REMIND-MAgPIE coupling) and "asc", (ASCII-Grid format as used by ArcGis) . If file\_type=NULL the file ending of the file\_name is used as format. If format is different to the formats mentioned standard MAgPIE format is assumed.
Should the input be transformed to an array? This can be useful for regional or global inputs, but all advantages of the magpie-class are lost.
character: a character vector of length one containing a single character or an empty string. Use "" to turn off the interpretation of comments altogether. If a comment is found it will be stored in attr(,"comment"). In text files the comment has to be at the beginning of the file in order to be recognized by read.magpie.
logical. If TRUE then the names of the variables in the data frame are checked to ensure that they are syntactically valid variable names. Same functionality as in read.table.
additional arguments passed to specific read functions (e.g.
varname for specifying the variable to be read in from a multi-variable
NCDF file.)
Jan Philipp Dietrich, Stephen Bi, Florian Humpenoeder
This function reads from 13 different MAgPIE file\_types. "rds" is
a R-default format for storing R objects."cs2" or "cs2b" is the new standard
format for cellular data with or without
header and the first columns (year,regiospatial) or only (regiospatial),
"csv" is the standard format for regional data with or without header
and the first columns (year,region,cellnumber) or only (region,cellnumber).
"cs3" is a format similar to csv and cs2, but with the difference that it supports
multidimensional data in a format which can be read by GAMS, "put" is a
newly supported format which is mosty used for the REMIND-MAgPIE coupling.
This format is only partly supported at the moment. "asc" is the AsciiGrid
format (for example used for Arc Gis data). "nc" is the netCDF format (only
"nc" files written by write.magpie can be read). All these variants are
read without further specification. "magpie" (.m) and "magpie zipped" (.mz)
are new formats developed to allow a less storage intensive management of
MAgPIE-data. The only difference between both formats is that .mz is gzipped
whereas .m is not compressed. So .mz needs less memory, whereas .m might
have a higher compatibility to other languages.
Since library version
1.4 read.magpie can also read regional or global MAgPIE csv-files.
"magpie", write.magpie