Skip to content

Move the MIKE+ station lookup out of #702 #706

Description

@jpalm3r

#702 carries a MIKE+ database lookup that places measured timeseries in the network:
_MikePlusStationResolver (~290 lines in obs.py), _observations_from_mikeplus, the db=
and source= arguments on NodeObservation.from_multiple and
ReachObservation.from_multiple, tests/test_mikeplus.py (558 lines), and a section of the
user guide. None of it is needed for the mikeio1d move #702 is about (ADR-013, Phase 2), and
it is not ready to ship on its own terms.

What needs more thought:

  • No fixture. Every test builds its own sqlite database with build_db, so the schema
    assumptions are checked only against our own construction of them. Nothing here has been
    read against a database MIKE+ wrote.
  • The locationtype codes are magic numbers. _NODE_TYPES = {8, 12},
    _LINK_TYPES = {9}. Any other code is dropped and named only on the failure path. No
    source says these are the codes, or that they are stable across MIKE+ versions.
  • resitemname is split on ; and the first field taken. An undocumented encoding.
  • tsfilename holds a Windows path and is matched on basename alone, case-folded. Two
    result files with the same name in different folders collide; source= is the only escape.
  • The nine columns across m_Station and m_Measurement are validated against one
    layout.
    The error says "The database layout is not the one modelskill expects" without
    recording which layout that is.
  • assetname becomes the observation name only when it is unique across the selection.
    The names a user gets depend on what else is in the database.

from_multiple(db=...) is public API, so whatever shape lands ships with 1.4.0.

Extract it onto its own branch, off #702 or off main once #702 lands.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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