fluves / pywaterinfo

Python package to download time series data from waterinfo.be
https://fluves.github.io/pywaterinfo/
MIT License
17 stars 9 forks source link

date-formatting #30

Closed nielsdevleeschouwer closed 2 years ago

nielsdevleeschouwer commented 3 years ago

Description

Downloading a time series based on timeseries id, start and end date of an event. Date string '01-03-2018' is interpreted as month-day-year instead of day-month-year Question: not standard date formatting in Flanders --> changing date format? / documenting alternative date format? / only allowing year-month-day format?

What I Did

import pywaterinfo
waterinfo_class=pywaterinfo.Waterinfo("vmm")
test = waterinfo_class.get_timeseries_values(35111042, start='01-01-2018', end='03-01-2018')

--> returns 2 months of data instead of 2 days
stijnvanhoey commented 3 years ago

Certainly a valid point, as we rely on the Pandas date conversion, this is interpreted as month-day-year, see https://github.com/fluves/pywaterinfo/blob/master/src/pywaterinfo/waterinfo.py#L358 This provides more flexibility compared to requiring an actual datetime.datetime (or pd.Timestamp) object with a trade off for 'wrong' date representations....

I would propose to keep the functionality as such - we can not know what the intention is of the user month-day or day-month. If as a user/client want to be sure, using ISO 8601, https://nl.wikipedia.org/wiki/ISO_8601 or converting to a datetime.datetime object is both a valid input which won't run into this issue.

stijnvanhoey commented 2 years ago

Closing this issue with the yyyy-mm-dd as preferred input which will ensure to not encounter this issue.