Scenario configuration¶
Copy every section and field in default.yaml when creating a scenario.
Change selections and output names while keeping the version-3 contract. The
builder assembles the parameter families required by the selected model.
Source identity, availability, access, native metadata, notes and DQ belong in
config/sources.yaml. Each scenario owns its regional fleet aggregation selections
under aggregation_sources. Extraction and modelling rules belong in
the parameter partitions, routed by config/parameters/rules.yaml.
Reusable conversions belong in config/parameters/conversion.yaml.
Supported roles and lifecycle¶
Keep one YAML per demonstrated, repeatable workflow. The current supported set is:
| File | Role and current scope |
|---|---|
default.yaml |
Production template for ten model regions, including BCT for British Columbia and the territories. Uses prospective periods anchored at 2025, sales-derived calibrated cohorts, EPA MOVES survival curves and new-capacity range shares. Its run label remains baseline. |
validation_opening_periods.yaml |
Ten-region verification of opening-period conditions with observed 2023 cohorts and NHTSA CAFE/EIA NEMS survival curves. Uses the shared constant-retirement tail to 0.5% survival or less, then zero. |
validation_baseline.yaml |
Ontario prospective-2025 comparison for both legacy variants: 2023 NRCan CEUD held constant for historical parameters, sales-survival stock anchored to NRCan CEUD, EPA MOVES fixed lifetimes and representative new LDV ranges. |
validation_energy_calibration.yaml |
Matched Ontario calibration-on comparison: same fleet/activity/source/representation as validation_baseline, optional NRCan CEUD reported-liquid-energy adjustment enabled and its diagnostic evidence captured. Scientific acceptance remains separate. |
validation_energy_calibration_regions.yaml |
Prospective-2025 calibration anchor evidence for all ten model regions, including the existing BC-plus-territories BCT region. Uses the Ontario calibration pair's methods and source selections with broader geography and no Ontario-only legacy comparison. It does not replace the matched Ontario OFF/ON audit. |
notebook_diagnostics.yaml |
Shared stock/efficiency notebook prerequisite for observed Ontario 2023. Uses NHTSA CAFE/EIA NEMS curves and within-family capacity shares for future plug-in vehicle ranges. Charging profiles and embodied emissions are disabled. |
validation_charging_nhts_uncontrolled.yaml |
Ontario charging case using production settings, distinct output names and comparison disabled. The six registered NHTS/TTS and uncontrolled/night/day profile combinations remain selectable through charging_profiles; use a complete temporary scenario for an alternative. Suitable for processed CSV preparation or a complete build. |
Retain these names and selections. For a new supported comparison, use a concise
validation_<question>.yaml name; add another diagnostic
preset only when the shared notebook preset cannot serve a demonstrated consumer.
Use lowercase snake_case for filenames and run labels. The filename identifies a
configuration; scenario.name identifies its report/output family and need not match
an existing filename. Record purpose, consumer and changed selections in the scenario.
Keep temporary alternatives as complete YAMLs under ignored
tmp/<task>/scenarios/exp_<question>_<variant>.yaml, outside the supported set. Start
from the appropriate complete control/template and change only the intended selections;
there is no scenario inheritance or override manager. Give every variant distinct
database/report/setup-log names through the existing output fields. Source years,
modeling selections and comparisons still belong in that YAML. Build from the repository
root using --scenario <path>.
Run scenarios serially
Distinct final outputs do not isolate shared preparation artifacts: run native scenarios serially. Tests or concurrent experiments need a disposable repository/configuration with all mutable artifact routes isolated, not only a different SQLite filename.
Remove task scratch after its useful results and configuration identities have been
recorded in their existing report or task owner. Promote a temporary scenario only for
a recurring supported workflow, with a documented consumer and appropriate validation.
The transportation-validation notebook uses
transportation_research.notebook_scenario in config/parameters/transport_diagnostic_controls.yaml, currently
validation_baseline.yaml. Both fleet and charger captures must match that live YAML
and the same fresh database/build fingerprints. Regenerate both after changing it.
Generated databases under outputs/sqlite/, run reports, comparison captures and
notebook HTML remain local and are ignored by Git. Keep their versioned scenarios,
producers and registered inputs so the supported commands can rebuild them. Unique
review handoffs and authored presentation files are retained separately; do not use
blanket generated-output deletion to clean them.
Shared run settings¶
| Section | What it controls |
|---|---|
scenario |
Run name, description, and purpose. |
geography.regions |
Regions covered by the registered inputs and template. Quote "ON" to avoid YAML 1.1 boolean parsing. |
periods |
Period mode, parameter base year, existing vintage labels, model periods, and step. Prospective evaluates closing conditions and legacy evaluates opening conditions. Source observations retain their own dates. |
sources.selections |
NRCan CEUD provincial/national years, and CER CEF edition. AFDC has an explicitly dated pinned registry snapshot. Other sources have pinned registry releases or their own discovery contract; an unused edition/year selector is rejected. |
sources.nrcan_ceud_beyond_observed |
error, constant, or extrapolated for stock and historical parameter views through base_year. Extrapolated uses ceud_inputs.cagr controls, omitting intervals touching 2020–2021. Demand always anchors at the actual selected-edition observation and uses CER CEF real GDP to base_year and future projection years; the optional passenger split shares the CAGR estimator, not this endpoint policy. |
aggregation_sources |
Regional fleet evidence shared across parameters: stock ages, LDV classes, medium-truck classes and heavy-truck haul activity. Every scenario declares the same four roles, with its own selections. |
economics.cer_scenario |
CER CEF trajectory used for currency harmonization, independently of demand. It must exist in the selected CER CEF edition. |
Other economics fields |
Discount and loan rates, CAD currency, and reference dollar year for costs. |
outputs |
Database filename, validation report, and setup log. Artifact directories and the automatic build-log naming template remain owned by config/paths.yaml. |
comparison |
Optional comparison with a second current schema-v4 database. Configure mode: scenario, a reference SQLite path, numerical tolerances, and provenance inclusion. Use mode: none to disable comparison. Integrity validation always runs. |
row_note_overrides.technology |
Replace technology.notes by exact technology key for this scenario. Keep {} to retain template notes; unknown keys fail. This does not change parameter values or source notes. |
notebook_diagnostics |
Optional list of capture types. Use vehicle_stock and efficiency for the road diagnostic preset, ceud_calibration for the Ontario calibration audit, and ceud_calibration_regions for regional anchors. Both calibration captures require energy calibration enabled. Omission leaves notebook capture disabled. |
All registry sources marked active are available to implemented ETL layers. Scenarios
do not maintain a second active-source list. A source year selects registered evidence;
it does not create missing caches, mappings, or template periods.
Every scenario build automatically writes timestamped INFO, WARNING and ERROR
messages, stage timings and failure tracebacks to its log. The naming template
outputs.build_log in config/paths.yaml combines {scenario_name} (the run label)
and {scenario_yaml} (the YAML filename without its extension), followed by
{timestamp} (UTC run start, YYYY-MM-DD_HH-mm-ss-microsecondsZ); for example,
outputs/logs/baseline_default_2026-10-22_17-30-00-123456Z.log.
Each run creates a separate file. Filename-unsafe characters become underscores.
Each attempt records the exact YAML path and SHA-256, with start and outcome markers.
--debug includes detailed audits; the validation report records the resolved log
path and verbosity. Scenario YAMLs need no separate build-log filename.
Road diagnostic preset¶
Prepare both notebooks with one offline native build:
uv run --offline python src/build_transport.py --scenario config/scenarios/notebook_diagnostics.yaml --overwrite
The preset compiles an Ontario database with explicit future PEV ranges and prepares
complete registered Ontario MTO history, reviewed-mapping diagnostics, retention evidence,
both heavy-truck survival sources, and the opt-in Ontario MTO rating-weighting benchmark.
It does not regenerate the reviewed map. Add --download-sources only to permit
acquiring missing registered caches.
Captured evidence has its own build identity
After a successful build, outputs/validation/notebook_evidence/latest.json points
to local bundles containing losslessly compressed CSVs and the configuration used by each
notebook, file hashes, build time and database identity. Open either notebook and
reload after a new preset build. There is no notebook scenario selector. Later
ordinary builds leave these bundles intact; they continue to describe the recorded
diagnostic build until the next explicit preparation. Editing a live YAML file
cannot reinterpret an older bundle. Detailed parameter choices remain in the preset.
Only evidence regenerated by supported ETL or notebook commands belongs to this
handoff. The optional Ontario MTO benchmark is calculated by its versioned diagnostic routine
and remains labeled as a benchmark. Agent judgments, task acceptance comparisons,
browser captures and probe logs are temporary development work under ignored tmp/;
remove them when the task ends. They are not source inputs or reproducibility proof.
Notebook bundles are ignored local outputs. After a successful publication the builder
removes superseded bundles; a failed build preserves the latest successful evidence.
Keep registered caches, external models, reviewed mappings and notebook source files.
Parameter settings¶
Build logs report elapsed and process CPU time for prerequisites, parameters,
insertion and final checks.
Efficiency preparation also reports family-matching and regional composition times.
Detailed count-weight audits are available with --debug. Preparations reuse
matching/cohort results, physical costs and numerical source points within their
current inputs. Every build replays registered inputs and performs its configured
validation. Numerical sensitivity callers clearing the NLR ATB value cache read the
current NLR ATB values. NRCan CEUD/load evidence is fixed within one preparation instance.
| Section and field | Selections and behavior |
|---|---|
lifetimes.survival_curves |
false exports calibrated physical survivors with fixed lifetimes. true exports installed-equivalent acquisitions with annual vintage survival and explicit process lifetimes; it uses the approved shared tail rule and validates annual curves and lifetimes. Buses/motorcycles retain their existing pathway. |
lifetimes.road_lifetime_survival_source |
nhtsa_nems selects NHTSA CAFE car/light/medium and EIA NEMS heavy schedules. moves selects EPA MOVES car/light/heavy schedules, with medium trucks using heavy rates. One choice supplies medians, historical stock survival and future curves. |
lifetimes.survival_curve_max_age |
null derives each end age using the selected survival threshold, then zero. A positive integer shortens any longer derived curve by forcing zero at that age and audits the removed stock. |
lifetimes.tail_survival_threshold |
Surviving fraction that ends the derived tail; default 0.005 means 0.5%. The final positive year is followed by zero. |
lifetimes.tail_derivation |
Only constant_retirement is supported: keep native survival, extend the final annual retirement rate to the selected threshold or less, retain that positive year, then append zero. Select the surviving fraction with tail_survival_threshold. |
existing_capacity.vehicle_population_year |
Ontario MTO edition used for LDV and medium-truck aggregation and for Report 5 bus and motorcycle age allocation. null or omission follows periods.base_year. An explicit year must have registered Report A, 4 and 5 evidence. Car and truck cohorts use sales and survival. |
existing_capacity.cleanup_tolerance |
Retain positive road/bus/off-road capacity at or above this threshold in each row's native capacity unit. This is a capacity cutoff, independent of comparison tolerances; it does not trim costs or round parameters. Charger capacities have their own preparation. |
demand.cer_scenario |
CER CEF demand trajectory, also used for the normalized default-source marker. Must exist in the selected CER CEF edition. |
demand.future_car_demand |
GDP-indexed or extrapolated. Extrapolation uses configured historical car CAGR; light trucks receive the remainder of the unchanged GDP-indexed combined passenger demand. History and harmonization remain in rules. |
road_utilization.vkt_schedules |
Keep false for native compilation and caller-owned contributions. Select true in a separate age-dependent mileage study. |
efficiencies.atb_trajectory |
Advanced, Conservative, or Mid; selected from the pinned NLR ATB release. For the three publisher-defined vocational exceptions, Conservative selects native Constant with that label retained in audits. Global Constant was discontinued for most 2024 vehicle types and is rejected before I/O; native reference rows remain available. |
efficiencies.ceud_energy_calibration |
Required boolean. false preserves uncalibrated efficiency. true fits supported NRCan CEUD gasoline/diesel class totals on matched physical stock/activity, retaining unadjusted evidence and unsupported coverage. Requires fixed road lifetimes and flat utilization. The effective class multiplier transfers to all powertrains/years; electricity is not independently calibrated. See the energy method. |
costs.atb_trajectory |
The same NLR ATB choices, independently selectable from efficiencies. |
ev_chargers.evs_per_port |
Three positive ratios in order: LDV, medium trucks, heavy trucks. |
ev_chargers.charger_type_classes |
aggregated uses LDV/MHDV archetypes; explicit separates public L2, public fast, private LDV, overnight MHDV and fast MHDV chargers. Explicit requires charging_profiles.travel_behavior_source: none until type-specific profiles are registered. |
ev_chargers.ld_home_utilization |
Empirical home active-charging fraction, used only by explicit infrastructure. The reviewed default is 0.08; aggregate UF remains the manual 0.20/0.30. |
charging_profiles.travel_behavior_source |
none, nhts, or tts travel evidence for the registered corrected Ontario RAMP simulation. Production uses NHTS uncontrolled by default. The shape proxies shared LDV charging in every selected region. |
charging_profiles.charging_strategy |
uncontrolled (default), night, or day. Ordinary charging occurs at arrival, preferentially 22:00–07:00, or preferentially 07:00–18:00 Toronto time, respectively. Controlled cases spread energy over eligible parked minutes; low SOC/next-trip emergencies can charge outside those windows. |
charging_profiles.time_mapping |
Null uses elapsed-hour D001–D365/H01–H24 labels after Toronto-calendar hourly means. On caller-supplied axes, a complete hour_index,season,tod CSV maps all 8,760 physical hours to the receiving slices. Slice durations must agree with season fractions and TOD hours. Python callers can supply the same mapping as a DataFrame alongside both axes. |
BEV_PHEV_range_representation.mode |
none preserves new variants and adds no range rules. new_capacity_shares prepares minimum (ge) shares of new class/powertrain capacity from the registered EPA OMEGA baseline sales/CD-range evidence. representative_archetype replaces new LDV range variants with one BEV/PHEV per category and emits no range constraints. Existing BEVs/PHEVs always use representatives with EPA OMEGA weights, independently of this selection. |
embodied_emissions |
Enables the road vehicle-cycle layer. When false, preparation requires no embodied ANL GREET workbooks or result bank and inserts no embodied rows. |
embodied_materials |
conventional or lightweight, for LDVs only. MHDV values and provenance are independent of this selection. The registered release's glider selector mismatch is accepted because the affected saved range inputs are identical; unequal inputs require a reviewed correction before lightweight use. |
Charging profiles carry explicit inherited travel assumptions
The six corrected, hash-registered profiles and metadata live under
inputs/0_external_models/ramp_mobility/, alongside aggregate survey input databases
and the pinned simulation source. Frozen legacy v5 profiles are comparison evidence,
not production inputs. New profiles correct charging-loss/SOC and UTC weather alignment
and already contain inherited fleet/range/charger composition.
They are peak-normalized hourly power shapes; no new market shares are multiplied into
them. Elapsed-hour labels preserve all 8760 physical hours, including Toronto DST, and
do not identify summer wall-clock hours. The selected Ontario/shared-charger proxies
apply the BEV shape to LDV BEV/PHEV/motorcycle charging in all regions. Ontario TTS remains a
weekday-derived simulation with weekday evidence repeated on weekends. NHTS uses
unweighted filtered trip-takers and midpoint trip occurrences. Hourly factors are not directly comparable with the legacy
clustered/rescaled profiles. Select charging_profiles.travel_behavior_source: none to retain the
annual charger utilization without hourly profile factors.
Range shares are within-family composition
Range shares describe US regulatory car/light-truck EPA OMEGA baseline sales within each BEV/PHEV
group; they are not adoption shares. Passenger and freight light trucks use the same
light-truck distribution. The accepted MY2022 legacy snapshot proxies the Canadian market
and applies unchanged across model vintages. The evidence command is independent of mode:
uv run --offline python -m parameterization.ldv_ev_ranges --evidence-only.
It publishes source-row records, full-denominator buckets and unresolved sales, including
zero-sales buckets. It never substitutes catalogue counts or renormalizes unknown sales.
The epa_omega_baseline registration supplies the reviewed compact sales/range
extract. Validate and normalize the pinned extract with
uv run --offline python -m fetching.epa_omega_baseline.
Representative PHEVs preserve total energy with a shared blend
Representative preparation accepts the already-prepared parameter batches through
parameterization.ldv_ev_ranges.prepare_representative_parameters; it does not acquire
sources or rebuild prerequisites. It conserves sales-weighted consumption (harmonic
efficiency), costs per equal capacity/service unit, surviving cohorts and embodied gases.
C2A, utilization, fixed lifetimes and range survival curves must agree within a family;
unsupported coverage, units or relationships fail explicitly. Each category has one PHEV
blend with the accepted arithmetic mean of consumption-weighted vintage electricity
fractions, applied across periods and vehicle vintages. Total energy remains specific to
the vehicle vintage; gasoline/electricity deviations appear in representative_conservation.json.
Historical stock, MHDVs, motorcycles and shared charging shapes retain their existing rows.
Declare both embodied fields even when the layer is disabled. Generate the complete
registered source bank explicitly on Windows with desktop Excel:
uv run python -m fetching.greet_automation --scenario config/scenarios/default.yaml.
The runner uses disposable copies of the configured pair and publishes gas,
exclusion, case and report evidence with a manifest. Ordinary preparation and the
native scenario build validate and read this bank offline, without starting Excel. After
changing source inputs, controls, anchors or NLR ATB archetypes, regenerate it.
The source adapter selects one simulation target and the expected imported LDV
cohort year; changing these requires fresh validated evidence. The harmonization
rules currently hold the 2025 factors constant through 2050. Factors are lifetime
totals per manufactured vehicle, with no lifetime, mileage, service-output or
annual-rate division. Current vintage coordinates follow ScenarioPeriods.
Source quality scores are explicit inputs
Unannotated source/component DQ indicators resolve to 5 from the source registry's
defaults. Explicit component scores override source scores one indicator at a time.
Blank placeholders do not prevent scenario builds. Source database_note fields remain
empty until annotated; component notes may override them.
Age-dependent road mileage¶
To prepare VKT research evidence, first build the same scenario with flat
utilization to replay the registered source prerequisites. Keep its other
selections and set road_utilization.vkt_schedules: true in a complete temporary
scenario. Run the road-utilization owner serially against the corresponding
prepared evidence.
uv run --offline python -m parameterization.road_utilization --scenario path/to/vkt.yaml
The calculation holds each native NLR ATB class at its final source-supported
mileage before aggregation. Fixed-lifetime factors cover all operating periods
and average only operating years in a partial final period. Curve-mode factors
cover the model horizon while each process remains alive. Buses and motorcycles
retain flat factors. SQLite compilation and caller-owned insertion require
vkt_schedules: false because the pinned v4 table lacks the joint
operating-period/vintage index.
Period modes and observed years¶
periods.base_year is the parameter anchor used for stocks, demand,
ratings, load factors and annual turnover. NRCan CEUD extension to this anchor requires
an explicit sources.nrcan_ceud_beyond_observed selection of constant or
extrapolated. Extended values are labeled estimates. It is independent of
economics.cost_reference_year, which expresses costs in a common dollar basis.
With the template, observations end in 2023 and costs are expressed in 2020 CAD.
Changing the dollar year does not change the observation year or period labels.
Sales reconstruction and later NRCan CEUD base years¶
Cars and trucks use sales-derived cohorts. Buses and motorcycles use their class-specific age evidence. A later base year needs a matching period grid and an explicit constant or extrapolated NRCan CEUD extension. Held values are estimates, never new observations.
For each region/class, compute physical survivors as annual sales times survival to
periods.base_year, then multiply acquisitions and survivors by
k = CEUD base-year stock / raw surviving stock. Current sales begin in 2000, so
calibration absorbs missing older cohorts and other source mismatches without resolving
them. Keep the annual powertrain allocation rules and their explicit overrides.
Curves off exports calibrated survivors after fixed-lifetime redistribution. Curves on
exports calibrated installed-equivalent acquisitions with acquisition-weighted annual
vintage curves and matching process lifetimes. The latter retains the summed annual
survival path until the explicit small-tail retirement rule; it does not match future NRCan CEUD stocks. Apply the
same constant-retirement schedule before calibration and vintage grouping. Raw source
survival remains audit evidence. Preserve annual survivor totals when grouping vintages; only values too small for
Temoa end a grouped curve early. Report that adjustment without recalibrating it away. The production
method is assessed in docs/insights/stock_cohort_diagnosis.py.
Calibration closure is conditional on the selected evidence
All road classes use one flat annual utilization factor per region and class.
Divide activity at periods.base_year by the retained physical stock's annual
service capacity (the sum of stock × C2A across its technologies and vintages).
At the CEUD observation year, this matches the observed activity. For a later base
year, the demand owner projects activity from native CEUD with CER real GDP,
and the selected CEUD extension determines stock. The optional historical car
CAGR changes the car/light-truck split while preserving the passenger-LDV total.
The prior observed-year utilization mean remains diagnostic evidence.
Existing efficiency aggregation and EV charger counts also use physical survivors.
Acquisition weights construct the combined vintage survival curves. Calibration closes stock and
activity by construction. Optional efficiency calibration subsequently fits the
supported CEUD liquid-energy boundary at unchanged activity; total-energy
residuals retain their fuel-boundary limitations. Aggregate powertrain
composition can change when the cohort ages change, even with unchanged annual shares.
parameterization.ceud_inputs writes labeled parameter evidence separately from
native normalized files. It extends missing tails of currently reported series
through the base year and preserves all native observations. constant holds the
last reported value. extrapolated applies historical CAGR from eligible observed
annual changes under ceud_inputs.cagr, excluding intervals touching 2020–2021.
The same estimator supports demand.future_car_demand: extrapolated. Generated
values never train this rate. Zero endpoints remain zero, and insufficient positive
history or invalid projections fail explicitly. Road efficiency projections use the
separate aligned NRCan/NLR ATB 2023 bridge described in docs/assumptions.md.
Period labels differ from evidence years
periods.period_mode: prospective is the template default. A period begins on
December 31 of its label year and ends at the next model label: 2025 covers
2026–2030, and time-varying inputs that describe closing conditions target 2030. The final label,
2045, uses 2050 inputs; 2050 is added to SQLite only as the horizon marker.
Source values that do not vary by year retain their source evidence and dates.
Historical labels follow the same interval boundaries. Vintage 2015 represents 2016–2020 cohorts; vintage 2020 represents 2021–2025 cohorts, using only observed 2021–2023 data in this run. Historical efficiencies average those available years; year-varying historical cost evidence uses the last observed year in its bin, with the existing source-availability proxies and manual baselines. The oldest label also receives the initial-stock/oldest-cohort proxy. Annual audit rows retain their source/cohort years separately from their model vintage labels.
The observation year need not appear in periods.existing. The default grid ends
at 2020 because 2023 observations already belong there. An explicit 2023 label in
prospective mode has no observed years when base_year is 2023; setup and build
reports identify this empty label. Historical efficiency and cost rows follow
retained capacity keys. Lifetime and scaling defaults may still describe an
explicitly declared empty label. Existing charger capacity and the medium-truck
BEV override use the latest bin containing observations: vintage 2020 in the
template. Irregular existing labels are supported; each next label closes the
preceding interval.
For opening-period conditions, use period_mode: legacy and include the
observation year as the last existing label. The validation_opening_periods.yaml
preset uses this grid.
periods:
period_mode: legacy
base_year: 2023
existing: [2000, 2005, 2010, 2015, 2020, 2023]
model: [2025, 2030, 2035, 2040, 2045]
step: 5
lifetimes:
survival_curves: true
survival_curve_max_age: null
tail_derivation: constant_retirement
tail_survival_threshold: 0.005 # Surviving fraction: 0.5%, then zero
Legacy existing cohorts use the closing label of their historical bin. On this grid, 2016–2020 maps to vintage 2020, and 2021–2023 maps to vintage 2023. For future periods and vintages, legacy evaluates opening conditions. Demand and explicit charger installed-capacity shares at period 2025 therefore target 2025, as do purchase costs and vintage-specific charger utilization. This intentionally changes the prior comparison convention, which used 2030 for demand, efficiency and explicit installed-capacity shares. Source-native dates, stock calibration and monetary reference years retain their separate meanings.
New legacy road efficiency uses a trailing annual evidence window as wide as
periods.step. Vintage 2025 uses 2021–2025 where the selected technology has
support. Eligible years have equal weight for this new-vintage representation.
The existing 2023 vintage still owns the corresponding historical stock. Non-road
efficiencies use point targets, with source-specific holds and improvement rules.
See the efficiency assumptions for the
bridge, proxies and fixed PHEV input split.
The period_mapping reports list historical bins, empty bins, evaluation years
and new road efficiency windows. The five operating labels are 2025–2045, and
2050 is the terminal boundary in both modes. Standalone SQLite publication uses
the configured period and vintage grid.
Shared regional aggregation¶
Each scenario owns aggregation_sources, with explicit "ON" and other selections
for every fleet role. Add a region key to override other; BC covers BCT unless
BCT is explicit. A new source must be registered and active in sources.yaml, with
an implemented aggregation adapter. These selections apply consistently across parameters and future embodied
emissions; there are no parameter-specific aggregation-source selectors.
| Role | Current regional treatment |
|---|---|
stock_age |
Ontario MTO Report 5 age evidence for bus and motorcycle allocation. Cars and trucks use sales-derived cohorts. |
ldv |
Ontario MTO Report A class weights everywhere, for ratings, NLR ATB efficiency/cost, utilization and NHTSA CAFE lifetime products. Wards Intelligence LDV survival products remain opt-in comparison evidence. |
medium_trucks |
ON uses Report 4 including Class 2/2b; other regions use Wards Intelligence Classes 3–7. Class 2b maps to Class 2 NLR ATB VMT. All available freight vocations receive equal weights within GVWR class, excluding School/Transit/Refuse; identical VMT schedules retain separate vocation weights. |
heavy_truck_haul |
StatCan Table 23-10-0142-01 provincial origin-or-destination tonne-km shares, pooled over 2011–2017 with within-province shipments counted once, shared by efficiency, costs and utilization. The configured geography map currently uses BC alone for BCT. |
The nhtsa_nems profile applies the NHTSA CAFE 2b/3 schedule to medium trucks
and EIA NEMS Class 7–8 to heavy trucks, with NHTSA CAFE car and aggregated light-truck
schedules. The moves profile uses native car/light-truck schedules and shares
the heavy-vehicle schedule across medium and heavy trucks. All conditional rates
become cumulative survival with an explicit age-zero baseline. One selected
profile governs stock survival, fixed medians, curves and provenance.
The normal build prepares the registered EPA MOVES release when selected. To prepare its optional
notebook comparison evidence independently, run
uv run python -m fetching.assorted_sources --scenario <scenario.yaml> --moves-survival.
Add --no-download to require the registered PDF cache. Later EIA NEMS builds preserve
this comparison table and its source audit without requiring the unselected PDF.
The selected release is owned by sources.yaml and extraction rules.
Cleanup and cross-table support¶
The capacity builder removes zero and sub-threshold stock with a per-key audit and
totals by unit. Efficiency and cost builders then select retained existing
(region, tech, vintage) keys. The assembled contribution checks those relationships
again after charger rows have been added and immediately before caller-owned insertion:
| Support check | Current guarantee |
|---|---|
| Remove negligible capacity and dependent historical rows | Historical efficiency, costs, process lifetimes and survival curves are checked against retained capacity keys. Historical vintages come from the scenario. |
| Require efficiency for every cost key | Investment, fixed and variable cost keys must have efficiency at the same region, technology and vintage, including future investments and chargers. |
| Require support for new-technology annual factors | New technology factors must have efficiency at their exact v4 vintage. Prepared age-dependent profiles remain audit artifacts. |
| Omit inactive fixed-lifetime rows | Complete builds publish a lifetime_tech row only when that region and technology have capacity or efficiency. Preparation retains the full lifetime catalogue for parameter calculations. Technology-level capacity-to-activity defaults can remain without stock or efficiency. |
Support gaps stop insertion
Unexpected assembled support gaps fail before database writes rather than silently
discarding generated costs. parameter_support in the build report records checked
key counts; existing_capacity.cleanup records actual removals. Development callers
that explicitly omit a layer receive an audit limited to prepared dependency tables.
SQLite comparisons¶
For a second current-backend scenario, set comparison.mode: scenario and point
comparison.reference_sqlite to its existing database (for example,
outputs/sqlite/canoe_transport_other_scenario.sqlite). This compares all regions
and included tables on their primary-key fields after any provenance exclusions.
It reports missing keys and changed values, with exact comparison for units and
text. Numerical values use absolute_tolerance and relative_tolerance.
Unkeyed solver output tables use exact row multisets, preserving duplicate counts.
Schema mismatches or duplicate model keys after excluding provenance are reported as
non-comparable. This is a database difference report, not a solver-feasibility check.
include_provenance: false excludes source registry tables, source IDs, dataset IDs,
DQ scores, and notes. Set it to true when checking those fields. Some dataset IDs
can differ across workspaces because normalized evidence records local input paths.
References are opened read-only. An enabled comparison needs an existing reference different from the
output database. mode: none disables only comparison; keep every template field,
using reference_sqlite: null if unused. Results live under comparison in the
configured validation report; integrity/provenance/FK checks live under validation.
Validation and execution¶
Configuration loading rejects unknown fields, missing parameter controls, duplicate YAML
keys, inactive/unsupported source selectors, invalid period grids, unregistered NLR ATB/CER CEF
choices, invalid DQ scores, and rates outside zero to one. Scenario paths are accepted by
the existing Python entrypoints. Build a complete scenario with
uv run --offline python src/build_transport.py --scenario <scenario.yaml> --overwrite.
The command replays production prerequisites from registered caches on every invocation,
offline by default. --download-sources permits acquisition of missing caches; it does not
refresh existing caches. Paths and all model/source selections stay in YAML. Run scenarios
serially while derived artifact paths are shared. Manual review, optional diagnostics and
external-model generation remain explicit operations.
To stop at all model-ready parameter tables without inserting transport parameters or publishing SQLite, use the same entrypoint:
uv run --offline python src/build_transport.py --scenario config/scenarios/default.yaml --processed-only
This replays the same production prerequisites and contribution preparation, then writes
schema-column CSVs with headers for empty tables, supporting axes, source and dataset
lookups, and a manifest beneath inputs/2_processed/scenario_tables/<scenario.name>/.
The in-memory schema supplies preparation contracts for row-model, key, provenance and
parameter-support checks. A complete build also publishes SQLite, runs its foreign-key and
integrity checks, and publishes any selected notebook captures. Add --export-processed
to that build for the same CSV export.
For fast charging-only iteration, the existing parameter owner needs no database build:
uv run --offline python -m parameterization.ldv_charging_profiles --scenario config/scenarios/validation_charging_nhts_uncontrolled.yaml
To select the other registered combinations, copy the complete YAML to an
ignored temporary path and change charging_profiles.travel_behavior_source
(nhts or tts) or charging_profiles.charging_strategy (uncontrolled,
night or day). Run prepared cases serially. Outputs are retained separately
under inputs/2_processed/ldv_charging_profiles/{nhts,tts}/{uncontrolled,night,day}/.
Each contains capacity_factor_tech.csv, season/TOD tables, dataset/source lookups,
hourly_mapping.csv and hourly_calendar.csv. The latter maps elapsed-hour keys to local
and UTC timestamps; H01–H24 are not summer wall-clock labels. With the current reviewed
LDV utilization, all six Ontario factor tables have mean 0.20 for each charger technology.
The CLI prepares factors on the native full-hour axes. To target a different
calendar, use the caller-owned preparation API with the receiving season and
time-of-day axes and a complete mapping. The integration chapter
explains how to check the factors against the final representative-period weights.