mroberge / hydrofunctions

A suite of convenience functions for working with hydrology data in an interactive Python session.
MIT License
62 stars 27 forks source link

The hydrofunctions docstring example no longer works #120

Closed mroberge closed 1 year ago

mroberge commented 1 year ago

Description

The docstring for hydrofunctions no longer works because the example stream gauge now collects different data.

help(hydrofunctions)

This gives us an example that uses the Harrisburg stream gauge: '01570500'.

>>> import hydrofunctions as hf
>>> site = '01570500'
>>> harrisburg = hf.NWIS(site, 'iv', period='P10D')

>>> harrisburg
    USGS:01570500: Susquehanna River at Harrisburg, PA
        00045: <30 * Minutes> Precipitation, total, inches
        00060: <30 * Minutes> Discharge, cubic feet per second
        00065: <30 * Minutes> Gage height, feet
    Start: 2019-04-06 00:30:00+00:00
    End:   2019-04-15 23:00:00+00:00

The example requests the last 10 days of IV data, returning precipitation, discharge, and stage, each with 30 minute sampling.

As of a few days ago (as far as I can tell), if you do this request again, you'll also get some data that gets collected every 15 minutes, leading to an 'upsampling' warning.

One way to avoid this is to either use a different gauge in the example, or simply request data from a range of dates that only have the 30 minute data, like back in 2019 when the example was first run.

Two Possible Solutions:

  1. Have the example request data from a time period that returns a known set of data:
harrisburg = hf.NWIS(site, 'iv', start_date='2019-04-06', end_date='2019-04-15')
  1. Request data from a different site that is less likely to cause problems in the future:
    • It should collect every 15 minutes so that this problem is less likely to repeat
    • It should be from a site that is unlikely to be 'upgraded'... Karthaus? 01542500
>>> site = '01542500'
>>> karthaus = hf.NWIS(site, 'iv', period='P10D')
mroberge commented 1 year ago

Solution 1 doesn't work

The USGS retroactively added temperature data to the Harrisburg station. These data were all collected every 15 minutes, while discharge is collected every 30. So when we request data from 2019, it gives us 15 minute and 30 minute data.

mroberge commented 1 year ago

closed with c4a8668