Skip to main content
Loading navigation
Back to prompt library

Build a Multi-Crop Drought Resilience Seed Shift Simulator — implementation

Linked challenge: Build a Multi-Crop Drought Resilience Seed Shift Simulator

Prompt source

implementation78 lines11 sectionsNo variables1 code block
## Build
Model agricultural yield sensitivity under ERA5 heat and precipitation deficits across multi-crop cooperatives. Formulate adaptive seasonal crop transition plans to mitigate drought exposure.

## User
Cooperative Agronomy Planner

## Workflow
1. Load multi-parcel baseline crop distributions, expected yield curves, and drought tolerance limits.
2. Retrieve historical ERA5 2-metre temperature and total precipitation records using cdsapi queries.
3. Simulate projected cooperative revenue under severe 90-day dry spell conditions across crop mixes.
4. Synthesize an acreage transition schedule shifting vulnerable acreage toward drought-tolerant varieties.

## Interface
Multi-tab browser dashboard presenting baseline versus adapted yield scenarios, revenue trade-off charts, and acreage transfer tables.

## Data
Download representative seasonal ERA5 single-level grib/netcdf files using cdsapi, stored locally as cached parquets for quick test loops.
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 ERA5 reanalysis datasets via cdsapi specifying 2m_temperature and total_precipitation variables.

## Tools
optuna, cdsapi, numpy, pandas.
Optimizes crop acreage transition weights across parcels to maximize drought resilience while honoring crop rotation constraints.
Fast local or cloud model for explaining mathematical trade-offs in final crop transition reports.

## 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
- Calculates simulated yield degradation rates under retrieved ERA5 dry season parameters.
- Solves for an acreage transition portfolio that limits simulated catastrophic yield losses below 15%.
- Exports structured contingency plan tables requiring agronomist and board verification.

## Starter Examples
```json
[
  {
    "input": {
      "coop_id": "COOP-MIDWEST-09",
      "total_acres": 1000,
      "current_mix": {
        "maize": 700,
        "sorghum": 300
      },
      "simulated_rain_deficit_pct": 35,
      "maize_loss_per_pct_deficit": 0.012,
      "sorghum_loss_per_pct_deficit": 0.004
    },
    "expected_output": {
      "coop_id": "COOP-MIDWEST-09",
      "baseline_yield_loss_pct": 33.6,
      "recommended_mix": {
        "maize": 400,
        "sorghum": 600
      },
      "projected_yield_loss_pct": 19.6,
      "resilience_gain_pct": 14
    }
  },
  {
    "input": {
      "coop_id": "COOP-PLAINS-02",
      "total_acres": 500,
      "current_mix": {
        "barley": 500
      },
      "simulated_rain_deficit_pct": 5,
      "barley_loss_per_pct_deficit": 0.008
    },
    "expected_output": {
      "coop_id": "COOP-PLAINS-02",
      "baseline_yield_loss_pct": 4,
      "recommended_mix": {
        "barley": 500
      },
      "projected_yield_loss_pct": 4,
      "resilience_gain_pct": 0
    }
  }
]
```

## Safety
Calculates simulation scenarios only; does not provide formal seed purchase commitments or financial guarantees.
Use mock external writes. Require human review before any real deployment.