Usage
write.magpie(x, file_name, file_folder = "", file_type = NULL, append=FALSE, comment=NULL, comment.char="*", mode = NULL, nc_compression=9)
Arguments
file_name
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)
file_folder
folder the file should be written to (alternatively you can also specify the full path in file\_name - wildcards are supported)
file_type
Format the data should be stored as. Currently 11 formats are available: "cs2" (cellular standard MAgPIE format), "csv" (regional standard MAgPIE format), "cs3" (Format for multidimensional MAgPIE data, 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"), "asc" (ASCII grid format / only available for 0.5deg data) and "nc" (netCDF format / only available for 0.5deg data).
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. Please be aware that the file\_name is independent of the file\_type you choose here, so no additional file ending will be added!
append
Decides whether an existing file should be overwritten (FALSE) or the data should be added to it (TRUE). Append = TRUE only works if the existing data can be combined with the new data using the mbind function
comment
Vector of strings: Optional comment giving additional information about the data. If different to NULL this will overwrite the content of attr(x,"comment")
comment.char
character: a character vector of length one containing a single character or an empty string. Use "" to turn off the interpretation of comments altogether.
mode
File permissions the file should be written with as 3-digit number (e.g. "777" means full access for user, group and all, "750" means full access for user, read access for group and no acess for anybody else). Set to NULL system defaults will be used. Access codes are identical to the codes used in unix function chmod.
nc_compression
Only used if file\_type="nc". Sets the compression level for netCDF files (default is 9). If set to an integer between 1 (least compression) and 9 (most compression), the netCDF file is written in netCDF version 4 format. If set to NA, the netCDF file is written in netCDF version 3 format.