-- tempo de duração: 10 anos (2004 a 2014) -- -- passo de tempo: mensal -- STEPS = 120 -- estados das células: classes TC reagrupadas-- URBANO = 1 PASTAGEM = 2 FLORESTA = 3 VEG_SECUNDARIA = 4 MOSAICO = 5 RIO = 6 -- probabilidade de transição entre as classes -- -- Urb | past | flo | veg | mosaic | rio -- I = {{1.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000}, {0.0149, 1.0000, 0.0000, 0.0000, 0.0000, 0.0000}, {0.0012, 0.0000, 1.0000, 0.0000, 0.0000, 0.0000}, {0.0031, 0.0000, 0.1000, 1.0000, 0,0000, 0.0000}, {0.0369, 0.0000, 0.0000, 0.0000, 1.0000, 0.0000}, {0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000}} I[0] = {} I[0][0] = 0 for i = 1, 6 do I[0][i] = 0 I[i][0] = 0 end randomObj = Random{seed = x} -- x = números aleatórios (30 repetições) -- -- declara as regras de transição entre estados baseado na matriz de probabilidade I -- cell = Cell{ execute = function(cell) forEachNeighbor(cell, function(neigh) if neigh.state == URBANO then local p = randomObj:number() if p < I[cell.state][neigh.state] then cell.state = neigh.state end end end) end, init = function(cell) if cell.cover3 == 6 then cell.state = RIO end end } cs = CellularSpace{ file = "Grid_100m_Mocajuba_Classes_2004_cut.shp", instance = cell, as = {state = "cover3"}, missing = 0, } cs2 = CellularSpace{ file = "Grid_100m_Mocajuba_Classes_2014_cut.shp", as = {state = "cover3"}, missing = 0, } map = Map{ target = cs, select = "state", color = {"red", "lightRed", "darkGreen", "green", "brown", "blue"}, value = {1, 2, 3, 4, 5, 6}, label = {"URBANO", "PASTAGEM", "FLORESTA", "VEG_SECUNDARIA", "MOSAICO", "RIO"} } map2 = Map{ target = cs2, select = "state", color = {"red", "lightRed", "darkGreen", "green", "brown", "blue"}, value = {1, 2, 3, 4, 5, 6}, label = {"URBANO", "PASTAGEM", "FLORESTA", "VEG_SECUNDARIA", "MOSAICO", "RIO"} } cs:createNeighborhood{strategy = "moore"} itF = Trajectory{ target = cs, select = function(cell) return true end } t = Timer{ Event{action = function() itF:execute() itF:rebuild() end}, Event{action = map}, Event{action = map2} } t:run(STEPS)