malcolmSQ commited on
Commit ·
d528a4f
1
Parent(s): 80c7573
feat: update logo path, fix project details UI, add mortality and carbon details to key model inputs
Browse files- dashboard/app.py +27 -2
dashboard/app.py
CHANGED
|
@@ -155,7 +155,7 @@ def hex_to_rgba(hex_color, alpha):
|
|
| 155 |
with gr.Blocks() as demo:
|
| 156 |
gr.Markdown("""
|
| 157 |
<div style='display: flex; align-items: center; gap: 16px;'>
|
| 158 |
-
<img src='
|
| 159 |
<div>
|
| 160 |
<b>This tool is provided by <a href='https://www.sequestr.io/' target='_blank'>Sequestr</a>.</b><br>
|
| 161 |
<span style='color: #d9534f;'>Please do not share this page.</span>
|
|
@@ -182,10 +182,35 @@ This version is smoother and may yield slightly different results than the discr
|
|
| 182 |
species_md = "| Species | Planting Density (trees/ha) | r0 (DBH, cm/yr) | Tm (DBH, yrs) | r0 (Height, m/yr) | Tm (Height, yrs) |\n|---|---|---|---|---|---|\n"
|
| 183 |
for sp in config["species"]:
|
| 184 |
species_md += f"| {sp['name']} | {sp['planting_density']} | {sp['declining_increment']['dbh']['r0']} | {sp['declining_increment']['dbh']['T_m']} | {sp['declining_increment']['height']['r0']} | {sp['declining_increment']['height']['T_m']} |\n"
|
| 185 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 186 |
gr.Markdown("""
|
| 187 |
### Key Model Inputs
|
| 188 |
""" + species_md + "\n" + project_md)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 189 |
with gr.Tabs():
|
| 190 |
with gr.Tab("Declining Increment"):
|
| 191 |
config = yaml.safe_load(open(MODEL_CONFIGS["Declining Increment"]))
|
|
|
|
| 155 |
with gr.Blocks() as demo:
|
| 156 |
gr.Markdown("""
|
| 157 |
<div style='display: flex; align-items: center; gap: 16px;'>
|
| 158 |
+
<img src='dashboard/sequestr_logo.png' alt='Sequestr Logo' style='height:48px;'>
|
| 159 |
<div>
|
| 160 |
<b>This tool is provided by <a href='https://www.sequestr.io/' target='_blank'>Sequestr</a>.</b><br>
|
| 161 |
<span style='color: #d9534f;'>Please do not share this page.</span>
|
|
|
|
| 182 |
species_md = "| Species | Planting Density (trees/ha) | r0 (DBH, cm/yr) | Tm (DBH, yrs) | r0 (Height, m/yr) | Tm (Height, yrs) |\n|---|---|---|---|---|---|\n"
|
| 183 |
for sp in config["species"]:
|
| 184 |
species_md += f"| {sp['name']} | {sp['planting_density']} | {sp['declining_increment']['dbh']['r0']} | {sp['declining_increment']['dbh']['T_m']} | {sp['declining_increment']['height']['r0']} | {sp['declining_increment']['height']['T_m']} |\n"
|
| 185 |
+
# Project details with proper line breaks
|
| 186 |
+
project_md = (
|
| 187 |
+
f"**Project Duration:** {config['project']['duration_years']} years \n"
|
| 188 |
+
f"**Buffer %:** {config['carbon']['buffer_percentage']} \n"
|
| 189 |
+
f"**Soil Carbon per ha per year:** {config['carbon']['soil_carbon_per_ha_per_year']} tCO2"
|
| 190 |
+
)
|
| 191 |
+
# Mortality table
|
| 192 |
+
mortality_md = "| Year | Mortality Rate (%) |\n|---|---|\n"
|
| 193 |
+
for year, rate in config['project'].get('annual_mortality_schedule', {}).items():
|
| 194 |
+
mortality_md += f"| {year} | {rate} |\n"
|
| 195 |
+
# Carbon details
|
| 196 |
+
carbon = config["carbon"]
|
| 197 |
+
carbon_md = (
|
| 198 |
+
f"**Biomass to Carbon:** {carbon['biomass_to_carbon']} \n"
|
| 199 |
+
f"**Carbon to CO2:** {carbon['carbon_to_co2']} \n"
|
| 200 |
+
f"**Buffer %:** {carbon['buffer_percentage']} \n"
|
| 201 |
+
f"**Leakage %:** {carbon['leakage_percentage']} \n"
|
| 202 |
+
f"**Baseline Emissions:** {carbon['baseline_emissions']} tCO2/ha/year \n"
|
| 203 |
+
f"**Soil Carbon per ha per year:** {carbon['soil_carbon_per_ha_per_year']} tCO2"
|
| 204 |
+
)
|
| 205 |
gr.Markdown("""
|
| 206 |
### Key Model Inputs
|
| 207 |
""" + species_md + "\n" + project_md)
|
| 208 |
+
gr.Markdown("""
|
| 209 |
+
### Annual Mortality Rate
|
| 210 |
+
""" + mortality_md)
|
| 211 |
+
gr.Markdown("""
|
| 212 |
+
### Carbon Details
|
| 213 |
+
""" + carbon_md)
|
| 214 |
with gr.Tabs():
|
| 215 |
with gr.Tab("Declining Increment"):
|
| 216 |
config = yaml.safe_load(open(MODEL_CONFIGS["Declining Increment"]))
|