I am expanding a model looking at the effect of different types of fruit and fragmentation on a population of monkeys. The model reads a landsat file made up of 1's and 0s (representing forested and deforested areas) I need to reclassify the 1's into three kinds of trees. At the moment in the code I have the three types of trees randomly set, now I want them to be divided into percentages i.e 30 percent of the forested patches are blue, 50 percent are yellow, 20 are green. I have this atm: I think I have to change the:
[ if value = 1 [ set value one-of tree-types ]
I tried with n-of but I can't seem to make it work.
Any suggestions?
to load-forest
file-open "patch46.txt"
let tree-types [ 1 2 3 ]
let tree-colors [ 0 15 65 45]
let tree-fruits [ 0 25 50 100 ]
foreach n-values world-height [ min-pycor + ? ]
[let num-lines ?
foreach n-values world-width [ min-pxcor + ? ]
[let num-cols ?
ask patch num-lines num-cols
[set value file-read
]
]
]
file-close
ask patches
[ if value = 1 [ set value one-of tree-types ]
set pcolor item value tree-colors
set fruit item value tree-fruits
]
end