Skip to content

[major_surface_waters] chd_ghb_from_major_surface_waters always returns ts_sea=None #66

Description

@bdestombe

major_surface_waters.py:129:

ts_sea = chd.ts.initialize(
    filename="sea_lvl.ts", time_series_namerecord="sea_stage", ...
)

flopy's child-package initialize returns None, so the third element of the returned tuple is None on every path — both the chd is None guard and the successful branch. Verified empirically on flopy 3.11.0.dev0:

chd is None? False
ts_sea returned: None
but chd.ts exists:  True

The model itself is unaffected: the time series really is attached to the CHD package and chd.ts is usable. What is wrong is the API surface — the docstring promises flopy.mf6.ModflowGwfts or None, and the if chd is None branch implies a caller can distinguish the two cases from the return value. Any caller that does ghb, chd, ts = ...; if ts is not None: silently takes the wrong path.

Either return chd.ts explicitly, or drop the third return value and document that the series lives on the CHD package.

Found while writing the test suite; the test asserts the time series is wired onto chd.ts rather than pinning the None.

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