Base Classes¶
The embrs.base_classes package provides the abstract interfaces and manager classes that form the backbone of the EMBRS simulation framework. Users extending EMBRS will primarily interact with ControlClass (to implement suppression strategies) and AgentBase (to define agents displayed in visualizations). The remaining classes—BaseFireSim, GridManager, WeatherManager, ControlActionHandler, and BaseVisualizer—are internal infrastructure that advanced users may need to understand when debugging or extending the simulation engine.
Abstract control class for user-defined fire suppression strategies.
Users extend ControlClass to implement custom control logic that interacts with the fire simulation at each time step.
Classes:
| Name | Description |
|---|---|
- ControlClass |
Abstract base for fire suppression algorithms. |
.. autoclass:: ControlClass :members:
ControlClass
¶
Bases: ABC
Abstract base class for user-defined fire suppression control code.
Subclasses must implement the process_state method, which is called after each simulation iteration to apply suppression actions.
Source code in embrs/base_classes/control_base.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | |
process_state(fire)
abstractmethod
¶
Process the current simulation state and apply control actions.
Called after each simulation iteration. Implement this method to access fire state and apply suppression actions such as retardant drops, water drops, or fireline construction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fire
|
FireSim
|
The current FireSim instance. Access fire state via fire.burning_cells, fire.get_frontier(), fire.curr_time_s, etc. |
required |
Source code in embrs/base_classes/control_base.py
28 29 30 31 32 33 34 35 36 37 38 39 | |
Base class for agents displayed in fire simulation.
Agents represent entities (vehicles, personnel, etc.) that can be registered with the simulation and displayed in visualizations.
Classes:
| Name | Description |
|---|---|
- AgentBase |
Base class for simulation agents. |
.. autoclass:: AgentBase :members:
AgentBase
¶
Base class for agents in user code.
Agent objects must be an instance of this class to be registered with the simulation and displayed in visualizations.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
Unique identifier of the agent. |
|
x |
float
|
X position in meters within the simulation. |
y |
float
|
Y position in meters within the simulation. |
label |
str
|
Label displayed with the agent, or None for no label. |
marker |
str
|
Matplotlib marker style for display. |
color |
str
|
Matplotlib color for display. |
Source code in embrs/base_classes/agent_base.py
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 68 69 70 | |
__init__(id, x, y, label=None, marker='*', color='magenta')
¶
Initialize an agent with position and display properties.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
Any
|
Unique identifier of the agent. |
required |
x
|
float
|
X position in meters within the simulation. |
required |
y
|
float
|
Y position in meters within the simulation. |
required |
label
|
str
|
Label displayed with the agent. Defaults to None. |
None
|
marker
|
str
|
Matplotlib marker style. Defaults to '*'. |
'*'
|
color
|
str
|
Matplotlib color. Defaults to 'magenta'. |
'magenta'
|
Source code in embrs/base_classes/agent_base.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | |
to_log_entry(timestamp)
¶
Convert agent state to a log entry for recording.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timestamp
|
float
|
Current simulation timestamp. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
AgentLogEntry |
AgentLogEntry
|
Log entry containing the agent's current state. |
Source code in embrs/base_classes/agent_base.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
Base class for fire simulation providing shared logic for FireSim and FirePredictor.
This module contains BaseFireSim, which implements the core fire spread simulation mechanics including cell management, fire propagation, weather updates, and control interface elements.
Classes:
| Name | Description |
|---|---|
- BaseFireSim |
Core fire simulation logic and state management. |
.. autoclass:: BaseFireSim :members:
BaseFireSim
¶
Base class for fire simulation providing shared logic for FireSim and FirePredictor.
Manages the hexagonal cell grid, fire propagation mechanics, weather updates, and control interface elements. Subclassed by FireSim for real-time simulation and FirePredictor for forward prediction.
This class uses composition with several manager classes
- GridManager: Handles cell grid storage, coordinate conversion, and neighbor lookups.
- WeatherManager: Handles weather stream and wind forecast management.
- ControlActionHandler: Handles fire suppression actions (retardant, water, firelines).
Attributes:
| Name | Type | Description |
|---|---|---|
cell_grid |
ndarray
|
2D array of Cell objects backing the simulation. |
cell_dict |
Dict[int, Cell]
|
Dictionary mapping cell IDs to Cell objects. |
burning_cells |
List[Cell]
|
Currently burning cells. |
frontier |
set
|
Cell IDs adjacent to burning cells that could ignite. |
curr_time_s |
int
|
Current simulation time in seconds. |
iters |
int
|
Number of iterations completed. |
finished |
bool
|
Whether the simulation has completed. |
Source code in embrs/base_classes/base_fire.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 | |
burning_cells
property
¶
List of currently burning cells at the time called.
Returns:
| Type | Description |
|---|---|
List[Cell]
|
List[Cell]: All cell objects currently in the FIRE state. |
cell_dict
property
¶
Dictionary mapping cell IDs to their respective :class:~fire_simulator.cell.Cell instances.
cell_grid
property
¶
2D array of all the cells in the sim at the current instant.
cell_size
property
¶
Size of each cell in the simulation.
Measured as the distance in meters between two parallel sides of the regular hexagon cells.
curr_time_h
property
¶
Current sim time in hours
curr_time_m
property
¶
Current sim time in minutes
curr_time_s
property
¶
Current sim time in seconds
finished
property
¶
True if the simulation is finished running. False otherwise
fire_break_cells
property
¶
List of :class:~fire_simulator.cell.Cell objects that fall along fire breaks
fire_breaks
property
¶
List of fire breaks in the simulation.
Returns:
| Name | Type | Description |
|---|---|---|
list |
list
|
List of (LineString, width, id) tuples for each fire break. |
frontier
property
¶
Set of cell IDs at the fire frontier.
.. deprecated::
Use :meth:get_frontier instead. This property has side effects
(modifies internal state) which is unexpected for a property.
It will be removed in a future version.
Returns:
| Name | Type | Description |
|---|---|---|
set |
set
|
Cell IDs of cells at the fire frontier. |
initial_ignition
property
¶
List of shapely polygons that were initially ignited at the start of the sim
iters
property
¶
Number of iterations run so far by the sim
roads
property
¶
Road data for the simulation.
Returns:
| Name | Type | Description |
|---|---|---|
list |
list
|
List of (road_coords, road_type, road_width) tuples, or None. |
shape
property
¶
Shape of the sim's backing array in (rows, cols)
sim_duration
property
¶
Duration of time (in seconds) the simulation should run for, the sim will run for this duration unless the fire is extinguished before the duration has passed.
size
property
¶
Size of the sim region (width_m, height_m)
time_step
property
¶
Time-step of the sim. Number of seconds per iteration
x_lim
property
¶
Max x coordinate in the sim's map in meters
y_lim
property
¶
Max y coordinate in the sim's map in meters
__init__(sim_params, burnt_region=None)
¶
Initialize the fire simulation.
Creates the hexagonal cell grid, populates cells with terrain and fuel data, sets up weather and wind forecasts, and applies initial ignitions and fire breaks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sim_params
|
SimParams
|
Simulation configuration parameters. |
required |
burnt_region
|
list
|
List of Shapely geometries defining pre-burnt regions. Defaults to None. |
None
|
Source code in embrs/base_classes/base_fire.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | |
add_agent(agent)
¶
Add agent to the simulation's registered agent list.
Registered agents are logged and displayed in visualizations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent
|
AgentBase
|
Agent to register with the simulation. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
If agent is not an instance of AgentBase. |
Source code in embrs/base_classes/base_fire.py
1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 | |
add_retardant_at_cell(cell, duration_hr, effectiveness)
¶
Apply long-term fire retardant to the specified cell.
Effectiveness is clamped to the range [0.0, 1.0]. Only applies to burnable cells.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell
|
Cell
|
Cell to apply retardant to. |
required |
duration_hr
|
float
|
Duration of retardant effect in hours. |
required |
effectiveness
|
float
|
Retardant effectiveness factor (0.0-1.0). |
required |
Note: This method delegates to ControlActionHandler.add_retardant_at_cell().
Source code in embrs/base_classes/base_fire.py
1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 | |
add_retardant_at_indices(row, col, duration_hr, effectiveness)
¶
Apply long-term fire retardant at the specified grid indices.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
row
|
int
|
Row index in the cell grid. |
required |
col
|
int
|
Column index in the cell grid. |
required |
duration_hr
|
float
|
Duration of retardant effect in hours. |
required |
effectiveness
|
float
|
Retardant effectiveness factor (0.0-1.0). |
required |
Note: This method delegates to ControlActionHandler.add_retardant_at_indices().
Source code in embrs/base_classes/base_fire.py
1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 | |
add_retardant_at_xy(x_m, y_m, duration_hr, effectiveness)
¶
Apply long-term fire retardant at the specified coordinates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_m
|
float
|
X position in meters. |
required |
y_m
|
float
|
Y position in meters. |
required |
duration_hr
|
float
|
Duration of retardant effect in hours. |
required |
effectiveness
|
float
|
Retardant effectiveness factor (0.0-1.0). |
required |
Note: This method delegates to ControlActionHandler.add_retardant_at_xy().
Source code in embrs/base_classes/base_fire.py
1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 | |
calc_ignition_ros(cell, neighbor, r_gamma)
¶
Calculate the ignition rate of spread for a neighbor cell.
Uses heat source from the spreading cell and heat sink from the receiving neighbor to compute the effective ignition ROS.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell
|
Cell
|
Source cell spreading fire. |
required |
neighbor
|
Cell
|
Neighbor cell being ignited. |
required |
r_gamma
|
float
|
Rate of spread from source cell (m/s). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Ignition rate of spread (ft/min). |
Source code in embrs/base_classes/base_fire.py
842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 | |
calc_wind_padding(forecast)
¶
Calculate padding offsets between wind forecast grid and simulation grid.
The wind forecast grid may not align exactly with the simulation boundaries. This calculates the x and y offsets needed to center the forecast within the simulation domain.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
forecast
|
ndarray
|
Wind forecast array with shape (time_steps, rows, cols, 2) where last dimension is (speed, direction). |
required |
Returns:
| Type | Description |
|---|---|
Tuple[float, float]
|
Tuple[float, float]: (x_padding, y_padding) in meters. |
Note: This method delegates to WeatherManager.calc_wind_padding().
Source code in embrs/base_classes/base_fire.py
950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 | |
construct_fireline(line, width_m, construction_rate=None, id=None)
¶
Construct a fire break along a line geometry.
If construction_rate is None, the fire break is applied instantly. Otherwise, it is constructed progressively over time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
line
|
LineString
|
Shapely LineString defining the fire break path. |
required |
width_m
|
float
|
Width of the fire break in meters. |
required |
construction_rate
|
float
|
Construction rate in m/s. If None, fire break is applied instantly. |
None
|
id
|
str
|
Unique identifier for the fire break. Auto-generated if not provided. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Identifier of the constructed fire break. |
Note: This method delegates to ControlActionHandler.construct_fireline().
Source code in embrs/base_classes/base_fire.py
1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 | |
get_action_entries(logger=False)
¶
Get action entries for logging active control actions.
Collects current state of long-term retardants, active firelines, water drops, and newly constructed fire breaks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
logger
|
bool
|
Whether call is from the logger. Affects cache cleanup. Defaults to False. |
False
|
Returns:
| Type | Description |
|---|---|
List[ActionsEntry]
|
List[ActionsEntry]: List of action entries for current actions. |
Source code in embrs/base_classes/base_fire.py
1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 | |
get_avg_fire_coord()
¶
Get the average position of all burning cells.
If there is more than one independent fire, includes cells from all fires.
Returns:
| Type | Description |
|---|---|
Tuple[float, float]
|
Tuple[float, float]: Average position as (x_avg, y_avg) in meters. |
Source code in embrs/base_classes/base_fire.py
1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 | |
get_cell_from_indices(row, col)
¶
Returns the cell in the sim at the indices [row, col] in the cell_grid.
Columns increase left to right in the sim visualization window, rows increase bottom to top.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
row
|
int
|
row index of the desired cell |
required |
col
|
int
|
col index of the desired cell |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
if row or col is not of type int |
ValueError
|
if row or col is out of the array bounds |
Returns:
| Name | Type | Description |
|---|---|---|
Cell |
Cell
|
Cell instance at the indices [row, col] in the cell_grid |
Note: This method delegates to GridManager.get_cell_from_indices().
Source code in embrs/base_classes/base_fire.py
1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 | |
get_cell_from_xy(x_m, y_m, oob_ok=False)
¶
Returns the cell in the sim that contains the point (x_m, y_m) in the cartesian plane.
(0,0) is considered the lower left corner of the sim window, x increases to the right, y increases up.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_m
|
float
|
x position of the desired point in units of meters |
required |
y_m
|
float
|
y position of the desired point in units of meters |
required |
oob_ok
|
bool
|
whether out of bounds input is ok, if set to |
False
|
Raises:
| Type | Description |
|---|---|
ValueError
|
oob_ok is |
Returns:
| Name | Type | Description |
|---|---|---|
Cell |
Cell
|
Cell at the requested point, returns |
Note: This method delegates to GridManager.get_cell_from_xy().
Source code in embrs/base_classes/base_fire.py
1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 | |
get_cells_at_geometry(geom)
¶
Get all cells that intersect with the given geometry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
geom
|
Union[Polygon, LineString, Point]
|
Shapely geometry to check for cell intersections. |
required |
Returns:
| Type | Description |
|---|---|
List[Cell]
|
List[Cell]: List of Cell objects that intersect with the geometry. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If geometry type is not Polygon, LineString, or Point. |
Note: This method delegates to GridManager.get_cells_at_geometry().
Source code in embrs/base_classes/base_fire.py
1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 | |
get_frontier()
¶
Get set of cell IDs at the fire frontier.
The frontier consists of FUEL cells adjacent to burning cells that could potentially ignite. Cells completely surrounded by fire are removed from the frontier.
Note
This method has the side effect of pruning cells that are completely surrounded by fire from the internal frontier set.
Returns:
| Name | Type | Description |
|---|---|---|
set |
set
|
Cell IDs of cells at the fire frontier. |
Source code in embrs/base_classes/base_fire.py
1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 | |
get_frontier_cells()
¶
Get list of cells at the fire frontier.
The frontier consists of FUEL cells adjacent to burning cells that could potentially ignite. Cells completely surrounded by fire are removed from the frontier.
This method is more efficient than get_frontier() when you need to access cell properties, as it avoids a second round of dictionary lookups.
Note
This method has the side effect of pruning cells that are completely surrounded by fire from the internal frontier set.
Returns:
| Type | Description |
|---|---|
List[Cell]
|
list[Cell]: Cells at the fire frontier. |
Source code in embrs/base_classes/base_fire.py
1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 | |
get_frontier_positions()
¶
Get list of (x, y) positions of cells at the fire frontier.
The frontier consists of FUEL cells adjacent to burning cells that could potentially ignite. Cells completely surrounded by fire are removed from the frontier.
This method is optimized for collecting frontier positions, performing filtering and coordinate extraction in a single pass.
Note
This method has the side effect of pruning cells that are completely surrounded by fire from the internal frontier set.
Returns:
| Type | Description |
|---|---|
List[Tuple[float, float]]
|
list[tuple[float, float]]: (x_pos, y_pos) for each frontier cell. |
Source code in embrs/base_classes/base_fire.py
1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 | |
get_neighbor_from_end_point(cell, end_point)
¶
Get the neighbor cell corresponding to an endpoint location.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell
|
Cell
|
Source cell from which to find neighbor. |
required |
end_point
|
Tuple[int, str]
|
Tuple of (location, neighbor_letter) where neighbor_letter indicates relative position. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Cell |
Cell
|
The neighboring Cell if it exists and is burnable, None otherwise. |
Source code in embrs/base_classes/base_fire.py
805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 | |
get_prediction_entry()
¶
Get prediction entry for logging current prediction state.
Returns:
| Name | Type | Description |
|---|---|---|
PredictionEntry |
PredictionEntry
|
Entry containing current time and prediction data. |
Source code in embrs/base_classes/base_fire.py
1770 1771 1772 1773 1774 1775 1776 | |
hex_round(q, r)
¶
Rounds floating point hex coordinates to their nearest integer hex coordinates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q
|
float
|
q coordinate in hex coordinate system |
required |
r
|
float
|
r coordinate in hex coordinate system |
required |
Returns:
| Type | Description |
|---|---|
Tuple[int, int]
|
Tuple[int, int]: (q, r) integer coordinates of the nearest hex cell |
Note: This method delegates to GridManager.hex_round().
Source code in embrs/base_classes/base_fire.py
1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 | |
ignite_neighbors(cell, r_gamma, gamma, end_point)
¶
Attempt to ignite neighboring cells reached by fire spread.
For each endpoint where fire has reached a neighbor boundary, checks if the neighbor is burnable and applies ignition if conditions are met.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell
|
Cell
|
Source cell spreading fire. |
required |
r_gamma
|
float
|
Rate of spread in direction gamma (m/s). |
required |
gamma
|
float
|
Spread direction angle (degrees). |
required |
end_point
|
list
|
List of (location, neighbor_letter) tuples indicating where fire reached neighbor boundaries. |
required |
Source code in embrs/base_classes/base_fire.py
747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 | |
is_firesim()
¶
Check if this instance is a FireSim (real-time simulation).
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if this is a FireSim instance. |
Source code in embrs/base_classes/base_fire.py
1778 1779 1780 1781 1782 1783 1784 | |
is_prediction()
¶
Check if this instance is a FirePredictor (forward prediction).
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if this is a FirePredictor instance. |
Source code in embrs/base_classes/base_fire.py
1786 1787 1788 1789 1790 1791 1792 | |
propagate_embers()
¶
Propagate embers from crown fires and ignite spot fires.
Simulates ember flight from lofted embers, schedules spot fire ignitions with delay, and ignites previously scheduled spots when their ignition time is reached.
Source code in embrs/base_classes/base_fire.py
870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 | |
propagate_fire(cell)
¶
Propagate fire spread from a burning cell to its neighbors.
Updates fire spread extent along each direction, checks for intersections with neighbor boundaries, and triggers ignition of neighboring cells when fire reaches them.
Uses a JIT-compiled inner loop to avoid Python overhead on the 12-element direction arrays.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell
|
Cell
|
Burning cell from which to propagate fire. |
required |
Source code in embrs/base_classes/base_fire.py
683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 | |
remove_neighbors(cell)
¶
Remove non-burnable neighbors from a cell's burnable neighbors list.
Filters out neighbors that are no longer in the FUEL state from the cell's burnable_neighbors dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell
|
Cell
|
Cell whose burnable neighbors should be updated. |
required |
Source code in embrs/base_classes/base_fire.py
634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 | |
set_ignition_at_cell(cell)
¶
Ignite the specified cell.
Sets the cell to the FIRE state and adds it to the new ignitions list.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell
|
Cell
|
Cell to ignite. |
required |
Source code in embrs/base_classes/base_fire.py
1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 | |
set_ignition_at_indices(row, col)
¶
Ignite the cell at the specified grid indices.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
row
|
int
|
Row index in the cell grid. |
required |
col
|
int
|
Column index in the cell grid. |
required |
Source code in embrs/base_classes/base_fire.py
1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 | |
set_ignition_at_xy(x_m, y_m)
¶
Ignite the cell at the specified coordinates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_m
|
float
|
X position in meters. |
required |
y_m
|
float
|
Y position in meters. |
required |
Source code in embrs/base_classes/base_fire.py
1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 | |
set_state_at_cell(cell, state)
¶
Set the state of the specified cell
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell
|
Cell
|
Cell object whose state is to be changed |
required |
state
|
CellStates
|
desired state to set the cell to (CellStates.FIRE, CellStates.FUEL, or CellStates.BURNT) |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
if 'cell' is not of type Cell |
ValueError
|
if 'cell' is not a valid Cell in the current fire Sim |
TypeError
|
if 'state' is not a valid CellStates value |
Source code in embrs/base_classes/base_fire.py
1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 | |
set_state_at_indices(row, col, state)
¶
Set the state of the cell at the indices [row, col] in the cell_grid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
row
|
int
|
row index of the desired cell |
required |
col
|
int
|
col index of the desired cell |
required |
state
|
CellStates
|
desired state to set the cell to (CellStates.FIRE, CellStates.FUEL, or CellStates.BURNT) |
required |
Source code in embrs/base_classes/base_fire.py
1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 | |
set_state_at_xy(x_m, y_m, state)
¶
Set the state of the cell at the point (x_m, y_m) in the Cartesian plane.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_m
|
float
|
x position of the desired point in meters |
required |
y_m
|
float
|
y position of the desired point in meters |
required |
state
|
CellStates
|
desired state to set the cell to (CellStates.FIRE, CellStates.FUEL, or CellStates.BURNT) |
required |
Source code in embrs/base_classes/base_fire.py
1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 | |
set_surface_accel_constant(cell)
¶
Sets the surface acceleration constant for a burning cell based on the state of its neighbors.
If a cell has any burning neighbors it is modelled as a line fire.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell
|
Cell
|
Cell object to set the surface acceleration constant for |
required |
Source code in embrs/base_classes/base_fire.py
1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 | |
stop_fireline_construction(fireline_id)
¶
Stop construction of an active fireline.
Finalizes the partially constructed fireline and adds it to the permanent fire breaks list.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fireline_id
|
str
|
Identifier of the fireline to stop constructing. |
required |
Note: This method delegates to ControlActionHandler.stop_fireline_construction().
Source code in embrs/base_classes/base_fire.py
1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 | |
truncate_linestring(line, length)
¶
Truncate a LineString to the specified length.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
line
|
LineString
|
Original line to truncate. |
required |
length
|
float
|
Desired length in meters. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
LineString |
LineString
|
Truncated line, or original if length exceeds line length. |
Note: This method delegates to ControlActionHandler._truncate_linestring().
Source code in embrs/base_classes/base_fire.py
1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 | |
update_control_interface_elements()
¶
Update all active control interface elements.
Processes long-term retardants, active fireline construction, and water drops that need updates based on elapsed time.
Source code in embrs/base_classes/base_fire.py
907 908 909 910 911 912 913 914 915 916 917 918 919 920 | |
update_long_term_retardants()
¶
Update long-term retardant effects and remove expired retardants.
Checks retardant expiration times and removes retardant effects from cells whose retardant has expired.
Note: This method delegates to ControlActionHandler.update_long_term_retardants().
Source code in embrs/base_classes/base_fire.py
940 941 942 943 944 945 946 947 948 | |
update_steady_state(cell)
¶
Update steady-state rate of spread for a burning cell.
Checks for crown fire conditions and calculates surface or crown fire spread rates. Also triggers ember lofting for spotting if crown fire is active.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell
|
Cell
|
Burning cell to update. |
required |
Source code in embrs/base_classes/base_fire.py
655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 | |
water_drop_at_cell_as_moisture_bump(cell, moisture_inc)
¶
Apply water drop as direct moisture increase to the specified cell.
Only applies to burnable cells. Adds cell to active water drops for moisture tracking.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell
|
Cell
|
Cell to apply water to. |
required |
moisture_inc
|
float
|
Moisture content increase as a fraction. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If moisture_inc is negative. |
Note: This method delegates to ControlActionHandler.water_drop_at_cell_as_moisture_bump().
Source code in embrs/base_classes/base_fire.py
1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 | |
water_drop_at_cell_as_rain(cell, water_depth_cm)
¶
Apply water drop as equivalent rainfall to the specified cell.
Only applies to burnable cells. Adds cell to active water drops for moisture tracking.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell
|
Cell
|
Cell to apply water to. |
required |
water_depth_cm
|
float
|
Equivalent rainfall depth in centimeters. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If water_depth_cm is negative. |
Note: This method delegates to ControlActionHandler.water_drop_at_cell_as_rain().
Source code in embrs/base_classes/base_fire.py
1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 | |
water_drop_at_cell_vw(cell, volume_L, efficiency=2.5, T_a=20.0)
¶
Apply Van Wagner energy-balance water drop to the specified cell.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell
|
Cell
|
Cell to apply water to. |
required |
volume_L
|
float
|
Water volume in liters (1 L = 1 kg). |
required |
efficiency
|
float
|
Application efficiency multiplier (Table 4). Default 2.5. |
2.5
|
T_a
|
float
|
Ambient air temperature in °C. Default 20. |
20.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If volume_L is negative. |
Note: This method delegates to ControlActionHandler.water_drop_at_cell_vw().
Source code in embrs/base_classes/base_fire.py
1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 | |
water_drop_at_indices_as_moisture_bump(row, col, moisture_inc)
¶
Apply water drop as direct moisture increase at the specified grid indices.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
row
|
int
|
Row index in the cell grid. |
required |
col
|
int
|
Column index in the cell grid. |
required |
moisture_inc
|
float
|
Moisture content increase as a fraction. |
required |
Note: This method delegates to ControlActionHandler.water_drop_at_indices_as_moisture_bump().
Source code in embrs/base_classes/base_fire.py
1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 | |
water_drop_at_indices_as_rain(row, col, water_depth_cm)
¶
Apply water drop as equivalent rainfall at the specified grid indices.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
row
|
int
|
Row index in the cell grid. |
required |
col
|
int
|
Column index in the cell grid. |
required |
water_depth_cm
|
float
|
Equivalent rainfall depth in centimeters. |
required |
Note: This method delegates to ControlActionHandler.water_drop_at_indices_as_rain().
Source code in embrs/base_classes/base_fire.py
1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 | |
water_drop_at_indices_vw(row, col, volume_L, efficiency=2.5, T_a=20.0)
¶
Apply Van Wagner energy-balance water drop at the specified grid indices.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
row
|
int
|
Row index in the cell grid. |
required |
col
|
int
|
Column index in the cell grid. |
required |
volume_L
|
float
|
Water volume in liters (1 L = 1 kg). |
required |
efficiency
|
float
|
Application efficiency multiplier (Table 4). Default 2.5. |
2.5
|
T_a
|
float
|
Ambient air temperature in °C. Default 20. |
20.0
|
Note: This method delegates to ControlActionHandler.water_drop_at_indices_vw().
Source code in embrs/base_classes/base_fire.py
1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 | |
water_drop_at_xy_as_moisture_bump(x_m, y_m, moisture_inc)
¶
Apply water drop as direct moisture increase at the specified coordinates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_m
|
float
|
X position in meters. |
required |
y_m
|
float
|
Y position in meters. |
required |
moisture_inc
|
float
|
Moisture content increase as a fraction. |
required |
Note: This method delegates to ControlActionHandler.water_drop_at_xy_as_moisture_bump().
Source code in embrs/base_classes/base_fire.py
1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 | |
water_drop_at_xy_as_rain(x_m, y_m, water_depth_cm)
¶
Apply water drop as equivalent rainfall at the specified coordinates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_m
|
float
|
X position in meters. |
required |
y_m
|
float
|
Y position in meters. |
required |
water_depth_cm
|
float
|
Equivalent rainfall depth in centimeters. |
required |
Note: This method delegates to ControlActionHandler.water_drop_at_xy_as_rain().
Source code in embrs/base_classes/base_fire.py
1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 | |
water_drop_at_xy_vw(x_m, y_m, volume_L, efficiency=2.5, T_a=20.0)
¶
Apply Van Wagner energy-balance water drop at the specified coordinates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_m
|
float
|
X position in meters. |
required |
y_m
|
float
|
Y position in meters. |
required |
volume_L
|
float
|
Water volume in liters (1 L = 1 kg). |
required |
efficiency
|
float
|
Application efficiency multiplier (Table 4). Default 2.5. |
2.5
|
T_a
|
float
|
Ambient air temperature in °C. Default 20. |
20.0
|
Note: This method delegates to ControlActionHandler.water_drop_at_xy_vw().
Source code in embrs/base_classes/base_fire.py
1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 | |
Fuel
¶
Base fuel model for Rothermel fire spread calculations.
Encapsulate the physical properties of a fuel type and precompute derived constants used in the Rothermel (1972) equations. Non-burnable fuel types (e.g., water, urban) store only name and model number.
All internal units follow the Rothermel convention: loading in lb/ft², surface-area-to-volume ratio in 1/ft, fuel depth in ft, heat content in BTU/lb.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Human-readable fuel model name. |
model_num |
int
|
Numeric fuel model identifier. |
burnable |
bool
|
Whether this fuel can sustain fire. |
dynamic |
bool
|
Whether herbaceous fuel transfer is applied. |
load |
ndarray
|
Fuel loading per class (tons/acre), shape (6,). Order: [1h, 10h, 100h, dead herb, live herb, live woody]. |
s |
ndarray
|
Surface-area-to-volume ratio per class (1/ft), shape (6,). |
sav_ratio |
int
|
Characteristic SAV ratio (1/ft). |
dead_mx |
float
|
Dead fuel moisture of extinction (fraction). |
fuel_depth_ft |
float
|
Fuel bed depth (feet). |
heat_content |
float
|
Heat content (BTU/lb), default 8000. |
rho_p |
float
|
Particle density (lb/ft³), default 32. |
Source code in embrs/models/fuel_models.py
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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | |
__init__(name, model_num, burnable, dynamic, w_0, s, s_total, dead_mx, fuel_depth)
¶
Initialize a fuel model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Human-readable fuel model name. |
required |
model_num
|
int
|
Numeric identifier for the fuel model. |
required |
burnable
|
bool
|
Whether this fuel can sustain fire. |
required |
dynamic
|
bool
|
Whether herbaceous transfer applies. |
required |
w_0
|
ndarray
|
Fuel loading per class (tons/acre), shape (6,). None for non-burnable models. |
required |
s
|
ndarray
|
SAV ratio per class (1/ft), shape (6,). None for non-burnable models. |
required |
s_total
|
int
|
Characteristic SAV ratio (1/ft). |
required |
dead_mx
|
float
|
Dead fuel moisture of extinction (fraction). |
required |
fuel_depth
|
float
|
Fuel bed depth (feet). |
required |
Source code in embrs/models/fuel_models.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | |
calc_E_B_C()
¶
Compute wind factor coefficients E, B, and C.
These coefficients parameterize the wind factor equation in the Rothermel model as a function of the characteristic SAV ratio.
Returns:
| Type | Description |
|---|---|
tuple
|
Tuple[float, float, float]: |
Source code in embrs/models/fuel_models.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | |
calc_W(w_0_tpa)
¶
Compute dead-to-live fuel loading ratio W.
W is used to determine live fuel moisture of extinction. Returns
np.inf when there is no live fuel loading (denominator is zero).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
w_0_tpa
|
ndarray
|
Fuel loading per class (tons/acre), shape (6,). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Dead-to-live loading ratio (dimensionless), or |
Source code in embrs/models/fuel_models.py
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | |
calc_flux_ratio()
¶
Compute propagating flux ratio for the Rothermel equation.
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Propagating flux ratio (dimensionless). |
Source code in embrs/models/fuel_models.py
132 133 134 135 136 137 138 139 140 141 | |
compute_f_and_g_weights()
¶
Compute fuel class weighting factors f_ij, g_ij, and category fractions f_i.
Derive weighting arrays from fuel loading and SAV ratios. f_ij
gives fractional area weights within dead/live categories. g_ij
gives SAV-bin-based moisture weighting factors. f_i gives the
dead vs. live category fractions.
Side Effects
Sets self.f_ij (2×6), self.g_ij (2×6), and
self.f_i (2,) arrays.
Source code in embrs/models/fuel_models.py
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | |
set_fuel_loading(w_n)
¶
Set net fuel loading and recompute weighted dead/live net loadings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
w_n
|
ndarray
|
Net fuel loading per class (lb/ft²), shape (6,). |
required |
Side Effects
Updates self.w_n, self.w_n_dead, and self.w_n_live.
Source code in embrs/models/fuel_models.py
237 238 239 240 241 242 243 244 245 246 247 248 | |
BTU_ft2_min_to_kW_m2(f_btu_ft2_min)
¶
Convert heat flux from BTU/(ft^2*min) to kW/m^2.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_btu_ft2_min
|
float
|
Heat flux in BTU/(ft^2*min). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Heat flux in kW/m^2. |
Source code in embrs/utilities/unit_conversions.py
220 221 222 223 224 225 226 227 228 229 | |
BTU_ft_min_to_kW_m(f_btu_ft_min)
¶
Convert fireline intensity from BTU/(ft*min) to kW/m.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_btu_ft_min
|
float
|
Fireline intensity in BTU/(ft*min). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Fireline intensity in kW/m. |
Source code in embrs/utilities/unit_conversions.py
232 233 234 235 236 237 238 239 240 241 | |
BTU_ft_min_to_kcal_s_m(f_btu_ft_min)
¶
Convert fireline intensity from BTU/(ftmin) to kcal/(sm).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_btu_ft_min
|
float
|
Fireline intensity in BTU/(ft*min). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Fireline intensity in kcal/(s*m). |
Source code in embrs/utilities/unit_conversions.py
244 245 246 247 248 249 250 251 252 253 | |
BTU_lb_to_cal_g(f_btu_lb)
¶
Convert heat content from BTU/lb to cal/g.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_btu_lb
|
float
|
Heat content in BTU/lb. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Heat content in cal/g. |
Source code in embrs/utilities/unit_conversions.py
272 273 274 275 276 277 278 279 280 281 | |
F_to_C(f_f)
¶
Convert temperature from Fahrenheit to Celsius.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_f
|
float
|
Temperature in degrees Fahrenheit. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Temperature in degrees Celsius. |
Source code in embrs/utilities/unit_conversions.py
48 49 50 51 52 53 54 55 56 57 | |
KiSq_to_Lbsft2(f_kisq)
¶
Convert fuel loading from kg/m^2 to lb/ft^2.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_kisq
|
float
|
Fuel loading in kg/m^2. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Fuel loading in lb/ft^2. |
Source code in embrs/utilities/unit_conversions.py
156 157 158 159 160 161 162 163 164 165 | |
KiSq_to_TPA(f_kisq)
¶
Convert fuel loading from kg/m^2 to tons per acre.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_kisq
|
float
|
Fuel loading in kg/m^2. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Fuel loading in tons per acre. |
Source code in embrs/utilities/unit_conversions.py
204 205 206 207 208 209 210 211 212 213 | |
Lbsft2_to_KiSq(f_libsft2)
¶
Convert fuel loading from lb/ft^2 to kg/m^2.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_libsft2
|
float
|
Fuel loading in lb/ft^2. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Fuel loading in kg/m^2. |
Source code in embrs/utilities/unit_conversions.py
144 145 146 147 148 149 150 151 152 153 | |
Lbsft2_to_TPA(f_lbsft2)
¶
Convert fuel loading from lb/ft^2 to tons per acre.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_lbsft2
|
float
|
Fuel loading in lb/ft^2. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Fuel loading in tons per acre. |
Source code in embrs/utilities/unit_conversions.py
192 193 194 195 196 197 198 199 200 201 | |
TPA_to_KiSq(f_tpa)
¶
Convert fuel loading from tons per acre to kg/m^2.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_tpa
|
float
|
Fuel loading in tons per acre. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Fuel loading in kg/m^2. |
Source code in embrs/utilities/unit_conversions.py
168 169 170 171 172 173 174 175 176 177 | |
TPA_to_Lbsft2(f_tpa)
¶
Convert fuel loading from tons per acre to lb/ft^2.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_tpa
|
float
|
Fuel loading in tons per acre. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Fuel loading in lb/ft^2. |
Source code in embrs/utilities/unit_conversions.py
180 181 182 183 184 185 186 187 188 189 | |
accelerate(cell, time_step)
¶
Apply fire acceleration toward steady-state ROS.
Update the transient rate of spread (cell.r_t) and average ROS
(cell.avg_ros) for each spread direction using the exponential
acceleration model (McAlpine 1989). Directions already at or above
steady-state are clamped.
Uses a JIT-compiled inner loop to avoid numpy dispatch overhead on small (12-element) arrays.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell
|
Cell
|
Burning cell with |
required |
time_step
|
float
|
Simulation time step in seconds. |
required |
Side Effects
Updates cell.r_t, cell.avg_ros, and cell.I_t in-place.
Source code in embrs/models/rothermel.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
cal_g_to_BTU_lb(f_cal_g)
¶
Convert heat content from cal/g to BTU/lb.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_cal_g
|
float
|
Heat content in cal/g. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Heat content in BTU/lb. |
Source code in embrs/utilities/unit_conversions.py
260 261 262 263 264 265 266 267 268 269 | |
calc_I_r(fuel, dead_moist_damping, live_moist_damping)
¶
Compute reaction intensity from fuel properties and moisture damping.
Reaction intensity is the rate of heat release per unit area of the flaming front (Rothermel 1972, Eq. 27).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fuel
|
Fuel
|
Fuel model with net fuel loadings, heat content, and
optimum reaction velocity ( |
required |
dead_moist_damping
|
float
|
Dead fuel moisture damping coefficient in [0, 1]. |
required |
live_moist_damping
|
float
|
Live fuel moisture damping coefficient in [0, 1]. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Reaction intensity (BTU/ft²/min). |
Source code in embrs/models/rothermel.py
370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 | |
calc_eccentricity(fuel, R_h, R_0)
¶
Compute fire ellipse eccentricity from effective wind speed.
Convert the effective wind speed to m/s, then compute the length-to-
breadth ratio z and derive eccentricity. Capped at z = 8.0
following Anderson (1983).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fuel
|
Fuel
|
Fuel model for effective wind speed calculation. |
required |
R_h
|
float
|
Head-fire rate of spread (ft/min). |
required |
R_0
|
float
|
No-wind, no-slope base ROS (ft/min). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Fire ellipse eccentricity in [0, 1). |
Source code in embrs/models/rothermel.py
557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 | |
calc_effective_wind_factor(R_h, R_0)
¶
Compute the effective wind factor from head-fire and base ROS.
The effective wind factor (phi_e) represents the combined influence of wind and slope as if it were a single wind-only factor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
R_h
|
float
|
Head-fire rate of spread (ft/min). |
required |
R_0
|
float
|
No-wind, no-slope base ROS (ft/min). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Effective wind factor (dimensionless). |
Source code in embrs/models/rothermel.py
513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 | |
calc_effective_wind_speed(fuel, R_h, R_0)
¶
Compute the effective wind speed from the effective wind factor.
Invert the wind factor equation to recover the equivalent wind speed that produces the same effect as the combined wind and slope.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fuel
|
Fuel
|
Fuel model with wind coefficients |
required |
R_h
|
float
|
Head-fire rate of spread (ft/min). |
required |
R_0
|
float
|
No-wind, no-slope base ROS (ft/min). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Effective wind speed (ft/min). Returns 0 when |
Source code in embrs/models/rothermel.py
530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 | |
calc_flame_len(cell)
¶
Estimate flame length from maximum fireline intensity.
For surface fires, uses Brown and Davis (1973) correlation. For crown fires, uses Thomas (1963) correlation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell
|
Cell
|
Cell with |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Flame length in feet. |
Source code in embrs/models/rothermel.py
580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 | |
calc_heat_sink(fuel, m_f)
¶
Compute heat sink term for the Rothermel spread equation.
The heat sink represents the energy required to raise the fuel ahead of the fire front to ignition temperature, weighted by fuel class properties and moisture contents.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fuel
|
Fuel
|
Fuel model with bulk density, weighting factors, and surface-area-to-volume ratios. |
required |
m_f
|
ndarray
|
Fuel moisture content array of shape (6,) as fractions. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Heat sink (BTU/ft³). |
Source code in embrs/models/rothermel.py
396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 | |
calc_live_mx(fuel, m_f)
¶
Compute live fuel moisture of extinction.
Determine the threshold moisture content above which live fuels will
not sustain combustion, based on the ratio of dead-to-live fuel loading
(fuel.W) and the dead characteristic moisture.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fuel
|
Fuel
|
Fuel model with loading ratio |
required |
m_f
|
float
|
Weighted characteristic dead fuel moisture (fraction). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Live fuel moisture of extinction (fraction). Clamped to be
at least |
Source code in embrs/models/rothermel.py
337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | |
calc_mineral_damping(s_e=0.01)
¶
Compute mineral damping coefficient.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
s_e
|
float
|
Effective mineral content (fraction). Defaults to 0.010 (standard value for wildland fuels). |
0.01
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Mineral damping coefficient (dimensionless). |
Source code in embrs/models/rothermel.py
495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 | |
calc_moisture_damping(m_f, m_x)
¶
Compute moisture damping coefficient for dead or live fuel.
Evaluates a cubic polynomial in the moisture ratio m_f / m_x
(Rothermel 1972, Eq. 29). Returns 0 when moisture of extinction is
zero or when the polynomial evaluates to a negative value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
m_f
|
float
|
Characteristic fuel moisture content (fraction). |
required |
m_x
|
float
|
Moisture of extinction (fraction). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Moisture damping coefficient in [0, 1]. |
Source code in embrs/models/rothermel.py
469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 | |
calc_r_0(fuel, m_f)
¶
Compute no-wind, no-slope base rate of spread and reaction intensity.
Evaluate the Rothermel (1972) equations for base ROS using fuel properties and moisture content. This is the fundamental spread rate before wind and slope adjustments.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fuel
|
Fuel
|
Fuel model with precomputed constants. |
required |
m_f
|
ndarray
|
Fuel moisture content array of shape (6,) with entries [1h, 10h, 100h, dead herb, live herb, live woody] as fractions (g water / g fuel). |
required |
Returns:
| Type | Description |
|---|---|
Tuple[float, float]
|
Tuple[float, float]: |
Source code in embrs/models/rothermel.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | |
calc_r_h(cell, R_0=None, I_r=None)
¶
Compute head-fire rate of spread combining wind and slope effects.
Resolve the wind and slope vectors to determine the maximum spread
direction (alpha) and head-fire ROS (R_h). Wind speed is capped
at 0.9 × reaction intensity per Rothermel's wind limit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell
|
Cell
|
Cell with wind, slope, fuel, and moisture data. |
required |
R_0
|
float
|
Pre-computed no-wind, no-slope ROS (ft/min). Computed internally if None. |
None
|
I_r
|
float
|
Pre-computed reaction intensity (BTU/ft²/min). Computed internally if None. |
None
|
Returns:
| Type | Description |
|---|---|
Tuple[float, float, float, float]
|
Tuple[float, float, float, float]: |
Side Effects
May update cell.aspect when slope is zero (set to wind direction).
Source code in embrs/models/rothermel.py
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | |
calc_slope_factor(fuel, phi)
¶
Compute the slope factor (phi_s) for the Rothermel spread equation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fuel
|
Fuel
|
Fuel model with bulk density |
required |
phi
|
float
|
Slope angle (radians). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Dimensionless slope factor (phi_s). |
Source code in embrs/models/rothermel.py
451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 | |
calc_vals_for_all_directions(cell, R_h, I_r, alpha, e, I_h=None)
¶
Compute ROS and fireline intensity along all spread directions.
Use the fire ellipse (eccentricity e) and the combined wind/slope
heading alpha to resolve the head-fire ROS into each of the cell's
spread directions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell
|
Cell
|
Cell providing directions and fuel properties. |
required |
R_h
|
float
|
Head-fire rate of spread (ft/min for surface, m/min for crown fire). |
required |
I_r
|
float
|
Reaction intensity (BTU/ft²/min). Ignored when
|
required |
alpha
|
float
|
Combined wind/slope heading in radians, relative to the cell's aspect (upslope direction). |
required |
e
|
float
|
Fire ellipse eccentricity in [0, 1). |
required |
I_h
|
float
|
Head-fire fireline intensity (BTU/ft/min).
When provided, directional intensities are scaled from this
value instead of being computed from |
None
|
Returns:
| Type | Description |
|---|---|
Tuple[ndarray, ndarray]
|
Tuple[np.ndarray, np.ndarray]: |
Source code in embrs/models/rothermel.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | |
calc_wind_factor(fuel, wind_speed)
¶
Compute the wind factor (phi_w) for the Rothermel spread equation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fuel
|
Fuel
|
Fuel model with precomputed wind coefficients
|
required |
wind_speed
|
float
|
Midflame wind speed (ft/min). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Dimensionless wind factor (phi_w). |
Source code in embrs/models/rothermel.py
436 437 438 439 440 441 442 443 444 445 446 447 448 449 | |
calc_wind_slope_vec(R_0, phi_w, phi_s, angle)
¶
Compute the combined wind and slope vector magnitude and direction.
Resolve wind and slope spread factors into a single resultant vector using Rothermel's vector addition method.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
R_0
|
float
|
No-wind, no-slope ROS (ft/min). |
required |
phi_w
|
float
|
Wind factor (dimensionless). |
required |
phi_s
|
float
|
Slope factor (dimensionless). |
required |
angle
|
float
|
Angle between wind and upslope directions (radians). |
required |
Returns:
| Type | Description |
|---|---|
Tuple[float, float]
|
Tuple[float, float]: |
Source code in embrs/models/rothermel.py
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | |
ft_min_to_m_s(f_ft_min)
¶
Convert speed from feet per minute to meters per second.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_ft_min
|
float
|
Speed in ft/min. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Speed in m/s. |
Source code in embrs/utilities/unit_conversions.py
92 93 94 95 96 97 98 99 100 101 | |
ft_min_to_mph(f_ft_min)
¶
Convert speed from feet per minute to miles per hour.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_ft_min
|
float
|
Speed in ft/min. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Speed in mph. |
Source code in embrs/utilities/unit_conversions.py
116 117 118 119 120 121 122 123 124 125 | |
ft_to_m(f_ft)
¶
Convert length from feet to meters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_ft
|
float
|
Length in feet. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Length in meters. |
Source code in embrs/utilities/unit_conversions.py
76 77 78 79 80 81 82 83 84 85 | |
get_characteristic_moistures(fuel, m_f)
¶
Compute weighted characteristic dead and live fuel moisture contents.
Use fuel weighting factors (f_dead_arr, f_live_arr) to collapse
the per-class moisture array into single dead and live values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fuel
|
Fuel
|
Fuel model providing weighting arrays. |
required |
m_f
|
ndarray
|
Moisture content array of shape (6,) as fractions. |
required |
Returns:
| Type | Description |
|---|---|
Tuple[float, float]
|
Tuple[float, float]: |
Source code in embrs/models/rothermel.py
318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 | |
m_s_to_ft_min(m_s)
¶
Convert speed from meters per second to feet per minute.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
m_s
|
float
|
Speed in m/s. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Speed in ft/min. |
Source code in embrs/utilities/unit_conversions.py
104 105 106 107 108 109 110 111 112 113 | |
m_to_ft(f_m)
¶
Convert length from meters to feet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_m
|
float
|
Length in meters. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Length in feet. |
Source code in embrs/utilities/unit_conversions.py
64 65 66 67 68 69 70 71 72 73 | |
mph_to_ft_min(f_mph)
¶
Convert speed from miles per hour to feet per minute.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_mph
|
float
|
Speed in mph. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Speed in ft/min. |
Source code in embrs/utilities/unit_conversions.py
128 129 130 131 132 133 134 135 136 137 | |
surface_fire(cell)
¶
Compute steady-state surface fire ROS and fireline intensity for a cell.
Calculate the head-fire rate of spread (R_h), then resolve spread rates and fireline intensities along all 12 spread directions using fire ellipse geometry. Results are stored directly on the cell object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell
|
Cell
|
Cell to evaluate. Must have fuel, moisture, wind, slope, and direction attributes populated. |
required |
Side Effects
Sets cell.r_ss (m/s), cell.I_ss (BTU/ft/min),
cell.r_h_ss (m/s), cell.reaction_intensity (BTU/ft²/min),
cell.alpha (radians), and cell.e (eccentricity) on the cell.
Source code in embrs/models/rothermel.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
Grid management for hexagonal fire simulation.
This module provides the GridManager class which handles all grid-related operations for the fire simulation, including cell storage, coordinate conversion, neighbor calculations, and geometry operations.
Classes:
| Name | Description |
|---|---|
- GridManager |
Manages the hexagonal cell grid for fire simulation. |
GridManager
¶
Manages the hexagonal cell grid for fire simulation.
Handles grid initialization, cell storage, coordinate conversion between Cartesian and grid indices, neighbor calculations, and geometry-based cell lookups.
Attributes:
| Name | Type | Description |
|---|---|---|
cell_grid |
ndarray
|
2D array of Cell objects. |
cell_dict |
Dict[int, Cell]
|
Dictionary mapping cell IDs to Cell objects. |
shape |
Tuple[int, int]
|
Grid dimensions (num_rows, num_cols). |
cell_size |
float
|
Edge length of hexagonal cells in meters. |
Source code in embrs/base_classes/grid_manager.py
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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 | |
cell_dict
property
¶
Dictionary mapping cell IDs to Cell objects.
cell_grid
property
¶
2D array of Cell objects.
cell_size
property
¶
Edge length of hexagonal cells in meters.
num_cols
property
¶
Number of columns in the grid.
num_rows
property
¶
Number of rows in the grid.
shape
property
¶
Grid dimensions (num_rows, num_cols).
__init__(num_rows, num_cols, cell_size)
¶
Initialize the grid manager.
Creates the backing array for the hexagonal cell grid but does not populate cells. Use init_grid() to populate with Cell objects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num_rows
|
int
|
Number of rows in the grid. |
required |
num_cols
|
int
|
Number of columns in the grid. |
required |
cell_size
|
float
|
Edge length of hexagonal cells in meters. |
required |
Source code in embrs/base_classes/grid_manager.py
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 | |
add_cell_neighbors()
¶
Populate neighbor references for all cells in the grid.
For each cell, determines its neighbors based on hexagonal grid geometry (even/odd row offset pattern) and stores neighbor IDs with their relative positions.
Source code in embrs/base_classes/grid_manager.py
331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 | |
compute_all_cell_positions()
¶
Pre-compute world coordinates for all cell centers.
Uses vectorized operations to compute x,y positions for all cells in the grid based on hexagonal geometry.
The formula matches Cell.init: - Even row: x = col * cell_size * sqrt(3) - Odd row: x = (col + 0.5) * cell_size * sqrt(3) - y = row * cell_size * 1.5
Returns:
| Type | Description |
|---|---|
ndarray
|
Tuple of (all_x, all_y) where each is a 2D numpy array with |
ndarray
|
shape (num_rows, num_cols) containing the cell center coordinates. |
Source code in embrs/base_classes/grid_manager.py
392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 | |
compute_data_indices(all_x, all_y, data_res, data_rows, data_cols)
¶
Convert cell positions to terrain data array indices.
Vectorized computation of which terrain data pixels correspond to each cell center.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
all_x
|
ndarray
|
2D array of cell x coordinates. |
required |
all_y
|
ndarray
|
2D array of cell y coordinates. |
required |
data_res
|
float
|
Resolution of terrain data in meters per pixel. |
required |
data_rows
|
int
|
Number of rows in terrain data arrays. |
required |
data_cols
|
int
|
Number of columns in terrain data arrays. |
required |
Returns:
| Type | Description |
|---|---|
Tuple[ndarray, ndarray]
|
Tuple of (data_row_indices, data_col_indices) as 2D integer arrays. |
Source code in embrs/base_classes/grid_manager.py
426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 | |
get_cell_from_indices(row, col)
¶
Return the cell at grid indices [row, col].
Columns increase left to right, rows increase bottom to top.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
row
|
int
|
Row index of the desired cell. |
required |
col
|
int
|
Column index of the desired cell. |
required |
Returns:
| Type | Description |
|---|---|
Cell
|
Cell at the specified indices. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If row or col is not an integer. |
ValueError
|
If row or col is out of bounds. |
Source code in embrs/base_classes/grid_manager.py
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | |
get_cell_from_xy(x_m, y_m, oob_ok=False)
¶
Return the cell containing the point (x_m, y_m) in Cartesian coordinates.
Converts Cartesian coordinates to hexagonal grid indices and returns the cell at that position.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_m
|
float
|
x position in meters. (0,0) is lower-left corner. |
required |
y_m
|
float
|
y position in meters. y increases upward. |
required |
oob_ok
|
bool
|
If True, return None for out-of-bounds coordinates. If False, raise ValueError. |
False
|
Returns:
| Type | Description |
|---|---|
Optional[Cell]
|
Cell at the requested point, or None if out of bounds and oob_ok=True. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If coordinates are out of bounds and oob_ok=False. |
Source code in embrs/base_classes/grid_manager.py
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | |
get_cells_at_geometry(geom)
¶
Get all cells that intersect with the given geometry.
Supports Point, LineString, and Polygon geometries from Shapely.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
geom
|
Union[Polygon, LineString, Point]
|
Shapely geometry to check for cell intersections. |
required |
Returns:
| Type | Description |
|---|---|
List[Cell]
|
List of Cell objects that intersect with the geometry. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If geometry type is not supported. |
Source code in embrs/base_classes/grid_manager.py
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | |
get_cells_in_radius(center_x, center_y, radius)
¶
Get all cells within a given radius of a center point.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
center_x
|
float
|
x coordinate of center point in meters. |
required |
center_y
|
float
|
y coordinate of center point in meters. |
required |
radius
|
float
|
Radius in meters. |
required |
Returns:
| Type | Description |
|---|---|
List[Cell]
|
List of Cell objects within the specified radius. |
Source code in embrs/base_classes/grid_manager.py
359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 | |
hex_round(q, r)
¶
Round floating point hex coordinates to their nearest integer hex coordinates.
Uses cube coordinate rounding to find the nearest valid hexagonal cell. The algorithm ensures the cube coordinate constraint (q + r + s = 0) is maintained.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q
|
float
|
q coordinate in hex coordinate system. |
required |
r
|
float
|
r coordinate in hex coordinate system. |
required |
Returns:
| Type | Description |
|---|---|
Tuple[int, int]
|
Tuple of (q, r) integer coordinates of the nearest hex cell. |
Source code in embrs/base_classes/grid_manager.py
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | |
init_grid(cell_factory, progress_callback=None)
¶
Initialize the grid by creating cells using the provided factory.
Iterates through all grid positions and calls the cell factory to create each cell. The factory is responsible for creating fully initialized Cell objects with terrain data, fuel types, etc.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell_factory
|
Callable[[int, int, int], Cell]
|
Callable that takes (cell_id, col, row) and returns a fully initialized Cell object. The factory should handle: - Creating the Cell with correct position - Setting terrain data (elevation, slope, aspect, etc.) - Setting fuel type and moisture values - Setting wind forecast data - Any other cell initialization |
required |
progress_callback
|
Optional[Callable[[int], None]]
|
Optional callable that takes the number of cells processed (1 per call) for progress tracking. Can be used with tqdm or other progress indicators. |
None
|
Example
def my_cell_factory(cell_id, col, row): cell = Cell(cell_id, col, row, cell_size) cell.set_parent(sim) # ... initialize cell data ... return cell
grid_manager.init_grid(my_cell_factory, pbar.update)
Source code in embrs/base_classes/grid_manager.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | |
set_cell(row, col, cell)
¶
Place a cell in the grid at the specified position.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
row
|
int
|
Row index. |
required |
col
|
int
|
Column index. |
required |
cell
|
Cell
|
Cell object to place. |
required |
Source code in embrs/base_classes/grid_manager.py
98 99 100 101 102 103 104 105 106 107 | |
Weather management for fire simulation.
This module provides the WeatherManager class which handles all weather-related operations for the fire simulation, including weather stream management, wind forecast handling, and weather update logic.
Classes:
| Name | Description |
|---|---|
- WeatherManager |
Manages weather data and forecasts for fire simulation. |
WeatherManager
¶
Manages weather data and forecasts for fire simulation.
Handles weather stream management, wind forecast data, and weather update timing. Used by BaseFireSim to track and update weather conditions during simulation.
Attributes:
| Name | Type | Description |
|---|---|---|
weather_stream |
WeatherStream
|
The weather stream object providing weather data over time. |
curr_weather_idx |
int
|
Current index in the weather stream. |
wind_forecast |
ndarray
|
Wind forecast array with shape (time_steps, rows, cols, 2) where last dimension is (speed, direction). |
wind_res |
float
|
Wind resolution in meters. |
Source code in embrs/base_classes/weather_manager.py
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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | |
curr_weather_idx
property
writable
¶
Current index in the weather stream.
last_weather_update
property
writable
¶
Timestamp of last weather update in seconds.
sim_start_w_idx
property
¶
Weather stream index at simulation start.
weather_changed
property
writable
¶
Whether weather has changed since last check.
weather_stream
property
¶
The weather stream object.
weather_t_step
property
¶
Weather time step in seconds.
wind_forecast
property
writable
¶
Wind forecast array.
wind_res
property
¶
Wind resolution in meters.
wind_xpad
property
¶
Wind x-axis padding in meters.
wind_ypad
property
¶
Wind y-axis padding in meters.
__init__(weather_stream=None, wind_forecast=None, wind_res=100.0, sim_size=(0.0, 0.0))
¶
Initialize the weather manager.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
weather_stream
|
Optional[WeatherStream]
|
WeatherStream object providing weather data. Can be None for prediction models that don't use weather stream. |
None
|
wind_forecast
|
Optional[ndarray]
|
Wind forecast array. If None, defaults to zeros. |
None
|
wind_res
|
float
|
Wind resolution in meters. |
100.0
|
sim_size
|
Tuple[float, float]
|
Simulation domain size (width, height) in meters. |
(0.0, 0.0)
|
Source code in embrs/base_classes/weather_manager.py
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 68 69 70 71 72 73 74 75 76 77 | |
calc_wind_padding(forecast)
¶
Calculate padding offsets between wind forecast grid and simulation grid.
The wind forecast grid may not align exactly with the simulation boundaries. This calculates the x and y offsets needed to center the forecast within the simulation domain.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
forecast
|
ndarray
|
Wind forecast array with shape (time_steps, rows, cols, 2) where last dimension is (speed, direction). |
required |
Returns:
| Type | Description |
|---|---|
Tuple[float, float]
|
Tuple[float, float]: (x_padding, y_padding) in meters. |
Source code in embrs/base_classes/weather_manager.py
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | |
get_cell_wind(cell_x, cell_y)
¶
Get wind speed and direction arrays for a cell position.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell_x
|
float
|
Cell x position in meters. |
required |
cell_y
|
float
|
Cell y position in meters. |
required |
Returns:
| Type | Description |
|---|---|
Tuple[ndarray, ndarray]
|
Tuple[np.ndarray, np.ndarray]: (wind_speed, wind_dir) arrays across all forecast time steps. |
Source code in embrs/base_classes/weather_manager.py
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | |
get_wind_indices(cell_x, cell_y)
¶
Get wind forecast array indices for a cell position.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell_x
|
float
|
Cell x position in meters. |
required |
cell_y
|
float
|
Cell y position in meters. |
required |
Returns:
| Type | Description |
|---|---|
Tuple[int, int]
|
Tuple[int, int]: (wind_row, wind_col) indices into wind forecast array. |
Source code in embrs/base_classes/weather_manager.py
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | |
update_weather(curr_time_s)
¶
Updates the current wind conditions based on the forecast.
This method checks whether the time elapsed since the last wind update exceeds the wind forecast time step. If so, it updates the wind index and retrieves the next forecasted wind condition. If the forecast has no remaining entries, it raises a ValueError.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
curr_time_s
|
float
|
Current simulation time in seconds. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the wind conditions were updated, False otherwise. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the wind forecast runs out of entries. |
Side Effects
- Updates _last_weather_update to the current simulation time.
- Increments _curr_weather_idx to the next wind forecast entry.
- Resets _curr_weather_idx to 0 if out of bounds and raises an error.
Source code in embrs/base_classes/weather_manager.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | |
Control action handling for fire simulation.
This module provides the ControlActionHandler class which manages all fire suppression control actions including retardant application, water drops, and fireline construction.
Classes:
| Name | Description |
|---|---|
- ControlActionHandler |
Handles fire suppression control actions. |
ControlActionHandler
¶
Handles fire suppression control actions for fire simulation.
Manages retardant application, water drops, and fireline construction. Tracks active suppression effects and handles their updates over time.
Attributes:
| Name | Type | Description |
|---|---|---|
long_term_retardants |
Set[Cell]
|
Cells with active long-term retardant. |
active_water_drops |
List[Cell]
|
Cells with active water drop effects. |
active_firelines |
Dict
|
Firelines currently under construction. |
fire_break_cells |
List[Cell]
|
Cells along fire breaks. |
fire_breaks |
List
|
Completed fire breaks as (line, width, id) tuples. |
Source code in embrs/base_classes/control_handler.py
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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 | |
active_firelines
property
¶
Firelines currently under construction.
active_water_drops
property
¶
Cells with active water drop effects.
fire_break_cells
property
¶
Cells along fire breaks.
fire_break_dict
property
¶
Dictionary mapping fire break IDs to (line, width) tuples.
fire_breaks
property
¶
Completed fire breaks as (line, width, id) tuples.
long_term_retardants
property
¶
Cells with active long-term retardant.
new_fire_break_cache
property
¶
Cache of newly constructed fire breaks for logging/visualization.
__init__(grid_manager, cell_size, time_step, fuel_class_factory)
¶
Initialize the control action handler.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
grid_manager
|
GridManager
|
GridManager instance for cell lookups. |
required |
cell_size
|
float
|
Cell size in meters. |
required |
time_step
|
float
|
Simulation time step in seconds. |
required |
fuel_class_factory
|
Callable[[int], object]
|
Callable that creates a fuel class from a model number. |
required |
Source code in embrs/base_classes/control_handler.py
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 68 | |
add_retardant_at_cell(cell, duration_hr, effectiveness)
¶
Apply long-term fire retardant to the specified cell.
Effectiveness is clamped to the range [0.0, 1.0]. Only applies to burnable cells.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell
|
Cell
|
Cell to apply retardant to. |
required |
duration_hr
|
float
|
Duration of retardant effect in hours. |
required |
effectiveness
|
float
|
Retardant effectiveness factor (0.0-1.0). |
required |
Source code in embrs/base_classes/control_handler.py
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | |
add_retardant_at_indices(row, col, duration_hr, effectiveness)
¶
Apply long-term fire retardant at the specified grid indices.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
row
|
int
|
Row index in the cell grid. |
required |
col
|
int
|
Column index in the cell grid. |
required |
duration_hr
|
float
|
Duration of retardant effect in hours. |
required |
effectiveness
|
float
|
Retardant effectiveness factor (0.0-1.0). |
required |
Source code in embrs/base_classes/control_handler.py
135 136 137 138 139 140 141 142 143 144 145 146 | |
add_retardant_at_xy(x_m, y_m, duration_hr, effectiveness)
¶
Apply long-term fire retardant at the specified coordinates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_m
|
float
|
X position in meters. |
required |
y_m
|
float
|
Y position in meters. |
required |
duration_hr
|
float
|
Duration of retardant effect in hours. |
required |
effectiveness
|
float
|
Retardant effectiveness factor (0.0-1.0). |
required |
Source code in embrs/base_classes/control_handler.py
121 122 123 124 125 126 127 128 129 130 131 132 133 | |
construct_fireline(line, width_m, construction_rate=None, fireline_id=None, curr_time_s=0)
¶
Construct a fire break along a line geometry.
If construction_rate is None, the fire break is applied instantly. Otherwise, it is constructed progressively over time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
line
|
LineString
|
Shapely LineString defining the fire break path. |
required |
width_m
|
float
|
Width of the fire break in meters. |
required |
construction_rate
|
Optional[float]
|
Construction rate in m/s. If None, instant. |
None
|
fireline_id
|
Optional[str]
|
Unique identifier. Auto-generated if not provided. |
None
|
curr_time_s
|
float
|
Current simulation time in seconds. |
0
|
Returns:
| Type | Description |
|---|---|
str
|
Identifier of the constructed fire break. |
Source code in embrs/base_classes/control_handler.py
334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 | |
set_time_accessor(time_func)
¶
Set the function to get current simulation time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
time_func
|
Callable[[], float]
|
Callable that returns current time in seconds. |
required |
Source code in embrs/base_classes/control_handler.py
113 114 115 116 117 118 119 | |
set_updated_cells_ref(updated_cells)
¶
Set reference to the simulation's updated cells dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
updated_cells
|
Dict[int, Cell]
|
Dictionary to track cells that have been modified. |
required |
Source code in embrs/base_classes/control_handler.py
105 106 107 108 109 110 111 | |
stop_fireline_construction(fireline_id)
¶
Stop construction of an active fireline.
Finalizes the partially constructed fireline and adds it to the permanent fire breaks list.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fireline_id
|
str
|
Identifier of the fireline to stop constructing. |
required |
Source code in embrs/base_classes/control_handler.py
389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | |
update_active_firelines()
¶
Update progress of active fireline construction.
Extends partially constructed fire lines based on their construction rate. Completes fire lines that reach their full length.
Source code in embrs/base_classes/control_handler.py
405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 | |
update_long_term_retardants(curr_time_s)
¶
Update long-term retardant effects and remove expired retardants.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
curr_time_s
|
float
|
Current simulation time in seconds. |
required |
Source code in embrs/base_classes/control_handler.py
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | |
water_drop_at_cell_as_moisture_bump(cell, moisture_inc)
¶
Apply water drop as direct moisture increase to the specified cell.
Only applies to burnable cells. Adds cell to active water drops for moisture tracking.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell
|
Cell
|
Cell to apply water to. |
required |
moisture_inc
|
float
|
Moisture content increase as a fraction. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If moisture_inc is negative. |
Source code in embrs/base_classes/control_handler.py
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | |
water_drop_at_cell_as_rain(cell, water_depth_cm)
¶
Apply water drop as equivalent rainfall to the specified cell.
Only applies to burnable cells. Adds cell to active water drops for moisture tracking.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell
|
Cell
|
Cell to apply water to. |
required |
water_depth_cm
|
float
|
Equivalent rainfall depth in centimeters. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If water_depth_cm is negative. |
Source code in embrs/base_classes/control_handler.py
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | |
water_drop_at_cell_vw(cell, volume_L, efficiency=2.5, T_a=20.0)
¶
Apply Van Wagner energy-balance water drop to the specified cell.
Only applies to burnable cells. Adds cell to active water drops for tracking.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell
|
Cell
|
Cell to apply water to. |
required |
volume_L
|
float
|
Water volume in liters (1 L = 1 kg). |
required |
efficiency
|
float
|
Application efficiency multiplier (Table 4). Default 2.5. |
2.5
|
T_a
|
float
|
Ambient air temperature in °C. Default 20. |
20.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If volume_L is negative. |
Source code in embrs/base_classes/control_handler.py
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 | |
water_drop_at_indices_as_moisture_bump(row, col, moisture_inc)
¶
Apply water drop as direct moisture increase at the specified grid indices.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
row
|
int
|
Row index in the cell grid. |
required |
col
|
int
|
Column index in the cell grid. |
required |
moisture_inc
|
float
|
Moisture content increase as a fraction. |
required |
Source code in embrs/base_classes/control_handler.py
247 248 249 250 251 252 253 254 255 256 257 | |
water_drop_at_indices_as_rain(row, col, water_depth_cm)
¶
Apply water drop as equivalent rainfall at the specified grid indices.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
row
|
int
|
Row index in the cell grid. |
required |
col
|
int
|
Column index in the cell grid. |
required |
water_depth_cm
|
float
|
Equivalent rainfall depth in centimeters. |
required |
Source code in embrs/base_classes/control_handler.py
201 202 203 204 205 206 207 208 209 210 211 | |
water_drop_at_indices_vw(row, col, volume_L, efficiency=2.5, T_a=20.0)
¶
Apply Van Wagner energy-balance water drop at the specified grid indices.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
row
|
int
|
Row index in the cell grid. |
required |
col
|
int
|
Column index in the cell grid. |
required |
volume_L
|
float
|
Water volume in liters (1 L = 1 kg). |
required |
efficiency
|
float
|
Application efficiency multiplier (Table 4). Default 2.5. |
2.5
|
T_a
|
float
|
Ambient air temperature in °C. Default 20. |
20.0
|
Source code in embrs/base_classes/control_handler.py
296 297 298 299 300 301 302 303 304 305 306 307 308 | |
water_drop_at_xy_as_moisture_bump(x_m, y_m, moisture_inc)
¶
Apply water drop as direct moisture increase at the specified coordinates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_m
|
float
|
X position in meters. |
required |
y_m
|
float
|
Y position in meters. |
required |
moisture_inc
|
float
|
Moisture content increase as a fraction. |
required |
Source code in embrs/base_classes/control_handler.py
234 235 236 237 238 239 240 241 242 243 244 245 | |
water_drop_at_xy_as_rain(x_m, y_m, water_depth_cm)
¶
Apply water drop as equivalent rainfall at the specified coordinates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_m
|
float
|
X position in meters. |
required |
y_m
|
float
|
Y position in meters. |
required |
water_depth_cm
|
float
|
Equivalent rainfall depth in centimeters. |
required |
Source code in embrs/base_classes/control_handler.py
188 189 190 191 192 193 194 195 196 197 198 199 | |
water_drop_at_xy_vw(x_m, y_m, volume_L, efficiency=2.5, T_a=20.0)
¶
Apply Van Wagner energy-balance water drop at the specified coordinates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_m
|
float
|
X position in meters. |
required |
y_m
|
float
|
Y position in meters. |
required |
volume_L
|
float
|
Water volume in liters (1 L = 1 kg). |
required |
efficiency
|
float
|
Application efficiency multiplier (Table 4). Default 2.5. |
2.5
|
T_a
|
float
|
Ambient air temperature in °C. Default 20. |
20.0
|
Source code in embrs/base_classes/control_handler.py
281 282 283 284 285 286 287 288 289 290 291 292 293 294 | |
Base visualization functionality for fire simulation display.
Provides common visualization components including grid rendering, weather display, static map elements (roads, firebreaks), and prediction overlays.
Classes:
| Name | Description |
|---|---|
- BaseVisualizer |
Base class for simulation visualization. |
.. autoclass:: BaseVisualizer :members:
BaseVisualizer
¶
Base class for fire simulation visualization.
Provides common visualization functionality including hexagonal grid rendering, weather data display, static elements (roads, firebreaks, elevation contours), and prediction overlays.
Attributes:
| Name | Type | Description |
|---|---|---|
fig |
Matplotlib figure object. |
|
h_ax |
Main axes for the hexagonal grid display. |
|
render |
bool
|
Whether to render to screen (False for headless). |
cell_size |
float
|
Size of hexagonal cells in meters. |
width_m |
float
|
Simulation width in meters. |
height_m |
float
|
Simulation height in meters. |
Source code in embrs/base_classes/base_visualizer.py
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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 | |
__init__(params, render=True)
¶
Initialize the visualizer with simulation parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
VisualizerInputs
|
Configuration parameters for visualization. |
required |
render
|
bool
|
Whether to render to screen. Use False for headless operation. Defaults to True. |
True
|
Source code in embrs/base_classes/base_visualizer.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |
close()
¶
Close the visualization figure.
Source code in embrs/base_classes/base_visualizer.py
432 433 434 435 436 | |
meters_to_points(meters)
¶
Convert meters to matplotlib points for sizing elements.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
meters
|
float
|
Distance in meters. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Equivalent size in matplotlib points. |
Source code in embrs/base_classes/base_visualizer.py
609 610 611 612 613 614 615 616 617 618 619 620 621 | |
reset_figure(done=False)
¶
Reset the visualization figure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
done
|
bool
|
If True, only closes without reinitializing. Defaults to False. |
False
|
Source code in embrs/base_classes/base_visualizer.py
438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 | |
update_grid(sim_time_s, entries, agents=[], actions=[])
¶
Update the grid display with new cell states.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sim_time_s
|
float
|
Current simulation time in seconds. |
required |
entries
|
list[CellLogEntry]
|
Updated cell state entries. |
required |
agents
|
list[AgentLogEntry]
|
Agent positions. Defaults to []. |
[]
|
actions
|
list[ActionsEntry]
|
Active control actions. Defaults to []. |
[]
|
Source code in embrs/base_classes/base_visualizer.py
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 | |
visualize_ensemble_prediction(burn_probability)
¶
Visualize ensemble burn probability overlay.
Displays the final burn probability from an ensemble prediction, with color intensity indicating probability of burning.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
burn_probability
|
dict
|
Dictionary mapping timestamps to dictionaries of {(x, y): probability} representing cumulative burn probability at each time step. Uses the final time step. |
required |
Source code in embrs/base_classes/base_visualizer.py
661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 | |
visualize_prediction(prediction)
¶
Visualize a fire spread prediction overlay.
Displays predicted fire arrival times as colored points on the grid, with colors indicating arrival time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prediction
|
dict
|
Dictionary mapping timestamps (seconds) to lists of (x, y) coordinate tuples where fire is predicted to arrive. |
required |
Source code in embrs/base_classes/base_visualizer.py
624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 | |