-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tidal data from MOW-HIC stations? #11
Comments
Downloading MOW-HIC data will require expansion of the extdata/lookup_timeseriesgroup.txt Furthermore, the resolve_datasource function will need to be expanded to accommodate the stations in these timeseriesgroups. However, the whole resolve_datasource procedure can be avoided by incorporating the datasource in the timeseriesgroup_id (01 or 02 preceding the timeseriesgroup_id) and using datasource=0 by default in the call URL. |
This is indeed not supported by the Still, I also received the question at INBO to specifically target the tidal data as shown on the waterinfo.be Tide tab. As a temporay solution, I compiled a list of With these identifiers, and using Load the tidal stations ts_id_getij <- read.csv("tij_all_identifiers.txt") For example, imagine you're interested in the data of Dendermonde, i.e. library(wateRinfo)
dmonde <- ts_id_getij %>%
filter(station_no == "zes21a-1066") %>% # select all variables for Dendermonde
group_by(ts_id) %>%
do(get_timeseries_tsid(.$ts_id, period = "P1D",
to = "2017-01-02", datasource = 2)) %>% # 1 day of data
ungroup() %>%
left_join(ts_id_getij, by = "ts_id") Plotting the downloaded data: library(ggplot2)
ggplot(dmonde, aes(x = Timestamp, y = Value)) +
geom_point() +
facet_wrap(c("ts_name")) +
scale_x_datetime(date_labels = "%H:%M",
date_breaks = "6 hours") So, for the station, time series with different time resolution and some high/low water summary time series are available for download. Another example: you're interested in the 10min based data of Liefkenshoek: hwlw_campaign <- ts_id_getij %>%
filter(grepl(".*10min.base", ts_name)) %>%
filter(station_name == "Liefkenshoek tij/Zeeschelde") %>%
group_by(ts_id) %>%
do(get_timeseries_tsid(.$ts_id,
from = "2017-10-01 10:00:00",
to = "2017-10-02 11:00:00",
datasource = 2)) %>%
ungroup() %>%
left_join(ts_id_getij, by = "ts_id") ggplot(hwlw_campaign, aes(x = Timestamp, y = Value)) +
geom_line() +
scale_x_datetime(date_labels = "%Y-%m-%d\n%H:%M",
date_breaks = "12 hours") As @WillemMaetens suggests, the availability of tidal data as a |
@LennertSchepers, was the explanation above sufficient to solve your case? |
Hi Stijn. Thanks for quickly solving this! I think this is really useful for the people in our research group, who are doing quite some field work along the Scheldt River (also INBO's estuaries team). I will spread the news :). Another useful -related- feature for fieldwork would be to have access to the short-term tidal water level prediction (https://www.waterinfo.be/default.aspx?path=NL/Thema/Getij_KT), e.g. to know when a field site at a certain elevation is accessible (no longer inundated). The prediction graphs on the website are sometimes hard to read accurately. However it seems that these data are not available for download from the waterinfo website. Maybe we can ask if they can make these data available? |
This is indeed something the INBO estuaries team uses as well. I'll try to convert the explanation above on the tidal data download as a new tutorial/vignette of the package, incorporating the information on the For your data question of the new feature, I'll make a new issue and take contact with HIC. |
Notice, as waterinfo.be changed its time series identifiers, the file library(httr)
library(jsonlite)
library(dplyr)
library(stringr)
library(purrr)
library(wateRinfo)
request_url <- "https://www.waterinfo.be/tsmpub/KiWIS/KiWIS?service=kisters&type=queryServices&request=getTimeseriesValueLayer&datasource=0&format=esrijson×eriesgroup_id=04156183,04156182&metadata=true&custattr_returnfields=dataprovider,dataowner,significant,Portal_Bekken&crs=webmercator&orderDir=asc&orderBy=value&md_returnfields=custom_attributes,station_id,station_no,station_name,ts_id,ts_name,stationparameter_name,ts_unitsymbol,parametertype_name&userId=PortalPublic"
response <- GET(request_url)
parsed <- fromJSON(content(response, "text"))$features$attributes
# add ts_identifier of the 10 minute time series
tidal_stations <- parsed %>%
filter(str_detect(station_name, "tij"), str_detect(station_no, "1066")) %>%
mutate(station_no_short = str_sub(station_no, 3)) %>%
mutate(station_identifier = map_chr(.$station_no_short,
function(x) {
get_variables(x) %>%
filter(str_detect(ts_name, "Pv.10")) %>%
pull(ts_id)})
) returning the following table:
make sure to use the |
A more complete overview of all available variables for these stations (so not only the 10 min data) can be retrieved by: library(httr)
library(jsonlite)
library(dplyr)
library(stringr)
request_url <- "https://www.waterinfo.be/tsmpub/KiWIS/KiWIS?service=kisters&type=queryServices&request=getTimeseriesValueLayer&datasource=0&format=esrijson×eriesgroup_id=04156183,04156182&metadata=true&custattr_returnfields=dataprovider,dataowner,significant,Portal_Bekken&crs=webmercator&orderDir=asc&orderBy=value&md_returnfields=custom_attributes,station_id,station_no,station_name,ts_id,ts_name,stationparameter_name,ts_unitsymbol,parametertype_name&userId=PortalPublic"
response <- GET(request_url)
parsed <- fromJSON(content(response, "text"))$features$attributes
tidal_stations <-
parsed %>%
filter(str_detect(station_name, "tij"), str_detect(station_no, "1066")) %>%
select(-ts_id, -parametertype_name,
-stationparameter_name, -ts_name,
-ts_unitsymbol, -ts_value) %>%
mutate(station_no_short = str_sub(station_no, 3)) %>%
group_by(station_no_short) %>%
mutate(ts_id = map(station_no_short, get_variables) %>%
map(as.tibble)) %>%
unnest() %>%
select(-station_name1, -station_no1) |
On the waterinfo.be website, also the data from the navigable waterways is available, for example the tidal data of the Scheldt river (data from MOW-HIC). These stations are not accessible with the wateRinfo package. Is this a matter of adding some more functions, or are these data not (yet?) available through the API?
The text was updated successfully, but these errors were encountered: