Repository navigation
feat(swat): SWAT+ project model and TxtInOut reader/writer (phase 6a) - #1
Merged
Merged
Conversation
Two new crates for the SWAT+ editor: - rustgis-swat-model (L1): a SWAT+ project as its TxtInOut text files, kept losslessly (lines, per-line endings, UTF-8 or Latin-1), with token-level edits that keep columns aligned. - rustgis-swat-txtinout (L2): files from and to bytes (so it runs in the browser), file.cio's index and the input files it names, and each file's layout: tables, counted tables, and records owning the lines after them (soil layers, plant communities, schedules, decision tables, weather generator months, calibration conditions). Written from the format's documentation, not SWAT+'s code. A test reads the private test scenarios from SWAT_TESTDATA (skipped without it): all four (Osu_1hru, Ames_sub1, Batanghari, Pessel) come back byte for byte, and every line of every file has a place in its view. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L94WcvvLDssnAEZihGAwYo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 6a of the SWAT+ editor (design:
docs/swat/design.mdonswat-plus-design).rustgis-swat-model(L1): a project as its TxtInOut files, kept losslessly: lines, per-line endings (files mixing\r\nand\nkeep them), UTF-8 or Latin-1. Edits replace a token and keep the columns aligned (numbers keep their right edge, names their left).rustgis-swat-txtinout(L2):read/writefrom and to bytes (no file system, so it runs in the browser);cioreadsfile.cioand lists the inputs it names (with the climate lists' weather files andrecall.rec's files) and the missing ones;viewgives each file's layout: tables (connections' repeated outflow columns namedobj_typ_2…), counted tables,print.prt, and records owning lines (soil layers, plant communities, schedules with their automatic tables and operations, decision tables' conditions and actions, weather generator months, calibration conditions). A view never fails: an unexpected line isKind::Other.Written from the format's documentation, not SWAT+'s code (the engine is LGPL; this is Apache-2.0).
Tests: unit tests for round trips and aligned edits;
tests/projects.rsreads the private scenarios fromSWAT_TESTDATA(skipped in CI): Osu_1hru, Ames_sub1, Batanghari and Pessel all come back byte for byte, and every line of every file is placed (noOther), with checks on the nested layouts.Next: 6b (runner +
swat.run).Generated by Claude Code