Skip to main content

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:

SituationInterpretation
y is a global variablex must be a global variable or constant assigned to y
y is a global constantError — global constant values cannot be changed
y is a spatial variable/constantx must be a raster file name, used to reload the layer
y is not definedError
$y$ = xCreates/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 → paste 0).
  • 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 .sel file. If SELES detects two definitions of a state variable, it will issue an error. Differentiate similar names (e.g. luSeymour for a landscape unit vs. wsSeymour for 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:

  1. Open both files in the LSEditor.
  2. Parse the .lse file to check its syntax in isolation.
  3. Parse the .sel file — this loads the state-space definitions into memory.
  4. Parse the .lse file 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.