When using imod.idf.open_dataset() I got the following error:
#################################################################################
da_bdgriv = imod.idf.open_dataset(r"c:\Users\janssen_gs\OneDrive - Stichting Deltares\DATA\LWKM\Koppeling_ANIMO_Delwaq\Data\1-external\LHM_fluxen\bdgriv\bdgriv*.IDF")
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[55], line 1
----> 1 da_bdgriv = imod.idf.open_dataset(r"c:\Users\janssen_gs\OneDrive - Stichting Deltares\DATA\LWKM\Koppeling_ANIMO_Delwaq\Data\1-external\LHM_fluxen\bdgriv\bdgriv*.IDF")
File c:\Users\janssen_gs\AppData\Local\Deltares\iMODforge\env\Lib\site-packages\imod\formats\idf.py:342, in open_dataset(globpath, use_cftime, pattern)
338 d[n].append(p)
340 # load each group into a DataArray
341 das = [
--> 342 array_io.reading._load(v, use_cftime, pattern, _read, header)
343 for v in d.values()
344 ]
346 # store each DataArray under it's own name in a dictionary
347 dd = {da.name: da for da in das}
TypeError: _load() takes 4 positional arguments but 5 were given
################################################################################
I asked Deepwiki and it confirmed the bug in imod-python:
################################################################################
The error you're encountering is a bug in the current version of imod-python. The open_dataset function is calling array_io.reading._load() with 5 arguments, but the function only accepts 4 positional arguments. idf.py:341-344
Root Cause
The issue is in line 342 of imod/formats/idf.py, where array_io.reading._load() is called with arguments (v, use_cftime, pattern, _read, header), but the function signature doesn't match this call. idf.py:341-344 This appears to be an API change in the array_io.reading module that wasn't propagated to the open_dataset function.
Notes
This is a regression that should be reported to the imod-python maintainers. The open function at line 215 uses array_io.reading._open() which has a different signature and works correctly. idf.py:215
################################################################################
When using imod.idf.open_dataset() I got the following error:
I asked Deepwiki and it confirmed the bug in imod-python: