-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathexample.py
More file actions
66 lines (58 loc) · 2.69 KB
/
Copy pathexample.py
File metadata and controls
66 lines (58 loc) · 2.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#%%
import pyrothermel
import pandas as pd
import seaborn as sns
#%% md
# ## Setup Base Fuel Model and Moisture Scenario
#%%
moisture = pyrothermel.MoistureScenario.from_existing(dead_fuel_moisture_class='low',live_fuel_moisture_class='moderate')
fuel = pyrothermel.FuelModel.from_existing(identifier='TL8')
canopy_base_height = 2.5 # default unit is m
canopy_bulk_density = .1 # default unit is kg/m^3
# Print some fuel loading values from fuel model TL8
print([fuel.fuel_load_one_hour, fuel.fuel_load_ten_hour, fuel.fuel_load_hundred_hour])
print(fuel.units.loading_units)
#%% md
# ## Run Rothermel Models Across Range of Wind Speeds
#%%
results_list = []
for wind_speed in range(0,60,2):
run = pyrothermel.PyrothermelRun(fuel,moisture,wind_speed,wind_input_mode='ten_meter',canopy_base_height=canopy_base_height,canopy_bulk_density=canopy_bulk_density,canopy_cover=.5,canopy_height=20,canopy_ratio=.6)
results_surface = run.run_surface_fire_in_direction_of_max_spread()
results_final = run.run_crown_fire_scott_and_reinhardt()
results_final['wind_speed'] = wind_speed
results_final['treatment'] = 'untreated'
results_list.append(results_final)
untreated_crowning_index = run.calculate_crowning_index()
untreated_torching_index = run.calculate_torching_index()
df = pd.DataFrame(results_list)
df
#%% md
# ## Modify Fuel Loading and Recalculate
#%%
fuel.fuel_load_one_hour *= .5
fuel.fuel_load_ten_hour *= .5
fuel.fuel_load_hundred_hour *= .75
fuel.fuel_bed_depth *= .5
results_list = []
for wind_speed in range(0,60,2):
run = pyrothermel.PyrothermelRun(fuel,moisture,wind_speed,wind_input_mode='ten_meter',canopy_base_height=2.5,canopy_bulk_density=.1,canopy_cover=.5,canopy_height=20,canopy_ratio=.6)
results_surface = run.run_surface_fire_in_direction_of_max_spread()
results_final = run.run_crown_fire_scott_and_reinhardt()
results_final['wind_speed'] = wind_speed
results_final['treatment'] = 'treated'
results_list.append(results_final)
treated_crowning_index = run.calculate_crowning_index()
treated_torching_index = run.calculate_torching_index()
df_treated = pd.DataFrame(results_list)
df = pd.concat([df,df_treated])
#%% md
# ## Display Results
#%%
sns.lineplot(df,x='wind_speed',y='flame_length',hue='treatment').set(xlabel='Wind Speed (km/hr)',ylabel='Flame Length (m)')
#%%
print('Wind Speed to initiate crown fire in untreated stand: ', untreated_torching_index, ' km/hr')
print('Wind Speed to initiate crown fire in treated stand: ', treated_torching_index, ' km/hr')
print('Wind Speed to propagate crown fire in untreated stand: ', untreated_crowning_index, ' km/hr')
print('Wind Speed to propagate crown fire in treated stand: ', treated_crowning_index, ' km/hr')
#%%