Skip to content

mikeio.generic.concat first/last not working #956

@FransDHI

Description

@FransDHI

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'

Image

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()

Image

System information:

  • Python version
  • MIKE IO version: latest

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions