VECTRI Command Line Tutorial (Step-by-Step)¶
What you'll learn:
- Run VECTRI from the command line
- Understand all major command-line options
- Set up proper run directories
- Use options files and inline parameters
- Run ensemble simulations
- Troubleshoot common issues
This guide shows how to run VECTRI from the command line using the main options.
It is written to match the typical tutorial folder that contains files like:
| File | Description |
|---|---|
example_sys5.nc / example_sys5.grb | Example climate data |
example_data.nc | Example population/ancillary data |
example_data_wperm.nc or example_wperm.nc | Examples with permanent breeding fraction |
vectri_calibrated.options | Example options/namelist-style settings |
vectri_fake_clim.nc, vectri_fake_data.nc | Small test files |
Note
File names can vary between tutorial versions. If your filenames differ, just substitute accordingly.
1) Before You Run¶
1.1 Recommended Folder Practice¶
To avoid cluttering and accidental git tracking, keep separate directories for:
- Code directory — where you installed VECTRI
- Run directory — where you execute simulations
Example layout:
Copy or symlink tutorial data into your run folder.
1.2 Check the Executable¶
Assuming you have an environment variable VECTRI set:
Run help to see all options:
2) Command-Line Options Overview¶
| Option | What it does |
|---|---|
-c | Climate file (GRIB or NetCDF). Usually contains temperature; may also include precipitation. |
-d | Data file (NetCDF). Must include population; may also include permanent breeding fraction, land use, etc. |
-o | Output filename (default: vectri.nc) |
-p | Separate precipitation file if not included in -c |
-a | Options/arguments file to set model parameters (default: ./input/vectri.options) |
-r | Input directory (default: ./input) |
-v | Pass options inline without editing a file |
-i | Restart/init file |
-e | Ensemble number (for reproducibility) |
-x | Vector species selector |
-n | Namelist file path/name |
-z | Redirect text output to a file |
-g | Force climate file format as GRIB |
-u | Debug compilation flag (advanced/developer use) |
3) Minimal Run (NetCDF Climate)¶
From your run directory (where the tutorial files are located):
This will produce:
vectri.nc(default output)- Screen log output
4) Choose an Output Name¶
Use the -o flag to specify the output filename:
5) Using GRIB Climate¶
If your climate file is GRIB (.grb), VECTRI usually auto-detects the format:
If needed, force GRIB parsing with the -g flag:
6) When Precipitation is Separate (-p)¶
If the climate file provided with -c contains only temperature, you can supply a separate precipitation file:
Note
If your tutorial climate file already includes precipitation, -p is not required.
7) Using an Options File (-a)¶
7.1 Default Behavior¶
By default VECTRI looks for:
So if you have an input/ directory in your run folder:
Then run:
7.2 Explicitly Set an Options File¶
If your options file is elsewhere:
$VECTRI/vectri -a vectri_calibrated.options -c example_sys5.nc -d example_data.nc -o out_with_calibrated_options.nc
8) Changing the Input Directory (-r)¶
If you want to keep inputs in a custom folder:
Run with custom input directory:
$VECTRI/vectri -r myinput -a myinput/vectri.options -c example_sys5.nc -d example_data.nc -o out_custom_inputdir.nc
Important
When you change the input directory with -r, you should also specify -a explicitly.
9) Passing Options Inline (-v)¶
This is handy for quick experiments without editing files:
$VECTRI/vectri -c example_sys5.nc -d example_data.nc -v "nloopspinup=3,nlenspinup=180" -o out_inline_options.nc
Use this instead of editing vectri.options when you only need small changes.
10) Restart Runs (-i)¶
If you have a previous restart file:
Note
If -i is not set or the file does not exist, VECTRI uses artificial initial conditions.
11) Ensemble Runs (-e)¶
For reproducible ensemble members, use the -e flag with different numbers:
Member 1:
Member 2:
Member 3:
12) Vector Species Selection (-x)¶
Default: An. gambiae¶
An. funestus (unvalidated)¶
Ae. albopictus (under development)¶
13) Using a Namelist File (-n)¶
If your setup requires a custom namelist:
$VECTRI/vectri -n my_vectri.namelist -c example_sys5.nc -d example_data.nc -o out_custom_namelist.nc
14) Save Text Output to a Log File (-z)¶
This is useful for troubleshooting and keeping records.
15) Complete "Best Practice" Example¶
A clean, reproducible command you can adapt:
Create directories:
Copy options file:
Run VECTRI:
$VECTRI/vectri -a input/vectri.options -c example_sys5.nc -d example_data.nc -e 1 -v "nloopspinup=3,nlenspinup=180" -o outputs/ethiopia_tutorial_member01.nc -z logs/ethiopia_tutorial_member01.txt
16) Common Pitfalls & Quick Fixes¶
Troubleshooting
"Cannot find vectri.options"
- Make sure
./input/vectri.optionsexists, or provide-a path/to/options
Climate variables not recognized
- Confirm your climate file contains the required variables and correct units
- Use the tutorial file first to validate your workflow
You accidentally ran inside the code folder
- Move to a separate run directory and re-run
Output too large / too many files
- Use a dedicated
outputs/folder and name runs clearly with-o
17) Cheat Sheet¶
Help¶
Minimal Run¶
With Output Name¶
Separate Precipitation¶
Options File¶
Custom Input Directory¶
Inline Options¶
Ensemble Member¶
Restart Run¶
Vector Species¶
18) Next Steps¶
After mastering the command line, you can:
- Explain expected variables inside climate and data files using
ncdump -h - Create a simple post-processing workflow:
- Open
vectri.nc - Map risk metrics
- Compare months/seasons
- Open
- Develop a template for country-level runs with clipped climate inputs
Appendix: Example Run Script¶
You can save this as run_tutorial.sh:
#!/usr/bin/env bash
set -euo pipefail
VECTRI_EXE="${VECTRI:-$HOME/vectri}/vectri"
mkdir -p outputs logs input
cp -f vectri_calibrated.options input/vectri.options
"${VECTRI_EXE}" \
-a input/vectri.options \
-c example_sys5.nc \
-d example_data.nc \
-e 1 \
-o outputs/tutorial_run_member01.nc \
-z logs/tutorial_run_member01.txt
echo "Done. Output: outputs/tutorial_run_member01.nc"
Make it executable:
Run the script:
📝 Exercises¶
Exercise 1: Basic Run¶
- Navigate to your tutorial directory
- Run VECTRI with the example files
- Verify the output file was created
Exercise 2: Ensemble Members¶
- Run 3 ensemble members
- Compare the output file sizes
- Use
ncdump -hto verify they have the same structure
Exercise 3: Custom Options¶
- Create an
input/directory - Copy the options file
- Modify spinup parameters using
-v - Run and save output to a custom location
Exercise 4: Logging¶
- Run VECTRI with the
-zflag - Examine the log file
- Identify key information (runtime, parameters used, warnings)