Skip to content

Commit ee852d8

Browse files
committed
Add Ag Forecasting application with open Lambda
1 parent 540df8f commit ee852d8

24 files changed

Lines changed: 3938 additions & 15 deletions
149 KB
Binary file not shown.
25.3 KB
Binary file not shown.
8.42 KB
Binary file not shown.
9.78 KB
Binary file not shown.

_build/.doctrees/index.doctree

39 Bytes
Binary file not shown.

_build/html/.buildinfo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Sphinx build info version 1
22
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3-
config: 00f39c391346115ca176ede8239be645
3+
config: ff326529dec566ff85861a347816d852
44
tags: 645f666f9bcd5a90fca523b33c5a78b7

_build/html/README.html

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,14 @@
148148

149149

150150

151+
152+
153+
154+
155+
156+
<img src="_static/open-lambda.png" class="logo__image only-light" alt=""/>
157+
<script>document.write(`<img src="_static/open-lambda.png" class="logo__image only-dark" alt=""/>`);</script>
158+
151159

152160
<p class="title logo__title">OpenLambda</p>
153161

@@ -167,6 +175,10 @@
167175
<div class="bd-toc-item navbar-nav active">
168176
<ul class="nav bd-sidenav">
169177
<li class="toctree-l1"><a class="reference internal" href="worker.html">Worker</a></li>
178+
<li class="toctree-l1 has-children"><a class="reference internal" href="applications/index.html">Applications</a><details><summary><span class="toctree-toggle" role="presentation"><i class="fa-solid fa-chevron-down"></i></span></summary><ul>
179+
<li class="toctree-l2"><a class="reference internal" href="applications/ag-forecasting-api.html">🌾 Agricultural Forecasting API</a></li>
180+
</ul>
181+
</details></li>
170182
</ul>
171183

172184
</div>
@@ -443,7 +455,7 @@ <h2>Local Preview<a class="headerlink" href="#local-preview" title="Link to this
443455
<div class="footer-item">
444456

445457
<p class="component-author">
446-
By OpenLambda Contributors
458+
By OpenLambda
447459
</p>
448460

449461
</div>

_build/html/_sources/ag-forecasting-api.md

Lines changed: 932 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
# 🌾 Agricultural Forecasting API
2+
3+
FastAPI-based service for **crop disease risk forecasting** and **winter rye biomass estimation** using multi-source weather data.
4+
Developed by the University of Wisconsin–Madison Data Science Institute.
5+
6+
---
7+
8+
## Overview
9+
10+
The API provides geospatial agricultural intelligence for Wisconsin, combining weather data with validated agronomic models.
11+
12+
### Key Features
13+
- 🌽 Crop disease risk forecasting (corn & soybean)
14+
- 🌱 Winter rye biomass estimation
15+
- 🌦 Multi-source weather integration (IBM EIS, WiscoNet, NOAA)
16+
- 📍 Coordinate and station-based queries
17+
- 🗺 GeoJSON outputs for GIS applications
18+
- ⚡ Async batch processing for multi-station analysis
19+
20+
---
21+
22+
## System Architecture
23+
24+
The system is structured into four main layers:
25+
26+
- **API Layer (FastAPI)**
27+
Handles incoming requests and routing (`/ibm`, `/wisconet_g`, `/models`)
28+
29+
- **Data Layer**
30+
- IBM EIS: high-resolution global weather API
31+
- WiscoNet: Wisconsin mesonet station network
32+
33+
- **Processing Layer**
34+
Weather normalization, unit conversion, GDD calculation, rolling features
35+
36+
- **Model Layer**
37+
Disease risk models and winter rye biomass model
38+
39+
---
40+
41+
## Core Modules
42+
43+
- Weather ingestion (IBM + WiscoNet)
44+
- Disease risk modeling
45+
- Winter rye biomass estimation
46+
- Async pipeline orchestration
47+
- GeoJSON response formatting
48+
49+
---
50+
51+
## API Endpoints
52+
53+
### IBM Forecasting (Coordinates)
54+
`GET /v2/ag_models_wrappers/ibm`
55+
56+
Returns disease risk + biomass using IBM weather data.
57+
58+
---
59+
60+
### WiscoNet Forecasting (Stations)
61+
`GET /v2/ag_models_wrappers/wisconet_g`
62+
63+
Returns station-based time-series disease risk and biomass.
64+
65+
---
66+
67+
### Model Metadata
68+
`GET /v2/ag_models_wrappers/models`
69+
70+
Returns available disease and biomass models.
71+
72+
---
73+
74+
## Disease Models
75+
76+
- **Tarspot (corn)** – humidity and temperature-based risk
77+
- **Gray Leaf Spot (corn)** – temperature + dew point model
78+
- **Frogeye Leaf Spot (soybean)** – GDD + rainfall model
79+
- **White Mold (soybean)** – precipitation and soil moisture model
80+
81+
---
82+
83+
## Winter Rye Biomass Model
84+
85+
Predicts dry biomass (lb/acre) using:
86+
87+
- Growing Degree Days (0°C base)
88+
- Planting date (day-of-year)
89+
- Fall precipitation
90+
- Logistic growth curve
91+
92+
### Outputs
93+
- Biomass (lb/acre)
94+
- Color class (gray / yellow / green)
95+
- Interpretation message
96+
97+
---
98+
99+
## Data Sources
100+
101+
### IBM Environmental Intelligence Suite (EIS)
102+
- High-resolution global weather data
103+
- Hourly forecasts and historical data
104+
- Requires authentication
105+
106+
### WiscoNet
107+
- Wisconsin mesonet (~100 stations)
108+
- Daily weather observations
109+
- Public API access
110+
111+
---
112+
113+
## Response Format
114+
115+
All outputs are returned as **GeoJSON FeatureCollections**, including:
116+
117+
- Weather variables
118+
- Disease risk scores
119+
- Biomass predictions
120+
- Station metadata
121+
122+
---
123+
124+
## Performance Features
125+
126+
- Async multi-station processing
127+
- Cached weather and station data (6h–7d TTL)
128+
- Parallel risk computation
129+
- Optimized data aggregation pipeline
130+
131+
---
132+
133+
## Setup
134+
135+
```bash
136+
git clone <repo>
137+
cd ag_forecasting_api
138+
139+
python -m venv .venv
140+
source .venv/bin/activate
141+
142+
pip install -r requirements.txt
143+
144+
uvicorn app:app --reload
145+
```
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Applications
2+
3+
We are building OL to support a wide range of applications with minimal changes required from those applications. Our approach is to port more real-world workloads and let their needs drive incremental improvements to the platform.
4+
5+
## Want to deploy FastAPI apps on OpenLambda? Just ASGI us how.
6+
7+
In this post, we look at an agricultural forecasting application and an ASGI-based web service. The ag app is a natural fit for serverless because it is fundamentally stateless: results can be regenerated on demand from underlying data rather than relying on persistent runtime state. This also influenced the choice of FastAPI for a modern, async-friendly interface.
8+
To situate ASGI, it builds on the long history of WSGI-based Python web serving, where earlier work (including Jaime’s contributions) helped shape synchronous server patterns. ASGI extends this model with native async support, enabling higher concurrency and better I/O utilization, but requiring deeper runtime integration.
9+
A broader design question is whether it is beneficial to consolidate multiple functions into a single Lambda-like unit. We believe it is: co-locating functions enables opportunistic state reuse, faster warm starts, and reduced overhead.
10+
On the implementation side, OL removes its dependency on Tornado and adds optional support for both WSGI and ASGI applications. The ag forecasting app also surfaced practical issues, including /dev/shm constraints when using process pools, which required targeted adjustments.
11+
Looking ahead, improved visibility into execution—such as detecting when applications are blocked on I/O—opens the door to new billing models that distinguish compute from idle waiting time, addressing a longstanding serverless concern.
12+
More broadly, expanding the set of supported applications continues to drive OL’s evolution, alongside features like environment variables and GitHub-based deployments that further reduce friction for onboarding new workloads.
13+
14+
- [Ag Forecasting API](ag-forecasting-api.md)

0 commit comments

Comments
 (0)