A wrapper for querying KISTERS WISKI
databases via the KiWIS
API. Users can
toggle between various databases by specifying the hub argument.
Currently, the default hubs are:
By default, ki_station_list() returns a tibble containing information
for all available stations for the selected hub.
# With swmc as the hubki_station_list(hub ='swmc')#> # A tibble: 3,941 × 5#> station_name station_no station_id station_latitude station_longitude#> <chr> <chr> <chr> <dbl> <dbl>#> 1 A SNOW TEMPLATE SNOW-WLF-… 952125 NA NA #> 2 AA SNOW TEMPLATE SNOW-WLF-… 954599 NA NA #> 3 AARON PP SNOW-MNR-… 1346534 49.8 -92.6#> 4 ABERDEEN CLIM-MSC-… 121939 45.5 -98.4#> 5 ABITIBI CANYON ZZSNOW-OP… 148200 49.9 -81.6#> 6 ABITIBI LAKE CLIM-MNR-… 121135 48.7 -80.1#> 7 ABITIBI RIVER AT AB… HYDAT-04M… 136328 49.9 -81.6#> 8 ABITIBI RIVER AT IR… HYDAT-04M… 136304 48.8 -80.7#> 9 ABITIBI RIVER AT IS… HYDAT-04M… 136324 49.6 -81.4#> 10 Abitibi River at On… WSC-04ME0… 146775 50.6 -81.4#> # ℹ 3,931 more rows
Get Time Series Information
You can use the station_id column returned using ki_station_list()
to figure out which time series are available for a given station.
One Station
# Single station_idavailable_ts <- ki_timeseries_list( hub ='swmc', station_id ="144659")
available_ts
#> # A tibble: 223 × 6#> station_name station_id ts_id ts_name from to #> <chr> <chr> <chr> <chr> <dttm> <dttm> #> 1 Jackson Cre… 144659 9489… Precip… 2007-06-18 20:15:00 2024-10-11 10:15:00#> 2 Jackson Cre… 144659 1143… Precip… 2007-07-01 05:00:00 2024-11-01 05:00:00#> 3 Jackson Cre… 144659 1143… Precip… 2007-06-18 05:00:00 2024-10-12 05:00:00#> 4 Jackson Cre… 144659 9489… TAir.1… 2007-06-18 20:15:00 2024-10-11 10:15:00#> 5 Jackson Cre… 144659 9489… TAir.D… 2007-06-18 05:00:00 2024-10-10 05:00:00#> 6 Jackson Cre… 144659 9489… TAir.D… 2007-06-18 05:00:00 2024-10-10 05:00:00#> 7 Jackson Cre… 144659 1129… TAir.6… 2007-06-19 00:00:00 2024-10-11 06:00:00#> 8 Jackson Cre… 144659 1326… TAir.D… 2007-06-18 05:00:00 2024-10-12 05:00:00#> 9 Jackson Cre… 144659 1326… TAir.D… 2007-06-18 05:00:00 2024-10-12 05:00:00#> 10 Jackson Cre… 144659 9490… TWater… 2007-06-18 05:00:00 2024-10-10 05:00:00#> # ℹ 213 more rows
Multiple Stations
If you provide a vector to station_id, the returned tibble will have
all the available time series from all stations. They can be
differentiated using the station_name column.
You can now use the ts_id column in the tibble produced by
ki_timeseries_list() to query values for chosen time series.
By default this will return values for the past 24 hours. You can
specify the dates you’re interested in by setting start_date and
end_date. These should be set as date strings with the format
‘YYYY-mm-dd’.
You can pass either a single or multiple ts_id(s).
One Time Series
# Past 24 hoursmy_values <- ki_timeseries_values( hub ='swmc', ts_id ='966435042')#> No start or end date provided, trying to return data for past 24 hours
my_values
#> # A tibble: 405 × 7#> Timestamp Value ts_name ts_id Units station_name station_id#> <dttm> <dbl> <chr> <chr> <chr> <chr> <chr> #> 1 2024-10-10 00:00:00 23.1 LVL.1.O 966435042 m Attawapiskat Ri… 146273 #> 2 2024-10-10 00:05:00 23.1 LVL.1.O 966435042 m Attawapiskat Ri… 146273 #> 3 2024-10-10 00:10:00 23.1 LVL.1.O 966435042 m Attawapiskat Ri… 146273 #> 4 2024-10-10 00:15:00 23.1 LVL.1.O 966435042 m Attawapiskat Ri… 146273 #> 5 2024-10-10 00:20:00 23.1 LVL.1.O 966435042 m Attawapiskat Ri… 146273 #> 6 2024-10-10 00:25:00 23.1 LVL.1.O 966435042 m Attawapiskat Ri… 146273 #> 7 2024-10-10 00:30:00 23.1 LVL.1.O 966435042 m Attawapiskat Ri… 146273 #> 8 2024-10-10 00:35:00 23.1 LVL.1.O 966435042 m Attawapiskat Ri… 146273 #> 9 2024-10-10 00:40:00 23.1 LVL.1.O 966435042 m Attawapiskat Ri… 146273 #> 10 2024-10-10 00:45:00 23.1 LVL.1.O 966435042 m Attawapiskat Ri… 146273 #> # ℹ 395 more rows
A wrapper for querying 'WISKI' databases via the 'KiWIS' 'REST' API. 'WISKI' is an 'SQL' relational database
used for the collection and storage of water data developed by KISTERS and 'KiWIS' is a 'REST' service that provides
access to 'WISKI' databases via HTTP requests (<https://www.kisters.eu/water-weather-and-environment/>).
Contains a list of default databases (called 'hubs') and also allows users to provide their own 'KiWIS' URL.
Supports the entire query process- from metadata to specific time series values. All data is returned as tidy tibbles.