ropensci / wateRinfo

R package to download time series data from waterinfo.be
https://docs.ropensci.org/wateRinfo
MIT License
13 stars 3 forks source link

wateRinfo API request failed #74

Closed PieterjanVerhelst closed 4 years ago

PieterjanVerhelst commented 4 years ago

When I tried to download tidal data from multiple stations in the Scheldt Estuary through the following code, I got an error. Note that this occurs in the tidal-eel example from the R-blog.

tidal_data <-
  tidal_zone_ts_ids %>%
  group_by(ts_id) %>%

  # Download tidal data for each ts_id (time series id)
  do(get_timeseries_tsid(
      .$ts_id,
      from = min(eel$date), # Start of eel tracking data
      to = max(eel$date),   # End of eel tracking data
      datasource = 4
  ))

The error:

Error: Waterinfo API request failed [500]
Waterinfo error:
                DatasourceError
Waterinfo return message: Could not create WDP connection in given time frame, returning lock.
stijnvanhoey commented 4 years ago

Thanks for reporting! There seems to be an issue on the request of HIC station data. The request for the data at waterinfo is not giving any response with the given URL. When I just pick one of the time series identifiers, 55419010 and the last day as period to download data (period=P1D), we can mimick the underlying request to waterinfo.be:

https://download.waterinfo.be/tsmdownload/KiWIS/KiWIS?type=queryServices&service=kisters&request=getTimeseriesvalues&ts_id=55419010&format=json&datasource=4&period=P1D

Try this in your browser and it doesn't really react either (cfr. R not responding for a while until connection time out). However, when I use another base url:

https://www.waterinfo.be/tsmhic/KiWIS/KiWIS?type=queryServices&service=kisters&request=getTimeseriesvalues&ts_id=55419010&format=json&datasource=4&period=P1D

but this in your browser and it works...

So, I'll have to refactor the code a bit to overcome this issue and use https://www.waterinfo.be/tsmhic/KiWIS/KiWIS for calls to HIC stations.

stijnvanhoey commented 4 years ago

@PieterjanVerhelst, when all test pass at https://github.com/ropensci/wateRinfo/pull/75 this should be working again when merged. I'll keep you posted.

stijnvanhoey commented 4 years ago

reinstall with devtools::install_github("ropensci/wateRinfo") and have a try