switch_model/tools/graph/main.py
def read_modules(scenarios):
    """Reads all the modules found in modules.txt"""

    def read_modules_txt(scenario):
        """Returns a sorted list of all the modules in a run folder (by reading modules.txt)"""
        with scenario:
            module_list = get_module_list(include_solve_module=False)
        return np.sort(module_list)

    # Split compare_dirs into a base and a list of others
    scenario_base, other_scenarios = scenarios[0], scenarios[1:]
    module_names = read_modules_txt(scenario_base)

    # Check that all the compare_dirs have equivalent modules.txt
    for scenario in other_scenarios:
        scenario_module_names = read_modules_txt(scenario)
        if not np.array_equal(module_names, scenario_module_names):
            warnings.warn(f"modules.txt is not equivalent between {scenario_base.name} (len={len(module_names)}) and "
                          f"{scenario.name} (len={len(scenario_module_names)}). "
                          f"We will use the modules.txt in {scenario_base.name} however this may result "
                          f"in missing graphs and/or errors.")

    return module_names
Reads all the modules found in modules.txt
Reads all the modules found in modules.txt
Reads all the modules found in modules . txt
def read_modules(scenarios):
    def read_modules_txt(scenario):
        with scenario:
            module_list = get_module_list(include_solve_module=False)
        return np.sort(module_list)
    scenario_base, other_scenarios = scenarios[0], scenarios[1:]
    module_names = read_modules_txt(scenario_base)
    for scenario in other_scenarios:
        scenario_module_names = read_modules_txt(scenario)
        if not np.array_equal(module_names, scenario_module_names):
            warnings.warn(f"modules.txt is not equivalent between {scenario_base.name} (len={len(module_names)}) and "
                          f"{scenario.name} (len={len(scenario_module_names)}). "
                          f"We will use the modules.txt in {scenario_base.name} however this may result "
                          f"in missing graphs and/or errors.")
    return module_names
def read_modules ( scenarios ) : def read_modules_txt ( scenario ) : """Returns a sorted list of all the modules in a run folder (by reading modules.txt)""" with scenario : module_list = get_module_list ( include_solve_module = False ) return np . sort ( module_list ) scenario_base , other_scenarios = scenarios [ 0 ] , scenarios [ 1 : ] module_names = read_modules_txt ( scenario_base ) for scenario in other_scenarios : scenario_module_names = read_modules_txt ( scenario ) if not np . array_equal ( module_names , scenario_module_names ) : warnings . warn ( f"modules.txt is not equivalent between {scenario_base.name} (len={len(module_names)}) and " f"{scenario.name} (len={len(scenario_module_names)}). " f"We will use the modules.txt in {scenario_base.name} however this may result " f"in missing graphs and/or errors." ) return module_names
Reads all the modules found in modules.txt
Reads all the modules found in modules . txt
"""Reads all the modules found in modules.txt""" """Returns a sorted list of all the modules in a run folder (by reading modules.txt)""" # Split compare_dirs into a base and a list of others # Check that all the compare_dirs have equivalent modules.txt
scenarios