Skip to content

ComparerCollection.save()/load() does not support the NODE geometry type #677

Description

@jpalm3r

Summary

ComparerCollection.save() on a match(NodeObservation, NetworkModelResult) result produces a .msk file that fails to load. ComparerCollection.load() raises:

NotImplementedError: Unknown gtype: node

at comparison/_comparison.py:1425.

Root cause

GeometryType.NODE (src/modelskill/types.py:18) is wired correctly into most of the Comparer API:

  • Comparer._to_observation() (_comparison.py:778-812) has an explicit elif self.gtype == "node" branch.
  • Comparer.to_dataframe() (lines 1321-1345) has an explicit NODE branch.

But the save/load round trip was never updated:

  • Comparer.save() (lines 1347-1374) only special-cases gtype == "point" (line 1364) to flatten raw_mod_data into the netcdf. NODE data silently loses its raw model data on save.
  • Comparer.load() (lines 1376-1425) dispatches on data.gtype with branches for "track", "vertical", and "point", then falls into else: raise NotImplementedError(f"Unknown gtype: {data.gtype}") for "node".

ComparerCollection.save()/load() (comparison/_collection.py:829-897) just zip/unzip a per-Comparer netcdf file and delegate to Comparer.save()/Comparer.load(), so the gap surfaces there too.

Why this matters

Some users persist a ComparerCollection per calibration trial as a .msk file. As things stand, switching such a workflow to the new network-results path breaks that archiving outright.

Suggested fix

Add a node branch to Comparer.load() that reconstructs NodeModelResult from any _raw_* variables, mirroring the existing point branch, and extend Comparer.save()'s raw-data flattening to also cover gtype == "node".

Found by a test user evaluating the network functionality ahead of a 1.4.0 release.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions