Repository navigation
Feature/data dir - #242
Open
j-brendel wants to merge 4 commits into
Open
Feature/data dir#242j-brendel wants to merge 4 commits into
j-brendel wants to merge 4 commits into
Conversation
Relative path arguments and csv_file entries of electrified stations are resolved against data_dir (config, --data-dir or SIMBA_DATA_DIR). A relative data_dir is relative to the config file. Without data_dir nothing changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- better use of add_argument options (default, type) - move resolve_csv_files fom data_container to util - streamline resolve_data_dir function
stefansc1
approved these changes
Oct 15, 2026
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.
Central base directory (
data_dir) for relative input/output pathsProblem
All paths in a SimBA config (
schedule_path,electrified_stations_path,output_path, ...) andthe
csv_fileentries insideelectrified_stations.jsonare resolved relative to the currentworking directory, not relative to the config file.
As a result, scenario data has to live inside the SimBA repository (e.g.
data/private_examples/),or every file has to contain absolute paths. Moving a scenario folder, e.g. confidential project
data to a separate (cloud) drive outside the repository, means editing paths in many files.
Absolute paths are machine-specific, so configs cannot be shared between colleagues.
Proposed solution
Add a new option
data_dirthat serves as a central base directory for relative paths:data_dircan be set in the config, via--data-dir, or via the environment variableSIMBA_DATA_DIR. With the environment variable, no machine-specific path has to be stored inany file.
data_diris resolved relative to the config file.csv_fileentries in electrifiedstations (
fixed_load,local_generation,price_csv, ...), anddecision_tree_pathin theoptimizer config.
(e.g.
vehicle_types_path). Those stay relative to the working directory.data_dir: the behaviour is unchanged (fully backwards compatible).Implementation (branch
feature/data_dir)simba/util.py: new argument--data-dir, helpersresolve_path()andresolve_data_dir(),called in
get_args()after deprecated arguments are replaced.simba/data_container.py:resolve_csv_files()is applied to the electrified stations inadd_stations_from_json(), so SimBA and SpiceEV receive absolute paths.simba/simulate.py: resolvesdecision_tree_pathof the optimizer config.tests/test_util.pyandtests/test_data_container.py. Docs insimulation_parameters.rstandextensive.cfg.