Filter Small: Difference between revisions
Appearance
No edit summary |
|||
| (2 intermediate revisions by the same user not shown) | |||
| Line 4: | Line 4: | ||
==Screenshot== | ==Screenshot== | ||
[[Image: | [[Image:FilterSmall.gif]] | ||
==Download Model== | ==Download Model== | ||
Download the .scn, .sel and .lse files by clicking on the following link: [[Image: | Download the .scn, .sel and .lse files by clicking on the following link: [[Image:FilterSmall.zip]] | ||
==Model Code Exploration== | ==Model Code Exploration== | ||
| Line 14: | Line 14: | ||
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. | 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 | SELES Scenario | ||
$gisData$ = ..\..\ | $gisData$ = ..\..\CaseStudy\gisData\cell | ||
PatchLayer = $gisData$\Old_bF | |||
Model Dimensions: | Model Dimensions: PatchLayer | ||
filterSmall.sel | |||
sizeThreshold = 100 | |||
===FilterSmall.sel=== | |||
Seles Model | Seles Model | ||
Time Units: Step | Time Units: Step KiloStep 1000 2 | ||
Landscape Events: | Landscape Events: | ||
findSmall.lse | |||
deleteSmall.lse | |||
Spatial Constants: | Spatial Constants: | ||
PatchLayer | |||
Spatial Variables: | Spatial Variables: | ||
FilteredPatchLayer[1] <= 0 | |||
Visited[2] <= 0 | |||
Global Variables: | Global Variables: | ||
// Size threshold (in cells) | |||
sizeThreshold = 100 | |||
numFilteredPatches = 0 | |||
numFilteredCells = 0 | |||
numUnfilteredPatches = 0 | |||
numUnfilteredCells = 0 | |||
PatchType = 1 | |||
Output Frequency: 1 | Output Frequency: 1 | ||
=== | ===FilterSmall.lse=== | ||
// Find small patches out of a layer | |||
// | LSEVENT: FindSmall | ||
DEFINITIONS | DEFINITIONS | ||
GLOBAL VARIABLE: PatchType | |||
LAYER: PatchLayer, FilteredPatchLayer, Visited | |||
GLOBAL VARIABLE: sizeThreshold | |||
GLOBAL VARIABLE: numUnfilteredPatches, numUnfilteredCells | |||
CLUSTER VARIABLE: currPatchSize | |||
LOCAL: cps | |||
ENDDEF | ENDDEF | ||
INITIALSTATE | INITIALSTATE | ||
FilteredPatchLayer = IF (PatchLayer EQ PatchType) THEN 1 ELSE 0 | |||
INITIALSTATE = 1 | INITIALSTATE = 1 | ||
ENDIS | ENDIS | ||
RETURNTIME = 0 | |||
PROBINIT | PROBINIT | ||
PROBINIT = (FilteredPatchLayer EQ 1) AND (Visited EQ 0) | |||
currPatchSize = 0 | |||
numUnfilteredPatches = numUnfilteredPatches + (Visited EQ 0) | |||
numUnfilteredCells = numUnfilteredCells + 1 | |||
cps = 0 | |||
ENDPI | ENDPI | ||
TRANSITIONS | TRANSITIONS | ||
TRANSITIONS = (Visited EQ 0) AND (FilteredPatchLayer EQ 1) | |||
Visited = 1 | |||
currPatchSize = currPatchSize + 1 | |||
cps = currPatchSize | |||
ENDTR | 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== | ==Suggested Experiments== | ||
To explore this cellular automata model further, try the following: | To explore this cellular automata model further, try the following: | ||
Latest revision as of 21:59, 8 November 2006
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:
