malcolmSQ commited on
Commit
f2ae770
·
1 Parent(s): 42ce3bd

Add model description and key input params UI to dashboard (steps 1 and 2)

Browse files
Files changed (1) hide show
  1. dashboard/app.py +18 -1
dashboard/app.py CHANGED
@@ -153,7 +153,24 @@ def hex_to_rgba(hex_color, alpha):
153
 
154
  # Gradio UI code starts here
155
  with gr.Blocks() as demo:
156
- gr.Markdown("# Mangrove ER Model Dashboard\nDeclining Increment Model Only")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157
  with gr.Tabs():
158
  with gr.Tab("Declining Increment"):
159
  config = yaml.safe_load(open(MODEL_CONFIGS["Declining Increment"]))
 
153
 
154
  # Gradio UI code starts here
155
  with gr.Blocks() as demo:
156
+ gr.Markdown("""
157
+ # Declining Increment Model
158
+
159
+ **Growth Model:** Annual increment declines linearly to zero; total size is the sum of non-negative increments. No negative growth: DBH and height never decrease. Mortality is compounded annually according to the schedule in the config. Continuous mode uses the analytical formula:
160
+ \( \text{size}(t) = \text{initial} + r_0 \cdot (t - \frac{t^2}{2T_m}) \)
161
+ This version is smoother and may yield slightly different results than the discrete sum, especially for short time periods or small Tm.
162
+
163
+ *Species are displayed as "Rhizophora spp." and "Avicennia germinans" throughout the dashboard for clarity.*
164
+ """)
165
+ # --- Key Input Params Card ---
166
+ config = yaml.safe_load(open(MODEL_CONFIGS["Declining Increment"]))
167
+ species_md = "| Species | Planting Density (trees/ha) | r0 (DBH, cm/yr) | Tm (DBH, yrs) | r0 (Height, m/yr) | Tm (Height, yrs) |\n|---|---|---|---|---|---|\n"
168
+ for sp in config["species"]:
169
+ 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"
170
+ project_md = f"**Project Duration:** {config['project']['duration_years']} years \\n**Buffer %:** {config['carbon']['buffer_percentage']} \\n**Soil Carbon per ha per year:** {config['carbon']['soil_carbon_per_ha_per_year']} tCO2 "
171
+ gr.Markdown("""
172
+ ### Key Model Inputs
173
+ """ + species_md + "\n" + project_md)
174
  with gr.Tabs():
175
  with gr.Tab("Declining Increment"):
176
  config = yaml.safe_load(open(MODEL_CONFIGS["Declining Increment"]))