ReadDescription {HYPEtools} | R Documentation |
Read a 'description.txt' file
Description
Read a 'description.txt' file as list
object into R. A 'description.txt' file contains land use, soil, and crop
class names of a HYPE set-up, as well as model set-up name and version.
Usage
ReadDescription(
filename,
gcl = NULL,
encoding = c("unknown", "UTF-8", "latin1")
)
Arguments
filename |
Path to and file name of the 'description.txt' file to import. |
gcl |
dataframe, GeoClass.txt file imported with |
encoding |
Character string, encoding of non-ascii characters in imported text file. Particularly relevant when
importing files created under Windows (default encoding "Latin-1") in Linux (default encoding "UTF-8") and vice versa. See
also argument description in |
Details
ReadDescription
imports a 'description.txt' into R. This file is not used by HYPE, but is convenient for
e.g. plotting legend labels or examining imported GeoClass files. E.g., PlotBasinSummary
requires a list
as returned from ReadDescription
for labeling.
A 'description.txt' file consists of 22 lines, alternating names and semicolon-separated content. Lines with names are not read by the import function, they just make it easier to compose and read the actual text file.
File contents read by ReadDescription
:
HYPE set-up name (line 2)
HYPE set-up version (line 4)
Land use class IDs (line 6)
Land use class names (line 6)
Land use class short names (line 8)
Soil class IDs (line 10)
Soil class names (line 10)
Soil class short names (line 12)
Crop class IDs (line 14)
Crop class names (line 14)
Crop class short names (line 16)
Note that Crop class IDs start from 0
, which means no crop, whereas land use and soil IDs start from 1
(or higher).
Formatting example for description.txt files:
# Name
MyHYPE
# Version
0.1
# Land use class IDs
1;2
# Land use class names
Agriculture;Coniferous forest
# Short land use class names
Agric.;Conif. f.
# Soil class IDs
1;2
# Soil class names
Coarse soils;Medium to fine soils
# Short soil class names
Coarse;Medium
# Crop class IDs
0;1;2
# Crop class names
None;Row crops;Autumn-sown cereal
# Short crop class names
None;Row;Aut.-sown
Value
ReadDescription
returns a named list with 11 named character elements, corresponding to the
imported lines:
Name
, Version
, lu.id
, Landuse
, lu
(short names), so.id
,
Soil
, so
(short names), cr.id
, Crop
, cr
(short names)
Examples
te <- ReadDescription(filename = system.file("demo_model",
"description.txt", package = "HYPEtools"))
te