Packages and registries#

Built from the registries of the code and the folders of hydromodpy/ each time the site is built. Fix a wrong row there.

Registries#

Counted when the site is built. A name list longer than 30 is cut.

What

Count

Source

Names

Layers of the import matrix

16

tests/unit/architecture/layer_matrix.yaml

core, schema, catchment, mesh, model, data, results, solver, calibration, display, config, workflow, project, cli, hydromodpy (root), <main>

Pipeline steps of a run, in order

13

hydromodpy.workflow.steps.sequence.standard_steps

validate, resolve, build_geographic, load_data, build_mesh, setup_process, prepare_solver, run_solver, extract, derive, export, seal, display

Data variables

32

hydromodpy.data.loading._dispatch.VARIABLE_SPECS

crossings, curve_number, dem, etp, geology, humidity, hydrography, hydrometry, impervious, infiltration_ratio, intermittency, lake_abacus, lake_bathymetry, lake_geometry, lake_inflow, lake_levels, lake_outflow, lake_withdrawal, layer_base, oceanic, piezometry, precipitation, property_map, radiation, recharge, runoff, soil_capacity, soil_moisture, substratum, temperature and 2 more

Data sources with a licence entry

20

hydromodpy.schema.sources.SOURCES

bdalti, bdtopage, bdtopo, brgm_1m, brgm_50k, constant, euhydro, explore2, file, hubeau, land_cover, ocsge, osm, rgealti, roe, shom, sim2, synthetic, url, worldcover

Sources served through the data-source port

89

hydromodpy.data.source.registry.data_sources

crossings_bdtopo, crossings_file, crossings_roe, crossings_url, curve_number_file, curve_number_land_cover, curve_number_ocsge, curve_number_url, curve_number_worldcover, dem_bdalti, dem_file, dem_rgealti, dem_url, etp_explore2, etp_file, etp_sim2, etp_url, geology_brgm_1m, geology_brgm_50k, geology_file, geology_url, humidity_file, humidity_sim2, humidity_url, hydrography_bdtopage, hydrography_euhydro, hydrography_file, hydrography_osm, hydrography_url, hydrometry_file and 59 more

Process and solver pairs

8

hydromodpy.solver.base.registry.solvers

flow/boussinesq, flow/linear_reservoir, flow/modflow6, flow/modflow_nwt, transport/modflow6, transport/modflow6_prt, transport/modpath, transport/mt3dms

Figure presets

5

hydromodpy.display.presets.PANEL_PRESETS

hydrograph, network_expansion, residuals, water_budget, watershed_id_card

Special figures

17

hydromodpy.display.request.SPECIALS

calibration_landscape, calibration_progress, ensemble_band, flow_directions, lake_abacus_comparison, network_comparison, observed_network_heads, parameter_space, particle_tracks, recession, recharge_estimates, recharge_regime, recharge_signals, residence_time_distribution, root_search, sfr_longitudinal_profile, water_balance_loop

Packages#

One row per sub-package of hydromodpy. The summary is the first paragraph of its README.md, the map of the package.

Package

Layer

Modules

Lines

Summary

calibration

yes

95

34 754

Fitting model parameters to observations. A [calibration] table names the parameters to vary, the outputs to compare, the criterion that scores them and the search method. The package turns that table into a search. An optimizer proposes parameter values, one trial runs the model with them, the outputs are scored against the observations, and the session is written to disk as it goes.

catchment

yes

93

20 586

The catchment layer takes a DEM and an outlet and gives the catchment, its river network and the ground the model sits on. It conditions the DEM and routes flow on it through a terrain engine, which is a port (terrain/, with its own README). It delineates the catchment, cuts the domain polygons and extracts the streams. It also holds the surfaces of the domain, the routing of water on the cells of the model top, the stream-network criterion on arrays and the French departments used to pick data tiles. The package is a layer because the mesh, the model, the solvers and the results all start from the same ground and the same network, and it knows no solver and no data provider. The DEM arrives as a resolved dem_path with its digest and state, and a geology map is read by a function the caller passes as an argument.

cli

yes

79

12 120

The command line, with the hmp and hydromodpy entry points. It parses arguments, calls the code that does the work, formats the output and turns an exception into a typed exit code. It holds no scientific logic, so a result that the command line gives is the one that hydromodpy.project.api gives. Fourteen of the fifteen verbs have a command, and open has none. Under their names status is ls --disk, compare is diff and trash is catalog trash. The families workspace, project, campaign, data, site, process, config and privacy, and catalog apart from trash, call the lower packages directly because no verb covers them.

config

yes

15

7 469

The root of the configuration. HydroModPyConfig is the one Pydantic model that aggregates every section of a project TOML file, and anything a user can write in a project file must load through it and round-trip. The package is thin on purpose. Each section model lives next to the code it configures, and this package is the only place where the section types of the other packages are imported together. Every other layer refers to its own section model, never to the root.

core

yes

128

24 367

The kernel leaf of HydroModPy. Every other package may read core, and core reads no sibling package, not even under TYPE_CHECKING. It holds what several layers need and none should own: the base of every config model, units, the paths of a project and a workspace, run state, the I/O primitives, the typed exceptions and a few kernels that two layers must compute the same way, such as the sign of a budget flux and the digest of a block of values.

data

yes

189

32 229

Everything a run reads from outside is here: provider APIs, the files of the user, their cache and the typed records handed to the layers above. Each [data.<name>] section of a project TOML is one variable, and VARIABLE_SPECS in loading/_dispatch.py is the one list of them. A variable owns its cache and the unit of its records and leaves the provider to a class of the DataSource port (source/, with its own README), so adding a provider touches no variable. The data folder is the cache, each fetched file has a JSON sidecar beside it, and there is no database. The package is a layer because the loaders, the workflow and the calibration need data in one typed form, and none of them should know which provider or file it came from.

display

yes

58

13 358

display draws. It takes a run that is already computed, or data that is already loaded, and writes PNG figures, HTML pages and the tables behind them. It never runs a solver and never writes into the storage of a run. It reads only core and results, and everything it reads from a run goes through subject.py.

mesh

yes

75

16 448

This package turns a project into the cells that MODFLOW 6 and the other solvers compute on. It reads the catchment, the rivers, the lakes and the geology, returns one PlanarCellMesh that the rest of HydroModPy reads, and writes and reads the mesh in the usual exchange formats, so a mesh opens in ParaView or gmsh. It reads core, schema and catchment, and it also carries the mesh port, because its registry sits at the root of the package.

model

yes

106

25 764

The model is what a groundwater solver reads, written without any solver. A [domain] table says where the aquifer lies, a [flow] table gives its parameters, initial heads, boundaries and sinks and sources, and a [transport] table holds the tracking settings. The package turns those tables into typed config models and the config models into runtime objects. It puts the forcings on the cells of a mesh, maps the properties onto those cells, binds loaded data to the flow and holds the arithmetic of the daily soil reservoir that turns the weather into recharge. Flow (flow.py) is the object the setup binds loaded data to, Model (model.py) is the frozen object a solver reads, and prepare_solver builds it from the Flow. The same step gives it the top and the bottom of every cell, by the rule the backend declares in domain/cell_column.py, so no solver samples the DEM itself. The package is a layer because the solvers, the workflow, the calibration and the results all need one description of the model, and none of them should own it.

project

yes

58

21 176

The public face of HydroModPy. api.py holds the fifteen verbs that hydromodpy and hmp expose: open, run, check, calibrate, spinup, replay, stop, status, trash, compare, show, export, publish, example and doctor. A verb takes text, numbers, paths and mappings and gives back a value with to_dict, a path or diagnostics, so a server sends what it gets. A reference is a path, a name read in workspace, or the object itself, and nothing is looked for above the working directory. kept_readers.py keeps read, index and Catalog at the top level beside the verbs.

results

yes

183

52 961

What a run leaves on disk and how it is read back. A run directory holds Zarr 3 arrays and Parquet 2.6 tables, sealed by the manifest.json that the run writes last. The DuckDB index .hmp/index.duckdb is derived from the run and session directories, so disk is the truth and hmp catalog reindex rebuilds the index at no cost.

schema

yes

25

5 634

The shapes that HydroModPy writes for a reader outside this process. One family is for a front end, the JSON Schema of the whole configuration and the sentence of each code that a check gives. The other is for an orchestrator, the job directory that a capability writes and the declaration of each capability. The package reads core and itself, so a document can be described without importing any science.

solver

yes

200

49 230

The numerical backends. solver.backend names the flow backend, the table [solver.<name>] holds its settings, and a [[simulation.process]] entry names the solvers each process runs. The package holds the adapters that turn a built Flow or Transport into a backend run, the extractors that read the backend’s files into the results store, and the registry that pairs a <process_type>_<name> key with each. Four flow backends ship, MODFLOW 6, MODFLOW-NWT, Boussinesq and the linear reservoir, with the transport tools that go with them.

workflow

yes

46

11 966

The order in which a project is built and run. A file such as project.toml becomes thirteen steps, from validation to the seal of the run. Each step takes an immutable PipelineState, does its part and returns the next one. A Pipeline chains the steps, records them in the journal of the run and can resume a run from the artifacts of the steps already done. The Project facade and every workflow launcher, simulation or calibration, call these steps, so one file always drives one lifecycle.