WEPP Management Agent Guide
Authorship
This document and all AGENTS.md documents are maintained by GitHub Copilot / Codex which retain full authorship rights for all AGENTS.md content revisions. Agents can author AGENTS.md document when and where they see fit.
Mission Snapshot
- Maintain the management file toolchain that turns landcover metadata into runnable
.manscenarios for WEPP and channel simulations. - Keep template libraries (
data/*.json,channels.defs,*.man) internally consistent so CLI, web, and batch workflows resolve the same management keys. - Protect backwards compatibility with historic WEPP 95.7 and 98.4 file formats while extending support for new disturbance catalogues.
Primary Assets
managements.py– parser/writer for management files plus helpers likeget_management,merge_managements,get_management_summary, andget_disturbed_classes.channels.py– channel template loader (load_channels,get_channel) and D50/Cs lookup support.pmetpara.py–pmetpara_prepwriter that emitspmetpara.txtwith canopy coefficients per plant loop.utils/– synthesis tooling (ManagementMultipleOfeSynth,ManagementRotationSynth,downgrade_to_98_4_format) for multi-OFE and legacy scenarios.data/– canonical management assets (map JSON, disturbed catalogues, regional.manfiles,channel_d50_cs.csv).tests/– regression fixtures (test_multiple_ofe.py,test_rotation_stack.py, CSV/GeoJSON datasets).- Type stubs:
channels.pyi,managements.pyi,utils/*.pyi(must stay in sync with runtime modules).
Standard Workflow
- Scope – identify which assets change (map JSON entries, template
.man, Python parsers, or synthesis utilities). Touch the smallest surface to avoid invalidating cached management directories. - Edit – prefer absolute imports inside the package. When adding public helpers, extend
__all__in the module and update the matching.pyi. - Data updates – validate JSON/CSV integrity (keys used elsewhere, numeric coercion). Keep descriptions under 55 characters to satisfy the parser’s
desctruncation logic. - Compatibility – confirm new management records still serialize under both WEPP 95.7 and 98.4 expectations (
downgrade_to_98_4_formatwhen required). Avoid breakingScenarioReferenceindexes. - Document – update the relevant README or domain docs if payload schemas or data contracts change.
- Validate – run targeted tests and optional manual inspections (see below). Regenerate derived files (e.g.,
pmetpara.txt) only through provided helpers.
Validation Checklist
wctl run-pytest tests/wepp/management/test_multiple_ofe.pywctl run-pytest tests/wepp/management/test_rotation_stack.py- Spot-check new or modified
.manfiles withpython -m wepppy.wepp.management.managements <path>(prints parsed summary). - For disturbed catalog updates, ensure keys line up with
map.jsonand any downstream NoDb consumers before committing.
Implementation Notes
- Management parsing relies on sentinel comments (for example
#landusemarkers). Preserve comment structure when editing templates. Management.__setitem__accepts dotted attribute paths (e.g.plant.data.rtyp); keep setter logic updated when new attributes become mutable.ManagementMultipleOfeSynthrewrites scenario names withOFE{n}_prefixes—when introducing new sections ensure renaming andScenarioReferenceupdates are covered.pmetpara_prepaccepts scalars or mappings. Validate new call sites supply entries for every plant loop or handle missing keys gracefully.- When extending channel definitions, keep
channels.defsblocks separated by blank lines and ensure_format_valueformatting rules remain valid for new numeric ranges.
Data Maintenance Workflow
- New management key – add the key to the appropriate map (
map.json,disturbed.json, regional variants) and pointManagementFileto a.manstored insidedata/<collection>/. - Template authoring – derive new
.manfiles from vetted sources (FSWEPP, GeoWEPP, BAER). Keep descriptions within 55 characters and matchlanduseenumerations used byManagementLoop. - CSV mirrors – if the key surfaces in
weppcloud_managements.csv,weppcloud_AU_managements.csv, or disturbance exports, regenerate them viatests/wepp/management/export_covers.pyand stage the resulting CSV for review. - Disturbance alignments – when editing disturbance maps, sync lookup tables in
wepppy/nodb/mods/disturbed/data/(for exampledisturbed_land_soil_lookup.csv) so severity classes keep valid management references. - Channel assets – update
channel_d50_cs.csvandchannels.defstogether; verify thatload_channel_d50_cs()continues to coerce numeric columns and thatget_channel()renders overrides correctly.
Catalog Quick Reference
data/map.json– default landcover-to-management lookup consumed byNoDbcontrollers.data/disturbed.json,data/c3s-disturbed*.json, regional*_map.json– overrides for disturbance scenarios and partner datasets; keys must align with NoDb mods.weppcloud_managements.csv,weppcloud_AU_managements.csv,disturbed_weppcloud_managements.csv– curated exports consumed by web UIs; regenerate viatests/wepp/management/export_covers.py.tests/wepp/management/validate.py– scaffolding used during data migrations; adapt when introducing new map flavors.tests/wepp/management/mofe_dir/– fixture bundle for multi-OFE synthesis regression checks.
Coordination Points
wepppy/nodb/core/wepp.pyandwepppy/nodb/core/landuse.pyexpect map keys and summaries to stay stable; update the controllers’ validation messages if new classes are introduced.wepppy/nodb/mods/disturbedrelies on consistentDisturbedClassstrings—document any renames indocs/disturbance_*notes before shipping.wepppy/export/export.pyreferences_management_dirwhen packaging runs; ensure new assets live under the canonical directory tree to avoid missing file errors.wepppy/microservices/browse/browse.pymay read management files directly; test browse flows if altering public APIs such asget_management_summary.
Utilities & QA
python tests/wepp/management/export_covers.py– regenerate management CSV mirrors and extended disturbance lookups.python tests/wepp/management/validate.py– smoke-check that every management key resolves and round-trips.python -m wepppy.wepp.management.managements data/<collection>/<file>.man– print parsed summaries for manual inspection.python -m wepppy.wepp.management.utils.multi_ofe <args>(or targeted unit tests) – confirm multi-OFE syntheses still annotate OFE prefixes and scenario references.
Troubleshooting
- KeyError reading management – confirm the requested key exists in
map.json, the referenced file is present underdata/, and disturbed overrides fall back correctly. - Malformed output – run
Management(str_path)round trips to ensure read/write parity; trailing whitespace in.manfiles often causes misaligned loops. - Stub mismatches – after adding or renaming public methods update
channels.pyi,managements.pyi, andutils/*.pyi; runwctl run-stubtest wepppy.wepp.managementwhen available. - Channel calibration drift – if
get_channeloverrides fail, double-check thatchnnbrandchnnstay numeric strings and that_format_valuedoes not swallow significant digits.
References
- Root guidance:
AGENTS.md - Interchange docs:
wepppy/wepp/interchange/README.md - Disturbance datasets:
wepppy/wepp/management/data/ - Template synthesis how-to:
tests/wepp/management/test_multiple_ofe.py