Type: | Package |
Version: | 0.5.3 |
Date: | 2025-02-26 |
Title: | 1d Water Level Interpolation along the Rivers Elbe and Rhine |
Description: | An S4 class and several functions which utilize internally stored datasets and gauging data enable 1d water level interpolation. The S4 class (WaterLevelDataFrame) structures the computation and visualisation of 1d water level information along the German federal waterways Elbe and Rhine. 'hyd1d' delivers 1d water level data - extracted from the 'FLYS' database - and validated gauging data - extracted from the hydrological database 'WISKI7' - package-internally. For computations near real time gauging data are queried externally from the 'PEGELONLINE REST API' https://pegelonline.wsv.de/webservice/dokuRestapi. |
Depends: | R (≥ 4.1.0) |
Imports: | methods, utils, Rdpack, httr2, curl |
Suggests: | DBI (≥ 0.4-9), RPostgreSQL (≥ 0.6-1), testthat, knitr, rmarkdown, stringr, devtools, pkgdown, roxygen2, revealjs, shiny, shiny.i18n, shinyTime, lubridate, usethis, yaml, desc |
RdMacros: | Rdpack |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 7.3.2 |
Collate: | 'Class-WaterLevelDataFrame.R' 'WaterLevelDataFrame-methods.R' 'data.R' 'getGaugingDataW.R' 'getPegelonlineW.R' 'hyd1d-internal.R' 'hyd1d.R' 'plotShiny.R' 'updateGaugingData.R' 'waterLevel.R' 'waterLevelFlood1.R' 'waterLevelFlood2.R' 'waterLevelFlys3.R' 'waterLevelFlys3InterpolateX.R' 'waterLevelFlys3InterpolateY.R' 'waterLevelFlys3Seq.R' 'waterLevelPegelonline.R' 'zzz.R' |
VignetteBuilder: | knitr |
BugReports: | https://github.com/bafg-bund/hyd1d/issues/ |
URL: | https://hyd1d.bafg.de, https://github.com/bafg-bund/hyd1d |
NeedsCompilation: | no |
Packaged: | 2025-02-26 08:08:07 UTC; WeberA |
Author: | Arnd Weber |
Maintainer: | Arnd Weber <arnd.weber@bafg.de> |
Repository: | CRAN |
Date/Publication: | 2025-02-26 09:00:02 UTC |
hyd1d - 1d Water Level Interpolation along the Rivers Elbe and Rhine
Description
The hyd1d package provides an S4 class, relevant datasets and functions to compute 1d water levels along the German federal waterways Elbe and Rhine.
S4 class WaterLevelDataFrame
The detailled description of the S4 class WaterLevelDataFrame
is
available here. This class structures the
handling and computation of the 1d water levels.
Datasets
Datasets delivered with this package are:
Water level computation
Water levels are either obtained from the df.flys
-dataset
by the functions waterLevelFlys3
or
waterLevelFlys3Seq
or computed by the functions
waterLevel
and waterLevelPegelonline
. The later
functions use the datasets df.flys
and
df.gauging_station_data
and gauging data provided by
df.gauging_data
or https://pegelonline.wsv.de/gast/start
to linearily interpolate continuous water levels intersecting with the
measured water level data at the gauging stations.
Author(s)
Maintainer: Arnd Weber arnd.weber@bafg.de (ORCID)
Authors:
Marcus Hatz hatz@bafg.de
Other contributors:
Wolfgang Stürmer [contributor]
Wilfried Wiechmann wiechmann@bafg.de [contributor]
Benjamin Eberhardt eberhardt@bafg.de [contributor]
See Also
Useful links:
Report bugs at https://github.com/bafg-bund/hyd1d/issues/
Initialize a WaterLevelDataFrame
Description
To initialize an object of class WaterLevelDataFrame this function should be used. It checks all the required input data and validates the final object.
Usage
WaterLevelDataFrame(
river = c("Elbe", "Rhine"),
time,
gauging_stations = NULL,
gauging_stations_missing = NULL,
comment = NULL,
id = NULL,
station = NULL,
station_int = NULL,
w = NULL
)
Arguments
river |
a required argument to fill the WaterLevelDataFrame-slot
|
time |
a required argument to fill the WaterLevelDataFrame-slot
|
gauging_stations |
a slot of class |
gauging_stations_missing |
an optional argument to fill the
WaterLevelDataFrame-slot |
comment |
an optional argument to fill the
WaterLevelDataFrame-slot |
id |
an optional argument to hand over the |
station |
an optional argument to hand over the stationing along the
specified |
station_int |
an optional argument to hand over the stationing along the
specified |
w |
an optional argument to hand over the water level information along
the stationing of the specified |
Value
The function produces an object of class WaterLevelDataFrame which might contain 1d water level data and information to recompute it.
Examples
wldf <- WaterLevelDataFrame(river = "Elbe",
time = as.POSIXct("2016-12-21"),
station = seq(257, 262, 0.1))
wldf <- waterLevel(wldf)
S4 class for 1d water level data
Description
The S4 class WaterLevelDataFrame is inherited from
the S3 class data.frame
and stores 1d water level
information together with the official stationing along the German federal
waterways Elbe and Rhine.
Details
In addition to the 1d water level data stored in the
data.frame
further slots contain necessary information
used for or computed during the computation of water levels:
Slots
.Data
contains the
data.frame
with at least three columns:station
,station_int
andw
. The columnsstation
andstation_int
represent the official stationing along the waterways in two different formats. They are totally exchangeable sincestation <- as.numeric(station_int / 1000)
andstation_int <- as.integer(station * 1000)
. The columnw
represents the height of the water level relative to standard elevation zero (DHHN92). These first three columns are required, but further columns can be added.river
is a required slot clearly determining the location of a station. Possible values of
river
have to be typecharacter
, have to have a length of one and are either Elbe or Rhine.time
is a slot determining the time for which the water level has been computed.
time
has to be typec("POSIXct", "POSIXt")
, has to have a length of one and be in the range between1960-01-01 00:00:00 CET
and now (Sys.time()
) orNA
.gauging_stations
possibly contains a
data.frame
with relevant information about gauging stations within the relevantriver
stretch and the closer surrounding up- and downstream of the relevantriver
stretch. It is usually filled by the functionswaterLevel
orwaterLevelPegelonline
.gauging_stations_missing
possibly contains a vector of type
character
with names of gauging stations for which no gauging data existed for the requestedtime
. It is automatically filled by the functionswaterLevel
,waterLevelPegelonline
,waterLevelFlys3
andwaterLevelFlys3Seq
.comment
contains information on which function has been used to create (
WaterLevelDataFrame
) or compute (waterLevel
,waterLevelPegelonline
,waterLevelFlys3
andwaterLevelFlys3Seq
) an object of class WaterLevelDataFrame.
Extract or replace parts of a WaterLevelDataFrame
Description
Extract or replace subsets of the .Data
slot of an object
of class WaterLevelDataFrame.
Usage
## S4 method for signature 'WaterLevelDataFrame'
x[i, j]
## S4 replacement method for signature 'WaterLevelDataFrame,ANY,ANY,data.frame'
x[i, j] <- value
Arguments
x |
object of class WaterLevelDataFrame. |
i , j |
elements to extract or replace. For |
value |
A suitable replacement value: it will be repeated a whole number
of times if necessary and it may be coerced: see the Coercion section. If
|
Details
For details see [.data.frame
.
Value
A new object of class WaterLevelDataFrame is returned.
Since the extraction or replacement acts only on the .Data
-slot of
the object, all other slots remain unchanged.
See Also
Examples
wldf <- WaterLevelDataFrame(river = "Elbe",
time = as.POSIXct("2016-12-21"),
station = seq(257, 262, 0.1))
wldf <- wldf[which(wldf$station >= 259 & wldf$station <= 261), ]
Coerce a WaterLevelDataFrame to a data.frame
Description
A function to coerce an object of class
WaterLevelDataFrame to a data.frame
.
Usage
## S3 method for class 'WaterLevelDataFrame'
as.data.frame(x, ...)
Arguments
x |
an object of class WaterLevelDataFrame. |
... |
additional arguments to be passed to the internally used
|
Value
as.data.frame
returns a data.frame
.
See Also
WaterLevelDataFrame
,
data.frame
, as.data.frame
Examples
wldf <- WaterLevelDataFrame(river = "Elbe",
time = as.POSIXct("2016-12-21"),
station = seq(257, 262, 0.1))
df <- as.data.frame(wldf)
Stationary water levels from the FLYS 3-database
Description
This dataset contains the 30 stationary 1d water levels for the rivers Elbe and Rhine originally stored in the FLYS3-database.
For both rivers 30 stationary water levels have been computed by means of the 1d hydraulic model SOBEK. The water levels cover the full length of the free flowing river sections with a spatial resolution of 200 m river stretch along the official river stationing. They range from extremely low to extremely high flow conditions and are usually separated vertically by 0.2 - 0.6 m.
Usage
df.flys
Format
A data.frame
with 169980 rows and 4 variables:
- river
name of the relevant water body (type
character
).- name
of the FLYS 3 water level (type
character
). See details for more information.- station
rivers stationing (type
numeric
).- w
water level (cm above gauge zero, type
numeric
).
Details
The name
ing of the water levels is river
-specific:
Elbe:
'0.5MNQ', 'MNQ', '0.5MQ', 'a', '0.75MQ', 'b', 'MQ', 'c', '2MQ', '3MQ', 'd', 'e', 'MHQ', 'HQ2', 'f', 'HQ5', 'g', 'h', 'HQ10', 'HQ15', 'HQ20', 'HQ25', 'HQ50', 'HQ75', 'HQ100', 'i', 'HQ150', 'HQ200', 'HQ300', 'HQ500'
Rhine:
'Ud=1', 'Ud=5', 'GlQ2012', 'Ud=50', 'Ud=80', 'Ud=100', 'Ud=120', 'Ud=183', 'MQ', 'Ud=240', 'Ud=270', 'Ud=310', 'Ud=340', 'Ud=356', 'Ud=360', 'MHQ', 'HQ2', 'HQ5', 'HQ5-10', 'HQ10', 'HQ10-20', '~HQ20', 'HQ20-50', 'HQ50', 'HQ50-100', 'HQ100', 'HQ100-200', 'HQ200', 'HQ200-ex', 'HQextr.'
Both lists of water levels are ordered from low to high water levels.
References
Busch N, Hammer M (2009). “Einheitliche Grundlage für die Festlegung der Bemessungswasserspiegellagen der Elbe auf der frei fließenden Strecke in Deutschland.” doi:10.5675/bfg-1650.
HKV Hydrokontor (2014). “Erstellung eines SOBEK-River Modells für den Rhein von Iffezheim bis Pannerdense Kop als Weiterentwicklung bestehender SOBEK-RE Modelle.”
Bundesanstalt für Gewässerkunde (2013). “FLYS goes WEB: Eröffnung eines neuen hydrologischen Fachdienstes in der BfG.” doi:10.5675/BfG_Veranst_2013.4, https://doi.bafg.de/BfG/2013/Veranst4_2013.pdf.
Bundesanstalt für Gewässerkunde (2016). “FLYS – Flusshydrologischer Webdienst.” https://www.bafg.de/DE/5_Informiert/1_Portale_Dienste/FLYS/flys_node.html.
DELTARES (2018). “SOBEK.” https://download.deltares.nl/en/sobek/.
Reference gauging stations according to FLYS3
Description
This dataset relates the reference gauging stations to river stationing as used within FLYS3
Usage
df.flys_sections
Format
A data.frame
with 24 rows and 4 variables:
- river
name of the FLYS3 water body (type
character
).- gauging_station
name of the reference gauging station (type
character
).- from
uppermost station of the river section (type
numeric
).- to
lowermost station of the river section (type
numeric
).- uuid
name of the reference gauging station (type
character
).
References
Bundesanstalt für Gewässerkunde (2016). “FLYS – Flusshydrologischer Webdienst.” https://www.bafg.de/DE/5_Informiert/1_Portale_Dienste/FLYS/flys_node.html.
Gauging data for all WSV-run gauging stations along Elbe and Rhine
Description
This dataset contains all daily-averaged gauging data for the gauging stations along Elbe and Rhine operated by the waterway and shipping administration (Wasserstraßen- und Schifffahrtsverwaltung (WSV)) since 1960-01-01. Data from 1960-01-01 until 2023-12-31 are validated and were queried from (WISKI7)-database and supplied by Datenstelle-M1@bafg.de. Data after 2023-12-31 are continuously collected from https://pegelonline.wsv.de/gast/start and are not officially validated. Unvalidated recent data will be replaced anually and distributed through package and/or internal dataset updates.
The latest version is stored locally under
paste0(options()$hyd1d.datadir, "/df.gauging_data_latest.RDS")
. To
modify the location of your locally stored gauging data set using
options()
prior to loading the package, e.g.
options("hyd1d.datadir" = "~/.hyd1d");library(hyd1d)
. The location
can be determined through the environmental variable hyd1d_datadir.
Usage
df.gauging_data
Format
A data.frame
with 1379334 (rows and 3 variables):
- gauging_station
name of the gauging station (type
character
). It is used as JOIN field for datasetdf.gauging_station_data
.- date
of the measurement (type
Date
).- w
water level relative to the gauge zero (cm, type
numeric
).
References
Wasserstraßen- und Schifffahrtsverwaltung des Bundes (WSV) (2024). “Pegeldaten für Elbe und Rhein.”
Wasserstraßen- und Schifffahrtsverwaltung des Bundes (WSV) (2022). “PEGELONLINE.” https://pegelonline.wsv.de/gast/start.
See Also
Examples
options("hyd1d.datadir" = tempdir())
updateGaugingData(paste0(options()$hyd1d.datadir,
"/df.gauging_data_latest.RDS"))
Gauging station data for all WSV-run gauging stations along Elbe and Rhine
Description
This dataset contains gauging station data for the gauging stations along Elbe and Rhine operated by the waterway and shipping administration (Wasserstraßen- und Schifffahrtsverwaltung (WSV)). The data were originally obtained from https://pegelonline.wsv.de/gast/start and are updated anually.
Usage
df.gauging_station_data
Format
A data.frame
with 70 rows and 13 variables:
- id
continuous numbering (type
integer
).- gauging_station
name of the gauging station (type
character
). It is used as JOIN field for datasetdf.gauging_data
.- uuid
of the gauging station in the PEGELONLINE system (type
character
).- agency
of the waterway and shipping administration in charge of the respective gauging station (type
character
).- km
official stationing of the gauging station (type
numeric
).- longitude
of the gauging stations location (WGS1984, type
numeric
).- latitude
of the gauging stations location (WGS1984, type
numeric
).- mw
mean water level of the gauging station (m relative to the gauge zero, type
numeric
).- mw_timespan
timespan used to derive the gauging stations mean water level (type
character
).- pnp
the gauge zero relative to sea level (NHN (DHHN92), type
numeric
).- data_present
logical
to separate TRUE (real) from section structuring FALSE gauging stations.- km_qps
corrected stationing used for the water level computations of
waterLevel
andwaterLevelPegelonline
(typenumeric
).- river
the gauging station is located on (type
character
).
References
Wasserstraßen- und Schifffahrtsverwaltung des Bundes (WSV) (2022). “PEGELONLINE.” https://pegelonline.wsv.de/gast/start.
Get W from internal dataset df.gauging_data for the specified gauging station and time
Description
Extract the daily mean water level data from
df.gauging_data
for specific gauging station and date.
Usage
getGaugingDataW(gauging_station, time, uuid)
Arguments
gauging_station |
must be type |
time |
must be type |
uuid |
must be type |
Details
This functions queries package-internal gauging data
(df.gauging_data
).
Value
If gauging data exist for the specified gauging station and time, a
water level is returned. If no data exist, NA
is returned.
References
Wasserstraßen- und Schifffahrtsverwaltung des Bundes (WSV) (2024). “Pegeldaten für Elbe und Rhein.”
Examples
getGaugingDataW(gauging_station = "DESSAU", time = as.Date("2016-12-21"))
Extract a WaterLevelDataFrame's slot gauging_stations
Description
A function to extract the slot gauging_stations
from an
object of class WaterLevelDataFrame.
Usage
getGaugingStations(x)
## S4 method for signature 'WaterLevelDataFrame'
getGaugingStations(x)
Arguments
x |
an object of class WaterLevelDataFrame. |
Value
The function above extracts the slot gauging_stations
and
returns an object of class data.frame
, which might
contain gauging station data that have been used for the interpolation of a
water level for the specified date.
See Also
Examples
wldf <- WaterLevelDataFrame(river = "Elbe",
time = as.POSIXct("2016-12-21"),
station = seq(257, 262, 0.1))
wldf <- waterLevel(wldf)
getGaugingStations(wldf)
Extract a WaterLevelDataFrame's slot gauging_stations_missing
Description
A function to extract the slot gauging_stations_missing
from an object of class WaterLevelDataFrame.
Usage
getGaugingStationsMissing(x)
## S4 method for signature 'WaterLevelDataFrame'
getGaugingStationsMissing(x)
Arguments
x |
an object of class WaterLevelDataFrame. |
Value
The function above extracts the slot gauging_stations_missing
and returns an object of class character
, which might contain a
vector with gauging stations without gauging data for the specified date.
See Also
setGaugingStationsMissing<–method
Examples
wldf <- WaterLevelDataFrame(river = "Elbe",
time = as.POSIXct("1991-12-16"),
station = seq(500, 501, 0.1))
wldf <- waterLevel(wldf)
getGaugingStationsMissing(wldf)
Get W from pegelonline.wsv.de for the specified gauging station and time
Description
Download and temporarily interpolate or average water level data from https://pegelonline.wsv.de/gast/start.
Usage
getPegelonlineW(gauging_station, time, uuid)
Arguments
gauging_station |
must be type |
time |
must be type |
uuid |
must be type |
Details
This functions queries online water level data through the
REST
service of PEGELONLINE. The
gauging data from PEGELONLINE
have a high temporal resolution of 15 minutes, enabling meaningful linear
temporal interpolation if time
is supplied with type
c("POSIXct", "POSIXt")
. If time
is
supplied with type Date
water level data are aggregated to daily
averages.
Since data from PEGELONLINE expire after 31 days, this function is only applicable to query unvalidated water level values for the last 31 days before function call. If you need older and validated data, feel free to contact the data service at the Federal Institute of Hydrology by email (Datenstelle-M1@bafg.de).
Value
The returned output depends on the type of the input parameter
time
. If time
is type
c("POSIXct", "POSIXt")
the
returned object contains queried and interpolated water levels. If
time
is type Date
the returned object contains daily averaged
water levels.
References
Wasserstraßen- und Schifffahrtsverwaltung des Bundes (WSV) (2022). “PEGELONLINE.” https://pegelonline.wsv.de/gast/start.
See Also
Examples
getPegelonlineW(gauging_station = "DESSAU", time = Sys.time() - 3600)
getPegelonlineW(gauging_station = "DESSAU", time = Sys.Date() - 1)
Extract a WaterLevelDataFrame's slot river
Description
A function to extract the slot river
from an object
of class WaterLevelDataFrame.
Usage
getRiver(x)
## S4 method for signature 'WaterLevelDataFrame'
getRiver(x)
Arguments
x |
an object of class WaterLevelDataFrame. |
Value
The function above extracts the slot river
and returns an object of class character
.
See Also
Examples
wldf <- WaterLevelDataFrame(river = "Elbe",
time = as.POSIXct("2016-12-21"),
station = seq(257, 262, 0.1))
getRiver(wldf)
Extract a WaterLevelDataFrame's slot time
Description
A function to extract the slot time
from an object of
class WaterLevelDataFrame.
Usage
getTime(x)
## S4 method for signature 'WaterLevelDataFrame'
getTime(x)
Arguments
x |
an object of class WaterLevelDataFrame. |
Value
The function above extracts the slot time
and returns an
object of type c("POSIXct", "POSIXt")
.
See Also
Examples
wldf <- WaterLevelDataFrame(river = "Elbe",
time = as.POSIXct("2016-12-21"),
station = seq(257, 262, 0.1))
getTime(wldf)
Set names of a WaterLevelDataFrame
Description
Function to get or set the column names of an object of class WaterLevelDataFrame.
Usage
## S4 replacement method for signature 'WaterLevelDataFrame,character'
names(x) <- value
Arguments
x |
an object of class WaterLevelDataFrame. |
value |
a character vector of up to the same length as |
Value
For names
, a character vector of the same length as
ncol(x)
.
For names<-
, the updated object. (Note that the value of
names(x) <- value
is that of the assignment, value
, not the
return value from the left-hand side.)
Note
To access the slot names of an object of class
WaterLevelDataFrame the function
slotNames
has to be used.
See Also
Examples
wldf <- WaterLevelDataFrame(river = "Elbe",
time = as.POSIXct("2016-12-21"),
station = seq(257, 262, 0.1))
wldf <- waterLevel(wldf, TRUE)
names(wldf) <- c(names(wldf)[1:5], "WEIGHT_Y")
Plot a WaterLevelDataFrame in Shiny
Description
This convenience function enables the easy visualisation of
interpolated water levels stored as WaterLevelDataFrame using
the R package shiny. The
results of functions like waterLevel
and
waterLevelPegelonline
can be plotted interactively so that
the computation process itself becomes visible.
Usage
plotShiny(
wldf,
add_flys = TRUE,
add_flys_labels = TRUE,
add_weighting = TRUE,
...
)
Arguments
wldf |
an object of class WaterLevelDataFrame. |
add_flys |
|
add_flys_labels |
|
add_weighting |
|
... |
further graphical parameters passed to
|
Value
A plot of a WaterLevelDataFrame.
References
Bundesanstalt für Gewässerkunde (2016). “FLYS – Flusshydrologischer Webdienst.” https://www.bafg.de/DE/5_Informiert/1_Portale_Dienste/FLYS/flys_node.html.
Examples
wldf <- WaterLevelDataFrame(river = "Elbe",
time = as.POSIXct("2016-12-21"),
station = seq(257, 262, 0.1))
wldf <- waterLevel(wldf, shiny = TRUE)
plotShiny(wldf, TRUE, TRUE, TRUE)
Combine WaterLevelDataFrames by Rows
Description
Take WaterLevelDataFrames that were produced for
the same river
and time
and combine them by r
ows.
Usage
## S3 method for class 'WaterLevelDataFrame'
rbind(...)
Arguments
... |
objects of class WaterLevelDataFrame. |
Value
All supplied objects of class WaterLevelDataFrame will be combined to one object of class WaterLevelDataFrame which is returned.
See Also
Examples
wldf1 <- WaterLevelDataFrame(river = "Elbe",
time = as.POSIXct("2016-12-21"),
station = seq(257, 262, 0.1))
wldf2 <- WaterLevelDataFrame(river = "Elbe",
time = as.POSIXct("2016-12-21"),
station = seq(262, 270, 0.1))
wldf <- rbind(wldf1, wldf2)
Set a WaterLevelDataFrame's slot gauging_stations
Description
A function to set the slot gauging_stations
of an object
of class WaterLevelDataFrame.
Usage
setGaugingStations(x) <- value
## S4 replacement method for signature 'WaterLevelDataFrame,data.frame'
setGaugingStations(x) <- value
Arguments
x |
an object of class WaterLevelDataFrame. |
value |
a new value of class |
Value
The function sets a new value
for the slot
gauging_stations
and returns an object of class
WaterLevelDataFrame. Since value
is normally generated
inside the functions waterLevel
or
waterLevelPegelonline
this function is of very little use
outside these functions.
See Also
Examples
wldf <- WaterLevelDataFrame(river = "Elbe",
time = as.POSIXct("2016-12-21"),
station = seq(257, 262, 0.1))
wldf <- waterLevel(wldf)
df <- data.frame(id = integer(),
gauging_station = character(),
uuid = character(),
km = numeric(),
km_qps = numeric(),
river = character(),
longitude = numeric(),
latitude = numeric(),
mw = numeric(),
mw_timespan = character(),
pnp = numeric(),
w = numeric(),
wl = numeric(),
n_wls_below_w_do = integer(),
n_wls_above_w_do = integer(),
n_wls_below_w_up = integer(),
n_wls_above_w_up = integer(),
name_wl_below_w_do = character(),
name_wl_above_w_do = character(),
name_wl_below_w_up = character(),
name_wl_above_w_up = character(),
w_wl_below_w_do = numeric(),
w_wl_above_w_do = numeric(),
w_wl_below_w_up = numeric(),
w_wl_above_w_up = numeric(),
weight_up = numeric(),
weight_do = numeric(),
stringsAsFactors = FALSE)
setGaugingStations(wldf) <- df
Set a WaterLevelDataFrame's slot gauging_stations_missing
Description
A function to set the slot gauging_stations_missing
of
an object of class WaterLevelDataFrame.
Usage
setGaugingStationsMissing(x) <- value
## S4 replacement method for signature 'WaterLevelDataFrame,character'
setGaugingStationsMissing(x) <- value
Arguments
x |
an object of class WaterLevelDataFrame. |
value |
a new value of class |
Value
The function above sets a new value
for the slot
gauging_stations_missing
and returns an object of class
WaterLevelDataFrame.
See Also
getGaugingStationsMissing-method
Examples
wldf <- WaterLevelDataFrame(river = "Elbe",
time = as.POSIXct("2016-12-21"),
station = seq(257, 262, 0.1))
setGaugingStationsMissing(wldf) <- as.character("VOCKERODE")
Set a WaterLevelDataFrame's slot river
Description
A function to set the slot river
of an object of class
WaterLevelDataFrame.
Usage
setRiver(x) <- value
## S4 replacement method for signature 'WaterLevelDataFrame,character'
setRiver(x) <- value
Arguments
x |
an object of class WaterLevelDataFrame. |
value |
a new value of class |
Value
The function above sets a new value
for the slot river
and returns an object of class WaterLevelDataFrame. Since
river
is a slot relevant for the computation of the
data.frame
column w
, w
is set to
NA
and needs to be recomputed by functions like
waterLevel
or waterLevelPegelonline
.
See Also
Examples
wldf <- WaterLevelDataFrame(river = "Elbe",
time = as.POSIXct("2016-12-21"),
station = seq(500, 501, 0.1))
setRiver(wldf) <- as.character("Rhine")
Set a WaterLevelDataFrame's slot time
Description
A function to set the slot time
of an object of class
WaterLevelDataFrame.
Usage
setTime(x) <- value
## S4 replacement method for signature 'WaterLevelDataFrame,POSIXct'
setTime(x) <- value
## S4 replacement method for signature 'WaterLevelDataFrame,POSIXlt'
setTime(x) <- value
## S4 replacement method for signature 'WaterLevelDataFrame,Date'
setTime(x) <- value
Arguments
x |
an object of class WaterLevelDataFrame. |
value |
a new value of class |
Value
The function above sets a new value
for the slot time
and returns an object of class WaterLevelDataFrame. Since
time
is a slot relevant for the computation of the
data.frame
column w
, w
is set to
NA
and needs to be recomputed by functions like
waterLevel
or waterLevelPegelonline
.
See Also
Examples
wldf <- WaterLevelDataFrame(river = "Elbe",
time = as.POSIXct("2016-12-21"),
station = seq(257, 262, 0.1))
setTime(wldf) <- as.POSIXct("2016-12-22")
Subsetting WaterLevelDataFrames
Description
Returns subsets of WaterLevelDataFrames which meet conditions.
Usage
## S3 method for class 'WaterLevelDataFrame'
subset(x, subset, select, drop = FALSE, ...)
Arguments
x |
object of class WaterLevelDataFrame. |
subset |
logical expression indicating elements or rows to keep: missing values are taken as false. |
select |
expression, indicating columns to select from a data frame. |
drop |
passed on to [ indexing operator. |
... |
further arguments to be passed to or from other methods. |
Value
An object similar to x, containing just the selected rows and columns. All other slots of the WaterLevelDataFrame remain unchanged.
See Also
Examples
wldf <- WaterLevelDataFrame(river = "Elbe",
time = as.POSIXct("2016-12-21"),
station = seq(257, 262, 0.1))
wldf <- subset(wldf, station >= 258 & station <= 261)
WaterLevelDataFrame summary
Description
Returns a list of descriptive statistics for an object of class WaterLevelDataFrame.
Usage
## S3 method for class 'WaterLevelDataFrame'
summary(object, ...)
Arguments
object |
an object of class WaterLevelDataFrame for which a summary is desired. |
... |
additional arguments to be passed to internally used functions. |
Value
A list of summary statistics of the WaterLevelDataFrame and its slots.
See Also
Examples
wldf <- WaterLevelDataFrame(river = "Elbe",
time = as.POSIXct("2016-12-21"),
station = seq(257, 262, 0.1))
wldf <- waterLevel(wldf)
summary(wldf)
Update local copy of df.gauging data
Description
Function to overwrite and update the internal dataset
df.gauging_data
. This function is usually called during the
initial loading of the package. If an update of
df.gauging_data
took place more than 8 days ago, an updated
version of df.gauging_data
will be downloaded and used.
Usage
updateGaugingData(x)
Arguments
x |
path to the file containing |
Value
invisible(logical)
notifying whether an updated version of
df.gauging_data
has been downloaded.
Examples
options("hyd1d.datadir" = tempdir())
updateGaugingData(paste0(options()$hyd1d.datadir,
"/df.gauging_data_latest.RDS"))
Compute a 1d water level dataset
Description
Functions to compute 1d water level information and store it as
column w
of an S4 object of type WaterLevelDataFrame.
Usage
waterLevel(wldf, shiny = FALSE)
waterLevelPegelonline(wldf, shiny = FALSE)
Arguments
wldf |
an object of class WaterLevelDataFrame. |
shiny |
|
Details
waterLevel
interpolates 1d water level along the river axis
of Elbe and Rhine based on daily averaged, mostly validated gauging data
stored in the internal dataset df.gauging_data
. Internally
stored gauging data are available from 1960-01-01 until yesterday.
waterLevelPegelonline
carries out the interpolation with gauging
data obtained through a
REST
service from https://pegelonline.wsv.de/gast/start. The gauging data
from PEGELONLINE have a high
temporal resolution of 15 minutes, enabling meaningful linear temporal
interpolation. Since data from
PEGELONLINE
expire after 31 days, this function is only applicable for
WaterLevelDataFrames with a time
-slot set to
appropriate values within the last 31 days before function call.
Value
An object of class WaterLevelDataFrame.
References
Busch N, Hammer M (2009). “Einheitliche Grundlage für die Festlegung der Bemessungswasserspiegellagen der Elbe auf der frei fließenden Strecke in Deutschland.” doi:10.5675/bfg-1650.
HKV Hydrokontor (2014). “Erstellung eines SOBEK-River Modells für den Rhein von Iffezheim bis Pannerdense Kop als Weiterentwicklung bestehender SOBEK-RE Modelle.”
Bundesanstalt für Gewässerkunde (2016). “FLYS – Flusshydrologischer Webdienst.” https://www.bafg.de/DE/5_Informiert/1_Portale_Dienste/FLYS/flys_node.html.
Wasserstraßen- und Schifffahrtsverwaltung des Bundes (WSV) (2022). “PEGELONLINE.” https://pegelonline.wsv.de/gast/start.
See Also
Examples
# waterLevel
wldf <- WaterLevelDataFrame(river = "Elbe",
time = as.POSIXct("2016-12-21"),
station = seq(257, 262, 0.1))
wldf <- waterLevel(wldf)
# waterLevelPegelonline
wldf1 <- wldf
setTime(wldf1) <- Sys.time() - as.difftime(60, units = "mins")
wldf1 <- waterLevelPegelonline(wldf1)
Compute 1d water level data from the FLYS3 water level MQ and a gauging station according to the INFORM 3-method Flood1 (Flut1)
Description
This function computes a 1d water level according to the
INFORM
flood duration method Flood1 (Flut1) and stores it as column w
of an
S4 object of type WaterLevelDataFrame. First the function
obtains the reference water level MQ from df.flys
. This
reference water level is then shifted by the difference between measured
water and the FLYS3 water level for MQ at the specified gauging station.
Here it is provided mainly for historical reasons and more advanced
functions like waterLevel
or
waterLevelPegelonline
should be used.
Usage
waterLevelFlood1(wldf, gauging_station, w, uuid, shiny = FALSE)
Arguments
wldf |
an object of class WaterLevelDataFrame. |
gauging_station |
must be type |
w |
If the |
uuid |
must be type |
shiny |
|
Details
This function computes a water level based on the reference water
level MQ from df.flys
. Since the function only shifts this
single reference water level to make it fit to the measured water level,
no interpolation is needed. Therefore the shiny
columns have
constant values of section <- 1
, weight_x <- 1
and
weight_y <- shift
.
Value
An object of class WaterLevelDataFrame.
References
Rosenzweig S, Giebel H, Schleuter M (2011). “Ökologische Modellierungen für die Wasser- und Schifffahrtsverwaltung – Das integrierte Flussauenmodell INFORM in seiner neuesten Fassung (Version 3). Bundesanstalt für Gewässerkunde, Koblenz, Germany.” doi:10.5675/bfg-1667.
Bundesanstalt für Gewässerkunde (2016). “FLYS – Flusshydrologischer Webdienst.” https://www.bafg.de/DE/5_Informiert/1_Portale_Dienste/FLYS/flys_node.html.
Examples
wldf <- WaterLevelDataFrame(river = "Elbe",
time = as.POSIXct("2016-12-21"),
station = seq(257, 262, 0.1))
wldf1 <- waterLevelFlood1(wldf, "ROSSLAU")
wldf2 <- waterLevelFlood1(wldf, "DESSAU")
wldf1$w - wldf2$w
Compute 1d water level data through linear interpolation with neighboring gauging stations according to the INFORM 3-method Flood2 (Flut2)
Description
This function computes a 1d water level according to the
INFORM
flood duration method Flood2 (Flut2) and stores it as column w
of an
S4 object of type WaterLevelDataFrame. Flood2 is designed to
enable water level computation between gauging stations along waterways
without reference water levels, provided for example by
FLYS3.
The function uses neighboring gauging stations for linear interpolation of
gauging station water levels along the selected river stretch. Here it is
provided mainly for historical reasons and more advanced functions like
waterLevel
or waterLevelPegelonline
should be
used.
Usage
waterLevelFlood2(wldf)
Arguments
wldf |
an object of class WaterLevelDataFrame. |
Details
This function computes a water level through simple linear
interpolation of water levels at neighboring gauging stations. Historically
it has been designed for rivers without 1d reference water levels provided
by FLYS3 for df.flys
.
Value
An object of class WaterLevelDataFrame.
References
Rosenzweig S, Giebel H, Schleuter M (2011). “Ökologische Modellierungen für die Wasser- und Schifffahrtsverwaltung – Das integrierte Flussauenmodell INFORM in seiner neuesten Fassung (Version 3). Bundesanstalt für Gewässerkunde, Koblenz, Germany.” doi:10.5675/bfg-1667.
Examples
wldf <- WaterLevelDataFrame(river = "Elbe",
time = as.POSIXct("2016-12-21"),
station = seq(257, 262, 0.1))
wldf1 <- waterLevelFlood2(wldf)
wldf1
Obtain 1d water level data from the FLYS3 database
Description
Obtain 1d water level data from the
FLYS3
database using either
a predefined WaterLevelDataFrame or river
, from
and to
arguments that enable the internal construction of a
WaterLevelDataFrame. The internally constructed
WaterLevelDataFrame contains stations every 0.1 km or 100 m
between the given range of from
and to
.
Usage
waterLevelFlys3(wldf, name)
waterLevelFlys3Seq(river = c("Elbe", "Rhine"), name, from, to)
Arguments
wldf |
an object of class WaterLevelDataFrame. |
name |
a string with the name of a stationary
FLYS3
water level. It has
to be type |
river |
a required argument to fill the WaterLevelDataFrame-slot
|
from |
|
to |
|
Details
Possible name
s of FLYS3 water levels and ranges of from
and to
are river-specific:
Elbe:
'0.5MNQ', 'MNQ', '0.5MQ', 'a', '0.75MQ', 'b', 'MQ', 'c', '2MQ', '3MQ', 'd', 'e', 'MHQ', 'HQ2', 'f', 'HQ5', 'g', 'h', 'HQ10', 'HQ15', 'HQ20', 'HQ25', 'HQ50', 'HQ75', 'HQ100', 'i', 'HQ150', 'HQ200', 'HQ300', 'HQ500'
Possible range of from
and to
: type numeric
(km) 0 - 585.7, type integer
(m) 0 - 585700.
Rhine:
'Ud=1', 'Ud=5', 'GlQ2012', 'Ud=50', 'Ud=80', 'Ud=100', 'Ud=120', 'Ud=183', 'MQ', 'Ud=240', 'Ud=270', 'Ud=310', 'Ud=340', 'Ud=356', 'Ud=360', 'MHQ', 'HQ2', 'HQ5', 'HQ5-10', 'HQ10', 'HQ10-20', '~HQ20', 'HQ20-50', 'HQ50', 'HQ50-100', 'HQ100', 'HQ100-200', 'HQ200', 'HQ200-ex', 'HQextr.'
Possible range of from
and to
: type numeric
(km) 336.2 - 865.7, type integer
(m) 336200 - 865700.
Both lists of water levels are ordered from low to high water levels.
Value
An object of class WaterLevelDataFrame.
References
Busch N, Hammer M (2009). “Einheitliche Grundlage für die Festlegung der Bemessungswasserspiegellagen der Elbe auf der frei fließenden Strecke in Deutschland.” doi:10.5675/bfg-1650.
HKV Hydrokontor (2014). “Erstellung eines SOBEK-River Modells für den Rhein von Iffezheim bis Pannerdense Kop als Weiterentwicklung bestehender SOBEK-RE Modelle.”
Bundesanstalt für Gewässerkunde (2013). “FLYS goes WEB: Eröffnung eines neuen hydrologischen Fachdienstes in der BfG.” doi:10.5675/BfG_Veranst_2013.4, https://doi.bafg.de/BfG/2013/Veranst4_2013.pdf.
Bundesanstalt für Gewässerkunde (2016). “FLYS – Flusshydrologischer Webdienst.” https://www.bafg.de/DE/5_Informiert/1_Portale_Dienste/FLYS/flys_node.html.
See Also
Examples
wldf <- WaterLevelDataFrame(river = "Elbe",
time = as.POSIXct("2016-12-21"),
station = seq(257, 262, 0.1))
wldf1 <- waterLevelFlys3(wldf, "MQ")
wldf2 <- waterLevelFlys3Seq("Elbe", "MQ", 257, 262)
Interpolate FLYS3 water levels for given stations
Description
Function to interpolate
FLYS3
water levels for selected stations and return it with the structure of
df.flys
.
Usage
waterLevelFlys3InterpolateX(
river = c("Elbe", "Rhine"),
station = NULL,
station_int = NULL
)
Arguments
river |
a required argument to fill the WaterLevelDataFrame-slot
|
station |
an optional argument to hand over the stationing along the
specified |
station_int |
an optional argument to hand over the stationing along the
specified |
Details
df.flys
contains 1d water level data computed
with SOBEK for every second hectometer (every 200 m). This function
provides a way to interpolate the 30 stationary water levels for selected
stations inbetween these hectometers and returns them with the
data.frame
-structure of the original dataset.
Value
An object of class data.frame
with the structure of
df.flys
.
References
Busch N, Hammer M (2009). “Einheitliche Grundlage für die Festlegung der Bemessungswasserspiegellagen der Elbe auf der frei fließenden Strecke in Deutschland.” doi:10.5675/bfg-1650.
HKV Hydrokontor (2014). “Erstellung eines SOBEK-River Modells für den Rhein von Iffezheim bis Pannerdense Kop als Weiterentwicklung bestehender SOBEK-RE Modelle.”
DELTARES (2018). “SOBEK.” https://download.deltares.nl/en/sobek/.
See Also
Examples
df.flys <- waterLevelFlys3InterpolateX("Elbe", 257.1)
Compute a 1d water level dataset based on the FLYS3 algorythms
Description
Function to compute 1d water level information based on the
original
FLYS3
algorythms and store it as column w
of an S4 object of type
WaterLevelDataFrame.
Usage
waterLevelFlys3InterpolateY(wldf, gauging_station, w, uuid, shiny = FALSE)
Arguments
wldf |
an object of class WaterLevelDataFrame. |
gauging_station |
must be type |
w |
If the |
uuid |
must be type |
shiny |
|
Value
An object of class WaterLevelDataFrame.
References
Busch N, Hammer M (2009). “Einheitliche Grundlage für die Festlegung der Bemessungswasserspiegellagen der Elbe auf der frei fließenden Strecke in Deutschland.” doi:10.5675/bfg-1650.
HKV Hydrokontor (2014). “Erstellung eines SOBEK-River Modells für den Rhein von Iffezheim bis Pannerdense Kop als Weiterentwicklung bestehender SOBEK-RE Modelle.”
DELTARES (2018). “SOBEK.” https://download.deltares.nl/en/sobek/.
See Also
Examples
# waterLevelFlys3InterpolateY
wldf <- WaterLevelDataFrame(river = "Elbe",
time = as.POSIXct("2016-12-21"),
station = seq(257, 263, 0.1))
wldf <- waterLevelFlys3InterpolateY(wldf, "ROSSLAU", w = 137)