Skip to content

Handling edge cases in speed averaging #92

@robfitzgerald

Description

@robfitzgerald

As shown in #88, a run of bambam-omf can panic when no speeds are found on any segments in the downloaded region:

 RUST_LOG=info ./rust/target/release/bambam_omf network -c configuration/bambam-omf/travel-mode-filter.json -b -105.173256,-105.164802,39.817799,39.823534 -o out/test                                   
[2026-01-26T22:26:36Z INFO  bambam_omf::app::network] running OMF import with
            object store AmazonS3
            rg_chunk_size 4
            file_concurrency_limit 64
            release latest
            (xmin,xmax,ymin,ymax): -105.173256,-105.1648,39.8178,39.823532
[2026-01-26T22:26:37Z INFO  bambam_omf::collection::collector] Collecting OvertureMaps Connector records from release 2026-01-21.0
[2026-01-26T22:26:38Z INFO  bambam_omf::collection::collector] Started collection
[2026-01-26T22:26:47Z INFO  bambam_omf::collection::collector] Collection time 8.999544084s
[2026-01-26T22:26:47Z INFO  bambam_omf::collection::collector] Deserialization time 1.1105ms
[2026-01-26T22:26:47Z INFO  bambam_omf::collection::collector] Total time 9.000756292s
[2026-01-26T22:26:47Z INFO  bambam_omf::collection::collector] Collecting OvertureMaps Segment records from release 2026-01-21.0
[2026-01-26T22:26:48Z INFO  bambam_omf::collection::collector] Started collection
[2026-01-26T22:26:58Z INFO  bambam_omf::collection::collector] Collection time 10.015029208s
[2026-01-26T22:26:58Z INFO  bambam_omf::collection::collector] Deserialization time 452.75µs
[2026-01-26T22:26:58Z INFO  bambam_omf::collection::collector] Total time 10.015506542s

[2026-01-26T22:26:58Z INFO  bambam_omf::graph::serialize_ops] all connectors accounted for

thread 'main' panicked at bambam-omf/src/bin/bambam_omf.rs:7:19:
called `Result::unwrap()` on an `Err` value: InternalError("internal division by zero when computing average speed: [None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None]")
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

This points to two issues:

  • speed averaging is semigroupal in nature; if there are no values, there is no mean speed, so it fails to be a good infill for missing speed values. In that case, we should probably alert the command line and skip building the speed file
  • speed averaging should also short circuit if there are no speed values, and the function computing average speeds should return None when there are no speeds to average

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions