embrs.utilities.fire_util#
Various sets of constants and helper functions useful throughout the codebase
- class embrs.utilities.fire_util.UtilFuncs#
Various utility functions that are useful across numerous files.
- get_cell_polygons() list #
Converts a list of cell objects into the minimum number of
shapely.Polygon
required to describe all of them- Parameters:
cells (list) – list of
Cell
objects to be converted- Returns:
list of
shapely.Polygon
representing the cells- Return type:
list
- get_dominant_fuel_type() int #
Finds the most commonly occurring fuel type within a fuel map.
- Parameters:
fuel_map (np.ndarray) – Fuel map for a region
- Returns:
Integer representation of the dominant fuel type. See
fuel_names
- Return type:
int
- get_indices_from_xy(y_m: float, cell_size: float, grid_width: int, grid_height: int) Tuple[int, int] #
Get the row and column indices in a backing array of a cell containing the point (x_m, y_m).
Does not require a
FireSim
object, uses ‘cell_size’ and the size of the array to calculate indices.- Parameters:
x_m (float) – x position in meters where indices should be found
y_m (float) – y position in meters where indices should be found
cell_size (float) – cell size in meters, measured as the distance across two parallel sides of a regular hexagon
grid_width (int) – number of columns in the backing array of interest
grid_height (int) – number of rows in the backing array of interest
- Raises:
ValueError – if x or y inputs are out of bounds for the array constructed by ‘cell_size’, ‘grid_width’, and ‘grid_height’
- Returns:
tuple containing [row, col] indices at the point (x_m, y_m)
- Return type:
Tuple[int, int]
- get_time_str(show_sec=False) str #
Returns a formatted time string in m-h-s format from the time in seconds.
Useful for generating readable display of the time.
- Parameters:
time_s (int) – time value in seconds
show_sec (bool, optional) – set to True if seconds should be displayed, False if not, defaults to False
- Returns:
formatted time string in h-m-s format
- Return type:
str
- static hexagon_vertices(x: float, y: float, s: float) list #
Calculates the locations of each of a hexagons vertices with center (x,y) and side length s.
- Parameters:
x (float) – x location of hexagon center
y (float) – y location of hexagon center
s (float) – length of hexagon sides
- Returns:
list of (x,y) points representing the hexagon’s vertices
- Return type:
list
- class embrs.utilities.fire_util.CellStates#
Enumeration of the possible cell states.
- Attributes:
BURNT (int): Represents a cell that has been burnt and has no fuel remaining.
FUEL (int): Represents a cell that still contains fuel and is not on fire.
FIRE (int): Represents a cell that is currently on fire.
- class embrs.utilities.fire_util.FireTypes#
Enumeration of the possible fire types.
- Attributes:
WILD (int): Represents a fire that occurred naturally.
PRESCRIBED (int): Represents a fire that was started in a controlled manner, burns with lower intensity.
- class embrs.utilities.fire_util.FuelConstants#
Various values and dictionaries pertaining to modelling of fuel types.
- Attributes:
burnout_thresh (float): fuel content which dictates what is considered to be a burned out cell.
ch_h_to_m_min (float): float that converts chains/hr to m/min.
fbfm_13_keys (list): list of ints corresponding to each of Anderson’s 13 FBFMs.
fuel_names (dict): dictionary where keys are ints for each FBFM and values are the names of each fuel type.
fuel_type_revers_lookup (dict): dictionary where keys are the fuel type names and values are the ints for each FBFM.
init_fuel_table (dict): dictionary of the initial fuel content of each fuel type.
nom_spread_prob_table (dict): dictionary of dictionaries for each fuel type’s nominal spread probabilities.
nom_spread_vel_table (dict): dictionary of nominal spread velocities for wildfires for each fuel type.
dead_fuel_moisture_ext_table (dict): dictionary of each fuel type’s dead fuel moisture of extinction.
fuel_consumption_factor_table (dict): dictionary of each fuel type’s mass-loss curve weighting factor.
fuel_color_mapping (dict): dictionary mapping each fuel type to the display color for visualizations.
- class embrs.utilities.fire_util.RoadConstants#
Information on the modelling of different road types.
- Attributes:
major_road_types (list): list of the names of each of the major road types defined by OpenStreetMap.
road_fuel_vals (dict): dictionary mapping road types to the amount of fuel modelled along them.
road_color_mapping (dict): dictionary mapping road types to their display color for visualizations.
- class embrs.utilities.fire_util.HexGridMath#
Data structures to help with handling cell neighbors in a hexagonal grid.
- Attributes:
hex_angle (float): float representing the angle between neighboring hexagon cell centers.
even_neighborhood_mapping (dict): dictionary that maps relative indices of a cell’s neighbors to unit vectors between them, for even rows.
odd_neighborhood mapping (dict): dictionary that maps relative indices of a cell’s neighbors to unit vectors between them, for odd rows.
even_neighborhood (list): list of relative indices of a cell’s neighbors, for even rows.
odd_neighborhood (list): list of relative indices of a cell’s neighbors, for odd rows.
- class embrs.utilities.fire_util.ControlledBurnParams#
Parameters differentiating
PRESCRIBED
fires fromWILD
- Attributes:
nominal_prob_adj (float): factor adjusting the nominal spread probability.
nominal_vel_adj (float): factor adjusting the nominal spread velocity.
consumption_factor_adj (float): factor adjusting the fuel consumption factor W.
min_burnable_fuel_content (float): minimum fuel fraction remaining in a neighboring cell for a possible ignition
burnout_fuel_frac (float): fraction of fuel at ignition remaining in burning cell at which it stops burning.
- class embrs.utilities.fire_util.WindAdjustments#
Mapping of wind speed to Lorentzian curve parameters, used to calculate alpha_w
- Attributes:
wind_speed_param_mapping (dict): dictionary mapping wind speeds (km/h) to Lorentzian parameters (A, gamma, C)
Classes
Enumeration of the possible cell states. |
|
Parameters differentiating |
|
Enumeration of the possible fire types. |
|
Various values and dictionaries pertaining to modelling of fuel types. |
|
Data structures to help with handling cell neighbors in a hexagonal grid. |
|
Information on the modelling of different road types. |
|
Various utility functions that are useful across numerous files. |
|
Mapping of wind speed to Lorentzian curve parameters, used to calculate alpha_w |