Skip to main content

Crate bywind

Crate bywind 

Source
Expand description

Wind-data types and sailing-search logic shared by bywind-viz (the egui GUI), bywind-cli (the command-line frontend), and any other headless consumer. No GUI dependencies.

Module layout:

  • wind_mapWindMap / TimedWindMap / BakedWindMap, the time-varying wind grid and its precomputed sampling structure.
  • grib2 — load a TimedWindMap from GRIB2 files.
  • wind_av1 — AV1 near-lossless wind-map codec for fast save/load.
  • io — extension-dispatched loaders that pick between GRIB2 and wind_av1 automatically. The single-stop entry point used by both the CLI and the GUI’s file dialogs.
  • fetch — pull GFS UGRD/VGRD-at-10m messages from NOAA’s S3 bucket into a concatenated GRIB2 stream the rest of the pipeline can ingest.
  • fmt — human-readable formatters for durations / fuel / distances / PSO-vs-benchmark deltas, shared by the GUI’s stats panel and the CLI’s summary output.
  • bounds — derive search and bake bounds from a wind map.
  • routeRouteEvolution (type-erases the const-generic waypoint count) plus the waypoint_match! / route_evolution_match! dispatch macros.
  • search — pure, blocking entry points for the PSO and time-reopt loops.
  • solution — persistence schema for a single search result.
  • metrics — per-segment fuel / time / speed breakdown.
  • landmass — Natural Earth landmass grid and A* sea-path finder.

Most consumers can reach for the re-exports at this crate’s root; specialised types (e.g. error enums, low-level landmass primitives) are accessible via bywind::<module>::*.

Re-exports§

pub use wind_map::BakedWindMap;
pub use wind_map::GridLayout;
pub use wind_map::TimedWindMap;
pub use wind_map::WindMap;
pub use grib2::Grib2Bbox;
pub use auto_bounds::derive_route_bbox;
pub use auto_bounds::format_bbox_flag;
pub use bounds::MapBounds;
pub use config::BoatConfig;
pub use config::GenerateConfig;
pub use config::SearchConfig;
pub use search::BAKE_STEP;
pub use search::SearchError;
pub use search::SearchResult;
pub use search::SearchWeights;
pub use search::run_search_blocking;
pub use search::run_search_blocking_with_baked;
pub use search::run_time_reopt_blocking;
pub use metrics::SegmentMetrics;
pub use metrics::compute_segment_metrics;
pub use metrics::gbest_segment_metrics;
pub use route::BenchmarkRoute;
pub use route::RouteEvolution;
pub use route::WaypointCount;
pub use solution::SavedSolution;
pub use landmass::SDF_RESOLUTION_DEG;
pub use landmass::landmass_grid;
pub use landmass::landmass_grid_at_resolution;

Modules§

auto_bounds
Auto-derive a sensible search bbox from just origin/destination.
baked_codec
Compact binary codec for BakedWindMap.
bounds
config
Parameter-bag configs shared between consumers.
fetch
Pull GFS UGRD/VGRD-at-10m messages from NOAA’s AWS Open Data bucket into a concatenated GRIB2 stream.
fmt
Human-readable formatters shared by the GUI’s stats panel and the CLI’s summary output.
grib2
GRIB2 → TimedWindMap loader.
io
Wind-map loaders dispatched by file extension.
landmass
Static landmass / coastline data for the sailing search.
metrics
Per-segment metrics derived from a search-result Path<N> against a baked wind field. These feed the GUI’s per-segment labels and the summary-panel totals; nothing here is rendering-specific.
route
scenario
TOML scenario files: a portable description of “what to search”.
search
Pure, blocking entry points for the sailing search and time-only PSO. Callers wrap them in their preferred concurrency model (GUI: worker thread + mpsc; CLI: main thread).
solution
Persistent representation of a single search solution.
wind_av1
AV1 near-lossless codec for crate::TimedWindMap data on a regular lat/lon grid.
wind_map

Macros§

route_evolution_match
Dispatch on RouteEvolution, binding the inner Evolution<Path<N>> per variant. Body monomorphises via type inference.
waypoint_match
Dispatch on WaypointCount, binding $n to the const N and $wrap to the matching RouteEvolution constructor.

Structs§

Boat
Sailboat physics model: motor + wind-driven speed and fuel-burn cubic.
LonLatBbox
Axis-aligned bounding box on the sphere in (lon°, lat°) degrees.
RouteBounds
Search domain and endpoint constraints.
SearchSettings
Outer (space) + inner (time) PSO sizing and coefficients. Both PSOs share the velocity-update coefficients; the inner PSO runs once per outer particle per iteration.
TimedWeatherRow
A WeatherRow tagged with a wall-clock time in seconds, used as the row-level representation when serialising / deserialising a TimedWindMap as a stream of samples.
WeatherRow
A single wind sample tagged with its (lon, lat) position.
WindSample
A single wind measurement: speed plus the direction it’s coming from.

Enums§

Topology
Outer-loop search topology. The match seam in search is the only topology-aware code; init, kicks, boundary, time PSO, and fitness are topology-agnostic.

Constants§

DEFAULT_STEP_DISTANCE_FRACTION
1% of the bbox diagonal — ~100 substeps along the longest path.