-
Notifications
You must be signed in to change notification settings - Fork 60
mikeio.generic.concat first/last not working #956
Description
Describe the bug
Using mikeio.generic.concat on a list of .dfs0 to concat the files -> always keeping the last regardless of the keep='last' / 'first' flag.
To Reproduce
dfs0_fls = glob(os.path.join(outpath,'*.dfs0'))
mikeio.generic.concat(infilenames=dfs0_fls,outfilename=os.path.join(outpath,'HD_Analysis_Loc_1979_2024_Keep_First.dfs0'),keep='first')
mikeio.generic.concat(infilenames=dfs0_fls,outfilename=os.path.join(outpath,'HD_Analysis_Loc_1979_2024_Keep_Last.dfs0'),keep='last')
Both produce the same result at the "join" time steps -> they both keep 'last'
Problem is in def _concat_time of (https://github.com/DHI/mikeio/tree/main/src/mikeio/dataset/_dataset.py)
lines 1152 - 1157
for j in range(ds.n_items):
if keep == "last":
newdata[j][idx1] = ds[j].to_numpy()
newdata[j][idx2] = other[j].to_numpy()
else:
newdata[j][idx2] = other[j].to_numpy()
newdata[j][idx1] = ds[j].to_numpy()
System information:
- Python version
- MIKE IO version: latest