Reading input functions
add_default_system_data!
MacroEnergy.add_default_system_data! — Function
add_default_system_data!(system_data::AbstractDict{Symbol,Any})::NothingAdd the default system data to the system data dictionary. This adds any required fields that are missing.
sourceclean_up_keys
MacroEnergy.clean_up_keys — Function
clean_up_keys(dict::AbstractDict{Symbol,Any})::AbstractDict{Symbol,Any}
Clean up a Dict{Symbol,Any} object by copying values from keys that match the key name.sourceeager_load_json_inputs
MacroEnergy.eager_load_json_inputs — Function
eager_load_json_inputs(json_data::AbstractDict{Symbol, Any}, rel_path::AbstractString)::AbstractDict{Symbol, Any}
Recursively loads data from sources specified in an input Dict{Symbol,Any} and returns a new
Dict{Symbol,Any} object with the data inserted.sourceeager_load_json_inputs(json_data::AbstractVector{<:AbstractDict{Symbol,Any}}, rel_path::AbstractString)::AbstractVector{<:AbstractDict{Symbol,Any}}
Recursively loads data from sources specified in several input Dict{Symbol,Any}, stored as a Vector,
and returns a new Vector{Dict{Symbol,Any}} object with the data inserted.sourcefetch_data
MacroEnergy.fetch_data — Function
fetch_data(path::AbstractString, dict::AbstractDict{Symbol, Any}, root_path::AbstractString, lazy_load::Bool = true)::Any
Fetch data from a JSON file or directory and return it as a Dict{Symbol,Any} object.sourceload_csv
MacroEnergy.load_csv — Function
load_time_series_data(file_path::AbstractString, header::AbstractVector{Symbol})::Dict{Symbol,Any}
Load time series data from one or more headers in a CSV file and return as a DataFrame.sourceload_default_system_data
MacroEnergy.load_default_system_data — Function
load_default_system_data()::Dict{Symbol,Any}Load the default system data from a JSON file. This describes the default locations for the system data files.
sourceload_json_inputs
MacroEnergy.load_json_inputs — Function
load_json_inputs(file_path::AbstractString; rel_path::AbstractString=dirname(file_path), lazy_load::Bool = true)::Dict{Symbol,Any}
Load JSON data from a file and return a Dict{Symbol,Any} object. The data can all be included in the
specified JSON file or distributed across multiple files and directories, with each source specified
using "path" or "timeseries" keys.\n
The `rel_path` argument is used to specify the path relative to which the file paths of this distributed
data should be resolved.\n
If `lazy_load` is set to `true`, then only the top-level data in the specified JSON file will be loaded.
If `lazy_load` is set to `false`, then the distrinuted data will be loaded recursively into the
appropriate data structures.sourceload_system
MacroEnergy.load_system — Function
load_system(path::AbstractString = pwd(); lazy_load::Bool=true)Load a system from the system_data.json file or directory containing the system data.
Arguments
path::AbstractString = pwd(): The path to thesystem_data.jsonfile or directory containing the system data.lazy_load::Bool=true: Whether to lazy load the system data.
Returns
- A
Systemobject containing the case data.
Examples
system = load_system("path/to/system_data.json")system = load_system("path/to/system_data_directory")sourceload_system_data
MacroEnergy.load_system_data — Function
load_system_data(file_path::AbstractString, rel_path::AbstractString; lazy_load::Bool = true)::Dict{Symbol,Any}Load the system data (currently only from a JSON file) given a file path and directory to search for the file in. All other file names defined in the system data file are assumed to be relative to rel_path.
sourceload_system_data(file_path::AbstractString, (system::System))::Dict{Symbol,Any}Load the system data (currently only from a JSON file) given a file path and existing System. All other file names defined in the system data file are assumed to be relative to the data_dirpath field of the System.
sourceprep_system_data
MacroEnergy.prep_system_data — Function
prep_system_data(file_path::AbstractString)::NothingThis attempts to load the system data from the file at file_path, adds any missing fields from the default system data, and writes the updated system data back to the file. In the future, we may change this to not write to the file, but for now, it's a quick way to ensure the system data is up-to-date.
sourceload_benders_settings
MacroEnergy.load_benders_settings — Function
load_benders_settings(settings::AbstractDict{Symbol,Any}, path::AbstractString)::AbstractDict{Symbol,Any}Load Benders settings from a file. First checks if a specific path is provided in the settings, otherwise looks for benders_settings.json in the settings directory. Handles both absolute and relative paths.
sourcetry_load_benders_settings
MacroEnergy.try_load_benders_settings — Function
try_load_benders_settings(path::AbstractString)::Union{AbstractDict{Symbol,Any}, Nothing}Attempts to load Benders settings from the given path. Returns the settings if found, nothing otherwise.
source