Filter Small
Appearance
Summary
Screenshot
Download Model
Download the .scn, .sel and .lse files by clicking on the following link: File:FilterSmall.zip
Model Code Exploration
In the following sections we will examine all of the model files for this model. Note that instead of downloading the zip file above, you could just copy the text in the boxes below into a text editor and save it with the appropriate name (Section title). Opening the resulting .scn file in the SELES simulator would run this model.
FilterSmall.scn
SELES Scenario $gisData$ = ..\..\CaseStudy\gisData\cell PatchLayer = $gisData$\Old_bF Model Dimensions: PatchLayer filterSmall.sel sizeThreshold = 100
FilterSmall.sel
Seles Model Time Units: Step KiloStep 1000 2 Landscape Events: findSmall.lse deleteSmall.lse Spatial Constants: PatchLayer Spatial Variables: FilteredPatchLayer[1] <= 0 Visited[2] <= 0 Global Variables: // Size threshold (in cells) sizeThreshold = 100 numFilteredPatches = 0 numFilteredCells = 0 numUnfilteredPatches = 0 numUnfilteredCells = 0 PatchType = 1 Output Frequency: 1
FilterSmall.lse
// Find small patches out of a layer
LSEVENT: FindSmall
DEFINITIONS
GLOBAL VARIABLE: PatchType
LAYER: PatchLayer, FilteredPatchLayer, Visited
GLOBAL VARIABLE: sizeThreshold
GLOBAL VARIABLE: numUnfilteredPatches, numUnfilteredCells
CLUSTER VARIABLE: currPatchSize
LOCAL: cps
ENDDEF
INITIALSTATE
FilteredPatchLayer = IF (PatchLayer EQ PatchType) THEN 1 ELSE 0
INITIALSTATE = 1
ENDIS
RETURNTIME = 0
PROBINIT
PROBINIT = (FilteredPatchLayer EQ 1) AND (Visited EQ 0)
currPatchSize = 0
numUnfilteredPatches = numUnfilteredPatches + (Visited EQ 0)
numUnfilteredCells = numUnfilteredCells + 1
cps = 0
ENDPI
TRANSITIONS
TRANSITIONS = (Visited EQ 0) AND (FilteredPatchLayer EQ 1)
Visited = 1
currPatchSize = currPatchSize + 1
cps = currPatchSize
ENDTR
SPREADLOCATION
REGION CENTRED(1, 1.5)
DECISION (Visited EQ 0) AND (FilteredPatchLayer EQ 1)
ENDSL
SPREADTIME = -1
ENDCLUSTER
IF (0 < cps < sizeThreshold)
Visited = 2
ENDFN
ENDCLUSTER = 1
ENDEC
Suggested Experiments
To explore this cellular automata model further, try the following:
