7-Day SELES Course Day 7

From SELESwiki

Jump to: navigation, search

Back to Course Index

Scenario Scripting Language (.scn files)

General

  • Procedural: step by step sequence of commands
  • Some commands will block until a simulation terminates
  • Case sensitive
  • First line: Scenario Information

Raster Layers

  • SELES currently supports GRASS, ERDAS and ARC ASCII formats
  • A model has one resolution and extent, so all rasters must have the same dimensions and represent the same landscape
  • SELES has support for aligning rasters

Loading Rasters

<Filename>
<Viewname> = <Filename>

Example:

.\gisdata\cell\Elevation
DEM = .\gisdata\Elevation.asc

Loading Real-value Rasters

<Filename> * #Multiplier
<Viewname> = <Filename> * #Multiplier
multiplies cell values as they are read

Example:

.\gisdata\cell\SiteIndex * 10

Saving Rasters

Save <ViewName> <FileName> <Type>

Example:

Save DEM .\gisdata\cell\Elevation GRASS
Save DEM .\Elevation.asc ARC ASCII
<Type> = GRASS COMPRESSED
<Type> = GRASS
<Type> = ARC ASCII
<Type> = ERDAS8
<Type> = ERDAS16

Saving JPEGs

Save <ViewName> <FileName> JPEG
Save <ViewName> <FileName> JPEG #Resolution
Save <ViewName> <FileName> JPEG [#bottom, #left, #top, #right]

Example:

Save DEM fig1.jpg JPEG

Closing Views

CLOSE ALL
CLOSE <Viewname>

Example:

Close DEM

Scenario Dimensions

Model Width: #NumColumns
Model Height: #NumRows
Model Cols: #NumColumns
Model Rows: #NumRows
Model Dimensions: #NumRows, #NumCols
Model Dimensions: <ViewName>

View Commands

Minimize All
Minimize <viewname>
Minimize Initial State
Minimize Static
Minimize
Display Resolution: Number
Tile
Close <viewname>
Close All

General Commands

cwd <directory> (or cd <directory>)
Change current working directory
Will create directory if not present
System "command”
Example:
system "copy AAC1.txt AAC.txt"

Simulation Control

  • SimStart #RunLength #Runs
SimStart #RunLength #Runs Priority

Example:

SimStart 10 100 Low Priority
  • <variable> = Expression
<landscape event filename> %UseEvent

Example:

FireRotation = 100
Logging.lse OFF

Expressions

Expr = #Value
Expr = Expr + Expr
Expr = Expr - Expr
Expr = Expr * Expr
Expr = Expr / Expr
Expr = Expr ^ Expr
Expr = Expr % Expr
Expr = (Expr)

Models

pic17

Script Variables: Defining

$VarName$ = “value”
$VarName$ = value
$VarName$ = #globalVar#

Example:

$threshold = 10
$baseDir = “..\output1”

String Temporary Variables: Using

Put anywhere in an expression except in quoted text

Example:

cwd $baseDir$\v1
param1 = $threshold$ + 10

Iteration

  • FOR($var$ = “filenameExpr”)
… (any commands)
END

Example:

FOR($x$ = \outputRasters\ageClass*)
  • FOR($var$ = #Number : #Number)
… (any commands)
END

Example:

FOR($x$ = 1:5)
  • FOR($var$ = #Number : #Number, #Step)
… (any commands)
END

Example:

FOR($x$ = 0:100,10)
  • WHILE(condition)
… (any commands)
END

Example:

WHILE(difference < 0.1)

Conditions

IF(condition)

… (any commands)
END

Example:

IF($x$ EQ 10)

Scheduling Commands

SCHEDULE(timestep)

… (any commands)
END

Example:

SCHEDULE(10)

$x$ = #year#
waterLevel = .\gisData\waterLevel$x$
END

Command Ordering

  • BEFORE Model (.sel) file:
    • Loading rasters
    • Copying files (file specified read when .sel file loaded)
  • AFTER Model (.sel) file:
    • Changing variable initial state (loading file will reset values)
    • Changing to output directory

Directories

  • Starting directory for processing a scenario:
    • Directory of scenario file
  • Ending directory after scenario processed
    • Current directory
  • Directory for files loaded in .sel file:
    • Directory of .sel file
Personal tools