Fixing Common Errors
1. Problems with Scenario Scripts
Errors in scenario scripts tend to relate to input files (raster grids, .sel files), script variable assignment and use, global variable (parameter) assignment, and folder paths. Syntax issues are less common because there are relatively few keywords.
Diagnosing ambiguous commands
The interpretation of a command like y = x depends on the current state:
| Situation | Interpretation |
|---|---|
y is a global variable | x must be a global variable or constant assigned to y |
y is a global constant | Error — global constant values cannot be changed |
y is a spatial variable/constant | x must be a raster file name, used to reload the layer |
y is not defined | Error |
$y$ = x | Creates/reassigns a script variable with text value "x" |
Isolating problematic commands
If a scenario doesn't run and the problem isn't obvious, use multi-line comments (/* … */) to comment out half the script, then run it. Narrow down by progressively adjusting the commented region. This is why it's recommended to write routine comments using single-line // (leaving /* */ free for diagnostic commenting).
2. Problems with Input Tables
Common problems when loading a .sel file that references input tables:
- Column count mismatch — verify the expected number of columns.
- Blank cells — SELES does not allow blanks in input tables. Fill blanks with
0(in Excel: Select All → Go To Special → Blanks → paste0). - Notes in extra columns — comments can be placed in columns to the right of the main data, as long as there is nothing on the first row (SELES uses the first two rows to determine column count).
- First column as row index — by default, the first column is the row ID and does not need to be sequential or complete. Missing rows are filled with
0. Duplicate IDs use the last value. - Duplicate global constant names — all global constants (including legend labels) must be unique across the entire
.selfile. If SELES detects two definitions of a state variable, it will issue an error. Differentiate similar names (e.g.luSeymourfor a landscape unit vs.wsSeymourfor a watershed). - Undefined constants — if an undefined global constant name appears in a loaded text file, SELES will report the file name, row, and column. Either add the constant to the state space or replace it with a defined value.
3. Problems with .sel Files
State-space .sel files can become quite complex. Use the LSEditor's Parse function to find the first syntax error. Make sure a .sel file parses correctly before attempting to load it in SELES.
To isolate an error that is not obvious, use the same commenting technique described for scenario scripts — comment out sections to narrow down which block contains the problem.
4. Problems with Landscape Events
Use the LSEditor's Parse function to find syntax errors in .lse files. Make sure a .lse file parses correctly before loading in SELES.
To check compatibility between a .lse file and its .sel state space:
- Open both files in the LSEditor.
- Parse the
.lsefile to check its syntax in isolation. - Parse the
.selfile — this loads the state-space definitions into memory. - Parse the
.lsefile again — this may reveal incompatibilities (e.g. a variable declared with a different type in each file).
To isolate errors within a landscape event, comment out entire properties and re-parse to narrow down which property contains the problem.