I'm fairly new to NetLogo and its programming capabilities. I am trying to create a grouping mechanism for my code so that NLCD classifications can be mirrored in my NetLogo world.
For example, the NLCD veg-type 11 and 12 are for areas classified as water. Instead of calling the individual veg-types each time, I want to assign groups (e.g. "water-patches) to optimize my code. At the moment, my code is very tedious by having an if
statement correspond to each veg-type.
ask patches [
ifelse veg-type > 0
[
if veg-type = 41 ;;NLCD forest gridcodes
[set pcolor 55]
if veg-type = 42
[set pcolor 55]
if veg-type = 43
[set pcolor 55]
if veg-type = 52
[set pcolor 55]
if veg-type = 71 ;;NLCD grass gridcodes
[set pcolor 43]
if veg-type = 90
[set pcolor 43]
if veg-type = 95
[set pcolor 43]
if veg-type = 81 ;;NLCD agriculture gridcodes
[set pcolor orange]
if veg-type = 82
[set pcolor orange]
if veg-type = 21 ;;NLCD urban gridcodes
[set pcolor red]
if veg-type = 22
[set pcolor red]
if veg-type = 23
[set pcolor red]
if veg-type = 24
[set pcolor red]
if veg-type = 11 ;;NLCD water gridcodes
[set pcolor blue]
if veg-type = 12
[set pcolor blue]
if veg-type = 31 ;;NLCD barren gridcode
[set pcolor brown]
]
[set pcolor white]
]
How can I create groups for the different veg-types so that one FOREST group can correspond to patches with veg-type 41, 42, 43, 52? Do I need to create a multiple agentsets (e.g. forest-patches, water-patches, etc.) or should I table:put
the veg-type information into a table and use the table:group-items
command?
I appreciate any and all input!