read_header: Read header (any version) from LPJmL input/output file

View source: R/read_header.R

read_headerR Documentation

Read header (any version) from LPJmL input/output file

Description

Reads a header from an LPJmL clm file. CLM is the default format used for LPJmL input files and can also be used for output files.

Usage

read_header(filename, force_version = NULL, verbose = TRUE)

Arguments

filename

Filename to read header from.

force_version

Manually set clm version. The default value NULL means that the version is determined automatically from the header. Set only if the version number in the file header is incorrect.

verbose

If TRUE (the default), read_header provides some feedback when using default values for missing parameters. If FALSE, only errors are reported.

Value

The function returns a list with 3 components:

  • name: Header name, e.g. "LPJGRID"; describes the type of data in the file.

  • header: Vector of header values ('version', 'order', 'firstyear', 'nyear', 'firstcell', 'ncell', 'nbands', 'cellsize_lon', 'scalar', 'cellsize_lat', 'datatype', 'nstep', 'timestep') describing the file structure. If header version is <4, the header is partially filled with default values.

  • endian: Endianness of file ("little" or "big").

See Also

  • create_header() for a more detailed description of the LPJmL header format.

  • write_header() for writing headers to files.

Examples

## Not run: 
header <- read_header("filename.clm")

## End(Not run)


lpjmlkit documentation built on March 31, 2023, 9:35 p.m.