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
README.md
CHANGED
|
@@ -1,19 +1,13 @@
|
|
| 1 |
# Mangrove Emissions Reduction Model & Dashboard
|
| 2 |
|
| 3 |
-
This project implements a flexible,
|
| 4 |
-
|
| 5 |
-
- **Chapman-Richards** (default/original)
|
| 6 |
-
- **Simple Linear**
|
| 7 |
-
- **Linear Plateau**
|
| 8 |
-
- **Declining Increment**
|
| 9 |
|
| 10 |
## Features
|
| 11 |
-
-
|
| 12 |
-
-
|
| 13 |
-
-
|
| 14 |
-
-
|
| 15 |
-
-
|
| 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 |
-
- **
|
| 38 |
-
-
|
| 39 |
-
-
|
| 40 |
-
- **
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
## File Structure
|
| 43 |
-
- `dashboard/app.py` β Gradio dashboard UI and logic
|
| 44 |
-
- `src/er_model.py` β Core model logic and
|
|
|
|
| 45 |
- `configs/` β Model configuration YAMLs
|
| 46 |
-
- `models/` β Reference model folders
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
-
|
| 50 |
-
- All
|
| 51 |
-
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
``
|
| 63 |
-
|
| 64 |
-
|
| 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 |
-
β
|
|
|
|
| 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]
|