reading LTS chronical statistics *.res1d
asfavie opened this issue · 0 comments
Hi!
I had a customer solving his own request, I thaught it's worth sharing:
He tried to read a LTS extreme statistics *.res1d file via mikeio1d and got the following error:
df = Res1D(‘../Var0LTS_extreme_statistics.res1d’).read()
OutOfBoundsDatetime: Out of bounds nanosecond timestamp: 100-01-01 00:00:00
The Pandas documentation gave him the following explenation:
„Since pandas represents timestamps in nanosecond resolution, the timespan that can be represented using a 64-bit integer is limited to approximately 584 years
pd.Timestamp.min
Out[54]: Timestamp('1677-09-22 00:12:43.145225')
In [55]: pd.Timestamp.max
Out[55]: Timestamp('2262-04-11 23:47:16.854775807')
After some back and forth, his final mail was, that the file he tried to read had too many data points. By changing the time index via the code in line 18 of the Jupyter Notebook, he could read the LTS:
time_stamps = [datetime.datetime(1900, 1, 1, 0, 0, 1)+datetime.timedelta(days = i) for i in range(number_of_event_entries)]
The maximum date stayed inside the boundaries needed and the LTS was readable.
Hope this helps someone else too as a quick fix.