Visualization
Results Visualization¶
Overview¶
The visualize.py script provides a simple command-line interface for visualizing evaluation results. It generates time series plots with precipitation and streamflow comparisons.
Key Features: - Time series plots with observed vs simulated streamflow - Precipitation displayed as inverted bars (top-down) - Automatic loading from NetCDF evaluation results - Basin-level or multi-basin visualization
Command-Line Usage¶
Basic usage (visualize all basins):
1 | |
Visualize specific basins:
1 2 3 | |
Custom output directory:
1 2 3 | |
Python API Usage¶
For programmatic visualization:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | |
Input Requirements¶
The visualization script expects:
- NetCDF file:
*_evaluation_results.nccontaining: qobs: Observed streamflow[time, basin]qsim: Simulated streamflow[time, basin]prcp: Precipitation[time, basin](optional)basin: Basin IDs-
time: Time coordinates -
Directory structure:
1 2 3 4 5 6 7
results/xaj_mz_SCE_UA/ └── evaluation_test/ ├── test_evaluation_results.nc └── figures/ # Output directory (auto-created) ├── 01013500_timeseries.png ├── 01022500_timeseries.png └── ...
Output¶
For each basin, generates:
- Time series plot: {basin_id}_timeseries.png
- Upper panel: Precipitation (inverted bars)
- Lower panel: Observed vs simulated streamflow
Plot features: - Date formatting (YYYY-MM) - Dual-axis precipitation/streamflow - Legend with simulation vs observation - PNG format with 300 DPI
Advanced Visualization¶
For custom plots beyond the CLI tool, use the core plotting functions directly:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | |