Read dfs0 with many items
Closed this issue · 3 comments
daniel-caichac-DHI commented
Describe the bug
Hi, so I have 2 dfs0 files (outputs of the same model), one has like 15 columns, the other has +800 columns, 1 year of data (~130 mb).
I have 2 environments:
- One with
mikeio 0.11.1
and python3.9.5
in that one I can read both files. - Another one with mikeio
1.0b0
(also tested1.0b2
) and python3.8.12
and that one can only read the smaller file.
To Reproduce
from mikeio import Dfs0
file=r'large_file.dfs0'
ds=Dfs0(file).read()
--> recursion error
Expected behavior
Open the file
System information:
- Python version =
3.8.12
- MIKE version =
1.0b0
I will try updating to python 3.9.5
to see if that fixes it
ecomodeller commented
Thanks @daniel-caichac-DHI for the bug report
import mikeio
import numpy as np
import pandas as pd
n_items = 800
nt = 2
time = pd.date_range("2000", freq="H", periods=nt)
das = []
for i in range(n_items):
x = np.random.random(nt)
da = mikeio.DataArray(data=x, time=time, item=mikeio.ItemInfo(f"Item {i+1}"))
das.append(da)
ds = mikeio.Dataset(das)
...
if isinstance(key, Iterable):
File "C:\Users\JAN\AppData\Local\Programs\Python\Python39\lib\typing.py", line 710, in __instancecheck__
return self.__subclasscheck__(type(obj))
File "C:\Users\JAN\AppData\Local\Programs\Python\Python39\lib\typing.py", line 842, in __subclasscheck__
return issubclass(cls, self.__origin__)
File "C:\Users\JAN\AppData\Local\Programs\Python\Python39\lib\abc.py", line 123, in __subclasscheck__
return _abc_subclasscheck(cls, subclass)
RecursionError: maximum recursion depth exceeded in comparison
I get the same error when I try to create a Dataset with many items.
daniel-caichac-DHI commented
Thanks, I just tested with python 3.9.5
and mikeio 1.0b0
and it crashed, so it is a mikeio thing.
ecomodeller commented
Yes, it is a problem introduced in MIKE IO 1.0.