Tools Reference¶
The embrs.tools package provides standalone tools that build on top of the core simulation engine. The primary tool is FirePredictor, which runs forward fire spread predictions with uncertainty modeling and ensemble support. Supporting classes handle forecast pool management for reusing pre-computed wind forecasts across predictions, and serialization for efficient parallel execution.
The ensemble_video utility generates video visualizations of ensemble prediction output.
Fire Predictor¶
Fire prediction module for EMBRS.
Provides forward fire spread prediction with uncertainty modeling. Supports single predictions, ensemble predictions with parallel execution, and pre-computed forecast pools for efficient rollout scenarios.
Classes:
| Name | Description |
|---|---|
- FirePredictor |
Ensemble fire prediction with wind uncertainty. |
.. autoclass:: FirePredictor :members:
Anderson13
¶
Bases: Fuel
Anderson 13 standard fire behavior fuel models.
Load fuel properties from the bundled Anderson13.json data file.
Model numbers 1-13 are burnable; higher numbers (91, 92, 93, 98, 99)
represent non-burnable types.
The JSON data is cached at the class level and loaded only once.
Source code in embrs/models/fuel_models.py
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 | |
__init__(model_number, live_h_mf=0)
¶
Initialize an Anderson 13 fuel model by model number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_number
|
int
|
Anderson fuel model number (1-13 for burnable, 91/92/93/98/99 for non-burnable). |
required |
live_h_mf
|
float
|
Live herbaceous fuel moisture (fraction). Unused for Anderson 13 (not dynamic). Defaults to 0. |
0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in embrs/models/fuel_models.py
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 | |
load_fuel_models()
classmethod
¶
Load Anderson 13 fuel model data from the bundled JSON file.
Data is cached at the class level after the first call.
Source code in embrs/models/fuel_models.py
298 299 300 301 302 303 304 305 306 307 | |
update_curing(live_h_mf)
¶
Anderson 13 models have no dynamic curing — no-op.
Source code in embrs/models/fuel_models.py
349 350 351 | |
Cell
¶
Represents a hexagonal simulation cell in the wildfire model.
Each cell maintains its physical properties (elevation, slope, aspect), fuel characteristics, fire state, and interactions with neighboring cells. Cells are structured in a point-up hexagonal grid to model fire spread dynamics.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
int
|
Unique identifier for the cell. |
col |
int
|
Column index of the cell in the simulation grid. |
row |
int
|
Row index of the cell in the simulation grid. |
cell_size |
float
|
Edge length of the hexagonal cell (meters). |
cell_area |
float
|
Area of the hexagonal cell (square meters). |
x_pos |
float
|
X-coordinate of the cell in the simulation space (meters). |
y_pos |
float
|
Y-coordinate of the cell in the simulation space (meters). |
elevation_m |
float
|
Elevation of the cell (meters). |
aspect |
float
|
Upslope direction in degrees (0° = North, 90° = East, etc.). |
slope_deg |
float
|
Slope angle of the terrain at the cell (degrees). |
fuel |
Fuel
|
Fire Behavior Fuel Model (FBFM) for the cell, from either Anderson 13 or Scott-Burgan 40. |
state |
CellStates
|
Current fire state (FUEL, FIRE, BURNT). |
neighbors |
dict
|
Dictionary of adjacent cell neighbors. |
burnable_neighbors |
dict
|
Subset of |
forecast_wind_speeds |
list
|
Forecasted wind speeds in m/s. |
forecast_wind_dirs |
list
|
Forecasted wind directions in degrees (cartesian). |
Source code in embrs/fire_simulator/cell.py
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 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 | |
burnable_neighbors
property
¶
Dictionary of adjacent cells that are in a burnable state.
Same format as neighbors: keys are cell IDs, values are (dx, dy) offsets.
cell_area
property
¶
Area of the cell in square meters.
cell_size
property
¶
Size of the cell in meters.
Measured as the side length of the hexagon.
col
property
¶
Column index of the cell in the simulation grid.
elevation_m
property
¶
Elevation of the cell in meters.
fire_area_m2
property
¶
Fire area within cell via trapezoidal polar integration.
Computes A = (1/2) Σ Δθ_i · (r_i² + r_{i+1}²) / 2 over the discretized spread directions. For center ignition (n_loc=0) the sum includes a closing segment from the last direction back to the first. No area_fraction is needed — the angular range of the directions already encodes whether the fire covers the full cell, a half-cell, or a 60° sector.
Clamped to cell_area as an upper bound.
Returns 0.0 for non-burning cells, cells with no spread data, or cells where _ign_n_loc has not yet been set.
fuel
property
¶
Fuel model for this cell.
Can be any Anderson or Scott-Burgan fuel model.
n_disabled_locs
property
¶
Number of boundary locations disabled by prior suppression.
neighbors
property
¶
Dictionary of adjacent cells.
Keys are neighbor cell IDs, values are (dx, dy) tuples indicating the column and row offset from this cell to the neighbor.
row
property
¶
Row index of the cell in the simulation grid.
state
property
¶
Current fire state of the cell (FUEL, FIRE, or BURNT).
x_pos
property
¶
X-coordinate of the cell center in meters.
Increases left to right in the visualization.
y_pos
property
¶
Y-coordinate of the cell center in meters.
Increases bottom to top in the visualization.
__getstate__()
¶
Prepare cell state for pickling.
Excludes the weak reference to parent which cannot be pickled.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
Cell state dictionary with _parent set to None. |
Source code in embrs/fire_simulator/cell.py
1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 | |
__gt__(other)
¶
Compares two cells based on their unique ID.
This method allows for sorting and comparison of cells using the > (greater than) operator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other
|
Cell
|
Another cell to compare against. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
|
Raises:
| Type | Description |
|---|---|
TypeError
|
If |
Source code in embrs/fire_simulator/cell.py
1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 | |
__init__(id, col, row, cell_size)
¶
Initialize a hexagonal cell with position and geometry.
Creates a cell at the specified grid position and calculates its spatial coordinates based on the hexagonal grid layout. The cell is initialized with default values for fire state and fuel properties.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
int
|
Unique identifier for this cell. |
required |
col
|
int
|
Column index in the simulation grid. |
required |
row
|
int
|
Row index in the simulation grid. |
required |
cell_size
|
float
|
Edge length of the hexagon in meters. |
required |
Notes
- Spatial position is calculated using point-up hexagon geometry.
- For even rows: x = col * cell_size * sqrt(3)
- For odd rows: x = (col + 0.5) * cell_size * sqrt(3)
- y = row * cell_size * 1.5
Source code in embrs/fire_simulator/cell.py
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 | |
__lt__(other)
¶
Compares two cells based on their unique ID.
This method allows for sorting and comparison of cells using the < (less than) operator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other
|
Cell
|
Another cell to compare against. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
|
Raises:
| Type | Description |
|---|---|
TypeError
|
If |
Source code in embrs/fire_simulator/cell.py
1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 | |
__setstate__(state)
¶
Restore cell state after unpickling.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
dict
|
Cell state dictionary from getstate. |
required |
Source code in embrs/fire_simulator/cell.py
1331 1332 1333 1334 1335 1336 1337 | |
__str__()
¶
Returns a formatted string representation of the cell.
The string includes the cell's ID, coordinates, elevation, fuel type, and state.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
A formatted string representing the cell. |
Source code in embrs/fire_simulator/cell.py
1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 | |
add_retardant(duration_hr, effectiveness)
¶
Apply long-term fire retardant to this cell.
Marks the cell as treated with retardant, which reduces the rate of spread by the effectiveness factor until the retardant expires.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
duration_hr
|
float
|
Duration of retardant effectiveness in hours. |
required |
effectiveness
|
float
|
Reduction factor for rate of spread (0.0-1.0). A value of 0.5 reduces ROS by 50%. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If effectiveness is not in range [0, 1]. |
Side Effects
- Sets self._retardant to True.
- Sets self._retardant_factor to (1 - effectiveness).
- Sets self.retardant_expiration_s to expiration time.
Source code in embrs/fire_simulator/cell.py
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 | |
apply_vw_suppression()
¶
Apply moisture injection from accumulated Van Wagner water energy.
Called by iterate() for cells with water_applied_kJ > 0. Computes suppression ratio from current fire state, then injects moisture toward dead_mx proportionally.
Uses
- I_ss (BTU/ft/min) converted to kW/m
- fuel.w_n_dead + w_n_live (lb/ft²) converted to kg/m²
- fire_area_m2 property
- self._vw_efficiency (stored from water_drop_vw call)
- heat_to_extinguish_kJ() (Eq. 7b + 10b + Table 4)
- compute_suppression_ratio()
- compute_moisture_injection()
Side Effects
- Modifies self.fmois
- Sets self.has_steady_state = False
Source code in embrs/fire_simulator/cell.py
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 | |
calc_cell_area()
¶
Calculates the area of the hexagonal cell in square meters.
The formula for the area of a regular hexagon is:
Area = (3 * sqrt(3) / 2) * side_length²
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The area of the hexagonal cell in square meters. |
Source code in embrs/fire_simulator/cell.py
1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 | |
calc_hold_prob(flame_len_m)
¶
Calculate the probability that a fuel break will stop fire spread.
Uses the Mees et al. (1993) model to estimate the probability that a fuel discontinuity (road, firebreak) will prevent fire from crossing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
flame_len_m
|
float
|
Flame length at the fire front in meters. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Probability that the fuel break holds (0.0-1.0). Returns 0 if no fuel break is present in this cell. |
Notes
- Based on Mees, et al. (1993).
Source code in embrs/fire_simulator/cell.py
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 | |
compute_disabled_locs()
¶
Compute boundary locations consumed by current fire and add to disabled_locs.
Must be called BEFORE fire-state arrays are cleared. Uses three rules to determine which boundary locations (1-12) have been consumed.
Rule 1: Entry point is consumed. Rule 2: Each crossed intersection's exit boundary location is consumed. Rule 3: For corner ignitions, adjacent midpoints are consumed if fire has spread past half the distance in that direction.
Source code in embrs/fire_simulator/cell.py
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 | |
curr_wind()
¶
Get the current wind speed and direction at this cell.
Returns the wind conditions for the current weather interval from the cell's local wind forecast. For prediction runs, may trigger forecast updates if needed.
Returns:
| Name | Type | Description |
|---|---|---|
tuple |
tuple
|
(wind_speed, wind_direction) where speed is in m/s and direction is in degrees using cartesian convention (0° = blowing toward North/+y, 90° = blowing toward East/+x). |
Source code in embrs/fire_simulator/cell.py
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 | |
get_ign_params(n_loc)
¶
Calculate fire spread directions and distances from an ignition location.
Computes the radial spread directions from the specified ignition point within the cell to each edge or vertex. Initializes arrays for tracking rate of spread and fireline intensity in each direction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_loc
|
int
|
Ignition location index within the cell. 0=center, 1-6=vertices, 7-12=edge midpoints. |
required |
Side Effects
- Sets self.directions: array of compass directions in degrees.
- Sets self.distances: slope-adjusted distances to cell boundaries.
- Sets self.end_pts: coordinates of cell boundary points.
- Initializes self.avg_ros, self.I_t, self.r_t to zero arrays.
Source code in embrs/fire_simulator/cell.py
531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 | |
iter_neighbor_cells()
¶
Iterate over neighboring Cell objects.
Yields each adjacent cell by looking up neighbor IDs in the parent simulation's cell_dict.
Yields:
| Name | Type | Description |
|---|---|---|
Cell |
Cell
|
Each neighboring cell object. |
Notes
- Returns immediately if parent reference is None.
Source code in embrs/fire_simulator/cell.py
1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 | |
project_distances_to_surf(distances)
¶
Project horizontal distances onto the sloped terrain surface.
Adjusts the flat-ground distances to each cell edge by accounting for the slope and aspect of the terrain. This ensures fire spread distances are measured along the actual terrain surface.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
distances
|
ndarray
|
Horizontal distances to cell edges in meters. |
required |
Side Effects
- Sets self.distances to the slope-adjusted distances in meters.
Source code in embrs/fire_simulator/cell.py
512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 | |
reset_to_fuel()
¶
Reset cell to initial FUEL state, preserving terrain/fuel/geometry data.
Resets all mutable fire-state attributes to their initial values as set
by __init__ and _set_cell_data. Immutable properties such as
position, fuel model, elevation, slope, aspect, canopy attributes,
polygon, wind adjustment factor, and neighbor topology are preserved.
This is used by FirePredictor to efficiently restore cells to a clean state between predictions, avoiding expensive deepcopy operations.
Side Effects
- Resets fire state to CellStates.FUEL
- Clears all spread tracking arrays
- Resets suppression effects (retardant, rain, firebreaks)
- Resets fuel moisture to initial values
- Restores full neighbor set to _burnable_neighbors
Source code in embrs/fire_simulator/cell.py
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 | |
set_arrays()
¶
Initialize fuel moisture tracking arrays for this cell.
DFM objects are created lazily on first moisture update to avoid allocating ~12 numpy arrays per object for cells that never burn.
Side Effects
- Sets self.wdry and self.sigma from fuel model properties.
- Initializes self.fmois array with initial moisture fractions.
- Sets self._dfms_needed tuple for lazy DFM creation.
Source code in embrs/fire_simulator/cell.py
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 | |
set_parent(parent)
¶
Sets the parent BaseFire object for this cell.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
BaseFireSim
|
The BaseFire object that owns this cell. |
required |
Source code in embrs/fire_simulator/cell.py
167 168 169 170 171 172 173 | |
suppress_to_fuel()
¶
Suppress cell back to FUEL state, preserving moisture and disabled_locs.
Similar to reset_to_fuel() but preserves: - disabled_locs (accumulated consumed boundary locations) - _suppression_count (incremented) - Fuel moisture state (fmois, dfms, moist_update_time_s)
Clears fire-state arrays, VW water state, and crown fire state. Restores burnable_neighbors from full neighbor set.
Source code in embrs/fire_simulator/cell.py
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 | |
to_log_entry(time)
¶
Create a log entry capturing the cell's current state.
Generates a structured record of the cell's fire behavior, fuel moisture, wind conditions, and other properties for logging and playback.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
time
|
float
|
Current simulation time in seconds. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
CellLogEntry |
CellLogEntry
|
Dataclass containing cell state for logging. |
Source code in embrs/fire_simulator/cell.py
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 | |
to_polygon()
¶
Generates a Shapely polygon representation of the hexagonal cell.
The polygon is created in a point-up orientation using the center (x_pos, y_pos)
and the hexagon's side length.
Returns:
| Name | Type | Description |
|---|---|---|
Polygon |
Polygon
|
A Shapely polygon representing the hexagonal cell. |
Source code in embrs/fire_simulator/cell.py
1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 | |
water_drop_as_moisture_bump(moisture_bump)
¶
Apply a water drop as a direct fuel moisture increase.
Simulates water delivery by directly increasing the outer node moisture of each dead fuel class, then advances the moisture model briefly to allow diffusion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
moisture_bump
|
float
|
Moisture fraction to add to fuel surface. |
required |
Side Effects
- Increases outer node moisture on each DeadFuelMoisture object.
- Advances moisture model by 30 seconds.
- Updates self.fmois with new moisture fractions.
Notes
- No effect on non-burnable fuel types.
Source code in embrs/fire_simulator/cell.py
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 | |
water_drop_as_rain(water_depth_cm, duration_s=30)
¶
Apply a water drop modeled as equivalent rainfall.
Simulates water delivery by treating the water as cumulative rainfall input to the fuel moisture model. Updates moisture state immediately.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
water_depth_cm
|
float
|
Equivalent water depth in centimeters. |
required |
duration_s
|
float
|
Duration of the water application in seconds. |
30
|
Side Effects
- Updates self.local_rain with accumulated water depth.
- Advances moisture model through the application period.
- Updates self.fmois with new moisture fractions.
Notes
- No effect on non-burnable fuel types.
Source code in embrs/fire_simulator/cell.py
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 | |
water_drop_vw(volume_L, efficiency=2.5, T_a=20.0)
¶
Apply water using Van Wagner (2022) energy-balance model.
Converts water volume to cooling energy (Eq. 1b) and accumulates in water_applied_kJ. Moisture injection is applied during iterate() by apply_vw_suppression().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
volume_L
|
float
|
Water volume in liters (1 L = 1 kg). |
required |
efficiency
|
float
|
Application efficiency multiplier (Table 4, Van Wagner 2022). Typical range 2.0–4.0. Default 2.5. |
2.5
|
T_a
|
float
|
Ambient air temperature in °C. Default 20. |
20.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If volume_L < 0. |
Source code in embrs/fire_simulator/cell.py
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 | |
CrownStatus
¶
Enumeration of crown fire status values.
Attributes:
| Name | Type | Description |
|---|---|---|
NONE |
int
|
No crown fire activity (value: 0). |
PASSIVE |
int
|
Passive crown fire (value: 1). |
ACTIVE |
int
|
Active crown fire (value: 2). |
Source code in embrs/utilities/fire_util.py
76 77 78 79 80 81 82 83 84 | |
FirePredictor
¶
Bases: BaseFireSim
Fire spread predictor with uncertainty modeling.
Extends BaseFireSim to run forward predictions from the current fire state. Supports wind uncertainty via AR(1) perturbations, rate of spread bias, and ensemble predictions with parallel execution.
The predictor maintains a reference to the parent FireSim and synchronizes its state before each prediction. For ensemble predictions, the predictor is serialized and reconstructed in worker processes without the parent reference.
Attributes:
| Name | Type | Description |
|---|---|---|
fire |
FireSim
|
Reference to the parent fire simulation. None in workers. |
time_horizon_hr |
float
|
Prediction duration in hours. |
wind_uncertainty_factor |
float
|
Scaling factor for wind perturbation (0-1). |
wind_speed_bias |
float
|
Constant wind speed bias in m/s. |
wind_dir_bias |
float
|
Constant wind direction bias in degrees. |
ros_bias_factor |
float
|
Multiplicative factor for rate of spread (0.5-1.5). |
dead_mf |
float
|
Dead fuel moisture fraction for prediction. |
live_mf |
float
|
Live fuel moisture fraction for prediction. |
model_spotting |
bool
|
Whether to model ember spotting. |
Source code in embrs/tools/fire_predictor.py
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 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 | |
__getstate__()
¶
Serialize predictor for parallel execution.
Return only the essential data needed to reconstruct the predictor in a worker process. Exclude non-serializable components like the parent FireSim reference, visualizer, and logger.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
Minimal state dictionary containing serialization_data, orig_grid, orig_dict, and c_size. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If prepare_for_serialization() was not called first. |
Source code in embrs/tools/fire_predictor.py
1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 | |
__init__(params, fire)
¶
Initialize fire predictor with parameters and parent simulation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
PredictorParams
|
Configuration for prediction behavior including time horizon, uncertainty factors, and fuel moisture. |
required |
fire
|
FireSim
|
Parent fire simulation to predict from. The predictor synchronizes with this simulation before each prediction run. |
required |
Source code in embrs/tools/fire_predictor.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | |
__setstate__(state)
¶
Reconstruct predictor in worker process without full initialization.
Manually restore all attributes that BaseFireSim.init() would set, but without the expensive cell creation loop. Use pre-built cell templates (orig_grid, orig_dict) instead of reconstructing cells from map data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
dict
|
State dictionary from getstate containing serialization_data, orig_grid, orig_dict, and c_size. |
required |
Side Effects
Restores all instance attributes needed for prediction, including maps, fuel models, weather stream, and optionally wind forecast. Sets fire to None (no parent reference in workers).
Source code in embrs/tools/fire_predictor.py
1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 | |
cleanup()
¶
Release all predictor resources including forecast pools.
Clears all active forecast pools managed by ForecastPoolManager and all prediction output data. Should be called when the predictor is no longer needed to free memory.
This method is safe to call multiple times.
Example
predictor = FirePredictor(params, fire) pool = predictor.generate_forecast_pool(30) output = predictor.run_ensemble(estimates, forecast_pool=pool)
When done with prediction¶
predictor.cleanup()
Source code in embrs/tools/fire_predictor.py
1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 | |
clear_prediction_data()
¶
Clear all prediction output data structures.
Frees memory used by spread tracking, flame lengths, fire line intensities, and other per-timestep data accumulated during prediction.
This is called automatically by cleanup() but can also be called separately to free memory while keeping the predictor usable.
Note
The next call to predict() will re-initialize these data structures, so this is safe to call between predictions.
Source code in embrs/tools/fire_predictor.py
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 | |
generate_forecast_pool(n_forecasts, num_workers=None, random_seed=None)
¶
Generate a pool of perturbed wind forecasts in parallel.
Create n_forecasts independent wind forecasts, each with different AR(1) perturbations applied to the base weather stream. WindNinja is called in parallel for efficiency.
The resulting pool can be reused across multiple ensemble runs. When passed to run_ensemble with explicit forecast_indices, each member uses the specified forecast. When forecast_indices is omitted, run_ensemble samples from the pool with replacement.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_forecasts
|
int
|
Number of forecasts to generate. |
required |
num_workers
|
int
|
Number of parallel workers. Defaults to min(cpu_count, n_forecasts). |
None
|
random_seed
|
int
|
Base seed for reproducibility. If None, uses random seeds for each forecast. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
ForecastPool |
ForecastPool
|
Container with all generated forecasts, base weather stream, map parameters, and creation metadata. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If called without a fire reference (fire is None). |
Source code in embrs/tools/fire_predictor.py
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 | |
prepare_for_serialization(vary_wind=False, forecast_pool=None, forecast_indices=None)
¶
Prepare predictor for parallel execution by extracting serializable data.
Must be called once before pickling the predictor. Capture the current state of the parent FireSim and store it in a serializable format. Call this in the main process before spawning workers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vary_wind
|
bool
|
If True, workers generate their own wind forecasts. If False, use pre-computed shared wind forecast. Defaults to False. |
False
|
forecast_pool
|
ForecastPool
|
Optional pre-computed forecast pool. |
None
|
forecast_indices
|
list[int]
|
Indices mapping each ensemble member to a forecast in the pool. |
None
|
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If called without a fire reference (fire is None). |
Side Effects
Populates _serialization_data dict with fire state, parameters, weather stream, and optionally pre-computed wind forecast.
Source code in embrs/tools/fire_predictor.py
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 | |
run(fire_estimate=None, visualize=False)
¶
Run a single fire spread prediction.
Executes forward prediction from either the current fire simulation state or a provided state estimate. Synchronizes with the parent fire simulation, generates perturbed wind forecasts, and iterates the fire spread model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fire_estimate
|
StateEstimate
|
Optional state estimate to initialize from. If None, uses current fire simulation state. If provided with start_time_s, prediction starts from that future time. |
None
|
visualize
|
bool
|
If True, display prediction on fire visualizer. Defaults to False. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
PredictionOutput |
PredictionOutput
|
Contains spread timeline (cell positions by time), flame length, fireline intensity, rate of spread, spread direction, crown fire status, hold probabilities, and breach status. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If fire_estimate.start_time_s is in the past or beyond weather forecast coverage. |
Source code in embrs/tools/fire_predictor.py
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 | |
run_ensemble(state_estimates, visualize=False, num_workers=None, random_seeds=None, return_individual=False, predictor_params_list=None, vary_wind_per_member=False, forecast_pool=None, forecast_indices=None)
¶
Run ensemble predictions using multiple initial state estimates.
Execute predictions in parallel, each starting from a different StateEstimate. Results are aggregated into probabilistic burn maps and fire behavior statistics.
Uses custom serialization to efficiently transfer predictor state to worker processes without reconstructing the full FireSim.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state_estimates
|
list[StateEstimate]
|
Initial fire states for each ensemble member. Each may include burning_polys, burnt_polys, and optional start_time_s. |
required |
visualize
|
bool
|
If True, visualize aggregated burn probability on the fire visualizer. Defaults to False. |
False
|
num_workers
|
int
|
Number of parallel workers. Defaults to cpu_count. |
None
|
random_seeds
|
list[int]
|
Optional seeds for reproducibility, one per state estimate. |
None
|
return_individual
|
bool
|
If True, include individual PredictionOutput objects in the returned EnsemblePredictionOutput. Defaults to False. |
False
|
predictor_params_list
|
list[PredictorParams]
|
Optional per-member parameters. If provided, each member uses its own params. Automatically enables vary_wind_per_member unless using forecast_pool. |
None
|
vary_wind_per_member
|
bool
|
If True, each worker generates its own perturbed wind forecast. If False, all members share the same wind forecast. Ignored when forecast_pool is provided. |
False
|
forecast_pool
|
ForecastPool
|
Optional pre-computed forecasts. Workers use forecasts from pool instead of running WindNinja. |
None
|
forecast_indices
|
list[int]
|
Optional indices into forecast_pool, one per state_estimate. If None, indices are sampled randomly with replacement. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
EnsemblePredictionOutput |
EnsemblePredictionOutput
|
Aggregated ensemble results including burn probability maps, fire behavior statistics, and optional individual predictions. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If state_estimates is empty, length mismatches occur, or any start_time_s is invalid. |
RuntimeError
|
If more than 50% of ensemble members fail. |
Source code in embrs/tools/fire_predictor.py
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 | |
set_params(params)
¶
Configure predictor parameters and optionally regenerate cell grid.
Updates all prediction parameters from the provided PredictorParams. If cell_size_m has changed since the last call, regenerates the entire cell grid (expensive operation).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
PredictorParams
|
New parameter values. All fields are used to update internal state. |
required |
Side Effects
- Updates all uncertainty and bias parameters
- May regenerate cell grid if cell_size_m changed
- Computes nominal ignition probability for spotting
Source code in embrs/tools/fire_predictor.py
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 | |
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_R10(cell)
¶
Compute no-wind no-slope ROS for Fuel Model 10 (Rothermel 1991).
Calculate the base ROS using Anderson 13 Fuel Model 10 properties and the cell's current fuel moisture. This value is used as a reference for the crown fire spread rate calculation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell
|
Cell
|
Cell providing fuel moisture ( |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Base ROS for Fuel Model 10 (ft/min). |
Source code in embrs/models/crown_model.py
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 | |
calc_crown_eccentricity(wind_slope_vec_mag)
¶
Compute crown fire ellipse eccentricity from wind/slope vector magnitude.
Similar to the surface fire eccentricity but uses different exponential coefficients and converts input from ft/min to mph.
Based on Alexander, M. E. (1985). Estimating the length-to-breadth ratio of elliptical forest fire patterns. Pages 287-304 in Proceedings of the Eighth Conference on Fire and Forest Meteorology. SAF Publication 85-04.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wind_slope_vec_mag
|
float
|
Combined wind/slope vector magnitude (ft/min). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Crown fire ellipse eccentricity in [0, 1). |
Source code in embrs/models/crown_model.py
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 | |
calc_crown_propagation(cell, r_actual, alpha, vec_mag, sfc, cfb)
¶
Compute directional crown fire ROS and fireline intensity.
Calculate crown fireline intensity (Scott & Reinhardt 2001, Eq. 22), crown fire eccentricity, and resolve ROS and intensity along all spread directions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell
|
Cell
|
Cell providing canopy and spread direction data. |
required |
r_actual
|
float
|
Actual crown fire ROS (m/min). |
required |
alpha
|
float
|
Crown fire spread heading (radians). |
required |
vec_mag
|
float
|
Wind/slope vector magnitude (ft/min). |
required |
sfc
|
float
|
Surface fuel consumed (kg/m²). |
required |
cfb
|
float
|
Crown fraction burned in [0, 1]. |
required |
Returns:
| Type | Description |
|---|---|
Tuple[ndarray, ndarray]
|
Tuple[np.ndarray, np.ndarray]: |
Source code in embrs/models/crown_model.py
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 | |
calc_crown_vector(cell, R10)
¶
Compute crown fire maximum ROS and spread direction.
Combine the Fuel Model 10 base ROS (R10) with wind and slope
effects, then scale by the 3.34 crown fire multiplier
(Rothermel 1991). Wind speed is reduced by 0.4 for the crown fire
calculation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell
|
Cell
|
Cell providing wind, slope, and fuel data. |
required |
R10
|
float
|
No-wind no-slope Fuel Model 10 ROS (ft/min). |
required |
Returns:
| Type | Description |
|---|---|
Tuple[float, float, float]
|
Tuple[float, float, float]: |
Source code in embrs/models/crown_model.py
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 | |
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_slope_speed(cell, phi_s)
¶
Compute equivalent wind speed from slope factor.
Invert the wind factor equation to find the wind speed that would produce the same spread effect as the slope factor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell
|
Cell
|
Cell providing fuel model with wind coefficients. |
required |
phi_s
|
float
|
Slope factor (dimensionless). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Equivalent slope wind speed (ft/min). |
Source code in embrs/models/crown_model.py
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 | |
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 | |
crown_fire(cell, fmc)
¶
Evaluate crown fire initiation and update cell spread parameters.
Check whether the surface fireline intensity exceeds the Van Wagner (1977) crown fire initiation threshold. If so, determine whether the crown fire is passive or active, compute crown fire ROS, and update the cell's spread and intensity arrays.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell
|
Cell
|
Burning cell with surface fire ROS ( |
required |
fmc
|
float
|
Foliar moisture content (percent). |
required |
Side Effects
Updates cell._crown_status, cell.cfb, cell.a_a,
cell.r_ss, cell.I_ss, cell.r_h_ss, and cell.e.
Sets crown status to NONE, PASSIVE, or ACTIVE.
Source code in embrs/models/crown_model.py
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 | |
crown_intensity(R, sfc, clb)
¶
Compute crown fireline intensity (Rothermel 1991, pp. 10-11).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
R
|
float
|
Crown fire ROS (m/min). Converted to ft/s internally. |
required |
sfc
|
float
|
Surface fuel consumed (kg/m²). |
required |
clb
|
float
|
Crown loading burned (kg/m²). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Crown fireline intensity (BTU/ft/min). |
Source code in embrs/models/crown_model.py
430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 | |
crown_loading_burned(cell, cfb)
¶
Compute crown fuel loading consumed by the crown fire.
Based on Van Wagner (1990): crown load burned = CFB * CBD * (CH - CBH).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell
|
Cell
|
Cell with |
required |
cfb
|
float
|
Crown fraction burned in [0, 1]. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Crown loading burned (kg/m²). |
Source code in embrs/models/crown_model.py
408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 | |
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 | |
get_wind_slope_vector(cell, phi_w, phi_s, slope_speed)
¶
Compute the combined wind and slope vector for crown fire spread.
Resolve wind and slope influences into a resultant speed, magnitude,
and direction using the law of cosines. Used by calc_crown_vector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell
|
Cell
|
Cell providing current wind and aspect. |
required |
phi_w
|
float
|
Wind factor (dimensionless). |
required |
phi_s
|
float
|
Slope factor (dimensionless). |
required |
slope_speed
|
float
|
Equivalent slope wind speed (ft/min). |
required |
Returns:
| Type | Description |
|---|---|
Tuple[float, float, float]
|
Tuple[float, float, float]: |
Source code in embrs/models/crown_model.py
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 | |
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 | |
njit_if_enabled(**jit_kwargs)
¶
Decorator that applies Numba njit if available and enabled.
Equivalent to jit_if_enabled(nopython=True, **jit_kwargs). Use this for functions that must run in nopython mode.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**jit_kwargs
|
Any
|
Keyword arguments to pass to numba.njit. |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
Callable |
Callable
|
Decorated function (JIT-compiled if enabled, else unchanged). |
Source code in embrs/utilities/numba_utils.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | |
set_accel_constant(cell, cfb)
¶
Set the fire acceleration constant based on crown fraction burned.
Compute a crown-fire-adjusted acceleration constant and store it on the cell. The formula reduces acceleration as CFB increases.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell
|
Cell
|
Cell to update. |
required |
cfb
|
float
|
Crown fraction burned in [0, 1]. |
required |
Side Effects
Sets cell.a_a (1/s).
Source code in embrs/models/crown_model.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | |
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 | |
Forecast Pool¶
Forecast pool management for ensemble fire predictions.
This module provides classes for managing pre-computed wind forecast pools that can be reused across multiple ensemble fire predictions.
Classes:
| Name | Description |
|---|---|
- ForecastData |
Container for a single wind forecast with metadata. |
- ForecastPool |
Collection of forecasts with pool size management. |
- ForecastPoolManager |
Global manager for active forecast pools. |
The forecast pool system allows efficient reuse of WindNinja computations across global predictions and rollout scenarios.
Example
from embrs.tools.forecast_pool import ForecastPool
Create a forecast pool from a fire predictor¶
pool = ForecastPool.generate( ... fire=fire_sim, ... predictor_params=params, ... n_forecasts=30, ... num_workers=4 ... )
Use the pool in ensemble predictions¶
output = predictor.run_ensemble( ... state_estimates=estimates, ... forecast_pool=pool ... )
ForecastData
dataclass
¶
Container for a single wind forecast and its generating parameters.
Stores a WindNinja output array along with the perturbation parameters used to generate it, enabling reproducibility and reuse of forecasts across ensemble predictions.
Attributes:
| Name | Type | Description |
|---|---|---|
wind_forecast |
ndarray
|
WindNinja output array. Shape: (n_timesteps, height, width, 2) where [..., 0] = speed (m/s), [..., 1] = direction (degrees). |
weather_stream |
'WeatherStream'
|
The perturbed weather stream used to generate this forecast. |
wind_speed_bias |
float
|
Constant wind speed bias applied (m/s). |
wind_dir_bias |
float
|
Constant wind direction bias applied (degrees). |
speed_error_seed |
int
|
Random seed used for AR(1) speed noise. |
dir_error_seed |
int
|
Random seed used for AR(1) direction noise. |
forecast_id |
int
|
Unique identifier for this forecast within the pool. |
generation_time |
float
|
Unix timestamp when forecast was generated. |
Source code in embrs/tools/forecast_pool.py
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 | |
memory_usage()
¶
Estimate memory usage in bytes.
Source code in embrs/tools/forecast_pool.py
196 197 198 | |
ForecastPool
dataclass
¶
A collection of pre-computed wind forecasts for ensemble use.
Provides storage and sampling methods for a pool of perturbed wind forecasts that can be reused across global predictions and rollouts.
The ForecastPool class now owns the pool generation process, making it the central point for creating and managing forecast pools.
Attributes:
| Name | Type | Description |
|---|---|---|
forecasts |
List[ForecastData]
|
List of ForecastData objects. |
base_weather_stream |
'WeatherStream'
|
Original unperturbed weather stream. |
map_params |
'MapParams'
|
Map parameters used for WindNinja. |
predictor_params |
'PredictorParams'
|
Predictor parameters at time of pool creation. |
created_at_time_s |
float
|
Simulation time (seconds) when pool was created. |
forecast_start_datetime |
'datetime'
|
Local datetime that index 0 of forecasts corresponds to. |
Example
Create a pool from fire simulation¶
pool = ForecastPool.generate( ... fire=fire_sim, ... predictor_params=params, ... n_forecasts=30 ... )
Sample forecast indices for ensemble¶
indices = pool.sample(10, seed=42)
Get a specific forecast¶
forecast = pool.get_forecast(0)
Source code in embrs/tools/forecast_pool.py
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 | |
__getitem__(idx)
¶
Get a forecast by index.
Source code in embrs/tools/forecast_pool.py
328 329 330 | |
__len__()
¶
Return the number of forecasts in the pool.
Source code in embrs/tools/forecast_pool.py
324 325 326 | |
__post_init__()
¶
Register this pool with the manager after creation.
Source code in embrs/tools/forecast_pool.py
320 321 322 | |
close()
¶
Explicitly close this pool and release memory.
Unregisters from the manager and clears forecasts.
Source code in embrs/tools/forecast_pool.py
384 385 386 387 388 389 390 | |
generate(fire, predictor_params, n_forecasts, num_workers=None, random_seed=None, wind_speed_bias=0.0, wind_dir_bias=0.0, wind_uncertainty_factor=0.0, verbose=True)
classmethod
¶
Generate a pool of perturbed wind forecasts in parallel.
Create n_forecasts independent wind forecasts, each with different AR(1) perturbations applied to the base weather stream. WindNinja is called in parallel for efficiency.
This class method centralizes all pool generation logic, making ForecastPool the owner of the entire pool creation process.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fire
|
'FireSim'
|
Fire simulation to generate forecasts from. |
required |
predictor_params
|
'PredictorParams'
|
Predictor parameters for time horizon and settings. |
required |
n_forecasts
|
int
|
Number of forecasts to generate. |
required |
num_workers
|
Optional[int]
|
Number of parallel workers. Defaults to min(cpu_count, n_forecasts). |
None
|
random_seed
|
Optional[int]
|
Base seed for reproducibility. If None, uses random seeds for each forecast. |
None
|
wind_speed_bias
|
float
|
Constant wind speed bias in m/s. |
0.0
|
wind_dir_bias
|
float
|
Constant wind direction bias in degrees. |
0.0
|
wind_uncertainty_factor
|
float
|
Scaling factor for AR(1) noise (0-1). |
0.0
|
verbose
|
bool
|
Whether to print progress messages. |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
ForecastPool |
'ForecastPool'
|
Container with all generated forecasts, base weather stream, map parameters, and creation metadata. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If fire is None or n_forecasts < 1. |
Example
pool = ForecastPool.generate( ... fire=fire_sim, ... predictor_params=params, ... n_forecasts=30, ... random_seed=42 ... )
Source code in embrs/tools/forecast_pool.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 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 | |
get_forecast(idx)
¶
Get a specific forecast by index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
idx
|
int
|
Index of the forecast to retrieve. |
required |
Returns:
| Type | Description |
|---|---|
ForecastData
|
ForecastData at the specified index. |
Source code in embrs/tools/forecast_pool.py
350 351 352 353 354 355 356 357 358 359 | |
get_weather_scenarios()
¶
Return all perturbed weather streams for time window calculation.
Returns:
| Type | Description |
|---|---|
List['WeatherStream']
|
List of WeatherStream objects, one per forecast in the pool. |
Source code in embrs/tools/forecast_pool.py
361 362 363 364 365 366 367 | |
memory_usage()
¶
Estimate memory usage in bytes.
Source code in embrs/tools/forecast_pool.py
369 370 371 372 373 374 | |
sample(n, replace=True, seed=None)
¶
Sample n indices from the pool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n
|
int
|
Number of indices to sample. |
required |
replace
|
bool
|
If True, sample with replacement (default). If False, n must not exceed pool size. |
True
|
seed
|
Optional[int]
|
Random seed for reproducibility. |
None
|
Returns:
| Type | Description |
|---|---|
List[int]
|
List of forecast indices. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If replace=False and n > pool size. |
Source code in embrs/tools/forecast_pool.py
332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 | |
ForecastPoolManager
¶
Manages active forecast pools to prevent unbounded memory growth.
This class tracks all active ForecastPool instances and enforces a maximum number of active pools. When a new pool is created and the limit is exceeded, the oldest pool is automatically cleaned up.
Class Attributes
MAX_ACTIVE_POOLS (int): Maximum number of active pools (default: 3). _active_pools (List[ForecastPool]): Currently active pools. _enabled (bool): Whether pool management is enabled.
Example
Check current pool count¶
print(f"Active pools: {ForecastPoolManager.pool_count()}")
Clear all pools when done¶
ForecastPoolManager.clear_all()
Source code in embrs/tools/forecast_pool.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 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 | |
clear_all()
classmethod
¶
Clear all active pools and release memory.
Source code in embrs/tools/forecast_pool.py
107 108 109 110 111 112 | |
disable()
classmethod
¶
Disable automatic pool management.
Source code in embrs/tools/forecast_pool.py
138 139 140 141 | |
enable()
classmethod
¶
Enable automatic pool management.
Source code in embrs/tools/forecast_pool.py
143 144 145 146 | |
get_active_pools()
classmethod
¶
Return list of active pools (read-only copy).
Source code in embrs/tools/forecast_pool.py
148 149 150 151 | |
memory_usage()
classmethod
¶
Estimate total memory usage of all active pools in bytes.
Source code in embrs/tools/forecast_pool.py
153 154 155 156 157 158 159 | |
pool_count()
classmethod
¶
Return the number of active pools.
Source code in embrs/tools/forecast_pool.py
114 115 116 117 | |
register(pool)
classmethod
¶
Register a new pool and evict oldest if over limit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pool
|
'ForecastPool'
|
The ForecastPool to register. |
required |
Source code in embrs/tools/forecast_pool.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | |
set_max_pools(n)
classmethod
¶
Set the maximum number of active pools.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n
|
int
|
Maximum number of active pools (must be >= 1). |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If n < 1. |
Source code in embrs/tools/forecast_pool.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | |
unregister(pool)
classmethod
¶
Unregister a pool without cleanup.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pool
|
'ForecastPool'
|
The ForecastPool to unregister. |
required |
Source code in embrs/tools/forecast_pool.py
97 98 99 100 101 102 103 104 105 | |
Predictor Serializer¶
Serialization utilities for FirePredictor multiprocessing.
This module provides the PredictorSerializer class which handles all serialization and deserialization logic for FirePredictor instances, enabling efficient parallel execution of ensemble predictions.
The serializer extracts the minimal state needed to reconstruct a predictor in worker processes without transferring the full FireSim reference or rebuilding the cell grid from scratch.
Classes:
| Name | Description |
|---|---|
- PredictorSerializer |
Handles FirePredictor serialization/deserialization. |
Example
from embrs.tools.predictor_serializer import PredictorSerializer
Prepare for parallel execution¶
PredictorSerializer.prepare_for_serialization(predictor, vary_wind=False)
Get minimal state for pickling¶
state = PredictorSerializer.get_state(predictor)
Restore state in worker process¶
PredictorSerializer.set_state(predictor, state)
PredictorSerializer
¶
Handles serialization and deserialization for FirePredictor multiprocessing.
This class owns the entire serialization process for FirePredictor, including: - Capturing fire simulation state for worker processes - Creating minimal pickle-compatible state dictionaries - Reconstructing predictor state without full FireSim initialization
The serializer is designed to work with Python's pickle module and multiprocessing, ensuring efficient transfer of predictor state to worker processes for parallel ensemble predictions.
Class Methods
prepare_for_serialization: Capture state from parent FireSim. get_state: Return minimal state dict for pickling (getstate). set_state: Restore predictor from state dict (setstate).
Example
In main process before spawning workers¶
PredictorSerializer.prepare_for_serialization( ... predictor, ... vary_wind=False, ... forecast_pool=pool ... )
Predictor can now be pickled and sent to workers¶
import pickle pickled = pickle.dumps(predictor)
Source code in embrs/tools/predictor_serializer.py
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 | |
get_state(predictor)
staticmethod
¶
Serialize predictor for parallel execution (getstate).
Return only the essential data needed to reconstruct the predictor in a worker process. Excludes non-serializable components like the parent FireSim reference, visualizer, and logger.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
predictor
|
'FirePredictor'
|
FirePredictor instance to serialize. |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Minimal state dictionary containing serialization_data, |
Dict[str, Any]
|
orig_grid, orig_dict, and c_size. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If prepare_for_serialization() was not called first. |
Source code in embrs/tools/predictor_serializer.py
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 | |
prepare_for_serialization(predictor, vary_wind=False, forecast_pool=None, forecast_indices=None)
staticmethod
¶
Prepare predictor for parallel execution by extracting serializable data.
Must be called once before pickling the predictor. Captures the current state of the parent FireSim and stores it in a serializable format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
predictor
|
'FirePredictor'
|
FirePredictor instance to prepare. |
required |
vary_wind
|
bool
|
If True, workers generate their own wind forecasts. If False, use pre-computed shared wind forecast. |
False
|
forecast_pool
|
Optional['ForecastPool']
|
Optional pre-computed forecast pool. |
None
|
forecast_indices
|
Optional[List[int]]
|
Indices mapping each ensemble member to a forecast in the pool. |
None
|
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If called without a fire reference (fire is None). |
Side Effects
Populates predictor._serialization_data dict with fire state, parameters, weather stream, and optionally pre-computed wind forecast.
Source code in embrs/tools/predictor_serializer.py
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 | |
set_state(predictor, state)
staticmethod
¶
Reconstruct predictor in worker process without full initialization.
Manually restores all attributes that BaseFireSim.init() would set, but without the expensive cell creation loop. Uses pre-built cell templates (orig_grid, orig_dict) instead of reconstructing cells from map data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
predictor
|
'FirePredictor'
|
FirePredictor instance to restore (typically empty/new). |
required |
state
|
Dict[str, Any]
|
State dictionary from get_state() containing serialization_data, orig_grid, orig_dict, and c_size. |
required |
Side Effects
Restores all instance attributes needed for prediction, including maps, fuel models, weather stream, and optionally wind forecast. Sets fire to None (no parent reference in workers).
Source code in embrs/tools/predictor_serializer.py
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 | |
Ensemble Video¶
Ensemble Prediction Video Generator
Creates professional video visualizations of ensemble fire prediction output, showing burn probability evolution over time with hexagonal cell polygons.
create_ensemble_video(ensemble_output, cell_size, output_path='ensemble_prediction.mp4', map_size=None, fps=10, dpi=150, title='Ensemble Fire Spread Prediction', figsize=(12, 10), colormap='YlOrRd', show_progress=True)
¶
Create a video visualization of ensemble prediction burn probability over time.
For each time step, plots all cells that have been predicted to burn by any ensemble member, colored by their burn probability. Suitable for presentations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ensemble_output
|
EnsemblePredictionOutput
|
EnsemblePredictionOutput from FirePredictor.run_ensemble() |
required |
cell_size
|
float
|
Size of hexagonal cells in meters (side length) |
required |
output_path
|
str
|
Path to save the video file (default: "ensemble_prediction.mp4") |
'ensemble_prediction.mp4'
|
map_size
|
Optional[Tuple[float, float]]
|
Tuple of (width_m, height_m) for the map. If None, computed from data. |
None
|
fps
|
int
|
Frames per second for the video (default: 10) |
10
|
dpi
|
int
|
Resolution of the video (default: 150) |
150
|
title
|
str
|
Title displayed on the video (default: "Ensemble Fire Spread Prediction") |
'Ensemble Fire Spread Prediction'
|
figsize
|
Tuple[float, float]
|
Figure size in inches (default: (12, 10)) |
(12, 10)
|
colormap
|
str
|
Matplotlib colormap name (default: "YlOrRd" - yellow to orange to red) |
'YlOrRd'
|
show_progress
|
bool
|
Print progress updates during video creation (default: True) |
True
|
Returns:
| Type | Description |
|---|---|
str
|
Path to the saved video file |
Example
from embrs.tools.ensemble_video import create_ensemble_video result = predictor.run_ensemble(state_estimates, ...) video_path = create_ensemble_video( ... result, ... cell_size=45.0, ... output_path="my_prediction.mp4" ... )
Source code in embrs/utilities/ensemble_video.py
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 | |
create_ensemble_video_from_predictor(predictor, ensemble_output, output_path='ensemble_prediction.mp4', **kwargs)
¶
Convenience function to create ensemble video using predictor's cell size and map info.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
predictor
|
FirePredictor
|
FirePredictor instance. |
required |
ensemble_output
|
EnsemblePredictionOutput
|
Output from run_ensemble(). |
required |
output_path
|
str
|
Path to save the video. |
'ensemble_prediction.mp4'
|
**kwargs
|
Any
|
Additional arguments passed to create_ensemble_video(). |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Path to the saved video file. |
Source code in embrs/utilities/ensemble_video.py
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 | |
create_hexagon_polygon(x, y, cell_size)
¶
Create a hexagonal polygon in point-up orientation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
X coordinate of cell center (meters) |
required |
y
|
float
|
Y coordinate of cell center (meters) |
required |
cell_size
|
float
|
Side length of hexagon (meters) |
required |
Returns:
| Type | Description |
|---|---|
Polygon
|
Shapely Polygon representing the hexagonal cell |
Source code in embrs/utilities/ensemble_video.py
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 | |