diff --git a/f90nml/namelist.py b/f90nml/namelist.py index 7fcd4ec..f8ae166 100644 --- a/f90nml/namelist.py +++ b/f90nml/namelist.py @@ -660,7 +660,12 @@ def patch(self, nml_patch): for sec in nml_patch: if sec not in self: self[sec] = Namelist() - self[sec].update(nml_patch[sec]) + + if '_index' in nml_patch[sec]: + index = int(nml_patch[sec].pop('_index')) + self[sec][index].update(nml_patch[sec]) + else: + self[sec].update(nml_patch[sec]) def groups(self): """Return an iterator that spans values with group and variable names.