diff --git a/.github/workflows/rust-publish.yaml b/.github/workflows/rust-publish.yaml deleted file mode 100644 index 00ddbf11..00000000 --- a/.github/workflows/rust-publish.yaml +++ /dev/null @@ -1,37 +0,0 @@ -name: Publish - crates.io - -on: - release: - types: [published] - -jobs: - publish: - name: Publish to Crates.io - environment: crates - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@master - with: - toolchain: stable - - - name: Run tests - run: cargo test --all --manifest-path=rust/Cargo.toml - - - name: Publish bambam-overturemaps - run: cargo publish -p bambam-overturemaps --manifest-path=rust/Cargo.toml --token "${{ secrets.CRATES_IO_TOKEN }}" - - - name: Publish bambam-osm - run: cargo publish -p bambam-osm --manifest-path=rust/Cargo.toml --token "${{ secrets.CRATES_IO_TOKEN }}" - - - name: Publish bambam-gtfs - run: cargo publish -p bambam-gtfs --manifest-path=rust/Cargo.toml --token "${{ secrets.CRATES_IO_TOKEN }}" - - - name: Publish bambam - run: cargo publish -p bambam --manifest-path=rust/Cargo.toml --token "${{ secrets.CRATES_IO_TOKEN }}" - - # - name: Publish bambam-py - # run: cargo publish -p bambam-py --manifest-path=rust/Cargo.toml --token "${{ secrets.CRATES_IO_TOKEN }}" diff --git a/.github/workflows/rust-release.yaml b/.github/workflows/rust-release.yaml index 2aaeddd3..73a35df3 100644 --- a/.github/workflows/rust-release.yaml +++ b/.github/workflows/rust-release.yaml @@ -23,13 +23,8 @@ jobs: rustup component add rustfmt cargo fmt --all --manifest-path rust/Cargo.toml -- --check - - name: Install test assets - run: | - ./setup.sh - - - name: Test - run: | - cargo test --workspace --verbose --manifest-path rust/Cargo.toml + - name: Run unit tests + run: cargo test --workspace --manifest-path=rust/Cargo.toml -- --skip test_e2e - name: Publish bambam-osm run: cargo publish -p bambam-osm --manifest-path=rust/Cargo.toml --token "${{ secrets.CRATES_IO_TOKEN }}" @@ -43,3 +38,5 @@ jobs: - name: Publish bambam run: cargo publish -p bambam --manifest-path=rust/Cargo.toml --token "${{ secrets.CRATES_IO_TOKEN }}" +# - name: Publish bambam-py +# run: cargo publish -p bambam-py --manifest-path=rust/Cargo.toml --token "${{ secrets.CRATES_IO_TOKEN }}" diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 41a89543..dc38f1e4 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -23,10 +23,14 @@ jobs: run: | rustup component add rustfmt cargo fmt --all --manifest-path rust/Cargo.toml -- --check - + + - name: Install uv + uses: astral-sh/setup-uv@v6 + - name: Install test assets run: | - ./setup.sh + ./script/setup_test_bambam.sh + ./script/setup_test_bambam_osm.sh - name: Test run: | diff --git a/.gitignore b/.gitignore index 750cd531..fc9d4ebb 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ Cargo.lock target output cache -.venv \ No newline at end of file +.venv +denver_co/ \ No newline at end of file diff --git a/configuration/denver_test.toml b/configuration/denver_test.toml new file mode 100644 index 00000000..5a3d6731 --- /dev/null +++ b/configuration/denver_test.toml @@ -0,0 +1,239 @@ +parallelism = 6 +response_persistence_policy = "persist_response_from_memory" + +[graph] +edge_list.input_file = "../denver_co/edges-compass.csv.gz" +vertex_list_input_file = "../denver_co/vertices-compass.csv.gz" + +[mapping] +type = "edge" +geometry = { input_file = "../denver_co/edges-geometries-enumerated.txt.gz" } +tolerance.distance = 15.0 +tolerance.unit = "meters" +queries_without_destinations = false +matching_type = ["point", "vertex_id", "edge_id"] + +[algorithm] +type = "a*" + +# cut off searches that exceed these termination policies. +[termination] +type = "combined" +[[termination.models]] +type = "query_runtime" +limit = "00:01:00" +frequency = 100_000 +[[termination.models]] +type = "solution_size" +limit = 2_000_000 + +[search.traversal] +type = "combined" + +[[search.traversal.models]] +type = "distance" +distance_unit = "miles" + +[[search.traversal.models]] +type = "fixed_speed" +name = "walk" +speed = 5.0 +speed_unit = "kph" + +[[search.traversal.models]] +type = "fixed_speed" +name = "bike" +speed = 16.0 +speed_unit = "kph" + +[[search.traversal.models]] +type = "speed" +speed_table_input_file = "../denver_co/edges-posted-speed-enumerated.txt.gz" +speed_unit = "kph" + +[[search.traversal.models]] +type = "multimodal" + +[search.traversal.models.dependencies] +walk = [{ input_feature = { name = "walk_speed", type = "speed" }, destination_features = ["edge_time", "trip_time"] }] +bike = [{ input_feature = { name = "bike_speed", type = "speed" }, destination_features = ["edge_time", "trip_time"] }] +drive = [ + { input_feature = { name = "edge_speed", type = "speed" }, destination_features = ["edge_time", "trip_time"] }, + # { time_feature = "trip_enroute_delay", destinations = [ + # "edge_time", + # "trip_time", + # ] }, +] + +[search.traversal.models.output_features] +trip_time = { type = "time", unit = "minutes", initial = 0.0, accumulator = true } +edge_time = { type = "time", unit = "minutes", initial = 0.0, accumulator = false } +# penalty_factor = { name = "factor", unit = "none", accumulator = false, format = { FloatingPoint = { initial = 1.0 } } } + +# use a time-optimal routing strategy +[cost] +weights = { trip_time = 1.0 } +vehicle_rates = { trip_time = { type = "raw" } } +# weights = { trip_time = 1.0, penalty_factor = 1.0 } +# vehicle_rates = { trip_time = { type = "raw" }, penalty_factor = { type = "raw" } } +cost_aggregation = "sum" + +[search.access] +type = "turn_delay" +edge_heading_input_file = "../denver_co/edges-headings-enumerated.csv.gz" +[search.access.turn_delay_model] +type = "tabular_discrete" +time_unit = "seconds" +[search.access.turn_delay_model.table] +no_turn = 0.0 +slight_right = 0.5 +right = 1.0 +sharp_right = 1.5 +slight_left = 1.0 +left = 2.5 +sharp_left = 3.5 +u_turn = 9.5 + +[search.frontier] +type = "combined" + +[[search.frontier.models]] +type = "road_class" +road_class_input_file = "../denver_co/edges-road-class-enumerated.txt.gz" + +# [[search.frontier.models]] +# type = "turn_restriction" +# turn_restriction_input_file = "../denver_co/edges-turn-restrictions.csv.gz" + +[[search.frontier.models]] +type = "time_limit" +time_limit = { time = 40.0, time_unit = "minutes" } + +[[plugin.input_plugins]] +type = "grid" +extent_format = "wkt" +grid = { type = "h3", resolution = 8 } +[plugin.input_plugins.population_source] +type = "acs" +acs_type = "five_year" +acs_year = 2022 +acs_resolution = "census_tract" +acs_categories = ["B01001_001E"] + +[[plugin.input_plugins]] +type = "inject" +format = "key_value" +write_mode = "overwrite" +key = "grid_search" +[plugin.input_plugins.value] +mode = ["walk", "bike", "drive"] +# modes = [{ mode = "walk", road_classes = [4, 5, 6, 7] }, { mode = "bike", road_classes = [4, 5, 6, 7] }, { mode = "drive", road_classes = [1, 2, 3, 4, 5, 6] }] + +[[plugin.input_plugins]] +type = "inject" +key = "start_time" +value = "08:00:00" +format = "key_value" +write_mode = "overwrite" + +[[plugin.input_plugins]] +type = "inject" +key = "start_weekday" +value = "monday" +format = "key_value" +write_mode = "overwrite" + +[[plugin.input_plugins]] +type = "grid_search" + +[[plugin.input_plugins]] +type = "load_balancer" +[plugin.input_plugins.weight_heuristic] +type = "custom" +[plugin.input_plugins.weight_heuristic.custom_weight_type] +type = "categorical" +column_name = "mode" +default = 1 +mapping = { "walk" = 1, "bike" = 10, "drive" = 100 } + +[[plugin.output_plugins]] +type = "summary" + +[[plugin.output_plugins]] +type = "isochrone" +time_bin = { type = "list", times = [10, 20, 30, 40] } +isochrone_algorithm = { type = "k_nearest_concave_hull", k = 3 } +destination_point_generator = { type = "destination_point" } +isochrone_output_format = "wkb" + +### MEP OPPORTUNITY DATA CONFIGURATION ################################# +# assigns opportunities to search results based on a file or api data source +# and a taxonomy for MEP activity types. +# this example shows data loaded from the census LODES online file repository +# assigning activity types by NAICS sector id. +[[plugin.output_plugins]] +type = "opportunity" +collect_format = "aggregate" + +[plugin.output_plugins.model] +type = "combined" + +[[plugin.output_plugins.model.models]] +type = "api" +vertex_input_file = "../denver_co/vertices-compass.csv.gz" +activity_column_names = ["entertainment", "food", "retail", "healthcare", "services", "jobs"] +table_orientation = "destination_vertex_oriented" + +[plugin.output_plugins.model.models.opportunity_source] +type = "lodes" +study_region = { type = "census", geoids = ["08"] } + +# collect LODES data at the tract level. while it is available at the block, +# the download + processing time is 10x that of census tracts. other possible values +# are `block`, `county` or `state`. +data_granularity = "census_tract" +# different editions of the dataset, we are choosing LODES v 8.0. +edition = "LODES8" +# Job Type, can have a value of “JT00” for All Jobs, “JT01” for Primary Jobs, “JT02” for All +# Private Jobs, “JT03” for Private Primary Jobs, “JT04” for All Federal Jobs, or “JT05” for +# Federal Primary Jobs +job_type = "JT00" +# Segment of the workforce, can have the values of: +# - S000: Total number of jobs (default) +# - SA01: Number of jobs of workers age 29 or younger +# - SA02: Number of jobs for workers age 30 to 54 +# - SA03: Number of jobs for workers age 55 or older +# - SE01: Number of jobs with earnings $1250/month or less +# - SE02: Number of jobs with earnings $1251/month to $3333/month +# - SE03: Number of jobs with earnings greater than $3333/month +# - SI01: Number of jobs in Goods Producing industry sectors +# - SI02: Number of jobs in Trade, Transportation, and Utilities industry sectors +# - SI03: Number of jobs in All Other Services industry sectors +segment = "S000" + +# most recent year with all states. Alaska has no coverage from 2017-2022. we may +# want a "continental" variant which could support 2022. +year = 2022 + +[plugin.output_plugins.model.models.opportunity_source.activity_mapping] +# see https://lehd.ces.census.gov/data/lodes/LODES8/LODESTechDoc8.0.pdf +CNS01 = ["jobs"] # 11 (Agriculture, Forestry, Fishing and Hunting) +CNS02 = ["jobs"] # 21 (Mining, Quarrying, and Oil and Gas Extraction) +CNS03 = ["jobs"] # 22 (Utilities) +CNS04 = ["jobs"] # 23 (Construction) +CNS05 = ["jobs"] # 31-33 (Manufacturing) +CNS06 = ["jobs"] # 42 (Wholesale Trade) +CNS07 = ["jobs", "retail"] # 44-45 (Retail Trade) +CNS08 = ["jobs"] # 48-49 (Transportation and Warehousing) +CNS09 = ["jobs"] # 51 (Information) +CNS10 = ["jobs"] # 52 (Finance and Insurance) +CNS11 = ["jobs"] # 53 (Real Estate and Rental and Leasing) +CNS12 = ["jobs", "services"] # 54 (Professional, Scientific, and Technical Services) +CNS13 = ["jobs"] # 55 (Management of Companies and Enterprises) +CNS14 = ["jobs"] # 56 (Admin/Support/Waste Mgmt/Remediation Services) +CNS15 = ["jobs"] # 61 (Educational Services) +CNS16 = ["jobs", "healthcare"] # 62 (Health Care and Social Assistance) +CNS17 = ["jobs", "entertainment"] # 71 (Arts, Entertainment, and Recreation) +CNS18 = ["jobs", "food"] # 72 (Accommodation and Food Services) +CNS19 = ["jobs"] # 81 (Other Services [except Public Administration]) +CNS20 = ["jobs"] # 92 (Public Administration) diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 733227f7..c81be8bb 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -9,9 +9,9 @@ bamcensus-core = { version = "0.1.0" } bamcensus-acs = { version = "0.1.0" } bamcensus = { version = "0.1.0" } bamcensus-lehd = { version = "0.1.0" } -routee-compass = { version = "0.14.0" } -routee-compass-core = { version = "0.14.0" } -routee-compass-powertrain = { version = "0.14.0" } +routee-compass = { git = "https://github.com/NREL/routee-compass.git", rev = "5e8503a" } +routee-compass-core = { git = "https://github.com/NREL/routee-compass.git", rev = "5e8503a" } +routee-compass-powertrain = { git = "https://github.com/NREL/routee-compass.git", rev = "5e8503a" } # third party arrow = { version = "55.0.0" } @@ -25,11 +25,14 @@ flate2 = "1.0" futures = { version = "0.3.31", features = ["executor"] } geo = { version = "0.30.0", features = ["use-serde"] } geo-buffer = "0.2.0" +geo-traits = "0.3.0" +geo-types = "0.7.16" geojson = { version = "0.24.1" } geozero = { version = "0.14.0", features = ["with-wkb"] } gtfs-structures = "0.43.0" h3o = { version = "0.8.0", features = ["serde", "geo"] } hex = "0.4.3" +inventory = { version = "0.3.21" } itertools = { version = "0.14.0" } kdam = "0.6.2" log = "0.4.19" @@ -38,17 +41,19 @@ object_store = { "version" = "0.12.0", features = ["aws"] } osmio = "0.14.0" osmpbf = "0.3.4" parquet = { version = "55.0.0", features = ["snap", "async", "object_store"] } +rand = "0.9.1" rayon = "1.10.0" regex = { version = "1.11.1" } reqwest = { version = "0.12.12", features = ["blocking"] } rstar = { version = "0.12.0" } serde = { version = "1.0.160", features = ["derive"] } serde_json = { version = "1.0" } +shapefile = { version = "0.7.0", features = ["geo-types"] } skiplist = "0.5.1" thiserror = "2.0.12" tokio = "1.39.2" toml = { version = "0.8.20" } uom = { version = "0.37.0", features = ["serde"]} -wkb = "0.7.1" +wkb = "0.9.0" wkt = { version = "0.13.0", features = ["serde"] } zip = "2.1.3" \ No newline at end of file diff --git a/rust/bambam-osm/src/main.rs b/rust/bambam-osm/src/main.rs index 8e1176f7..b4863d4f 100644 --- a/rust/bambam-osm/src/main.rs +++ b/rust/bambam-osm/src/main.rs @@ -106,7 +106,7 @@ mod tests { Err(_) => true, // default }; let temp_directory = "src/test/tmp"; - let pbf_file = "src/test/liechtenstein-latest.osm.pbf"; + let pbf_file = "src/test/liechtenstein-250908.osm.pbf"; let extent_file = "src/test/schaan_liechtenstein.txt"; let config_file = "src/test/test_osm_import.toml"; let conf = crate::App::Pbf { diff --git a/rust/bambam-osm/src/model/osm/graph/compass_writer.rs b/rust/bambam-osm/src/model/osm/graph/compass_writer.rs index cd801e07..1d9c9cf3 100644 --- a/rust/bambam-osm/src/model/osm/graph/compass_writer.rs +++ b/rust/bambam-osm/src/model/osm/graph/compass_writer.rs @@ -3,7 +3,7 @@ use std::{fs::File, path::Path}; use csv::QuoteStyle; use flate2::{write::GzEncoder, Compression}; use kdam::tqdm; -use routee_compass_core::model::network::Edge; +use routee_compass_core::model::network::{EdgeConfig, EdgeId}; use wkt::ToWkt; use crate::model::osm::{ @@ -144,12 +144,12 @@ impl CompassWriter for OsmGraphVectorized { } // COMPASS if let Some(ref mut writer) = edge_writer { - let edge = Edge::new( - edge_id, - row.src_vertex_id.0, - row.dst_vertex_id.0, - uom::si::f64::Length::new::(row.length_meters), - ); + let edge = EdgeConfig { + edge_id: EdgeId(edge_id), + src_vertex_id: row.src_vertex_id, + dst_vertex_id: row.dst_vertex_id, + distance: row.length_meters, + }; writer.serialize(edge).map_err(|e| { OsmError::CsvWriteError(String::from(filenames::EDGES_COMPASS), e) })?; diff --git a/rust/bambam-osm/src/test/get_test.sh b/rust/bambam-osm/src/test/get_test.sh deleted file mode 100755 index dfce2d56..00000000 --- a/rust/bambam-osm/src/test/get_test.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -echo "downloading test osm.pbf dataset" -curl -O https://download.geofabrik.de/europe/liechtenstein-latest.osm.pbf diff --git a/rust/bambam/Cargo.toml b/rust/bambam/Cargo.toml index e1810e0a..b6cfd6fd 100644 --- a/rust/bambam/Cargo.toml +++ b/rust/bambam/Cargo.toml @@ -28,40 +28,39 @@ routee-compass-powertrain = { workspace = true } bambam-osm = { version = "0.1.0", path = "../bambam-osm" } bambam-omf = { version = "0.1.0", path = "../bambam-omf" } -uom = { workspace = true } -inventory = { version = "0.3.21" } -log = "0.4.19" -itertools = { version = "0.14.0" } -chrono = { version = "0.4.31", features = ["serde"] } -skiplist = "0.5.1" -zip = "2.1.3" -# rusqlite = { version = "0.32.1", features = ["bundled"] } +uom = { workspace = true} +inventory = { workspace = true} +log = { workspace = true } +itertools = { workspace = true} +chrono = { workspace = true} +skiplist = { workspace = true } +zip = { workspace = true } +# rusqlite = { workspace = true} -env_logger = "0.11.3" -config = "0.15.11" -thiserror = "2.0.12" -kdam = { workspace = true } -clap = { version = "4.3.19", features = ["derive"] } +env_logger = { workspace = true } +config = { workspace = true } +thiserror = { workspace = true } +kdam = { workspace = true} +clap = { workspace = true} -serde = { version = "1.0.160", features = ["derive"] } -serde_json = { version = "1.0" } -csv = { version = "1.2.2" } -flate2 = "1.0" +serde = { workspace = true} +serde_json = { workspace = true} +csv = { workspace = true} +flate2 = { workspace = true } -rstar = { version = "0.12.0" } -geo = { version = "0.30.0", features = ["use-serde"] } -geo-traits = "0.3.0" -geo-types = "0.7.16" -wkt = { version = "0.14.0", features = ["serde"] } -wkb = "0.9.0" -hex = "0.4.3" -geojson = { version = "0.24.1" } -rand = "0.9.1" -shapefile = { version = "0.7.0", features = ["geo-types"] } +rstar = { workspace = true} +geo = { workspace = true} +geo-traits = { workspace = true } +geo-types = { workspace = true } +wkt = { workspace = true} +wkb = { workspace = true } +hex = { workspace = true } +geojson = { workspace = true} +rand = { workspace = true } +shapefile = { workspace = true} -h3o = { version = "0.8.0", features = ["serde", "geo"] } -gtfs-structures = "0.43.0" - -rayon = "1.10.0" -tokio = "1.44.2" +h3o = { workspace = true} +gtfs-structures = { workspace = true } +rayon = { workspace = true } +tokio = { workspace = true } diff --git a/rust/bambam/src/main.rs b/rust/bambam/src/main.rs index 6e1bbf8d..540ffe58 100644 --- a/rust/bambam/src/main.rs +++ b/rust/bambam/src/main.rs @@ -1,12 +1,20 @@ +use std::fs::File; +use std::io::BufReader; +use std::path::Path; + +use bambam::model::builder; use clap::Parser; -use routee_compass::app::cli::{cli_args::CliArgs, run}; -use routee_compass::app::compass::CompassAppError; +use routee_compass::app::cli::cli_args::CliArgs; +use routee_compass::app::compass::{CompassApp, CompassAppError, CompassJsonExtensions}; +use serde_json::Value; +inventory::submit! { builder::BUILDER_REGISTRATION } // Import the library to ensure inventory registrations in lib.rs are included #[allow(unused_imports)] fn main() { env_logger::init(); + log::debug!("cwd: {:?}", std::env::current_dir()); let args = CliArgs::parse(); // let args = CliArgs { @@ -21,15 +29,73 @@ fn main() { } } -fn run_bambam(args: CliArgs) -> Result<(), CompassAppError> { +fn run_bambam(args: CliArgs) -> Result, CompassAppError> { log::info!("starting app at {}", chrono::Local::now().to_rfc3339()); + let config_path = Path::new(&args.config_file); + let app = CompassApp::try_from(config_path)?; + let query_filename = &args.query_file; + let query_file = File::open(query_filename).map_err(|e| { + CompassAppError::BuildFailure(format!( + "failure reading input query file '{query_filename}': {e}" + )) + })?; + let reader = BufReader::new(query_file); + let user_json: serde_json::Value = serde_json::from_reader(reader)?; + let mut user_queries = user_json.get_queries()?; + app.run(&mut user_queries, None) +} - match run::command_line_runner(&args, None, None) { - Ok(_) => {} - Err(e) => { - log::error!("{e}") +#[cfg(test)] +mod test { + use std::path::PathBuf; + + use routee_compass::app::cli::cli_args::CliArgs; + + use crate::run_bambam; + + #[test] + fn test_e2e_denver() { + let conf_path = PathBuf::from(env!("CARGO_MANIFEST_DIR")) + .parent() + .expect("test invariant failed: repo 'rust/bambam' dir has no parent") + .parent() + .expect("test invariant failed: repo 'rust' dir has no parent") + .join("configuration") + .join("denver_test.toml"); + let query_path = PathBuf::from(env!("CARGO_MANIFEST_DIR")) + .parent() + .expect("test invariant failed: repo 'rust/bambam' dir has no parent") + .parent() + .expect("test invariant failed: repo 'rust' dir has no parent") + .join("query") + .join("denver_extent.json"); + let conf_file = conf_path + .to_str() + .expect("test invariant failed: config file path cannot be a string"); + let query_file = query_path + .to_str() + .expect("test invariant failed: config file path cannot be a string"); + + let args = CliArgs { + config_file: conf_file.to_string(), + query_file: query_file.to_string(), + chunksize: None, + newline_delimited: false, + }; + + match run_bambam(args) { + Ok(rows) => { + assert_eq!(rows.len(), 144); + for (idx, row) in rows.iter().enumerate() { + if let Some(error) = row.get("error") { + panic!( + "row {idx} has error: {}", + serde_json::to_string_pretty(error).unwrap_or_default() + ); + } + } + } + Err(e) => panic!("test failed: {e}"), } } - - Ok(()) } diff --git a/rust/bambam/src/model/output_plugin/opportunity/mod.rs b/rust/bambam/src/model/output_plugin/opportunity/mod.rs index 8974c4f4..da5efd47 100644 --- a/rust/bambam/src/model/output_plugin/opportunity/mod.rs +++ b/rust/bambam/src/model/output_plugin/opportunity/mod.rs @@ -4,7 +4,7 @@ //! search destinations into opportunities. mod destination_opportunity; mod opportunity_format; -mod opportunity_iterator; +pub mod opportunity_iterator; mod opportunity_model; mod opportunity_model_config; mod opportunity_orientation; diff --git a/rust/bambam/src/model/output_plugin/opportunity/opportunity_model_config.rs b/rust/bambam/src/model/output_plugin/opportunity/opportunity_model_config.rs index dd8765dd..5d4a45be 100644 --- a/rust/bambam/src/model/output_plugin/opportunity/opportunity_model_config.rs +++ b/rust/bambam/src/model/output_plugin/opportunity/opportunity_model_config.rs @@ -192,7 +192,6 @@ impl OpportunityModelConfig { .chunk_by(|(_, match_id)| *match_id); let proportion_iter = tqdm!( proportion_groups.into_iter(), - total = vertices.len(), desc = "opportunities areal proportioning" ); let mut proportion_lookup = HashMap::new(); diff --git a/rust/bambam/src/model/transit_old/sch_net_test.rs b/rust/bambam/src/model/transit_old/sch_net_test.rs index 257fdbc2..2930f94b 100644 --- a/rust/bambam/src/model/transit_old/sch_net_test.rs +++ b/rust/bambam/src/model/transit_old/sch_net_test.rs @@ -3,7 +3,7 @@ mod test { use gtfs_structures::{Gtfs, RawGtfs}; #[test] - fn test_read() { + fn test_e2e_read() { let gtfs = RawGtfs::new("http://data.trilliumtransit.com/gtfs/bustang-co-us/bustang-co-us.zip") .unwrap(); diff --git a/script/setup_test_bambam.py b/script/setup_test_bambam.py new file mode 100644 index 00000000..2ea8372c --- /dev/null +++ b/script/setup_test_bambam.py @@ -0,0 +1,10 @@ +print("importing osmnx, compass") +import osmnx as ox +from nrel.routee.compass.io import generate_compass_dataset + + +if __name__ == "__main__": + print("downloading graph") + g = ox.graph_from_place("Denver, Colorado, USA", network_type="drive") + print("processing graph into compass dataset") + generate_compass_dataset(g, output_directory="denver_co") \ No newline at end of file diff --git a/setup.sh b/script/setup_test_bambam.sh similarity index 52% rename from setup.sh rename to script/setup_test_bambam.sh index cdaad501..377d412d 100755 --- a/setup.sh +++ b/script/setup_test_bambam.sh @@ -6,8 +6,6 @@ set -e -# 1. bambam-osm test dataset -cd rust/bambam-osm/src/test/ -./get_test.sh -cd ../../../../ - +# create a virtual environment +echo "downloading denver_co scenario" +uv run --with osmnx --with "nrel.routee.compass[all]" script/setup_test_bambam.py diff --git a/script/setup_test_bambam_osm.sh b/script/setup_test_bambam_osm.sh new file mode 100755 index 00000000..f4e96dfe --- /dev/null +++ b/script/setup_test_bambam_osm.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +# setup.sh +# This script sets up the developer environment for the bambam-osm project. this is +# intended to be run once after cloning the repository. + +set -e + +echo "downloading test osm.pbf dataset" +cd rust/bambam-osm/src/test/ +curl -O http://download.geofabrik.de/europe/liechtenstein-250908.osm.pbf +cd ../../../../