malcolmSQ commited on
Commit
280f88c
Β·
1 Parent(s): c5df41a

Overwrite README with up-to-date modular, model-driven, and active/archived model documentation

Browse files
Files changed (1) hide show
  1. README.md +44 -96
README.md CHANGED
@@ -1,19 +1,13 @@
1
  # Mangrove Emissions Reduction Model & Dashboard
2
 
3
- This project implements a flexible, multi-model dashboard for mangrove carbon sequestration and emissions reduction, supporting several growth models:
4
-
5
- - **Chapman-Richards** (default/original)
6
- - **Simple Linear**
7
- - **Linear Plateau**
8
- - **Declining Increment**
9
 
10
  ## Features
11
- - Compare multiple growth models side-by-side in a Gradio dashboard.
12
- - Each model is configured via a YAML file in `configs/`.
13
- - Each tab in the dashboard corresponds to a different model.
14
- - Planting schedule is editable for the Original Model tab.
15
- - All plots and tables update live.
16
- - Dashboard can be shared via a public link (`share=True`).
17
 
18
  ## Usage
19
 
@@ -28,100 +22,58 @@ This project implements a flexible, multi-model dashboard for mangrove carbon se
28
  ```
29
  The terminal will display a public share link.
30
 
31
- 3. **Add new models:**
32
- - Add a new YAML config to `configs/` (see examples for structure).
33
- - Add an entry to `MODEL_CONFIGS` in `dashboard/app.py`.
34
- - Optionally, add a README in the corresponding `models/` subfolder.
35
-
36
  ## Growth Models
37
- - **Chapman-Richards:** Flexible sigmoidal growth, suitable for most mangrove species.
38
- - **Simple Linear:** Constant annual increment.
39
- - **Linear Plateau:** Linear growth up to a plateau.
40
- - **Declining Increment:** Annual increment declines linearly to zero; total size is the sum of non-negative increments (never decreases or goes negative).
 
 
 
 
41
 
42
  ## File Structure
43
- - `dashboard/app.py` β€” Gradio dashboard UI and logic
44
- - `src/er_model.py` β€” Core model logic and growth functions
 
45
  - `configs/` β€” Model configuration YAMLs
46
- - `models/` β€” Reference model folders (see subfolder READMEs)
47
-
48
- ## Notes
49
- - The dashboard is designed for easy extension: just add a config and a tab.
50
- - All growth models are robust to negative/complex values.
51
- - Diagnostics are included for debugging growth and biomass calculations.
52
-
53
- ---
54
-
55
- For more details, see the README files in each `models/` subfolder.
56
-
57
- ---
58
-
59
- ## πŸš€ Quickstart
60
-
61
- 1. **Install dependencies**
62
- ```bash
63
- conda env create -f environment.yml
64
- conda activate er-model
65
- pre-commit install
66
- ```
67
-
68
- 2. **Launch the dashboard**
69
- ```bash
70
- python -m dashboard.app
71
- ```
72
- - The dashboard opens in your browser.
73
- - Each tab represents a different model/configuration.
74
-
75
- ---
76
-
77
- ## πŸ–₯️ Dashboard Usage
78
- - **Multi-model:** Switch between models (e.g., "Original Model", "Jimenez & Lugo") using tabs.
79
- - **Interactive plots:** All plots are interactive (hover, zoom, export).
80
- - **Parameter editing:** Adjust planting schedule and see real-time results (where enabled).
81
- - **Tables:** View carbon, species, and survival tables for each model.
82
-
83
- ---
84
-
85
- ## πŸ“š Model Documentation
86
-
87
- - [Original Model](models/original/README.md): Chapman-Richards growth, DBH-dependent mortality, field-calibrated.
88
- - [Jimenez & Lugo Model](models/jimenez_lugo/README.md): Literature-based, fixed annual mortality rates.
89
-
90
- ---
91
-
92
- ## πŸ—‚οΈ Directory Structure
93
  ```
94
  er-chapman-richards/
95
  β”œβ”€β”€ README.md # This file
96
  β”œβ”€β”€ environment.yml # Conda environment
97
  β”œβ”€β”€ dashboard/ # Gradio dashboard app
98
  β”œβ”€β”€ src/ # Core model code
 
 
99
  β”œβ”€β”€ configs/ # Model parameter YAMLs
100
  β”œβ”€β”€ models/ # Model-specific docs
101
- β”‚ β”œβ”€β”€ original/README.md
102
- β”‚ └── jimenez_lugo/README.md
 
103
  β”œβ”€β”€ tests/ # Pytest suite
104
  └── ...
105
  ```
106
 
107
- ---
108
-
109
- ## βž• Adding a New Model
110
- 1. Create a new config YAML in `configs/` (e.g., `configs/my_model.yaml`).
111
- 2. Add a new entry to `MODEL_CONFIGS` in `dashboard/app.py`:
112
- ```python
113
- MODEL_CONFIGS = {
114
- "Original Model": "configs/params.yaml",
115
- "Jimenez & Lugo": "configs/jimenez_lugo.yaml",
116
- "My Model": "configs/my_model.yaml"
117
- }
118
- ```
119
- 3. (Optional) Add a new subdirectory and README in `models/` for documentation.
120
- 4. Restart the dashboard. Your model appears as a new tab.
121
-
122
- ---
123
-
124
- ## πŸ§‘β€πŸ’» Development & Testing
125
  - Code style: [black](https://black.readthedocs.io/), [isort](https://pycqa.github.io/isort/)
126
  - Type hints required for all public functions
127
  - Run tests with:
@@ -130,15 +82,11 @@ er-chapman-richards/
130
  ```
131
  - Pre-commit hooks ensure code quality
132
 
133
- ---
134
-
135
- ## πŸ“– References
136
  - Chapman-Richards growth model literature
137
  - Jimenez, J.A. & Lugo, A.E. (1985, 1987)
138
  - Zanvo et al. (2023) for allometric equations
139
  - Field data from Nigeria mangrove sites (2024)
140
 
141
- ---
142
-
143
- ## πŸ“ License
144
  [License details to be added]
 
1
  # Mangrove Emissions Reduction Model & Dashboard
2
 
3
+ This project implements a flexible, modular dashboard for mangrove carbon sequestration and emissions reduction, supporting multiple growth models. **Currently, only the Declining Increment model is active; all other models are archived for reference.**
 
 
 
 
 
4
 
5
  ## Features
6
+ - Interactive Gradio dashboard for project simulation and analysis
7
+ - Modular growth model architecture (see `src/growth_models/`)
8
+ - All dashboard tables and plots are driven by model outputs (no redundant calculations)
9
+ - Editable planting schedule for Declining Increment model
10
+ - Robust, transparent, and reproducible calculations
 
11
 
12
  ## Usage
13
 
 
22
  ```
23
  The terminal will display a public share link.
24
 
 
 
 
 
 
25
  ## Growth Models
26
+ - **Declining Increment (ACTIVE):**
27
+ - Annual increment declines linearly to zero; total size is the sum of non-negative increments (never decreases or goes negative).
28
+ - Both discrete and continuous versions are available (toggle via config).
29
+ - **Archived Models:**
30
+ - **Chapman-Richards** (see `src/growth_models/chapman_richards.py`)
31
+ - **Simple Linear** (see `src/growth_models/linear.py`)
32
+ - **Linear Plateau** (see `src/growth_models/linear.py`)
33
+ - **Jimenez-Lugo** (see `models/jimenez_lugo/README.md`)
34
 
35
  ## File Structure
36
+ - `dashboard/app.py` β€” Gradio dashboard UI and logic (now model-driven)
37
+ - `src/er_model.py` β€” Core model logic, growth model selection, and all calculations
38
+ - `src/growth_models/` β€” Modular growth model implementations (active and archived)
39
  - `configs/` β€” Model configuration YAMLs
40
+ - `models/` β€” Reference model folders and documentation
41
+ - `tests/` β€” Unit tests for model logic and outputs
42
+
43
+ ## Model-Driven Dashboard
44
+ - All per-year, per-species metrics (surviving trees, DBH, height, biomass per tree, total biomass) are calculated and stored in the model (`model.species_metrics`).
45
+ - Dashboard tables and plots read directly from model outputs for speed, consistency, and maintainability.
46
+ - No redundant calculations in the dashboard.
47
+
48
+ ## Adding or Re-enabling Models
49
+ 1. **To add a new model:**
50
+ - Implement the growth function in `src/growth_models/`.
51
+ - Add a config YAML to `configs/`.
52
+ - Add a tab/entry in `dashboard/app.py` (if you want it visible in the UI).
53
+ 2. **To re-enable an archived model:**
54
+ - Uncomment the relevant import and config entry.
55
+ - Ensure the model is listed in `MODEL_CONFIGS` in `dashboard/app.py`.
56
+ - Add or update documentation in `models/` as needed.
57
+
58
+ ## Directory Structure
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  ```
60
  er-chapman-richards/
61
  β”œβ”€β”€ README.md # This file
62
  β”œβ”€β”€ environment.yml # Conda environment
63
  β”œβ”€β”€ dashboard/ # Gradio dashboard app
64
  β”œβ”€β”€ src/ # Core model code
65
+ β”‚ β”œβ”€β”€ er_model.py
66
+ β”‚ └── growth_models/
67
  β”œβ”€β”€ configs/ # Model parameter YAMLs
68
  β”œβ”€β”€ models/ # Model-specific docs
69
+ β”‚ β”œβ”€β”€ original/README.md # Archived
70
+ β”‚ β”œβ”€β”€ jimenez_lugo/README.md # Archived
71
+ β”‚ └── declining_increment/README.md # Active
72
  β”œβ”€β”€ tests/ # Pytest suite
73
  └── ...
74
  ```
75
 
76
+ ## Development & Testing
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  - Code style: [black](https://black.readthedocs.io/), [isort](https://pycqa.github.io/isort/)
78
  - Type hints required for all public functions
79
  - Run tests with:
 
82
  ```
83
  - Pre-commit hooks ensure code quality
84
 
85
+ ## References
 
 
86
  - Chapman-Richards growth model literature
87
  - Jimenez, J.A. & Lugo, A.E. (1985, 1987)
88
  - Zanvo et al. (2023) for allometric equations
89
  - Field data from Nigeria mangrove sites (2024)
90
 
91
+ ## License
 
 
92
  [License details to be added]