Back to prompt library
Build an Agricultural Frost Index Parametric Trigger Analyzer — implementation
Linked challenge: Build an Agricultural Frost Index Parametric Trigger Analyzer
Prompt source
implementation71 lines11 sectionsNo variables1 code block
## Build
Simulate parametric freeze protection contracts for citrus and deciduous orchards using ERA5 2m temperature fields. Quantify hours below sub-zero thresholds during sensitive bloom windows to model basis risk.
## User
Agricultural Risk Consultant
## Workflow
1. Ingest orchard parcel coordinates, bloom calendar dates, and critical temperature limits.
2. Download ERA5 hourly 2-meter temperature reanalysis grids via cdsapi.
3. Calculate cumulative chilling hours below trigger thresholds during bloom.
4. Estimate simulated payout frequency and basis risk against synthetic crop logs.
## Interface
Terminal dashboard outputting seasonal temperature time series and threshold breach counts.
## Data
Execute cdsapi test query for 2m temperature or parse local NetCDF test grids over agricultural counties.
Starter examples below are synthetic. They are not downloaded records.
## Source
[Copernicus Climate Data Store client](https://raw.githubusercontent.com/ecmwf/cdsapi/master/README.rst)
Queries Copernicus CDS API reanalysis-era5-single-levels for 2m_temperature time series as documented in cdsapi examples.
## Tools
mlflow, cdsapi, numpy.
MLflow tracks simulation parameter runs, trigger variations, and metric outputs across historical weather regimes.
Local or hosted LLM to produce explanatory commentary on basis risk anomalies across varied elevation gradients.
## Deliverables
Submit runnable source, pinned dependencies, setup commands, a working interface, example outputs, and a recorded end-to-end demo. Include tests and an action log.
## Acceptance
- Converts Kelvin temperatures to Celsius accurately.
- Accumulates continuous hours where 2m temperature falls below designated freezing threshold.
- Generates trigger metrics without executing financial payments.
## Starter Examples
```json
[
{
"input": {
"orchard_id": "ORCH-WA-09",
"critical_temp_c": -2.2,
"temperature_kelvin_series": [
272.15,
270.15,
269.65,
271.15,
274.15
]
},
"expected_output": {
"orchard_id": "ORCH-WA-09",
"frost_hours_recorded": 3,
"min_temperature_c": -3.5,
"trigger_activated": true
}
},
{
"input": {
"orchard_id": "ORCH-WA-10",
"critical_temp_c": -3,
"temperature_kelvin_series": [
275.15,
274.65,
273.15
]
},
"expected_output": {
"orchard_id": "ORCH-WA-10",
"frost_hours_recorded": 0,
"min_temperature_c": 0,
"trigger_activated": false
}
}
]
```
## Safety
Strictly simulates trigger mechanisms; does not authorize payouts or replace formal agricultural loss adjusters.
Use mock external writes. Require human review before any real deployment.