aleaf / pydrograph

Get and process stream flows and groundwater levels from NWIS.
Other
13 stars 11 forks source link

Add get instantaneous values method #3

Open hwreeves-USGS opened 4 years ago

hwreeves-USGS commented 4 years ago
aleaf commented 4 years ago

@hwreeves-USGS, this would be great! Would also be interested to hear any ideas you might have on how to really make it general, so any 5 digit parameter code could be submitted, without pydrograph necessarily knowing what it was.

aleaf commented 4 years ago

@hwreeves-USGS, @lauraschachter, regarding resampling- adding a resample method as an argument to a get_ivs() function would be great. I would suggest adding two arguments- 1) a freq argument (following pandas terminology) that dictates the time interval to resample to. Input to this argument could be any pandas frequency string, and could then be simply passed to df.resample(). 2) a resample_method argument that could take the name of a method call on the pandas resampler object (e.g. mean). This would be great to start out, but I could see at some point in the future maybe wanting the ability to support quantiles (e.g. q10 for the 10th percentile). But just supporting methods on the pandas resampler is great for now.

Regarding default behavior- I know pydrograph (for now at least) is more focused on groundwater model-related applications, but I still think we should try to make it as agnostic and explicit as possible in terms of what it does. Along these lines, I think a get_ivs() method should just return the instantaneous values it gets from NWIS, without defaulting to any time-series processing. It's easy enough for a user to specify the two above arguments to get a desired frequency and statistic, and that has the added benefit of making their code is more explicit.