Delivered remotely for a business based in Saskatoon, Canada. Names withheld by agreement.
Project Overview
On the Canadian prairies, effective crop protection hinges on narrow atmospheric windows. Applying herbicides during high wind gusts risks physical spray drift onto neighboring sensitive crops, while spraying into dead-calm dusk air often traps fine droplets inside a thermal temperature inversion that floats miles off-target overnight. Standard consumer weather apps report city-center forecasts designed for commuters—ignoring wet-bulb Delta-T, rain-fast intervals, and boundary-layer stability over open farmland.
Built for broad-acre operations around Saskatoon, this weather-based farming assistant pairs a Python meteorological fusion engine with multi-source Weather APIs and a cross-platform Flutter client. Growers and custom applicators inspect field-by-field hourly spray suitability timelines, receive timely frost and storm-cell warnings, and capture legally defensible weather snapshots tied directly to every spray pass.
Microclimate & Forecasting Bottlenecks
Translating raw atmospheric models into operational decisions for spray rigs and combines poses distinct engineering problems:
- Coarse spatial resolution: Regional airport stations sit dozens of kilometers away from undulating prairie parcels, missing localized valley frost pockets and fast-moving summer squall lines.
- Misleading "ideal" wind metrics: Consumer UIs celebrate calm winds, unaware that sub-3 km/h twilight conditions frequently indicate hazardous thermal inversions for boom sprayers.
- Expensive Weather API fan-out: Polling external commercial Weather APIs individually for hundreds of quarter-sections per farm quickly blows through rate limits and API budgets.
- Unreliable connectivity in the cab: Sprayer operators spend twelve-hour days crossing rural municipalities with patchy LTE while needing continuous access to hourly wind-shift timelines and rain-washout timers.
Architectural Strategy
Instead of calling external Weather APIs directly from mobile clients, we built a spatial grid-deduplication and fusion tier in Python. PostGIS clusters overlapping or adjacent farm polygons onto shared meteorological grid cells so Celery workers fetch external forecasts once per grid point, dramatically cutting third-party API calls while preserving parcel-specific elevation and soil-heat adjustments.
On the frontend, Flutter delivers native iOS, Android, and desktop web experiences from a unified codebase. Pre-fetched 72-hour forecast matrices persist cleanly in on-device SQLite so operators check hourly Delta-T windows, wind direction vectors, and rain-fast countdowns seamlessly regardless of cellular signal strength.
Core Capabilities
- Parcel-Level Spray Suitability Matrix: Hourly traffic-light timelines scoring wind speed, gust spread, Delta-T evaporation risk, inversion likelihood, and minimum rain-fast buffer per chemical class.
- Multi-Model Forecast Blending & Bias Correction: Combines high-resolution numerical weather models with local mesonet/on-farm station readings to tighten temperature and dew-point accuracy.
- Radar Nowcasting & Storm-Cell Alerts: Tracks approaching convective cells and issues targeted push alerts ahead of rain washout or hail risk on active spray fields.
- Agronomic Degree-Day & Disease-Risk Indices: Computes growing-degree days (GDD), canola sclerotinia humidity hours, and fusarium infection risk windows from rolling weather histories.
- Immutable Application Weather Logs: Attaches verified atmospheric conditions—wind vector, temperature, humidity, and Delta-T—to every logged tank load for stewardship compliance.
Technical Architecture
Scheduled Celery workers pull gridded atmospheric variables, ensemble winds, and precipitation radar tiles from multiple Weather APIs, normalizing units and interpolating values across PostGIS field centroids. Python scientific kernels compute derived agronomic indices—including wet-bulb Delta-T, dew point spread, and Richardson-number inversion proxies—storing pre-computed hourly forecasts in PostgreSQL.
Flow: External Weather APIs & Local Stations → Celery Ingestion & Bias Calibration → Python FastAPI / SciPy Advisory Engine → PostGIS Parcel Forecast Store → Flutter Mobile (SQLite Cache) & Web App
When growers open the Flutter app or web planner, FastAPI serves compact binary/JSON forecast matrices scoped to their farm parcels. Background sync jobs refresh local SQLite caches automatically over Wi-Fi or strong LTE, while high-priority frost and inversion alerts route through Firebase Cloud Messaging.
Technology Stack
| Category | Technology detail |
|---|---|
| Mobile & Tablet App | Flutter (iOS, Android, and responsive web dashboard) |
| Advisory & Forecast API | Python 3.12 with FastAPI and NumPy/SciPy meteorological kernels |
| Meteorological Data Sources | Multi-provider Weather APIs (HRRR/GEM gridded NWP + radar nowcasts) |
| Spatial Field Mapping | PostgreSQL with PostGIS polygon indexing and elevation lookup |
| Scheduled Forecast Ingestion | Celery distributed workers with Redis broker for hourly NWP pulls |
| Offline Client Cache | SQLite (Drift) storing 72-hour parcel forecasts and spray logs offline |
| Push Alerting | Firebase Cloud Messaging for inversion, frost, and storm-cell alerts |
| Observability & Drift Audit | Immutable spray-record snapshots tied to forecast & station timestamps |
Engineering Trade-offs & Solutions
| Engineering Challenge | Solution & Trade-off |
|---|---|
| Per-field Weather API requests scale poorly across large multi-parcel farms | Clustered PostGIS parcel centroids onto underlying NWP forecast grids before polling Weather APIs; reduced upstream API calls sharply with negligible sub-kilometer accuracy loss on flat terrain. |
| Raw meteorological parameters confuse non-specialist operators in the cab | Translated raw pressure, dew point, and lapse rates into plain-English Delta-T bands and inversion warnings, while keeping full raw charts accessible on tap for agronomists. |
| Single forecast provider outages stall seasonal spraying schedules | Implemented multi-API provider fallback and cached previous bias-corrected model runs in PostgreSQL; added explicit forecast age badges so crews never mistake stale data for live updates. |
| Rapid morning wind shifts trigger noisy repeated push notifications | Built state-hysteresis filtering in Python workers requiring sustained threshold transitions before dispatching FCM alerts. |
Security & Reliability
Farm field boundaries reveal acreage holdings, crop rotations, and operational timing. All parcel geometries and spray logs remain strictly tenant-isolated inside PostgreSQL behind role-verified JWT tokens enforced by FastAPI middleware. External Weather API credentials never leave backend worker environments, eliminating key leakage in mobile binaries.
To keep advisory pipelines reliable during severe spring weather events, Celery queues separate time-critical radar/station ingestion from bulk seasonal GDD recalculations. Circuit breakers wrap every external Weather API client so an unresponsive upstream feed degrades gracefully onto secondary providers without blocking mobile forecast reads.
Performance & Scale
Dawn and late-afternoon spray briefings create sharp read spikes as hundreds of crews open the Flutter app simultaneously. Because Celery pre-computes hourly Delta-T and spray scores asynchronously into indexed PostgreSQL partitions, FastAPI serves farm-wide 72-hour dashboards directly from compact pre-joined payloads without running heavy meteorological math on the request thread.
Inside Flutter, custom-painted canvas timeline charts render multi-day wind vectors, humidity curves, and suitability bands at 60 fps across mid-tier cab tablets, keeping field planning snappy even when toggling dozens of quarter-sections.
Operational Outcomes
Putting hyperlocal meteorological intelligence directly inside the sprayer cab and farm office changed how crews plan field operations:
- Fewer wasted tank mixes and drift incidents: Explicit Delta-T and inversion warnings deter operators from spraying during hazardous calm twilight windows or excessive evaporation periods.
- Better crew scheduling across dispersed land: Managers sequence distant fields proactively by matching travel routes to parcel-level wind and rain-free horizons.
- Seamless in-cab usability offline: Cached SQLite forecast timelines keep operators informed across rural dead zones without waiting on stalled network requests.
- Defensible regulatory documentation: Timestamped atmospheric snapshots bound to each spray log provide clear records for neighbor inquiries and agronomic audits.