feat: add TimexLCASettings and TimexLCA.run() for streamlined full-pipeline execution - #221
Closed
TimoDiepers wants to merge 2 commits into
Closed
feat: add TimexLCASettings and TimexLCA.run() for streamlined full-pipeline execution#221TimoDiepers wants to merge 2 commits into
TimoDiepers wants to merge 2 commits into
Conversation
…peline execution Adds TimexLCASettings dataclass to encapsulate all configuration options for a complete TimexLCA calculation: - Core parameters: demand, method, database_dates, use_global_lci_cache - Timeline parameters: starting_datetime, temporal_grouping, interpolation_type, edge_filter_function, cutoff, max_calc, graph_traversal, traverse_background - LCI parameters: build_dynamic_biosphere, expand_technosphere, keep_activity_dimension - LCIA parameters: static_lcia_enabled, dynamic_lcia_enabled, metric, time_horizon, fixed_time_horizon, time_horizon_start, characterization_functions, characterization_function_co2, use_disaggregated_lci Adds TimexLCA.run(settings) method that executes the full pipeline: 1. build_timeline() with all specified parameters 2. lci() with specified LCI options 3. static_lcia() (if enabled) 4. dynamic_lcia() (if enabled) with all dynamic characterization options Enables method chaining for convenience. Includes comprehensive test coverage for various configurations and parameter combinations.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #221 +/- ##
==========================================
+ Coverage 78.51% 78.87% +0.35%
==========================================
Files 10 10
Lines 2472 2552 +80
==========================================
+ Hits 1941 2013 +72
- Misses 531 539 +8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…rent settings Adds _reset_run_state() method that clears timeline, LCI, and LCIA results between runs while preserving the expensive base_lca calculation. This enables efficient parameter sweeps and sensitivity analyses by: - Reusing base LCA across multiple runs (no recalculation overhead) - Clearing instance state for fresh timeline/LCI/LCIA calculations - Supporting different settings (temporal_grouping, starting_datetime, LCIA metrics) per run Includes 3 new tests: - test_run_multiple_times_with_different_settings: verifies different results for different datetime parameters - test_run_multiple_times_reuses_base_lca: confirms base_lca object identity preserved - All existing tests continue to pass
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
TimexLCASettingsconfiguration dataclass andTimexLCA.run()method to streamline full-pipeline execution of time-explicit LCA calculations.The settings class encapsulates all configuration options for timeline building, LCI calculation, and LCIA (both static and dynamic), enabling cleaner, more maintainable code for complex analyses.
Test plan
Changes
New Classes
TimexLCASettings: Dataclass containing all pipeline configuration parametersNew Methods
TimexLCA.run(settings): Executes full pipeline in sequenceReturns self for method chaining and includes detailed logging of each step.
Exports
TimexLCASettingsis exported frombw_timex.__init__for convenient access🤖 Generated with Claude Code
https://claude.ai/code/session_01Jog2Qz6f56dUM437aK7xUq