-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfire_spread_simulator.py
67 lines (52 loc) · 1.93 KB
/
fire_spread_simulator.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import numpy as np
import itertools
from ca_classes.field_class import Field
from ca_classes.fire_simulation_class import Fire_simulation
from ca_classes.MCE_class import MCE
########### External data ############
dimension = [40, 40]
test_cell_states = np.full(dimension, 1)
for coord in itertools.product(*[range(dim) for dim in dimension]):
if coord[0] in list(range(40, 60)) and coord[1] in list(range(70, 80)):
test_cell_states[coord] = 0
test_cell_height = np.zeros(dimension)
for i in range(dimension[0]):
for j in range(dimension[1]):
test_cell_height[i, j] = 1.6 * np.sqrt(i ** 2 + j ** 2)
#######################################
obj_field = Field(dimension=dimension,
wind_velocity=0,
wind_direction=[0, 0],
cell_states=None,
cell_height=None,
cell_veg_type=0,
cell_veg_density=0,
cell_size=15)
# obj_field.plot()
obj_fire_simul = Fire_simulation(field=obj_field,
fire_origin=[(20, 20)],
max_period_num=15,
plot=True)
obj_MCE = MCE(ca_fire_simul=obj_fire_simul,
rep_number=100)
obj_MCE.run()
obj_MCE.generate_report("sim_p_0.8_wind_height")
# obj_MCE.plot()
# obj_field = Field(dimension=[100, 100],
# wind_velocity=4,
# wind_direction=[0, 1],
# cell_states=None,
# cell_height=test_cell_height,
# cell_veg_type=0,
# cell_veg_density=0,
# cell_size=15)
#
# obj_fire_simul = Fire_simulation(field=obj_field,
# fire_origin=[(20, 20)],
# max_period_num=15,
# plot=False)
#
# obj_MCE = MCE(ca_fire_simul=obj_fire_simul,
# rep_number=100)
#
# obj_MCE.run()