robjameswall / dhitools

Python tools for working with DHI MIKE21
https://dhitools.readthedocs.io/en/latest/index.html
MIT License
24 stars 17 forks source link

fixed start_datetime format in dfsu.py and may cause an error in different region settings #3

Closed famiuer closed 5 years ago

famiuer commented 5 years ago

Rob, Thanks for your great tool and I think it is very helpful. I found that the start_datetime format is fixed in the dfsu.py line 100 as following self.start_datetime = dt.datetime.strptime(self.start_datetime_str, '%d/%m/%Y %H:%M:%S %p') I searched that different regions use different date and time format as Date format by country and this may cause some errors.

I think the implantation of the start time in dfs.py line 47 is more flexible : self.start_datetime = dt.datetime(year=dt_start_obj.Year, month=dt_start_obj.Month, day=dt_start_obj.Day, hour=dt_start_obj.Hour, minute=dt_start_obj.Minute, second=dt_start_obj.Second)

Do you have other considerations of time format in dfsu.py? I forked and test the latter and it works fine.

Thanks for your tools and great notebook examples!

robjameswall commented 5 years ago

Hi Geng Chen

Thanks for your kind words I appreciate it, and thank you for finding this bug. I agree that the dfs.py start_datetime format is more flexible than the dfsu.py. I've update this based on your suggestions.

Thanks again