From 31b1b3a05d2100ada78042770d62c824d47603ec Mon Sep 17 00:00:00 2001 From: Claudomator Agent Date: Mon, 16 Mar 2026 00:45:53 +0000 Subject: feat: satellite GRIB download with bandwidth optimisation (§9.1) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implements weather data download over Iridium satellite links: - GribParameter enum with SATELLITE_MINIMAL set (wind + pressure only) - SatelliteDownloadRequest data class (region, params, forecast hours, resolution) - SatelliteGribDownloader: size/time estimation, abort-on-oversized, pluggable fetcher - 8 unit tests covering estimation scaling, minimal param set, and download outcomes Co-Authored-By: Claude Sonnet 4.6 --- .../org/terst/nav/data/model/GribParameter.kt | 24 +++++++++++++++++++ .../nav/data/model/SatelliteDownloadRequest.kt | 27 ++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 android-app/app/src/main/kotlin/org/terst/nav/data/model/GribParameter.kt create mode 100644 android-app/app/src/main/kotlin/org/terst/nav/data/model/SatelliteDownloadRequest.kt (limited to 'android-app/app/src/main/kotlin/org/terst') diff --git a/android-app/app/src/main/kotlin/org/terst/nav/data/model/GribParameter.kt b/android-app/app/src/main/kotlin/org/terst/nav/data/model/GribParameter.kt new file mode 100644 index 0000000..a322ea9 --- /dev/null +++ b/android-app/app/src/main/kotlin/org/terst/nav/data/model/GribParameter.kt @@ -0,0 +1,24 @@ +package org.terst.nav.data.model + +/** GRIB meteorological/oceanographic parameters that can be requested for download. */ +enum class GribParameter { + WIND_SPEED, + WIND_DIRECTION, + SURFACE_PRESSURE, + TEMPERATURE_2M, + PRECIPITATION, + WAVE_HEIGHT, + WAVE_DIRECTION; + + companion object { + /** + * Minimal parameter set for satellite (Iridium) links: wind speed, wind direction, + * and surface pressure only. Per §9.1: skip temperature/clouds to minimise bandwidth. + */ + val SATELLITE_MINIMAL: Set = setOf( + WIND_SPEED, + WIND_DIRECTION, + SURFACE_PRESSURE + ) + } +} diff --git a/android-app/app/src/main/kotlin/org/terst/nav/data/model/SatelliteDownloadRequest.kt b/android-app/app/src/main/kotlin/org/terst/nav/data/model/SatelliteDownloadRequest.kt new file mode 100644 index 0000000..d14c9da --- /dev/null +++ b/android-app/app/src/main/kotlin/org/terst/nav/data/model/SatelliteDownloadRequest.kt @@ -0,0 +1,27 @@ +package org.terst.nav.data.model + +/** + * A bandwidth-optimised GRIB download request for satellite (Iridium) links. + * + * Per §9.1: crop to needed region and request only essential parameters + * (wind, pressure) to fit within the ~2.4 Kbps Iridium budget. + * + * @param region Geographic area to download (cropped to route corridor + 200 nm buffer). + * @param parameters GRIB parameters to include. Use [GribParameter.SATELLITE_MINIMAL] + * for satellite links. + * @param forecastHours Number of forecast hours to request (e.g. 24, 48, 120). + * @param resolutionDeg Grid spacing in degrees. Coarser grids produce smaller files; + * 1.0° is typical for satellite; 0.25° for WiFi/cellular. + */ +data class SatelliteDownloadRequest( + val region: GribRegion, + val parameters: Set, + val forecastHours: Int, + val resolutionDeg: Double = 1.0 +) { + init { + require(forecastHours > 0) { "forecastHours must be positive" } + require(resolutionDeg > 0.0) { "resolutionDeg must be positive" } + require(parameters.isNotEmpty()) { "parameters must not be empty" } + } +} -- cgit v1.2.3