GIS Gradient Example
Model was written in NetLogo 5.0.4
•
Viewed 1434 times
•
Downloaded 145 times
•
Run 4 times
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
Comments and Questions
Click to Run Model
extensions [ gis ] globals [ elevation slope aspect ] to setup clear-all set elevation gis:load-dataset "data/local-elevation.asc" gis:set-world-envelope gis:envelope-of elevation let horizontal-gradient gis:convolve elevation 3 3 [ 1 1 1 0 0 0 -1 -1 -1 ] 1 1 let vertical-gradient gis:convolve elevation 3 3 [ 1 0 -1 1 0 -1 1 0 -1 ] 1 1 set slope gis:create-raster gis:width-of elevation gis:height-of elevation gis:envelope-of elevation set aspect gis:create-raster gis:width-of elevation gis:height-of elevation gis:envelope-of elevation let x 0 repeat (gis:width-of slope) [ let y 0 repeat (gis:height-of slope) [ let gx gis:raster-value horizontal-gradient x y let gy gis:raster-value vertical-gradient x y if ((gx <= 0) or (gx >= 0)) and ((gy <= 0) or (gy >= 0)) [ let s sqrt ((gx * gx) + (gy * gy)) gis:set-raster-value slope x y s ifelse (gx != 0) or (gy != 0) [ gis:set-raster-value aspect x y atan gy gx ] [ gis:set-raster-value aspect x y 0 ] ] set y y + 1 ] set x x + 1 ] gis:set-sampling-method aspect "bilinear" ask patches [ sprout 1 [ set color blue let h gis:raster-sample aspect self ifelse h >= -360 [ set heading subtract-headings h 180 ] [ die ] ] ] gis:paint elevation 0 reset-ticks end to go ask turtles [ forward random-normal 0.1 0.1 let h gis:raster-sample aspect self ifelse h >= -360 [ set heading subtract-headings h 180 ] [ die ] ] tick if not any? turtles [ stop ] end ; Public Domain: ; To the extent possible under law, Uri Wilensky has waived all ; copyright and related or neighboring rights to this model.
There are 10 versions of this model.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
GIS Gradient Example.png | preview | Preview for 'GIS Gradient Example' | over 11 years ago, by Uri Wilensky | Download |
This model does not have any ancestors.
This model does not have any descendants.