Read SENATE's Grab Sample Data From CSV (type 2)
Source:R/senates_grab_sample_data_2.R
hsGetGsData2.Rd
SENATE's grab sample data is read from a csv file (type 2) and returned in forms of a list (see Value section below). The csv file is expected to contain grab sample data of more than one monitoring point, organized in sections each of which contains measurement results of all available parameters in a matrix-style format. For a format description of the csv file see the Details section below.
Usage
hsGetGsData2(
csv,
sep = ";",
dateFormat = "%d.%m.%Y",
dec = ",",
blockBeginPtrn = PATTERN_STATION(),
dbg = FALSE,
outlevel = 1
)
Arguments
- csv
full path to csv file
- sep
separator in csv file, e.g. ";" or ","
- dateFormat
date format specifier describing the format in which dates are represented in the csv file. Use placeholders ,
"%d"
(day),"%m"
(month),"%y"
(2-digit year),"%Y"
(4-digit year) to describe the date format."%d.%m.%Y"
,"%d/%m/%y"
,"%Y-%m-%d"
are examples for valid format specifiers.- dec
decimal character: "." or ","
- blockBeginPtrn
pattern indicating the begin of a data block in the file
- dbg
if
TRUE
(default), debug messages are shown- outlevel
Output level. Expected values are 1 or 2. The default is 1. If the output level is 2, the raw data block is passed to
kwb.read:::.hsExtractData
before being returned.
Value
Grab sample data is returned in forms of a list, e.g.:
$ moniPoint:List of 2
..$ mpID : chr , e.g. "730"
..$ mpName: chr , e.g. "Panke, Muendung (Nordhafen-Vorbecken) (0,5 m)"
$ byPar :List
..$ <parID1>:List of 7
.. ..$ parID : chr , e.g. "10001"
.. ..$ parName: chr , e.g. "Lufttemperatur"
.. ..$ parUnit: chr , e.g. "<degree>C"
.. ..$ smpDate: Date[], format: ...
.. ..$ parTxt : chr [], e.g. "3,000" "4,000" "9,300" "19,900" ...
.. ..$ parVal : num [], e.g. 3 4 9.3 19.9 12.1 13.1 19.6 28 13.9 7.2 ...
.. ..$ parLim : chr [], e.g. "" "<" "<" "" ...
..$ <parID2> ...
Details
The csv file is expected to look like the following example. It is structured
into blocks each of which represents a monitoring point. Such, it is
different from the format supported by hsGetGsData1
where each
block represents a measured parameter and there is only one monitoring point
per file. Here, a block starts with a line naming the monitoring point,
followed by a header line showing the names and units of the analysed
parameters. The header line is followed by data lines each of which
represents a sample with sample data and the measured values according to the
names in the header line. The value fields may contain a leading character
indicating that the detection limit was underrun or exceeded. (Shortened)
example of an input file:
G<ue>te - Parameterwerte (Tabelle 3);;; ...
;;; ...
Messstelle: 110 M<ue>ggelspree, F<ae>hre Rahnsdorf M<ue>ggelspree;;; ...
;TL, gesamt [<degree>C];TW, gesamt [<degree>C];Sicht, gesamt [cm];pH, gesamt [Wert]; ...
13.01.2011;3,000;0,400;;7,200;647,000;7,500;51,826;36,000;< 0,050; ...
10.02.2011;1,000;3,100;;7,600;621,000;11,300;84,231;35,000;< 0,050; ...
...
;;; ...
Messstelle: 130 Spree, F<ae>hre Baumschulenweg Spree;;; ...
;TL, gesamt [<degree>C];TW, gesamt [<degree>C];Sicht, gesamt [cm];pH, gesamt [Wert]; ...
02.11.2010;7,000;7,400;120,000;8,000;616,000;9,000;75,069;37,000; ...
30.11.2010;-4,000;2,700;150,000;7,900;608,000;10,100;74,464;36,000; ...
...