imod-wq: KeyError 'id' when writing well package

When writing the well package (m.write) in imod-wq I get the error KeyError 'id'. This seems to be a bug. I noticed that, in wel.py, def _save_layers, the "id" key drops out (at least in my case).

I also noted that including the line:

    if "id" not in columns:
        columns = ["id"] + columns

in the code below solved it for me, so that probably gives a clue.

     def _save_layers(self, df, directory, name, variable):
        d = {"directory": directory, "name": name, "extension": ".ipf"}
        d["directory"].mkdir(exist_ok=True, parents=True)

        if "time" in df:
            itype = "timeseries"
        else:
            itype = None

        columns, assoc_columns = _column_order(df, variable)
        if "id" not in columns:
            columns = ["id"] + columns
        path = self._compose_path(d)
        df = df[columns]
        if "layer" in df:
            for layer, layerdf in df.groupby("layer"):
                # Ensure different IDs per layer are not overwritten.
                print(df.columns)
                layerdf["id"] = f"{name}_l{layer}/" + layerdf["id"].astype(str)
                imod.ipf.save(
                    path=path, df=layerdf, itype=itype, assoc_columns=assoc_columns
                )
        else:
            imod.ipf.save(path=path, df=df, itype=itype, assoc_columns=assoc_columns)

        return
Edited by Joeri van Engelen