Description Usage Arguments Details Value Warning Author(s) References Examples
Summarise or read the content of files from the AWA (Amt fuer Wasser und Abfall Kanton Bern).
1 |
dir |
string. the directory which contains the files from the AWA. |
files |
character vector. The file names. |
time.res |
string. The measurement frequency, must be either 'year', 'month', 'day', 'hour', 'min', or 'irregular', see 'Details'. |
series |
logical. Return the series instead of a summary? In case of several files, this can take some time. |
merge |
character vector. If not missing, the series get merged
according to the attributes defined in |
Either dir
or files
can be specified, but not both;
dir
takes precedence.
time.res
determines how the function deals with the time
information. The approach is to first constrain the time stamps to the
format 'YYYY-MM-DD HH:MM' and second to truncate this string to the
desired resolution. E.g. for time.res='month'
we end up with
'YYYY-MM' and for time.res='hour'
we get 'YYYY-MM-DD HH'. In
case of time.res='min'
and time.res='irregular'
the
last digit is ignored, so the highest frequency amounts to 10 minute
intervals (i.e. 'YYYY-MM-DD HH:M').
time.res
is in particular important if series=TRUE
since
it forces the observations to a common time interval. If more than one
observation is present in a particular time interval, only the last
observation is used.
The ordering of files in dir
or files
determines how
series get merged: If the attributes specified in merge
are
consistent, then missing values in the first series are replaced by
corresponding non-missing values in the second series and so
on. Possible attributes are restricted to column names of the data frame
returned if series=FALSE
. Series for which an attribute is
missing are excluded from the merging procedure.
If series=FALSE
a data frame with columns 'file' (file name)
'id' (station id), 'name' (watercourse), 'site' (site name), 'unit'
(measurement unit), 'type' (peak versus mean values), 'start' (date of
the first non-missing value), 'end' (date of the last non-missing
value), 'comment' (remaining annotations as found in the header),
'hydropro' (file exported out of the Hydropro software?), 'sep' (field
separator), and 'skip' (number of header lines).
If series=TRUE
a matrix with row names corresponding to the
argument time.res
. In case of mean values, clock time refers
to the starting time of the underlying period, e.g. for hourly values 01
corresponds to 01:00 - 01:59. The column names contain the id (if
present) of the station as last number.
The function relies on a rather heuristic approach and thus may fail when the AWA comes up with new file formats.
Warning messages like 'NAs introduced by coercion' mean that missing values are present in at least one of the series.
Simon S
1 2 3 4 5 6 7 8 | ## Not run:
d <- '/path/to/dir/'
readFilesAwa(dir=d)
m <- readFilesAwa(dir=d,series=TRUE)
f <- c('/the/first/Awa/file1.asc','/the/second/Awa/file2.asc')
m <- readFilesAwa(files=f,series=T)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.