Expand description
Writing a flight out: a Recorder’s rows as CSV or JSON (or Parquet, with the parquet
feature), and the center of mass’s path with the landings as GeoJSON or KML for a map.
Every function builds the file’s contents (text, or bytes for Parquet) and returns them; none
writes a file (the core crates do no I/O). Text numbers are written in Rust’s shortest
round-trip form and Parquet stores each f64’s own 8 bytes, so each reads back as the exact
value recorded. A value that isn’t finite is refused rather than written as something a reader
would misread (NaN, or JSON’s null).
The two map formats put heights on different datums, as their specifications require:
- GeoJSON (RFC 7946, section 4): longitude, latitude and height in meters above the WGS 84 ellipsoid.
- KML (OGC 07-147r2,
altitudeModeabsolute): longitude, latitude and height above mean sea level (KML’s geoid is EGM96), which is the ellipsoidal height less the site’s geoid undulation (Environment::geoid_undulation_m). The undulation is taken as constant over the flight; the geoid’s slope, about 5 cm/km and up to some 30 cm/km in mountains, moves it by centimeters to decimeters over a rocket’s few kilometers.
Neither cuts a path that crosses the antimeridian (±180° longitude), which RFC 7946 section 3.1.9 asks for; a flight there draws a line the long way round the globe.
Each file names the program that wrote it, its version and its designation in the FusionSpace
product system (hpr_core::tool), as a drawing’s title block names the tool that made it:
JSON and GeoJSON in a top-level tool object, {"name", "version", "designation"} (in
GeoJSON a foreign member, which RFC 7946 section 6.1 allows); KML in an XML comment after the
declaration; Parquet in its key-value metadata. CSV is left as bare rows, so it opens cleanly
in a spreadsheet: a program writing one keeps the stamp beside it.
Structs§
- Track
Point - One point of the center of mass’s path, placed on the Earth.
Constants§
- PARQUET_
PAGE_ ROWS - The most values in one Parquet data page: 1024 doubles, the 8 KiB page the specification
recommends (
README.md, “Configurations”).
Functions§
- csv
- The recorded rows as CSV (RFC 4180): a header of the column names, which carry their units, then one line per row, lines ending in CRLF.
- geojson
- The path and the landings as a GeoJSON
FeatureCollection(RFC 7946): aLineStringof[longitude, latitude, height above the ellipsoid]whoseproperties.time_slists each point’s time, and aPointper landing ofsummarywith its time, body, distance and descent rate. A top-leveltoolobject names the program that wrote it, asjson()’s does: a foreign member, which RFC 7946 section 6.1 allows and readers pass over. - json
- The recorded rows as JSON:
{"tool": {...}, "columns": [names], "rows": [[values], ...]}, each row in the columns’ order.toolnames the program that wrote the file:{"name": "hpr-sim", "version": "0.1.0", "designation": "FS · SW · TOOL 005"}. AFlightSummaryis serializable on its own (serde_json::to_string). - kml
- The path and the landings as a KML 2.2 document (OGC 07-147r2) named
name: aLineStringoflongitude,latitude,height above mean sea levelwithaltitudeModeabsolute, and a ground-clampedPointper landing ofsummary. An XML comment after the declaration names the program that wrote it,<!-- hpr-sim 0.1.0 · FS · SW · TOOL 005 -->(hpr_core::tool::stamp). - parquet
- The recorded rows as an Apache Parquet file: one
DOUBLEcolumn per recorded column, named as inRecorder::columns, one row group,PLAINencoding, no compression. Every value reads back as the exactf64recorded. The footer’s key-value metadata names the program that wrote the file:tool=hpr-sim,tool_version= its version anddesignation=FS · SW · TOOL 005. - track
- The center of mass’s path from a recorder that kept
crate::Channel::Timeandcrate::Channel::CgPosition, placed onenvironment’s ellipsoid.