Skip to content

thorerismann/clr-landscape

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

clr-landscape

Simulates Coffee Leaf Rust (CLR) spread across neutral landscapes. Built for a graduate seminar in Economics of Biodiversity at the University of Bern.

Overview

  1. Landscape generation - Creates a patchwork of coffee and non-coffee cells using neutral landscape models (nlmpy).
  2. Infection dynamics - Coffee plants are infected by CLR, which spreads within cells, to neighbors, and globally depending on weather.
  3. Harvest calculation - After the simulation period, total coffee berry yield is computed based on infection levels.

Installation

# Create environment
mamba env create -f environment.yml
mamba activate clr-landscape

# Install package
pip install -e .

Usage

CLI

# Run simulation with defaults (40x40 grid, 10 runs, 365 days)
clr-landscape run

# Custom parameters
clr-landscape run --size 40 --cluster 0.4 --proportions 0.4 0.6 --num-runs 5

# Generate plots (reads config.json from data dir)
clr-landscape plot

# Use a different data directory
clr-landscape plot --data-dir results/experiment2

Python API

from clr_landscape import SimulationConfig, run_simulation

config = SimulationConfig(size=30, num_runs=3, num_days=180)
run_simulation(config)

Output

Results are saved to data/ by default:

  • config.json - Simulation parameters (loaded automatically by plotting)
  • results-{run}-{proportions}-{cluster}.csv - Daily infection metrics
  • map-{day}-{run}-{proportions}-{cluster}.csv - Intermediate infection maps
  • returns-{proportions}-{cluster}.csv - Final coffee berry yields

Figures are saved to figures/.

License

MIT

About

Uses a Neutral Landscape Model to investigate the impact of forest distribution on coffee leaf rust propogation

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages