Reading input functions

add_default_system_data!

MacroEnergy.add_default_system_data!Function
add_default_system_data!(system_data::AbstractDict{Symbol,Any})::Nothing

Add the default system data to the system data dictionary. This adds any required fields that are missing.

source

clean_up_keys

MacroEnergy.clean_up_keysFunction
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.
source

eager_load_json_inputs

MacroEnergy.eager_load_json_inputsFunction
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.
source
eager_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.
source

fetch_data

MacroEnergy.fetch_dataFunction
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.
source

load_csv

MacroEnergy.load_csvFunction
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.
source

load_default_system_data

load_json_inputs

MacroEnergy.load_json_inputsFunction
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.
source

load_system

MacroEnergy.load_systemFunction
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 the system_data.json file or directory containing the system data.
  • lazy_load::Bool=true: Whether to lazy load the system data.

Returns

  • A System object containing the case data.

Examples

system = load_system("path/to/system_data.json")
system = load_system("path/to/system_data_directory")
source

load_system_data

MacroEnergy.load_system_dataFunction
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.

source
load_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.

source

prep_system_data

MacroEnergy.prep_system_dataFunction
prep_system_data(file_path::AbstractString)::Nothing

This 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.

source

load_benders_settings

MacroEnergy.load_benders_settingsFunction
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.

source

try_load_benders_settings

MacroEnergy.try_load_benders_settingsFunction
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