How zawadzkim/pyswap works
pySWAP lets users define SWAP hydrology simulations in Python, run the external SWAP model, and inspect or visualize results. The central workflow is model configuration → input-file generation → SWAP execution → result parsing; configuration spans simulation settings, soil, crops, weather, boundaries, drainage, irrigation, and transport. Shared validation and SWAP-format serialization support these inputs. The README documents analysis and visualization, while the source index confirms result and plotting modules; their detailed wiring was not sampled, so those links are left unverified.
Main entry points: model.py Model orchestration · meteorology.py Meteorology · crop.py Crop settings · result.py Simulation results
Components 20
Simulation configuration
- Simulation settings
pyswap/components/simsettings.py - Soil water
pyswap/components/soilwater.py - Crop settings
pyswap/components/crop.py - Meteorology
pyswap/components/meteorology.py - Water controls
pyswap/components/irrigation.py - Drainage
pyswap/components/drainage.py - Boundary conditions
pyswap/components/boundary.py - Solute transport
pyswap/components/transport.py
Input and execution
- Model orchestration
pyswap/model/model.py - Validation and fields
pyswap/core/basemodel.py - SWAP serialization
pyswap/core/fields.py - Executable management
pyswap/utils/executables.py
Results and analysis
- Simulation results
pyswap/model/result.py - Result plotting
pyswap/core/plot
Data and integrations
- Data file I/O
pyswap/core/io - Crop database
pyswap/db/cropdb.py - Location data
pyswap/gis/location.py - Command line
pyswap/core/cli/cli.py
Other components
- Python user
- SWAP model
Connections 19
- Python user → Model orchestration: configures
- Model orchestration → Simulation settings: uses settings
pyswap/model/model.py - Model orchestration → Soil water: uses soil
pyswap/model/model.py - Model orchestration → Crop settings: uses crop
pyswap/model/model.py - Model orchestration → Meteorology: uses weather
pyswap/model/model.py - Model orchestration → Water controls: uses irrigation
pyswap/model/model.py - Model orchestration → Drainage: uses drainage
pyswap/model/model.py - Model orchestration → Boundary conditions: uses boundaries
pyswap/model/model.py - Model orchestration → Solute transport: uses transport
pyswap/model/model.py - Model orchestration → Validation and fields: validates inputs
pyswap/model/model.py - Model orchestration → SWAP serialization: writes inputs
pyswap/model/model.py - Model orchestration → Executable management: gets executable
pyswap/model/model.py - Model orchestration → SWAP model: runs
- Model orchestration → Simulation results: reads outputs
pyswap/model/model.py - Simulation results → Result plotting: visualizes
- Meteorology → Data file I/O: loads CSV
pyswap/components/meteorology.py - Crop settings → Crop database: loads crop data
pyswap/components/crop.py - Meteorology → Location data: uses location
- Command line → Executable management: manages executable
pyswap/core/cli/cli.py