VECTRI Parameter Sensitivity Mini-Pack¶
What you'll learn:
- Run a small sensitivity suite of experiments
- Use an auto-summary script to analyze differences
- Detect key variables automatically
- Compute baseline vs experiment differences
- Generate sensitivity reports
This companion handout helps you run a small sensitivity suite and then auto-summarize differences using a Python script that:
- Scans your outputs
- Detects likely EIR / incidence / infection / vector / hydrology variables by keyword
- Computes baseline vs experiment differences
- Optionally summarizes over Ethiopia (default bounds can be changed)
You can use this with the tutorial datasets you already have.
1) Folder Layout¶
Recommended structure:
Create folders:
2) Baseline Run¶
Run the baseline simulation:
3) One-Parameter-at-a-Time Experiments¶
These examples use the command line -v method for clarity.
3.1 Toy Warming¶
$VECTRI/vectri -c example_sys5.nc -d example_data.nc -v "rtemperature_offset=1.0" -o outputs/exp_temp_plus1K.nc -z logs/exp_temp_plus1K.log
3.2 Toy Rainfall Increase¶
$VECTRI/vectri -c example_sys5.nc -d example_data.nc -v "rrainfall_factor=1.2" -o outputs/exp_rain_x1p2.nc -z logs/exp_rain_x1p2.log
3.3 Vector Biting Intensity¶
$VECTRI/vectri -c example_sys5.nc -d example_data.nc -v "rbiteratio=0.8" -o outputs/exp_rbiteratio_0p8.nc -z logs/exp_rbiteratio_0p8.log
3.4 Hydrology Sensitivity¶
$VECTRI/vectri -c example_sys5.nc -d example_data.nc -v "wperm_default=1e-4" -o outputs/exp_wperm_1e-4.nc -z logs/exp_wperm_1e-4.log
3.5 Intervention Decay¶
$VECTRI/vectri -c example_sys5.nc -d example_data.nc -v "rbednet_tau=700" -o outputs/exp_bednet_tau_700.nc -z logs/exp_bednet_tau_700.log
4) Verify Parameters Were Written¶
Pick any experiment and check the global attributes:
Check another experiment:
5) Quick Batch Runner (Optional)¶
Create the batch script scripts/run_sensitivity.sh:
#!/usr/bin/env bash
set -euo pipefail
mkdir -p input outputs logs
# 0) Baseline
$VECTRI/vectri -c example_sys5.nc -d example_data.nc -o outputs/base.nc -z logs/base.log
# 1) Temperature +1K
$VECTRI/vectri -c example_sys5.nc -d example_data.nc -v "rtemperature_offset=1.0" -o outputs/exp_temp_plus1K.nc -z logs/exp_temp_plus1K.log
# 2) Rainfall x1.2
$VECTRI/vectri -c example_sys5.nc -d example_data.nc -v "rrainfall_factor=1.2" -o outputs/exp_rain_x1p2.nc -z logs/exp_rain_x1p2.log
# 3) Biting ratio
$VECTRI/vectri -c example_sys5.nc -d example_data.nc -v "rbiteratio=0.8" -o outputs/exp_rbiteratio_0p8.nc -z logs/exp_rbiteratio_0p8.log
# 4) Permanent water default
$VECTRI/vectri -c example_sys5.nc -d example_data.nc -v "wperm_default=1e-4" -o outputs/exp_wperm_1e-4.nc -z logs/exp_wperm_1e-4.log
# 5) Bednet tau
$VECTRI/vectri -c example_sys5.nc -d example_data.nc -v "rbednet_tau=700" -o outputs/exp_bednet_tau_700.nc -z logs/exp_bednet_tau_700.log
echo "All sensitivity runs completed."
Make the script executable:
Run the batch script:
6) Auto-Summary Script¶
This handout is paired with:
scripts/vectri_sensitivity_summary.py
The script will:
- Load
outputs/base.nc(unless you specify another baseline) - Scan other
.ncfiles inoutputs/ - Detect likely key variables using keywords:
eir,incidence,infect,vector,mosquito,cspr,larv,water, etc.- Compute:
- Global mean change
- Optional Ethiopia mean change
- Percent change relative to baseline
- Write:
outputs/sensitivity_report.mdoutputs/sensitivity_report.csv
6.1 Run the Summary¶
Basic usage:
6.2 Ethiopia-Focused Summary (Optional)¶
Include Ethiopia region summary:
python scripts/vectri_sensitivity_summary.py --baseline outputs/base.nc --pattern "outputs/*.nc" --ethiopia
6.3 Customize Ethiopia Bounds¶
To customize the bounding box:
python scripts/vectri_sensitivity_summary.py --baseline outputs/base.nc --pattern "outputs/*.nc" --ethiopia --lat-min 3 --lat-max 15 --lon-min 33 --lon-max 48
6.4 View the Reports¶
Check the generated reports:
Or open in a text editor:
View the CSV:
7) How to Interpret the Report¶
This mini-pack is designed for workflow verification and teaching:
Interpretation Guidelines
- You should see clear differences between baseline and at least some experiments
- The sign/magnitude of change depends on:
- Climate regime
- Population inputs
- Vector species settings
- Intervention assumptions
For operational or research conclusions, you would expand:
- Longer periods
- Multiple regions
- More realistic intervention schedules
- Validated parameter ranges
8) Suggested Classroom Sequence (45–60 min)¶
| Step | Activity | Time |
|---|---|---|
| 1 | Run baseline | 5–10 min |
| 2 | Run 2–3 quick experiments | 10–20 min |
| 3 | Confirm parameters in global attributes | 5 min |
| 4 | Run the auto-summary script | 5 min |
| 5 | Discuss which variables look most sensitive and why | 10–15 min |
9) Understanding the Summary Script¶
9.1 What Variables Are Detected?¶
The script uses keyword matching to find important variables:
| Category | Keywords |
|---|---|
| Transmission / Risk | eir, incidence, case, cases, risk |
| Infection / Immunity | infect, host, immune |
| Vector / Mosquitoes | vector, mosquito, larv, larva, egg, bite, cspr, spr |
| Hydrology / Climate | water, pond, wperm, rain, precip, temp, t2m, tas |
9.2 What Metrics Are Computed?¶
For each variable and experiment:
- Baseline mean: Average value in baseline run
- Experiment mean: Average value in sensitivity run
- Delta: Absolute change (experiment - baseline)
- Percent change: Relative change ((delta / baseline) × 100)
10) Example Workflow¶
Step 1: Set Up¶
Step 2: Run Baseline¶
Step 3: Run Experiments¶
$VECTRI/vectri -c example_sys5.nc -d example_data.nc -v "rtemperature_offset=1.0" -o outputs/exp_temp_plus1K.nc -z logs/exp_temp_plus1K.log
$VECTRI/vectri -c example_sys5.nc -d example_data.nc -v "rrainfall_factor=1.2" -o outputs/exp_rain_x1p2.nc -z logs/exp_rain_x1p2.log
Step 4: Generate Summary¶
python scripts/vectri_sensitivity_summary.py --baseline outputs/base.nc --pattern "outputs/*.nc" --ethiopia
Step 5: Review Results¶
11) Troubleshooting¶
Common Issues
Script can't find files:
- Ensure you're in the correct directory
- Check that
outputs/base.ncexists - Verify the pattern matches your output files
No variables detected:
- Check that output files contain expected variable names
- Try running with
--max-vars 10to see more variables
Ethiopia bounds error:
- Verify your data covers the specified lat/lon range
- Adjust bounds to match your data extent
12) Next Steps¶
After completing this mini-pack, you can:
| Next Step | Description |
|---|---|
| Expand Experiments | Add more parameter combinations |
| Regional Analysis | Analyze specific regions of interest |
| Time Series Analysis | Compare temporal patterns |
| Visualization | Create maps and plots of differences |
| Ensemble Analysis | Run multiple ensemble members per experiment |
📝 Exercises¶
Exercise 1: Basic Sensitivity Run¶
- Run baseline and 2 experiments
- Generate summary report
- Identify which variable shows the largest change
Exercise 2: Parameter Verification¶
- Run an experiment with a custom parameter
- Verify it appears in global attributes
- Check if the summary script detects the change
Exercise 3: Regional Comparison¶
- Generate global summary
- Generate Ethiopia-specific summary
- Compare the differences between global and regional results
Exercise 4: Multiple Parameters¶
- Run an experiment changing 2 parameters simultaneously
- Compare with single-parameter experiments
- Discuss non-linear interactions