switch_model/generators/extensions/storage.py
def graph_buildout(tools):
    """
    Create graphs relating to the storage that has been built
    """
    df = tools.get_dataframe("storage_builds.csv")
    df = tools.transform.load_zone(df)
    # Filter out rows where there's no power built
    df = df[df["IncrementalPowerCapacityMW"] != 0]
    df["duration"] = df["IncrementalEnergyCapacityMWh"] / df["IncrementalPowerCapacityMW"]
    df["power"] = df["IncrementalPowerCapacityMW"] / 1e3
    df["energy"] = df["IncrementalEnergyCapacityMWh"] / 1e3
    df = tools.transform.build_year(df)
    pn = tools.pn
    num_regions = len(df["region"].unique())
    plot = pn.ggplot(
        df,
        pn.aes(x='duration', y="power",
               color="build_year")) \
           + pn.geom_point() \
           + pn.labs(title="Storage Buildout", color="Build Year", x="Duration (h)", y="Power Capacity (GW)")

    tools.save_figure(by_scenario(tools, plot).draw(), "storage_duration")
    tools.save_figure(by_scenario_and_region(tools, plot, num_regions).draw(), "storage_duration_by_region")

    plot = pn.ggplot(df, pn.aes(x="duration")) \
           + pn.geom_histogram(pn.aes(weight="power"), binwidth=5) \
           + pn.labs(title="Storage Duration Histogram", x="Duration (h)", y="Power Capacity (GW)")

    tools.save_figure(by_scenario(tools, plot).draw(), "storage_duration_histogram")
    tools.save_figure(by_scenario_and_region(tools, plot, num_regions).draw(), "storage_duration_histogram_by_region")

    plot = pn.ggplot(df, pn.aes(x="duration")) \
           + pn.geom_histogram(pn.aes(weight="energy"), binwidth=5) \
           + pn.labs(title="Storage Duration Histogram", x="Duration (h)", y="Energy Capacity (GWh)")

    tools.save_figure(by_scenario(tools, plot).draw(), "storage_duration_histogram_by_energy")
    tools.save_figure(by_scenario_and_region(tools, plot, num_regions).draw(), "storage_duration_histogram_by_region_and_energy")

    Create graphs relating to the storage that has been built
    
Create graphs relating to the storage that has been built
Create graphs relating to the storage that has been built
def graph_buildout(tools):
    df = tools.get_dataframe("storage_builds.csv")
    df = tools.transform.load_zone(df)
    df = df[df["IncrementalPowerCapacityMW"] != 0]
    df["duration"] = df["IncrementalEnergyCapacityMWh"] / df["IncrementalPowerCapacityMW"]
    df["power"] = df["IncrementalPowerCapacityMW"] / 1e3
    df["energy"] = df["IncrementalEnergyCapacityMWh"] / 1e3
    df = tools.transform.build_year(df)
    pn = tools.pn
    num_regions = len(df["region"].unique())
    plot = pn.ggplot(
        df,
        pn.aes(x='duration', y="power",
               color="build_year")) \
           + pn.geom_point() \
           + pn.labs(title="Storage Buildout", color="Build Year", x="Duration (h)", y="Power Capacity (GW)")
    tools.save_figure(by_scenario(tools, plot).draw(), "storage_duration")
    tools.save_figure(by_scenario_and_region(tools, plot, num_regions).draw(), "storage_duration_by_region")
    plot = pn.ggplot(df, pn.aes(x="duration")) \
           + pn.geom_histogram(pn.aes(weight="power"), binwidth=5) \
           + pn.labs(title="Storage Duration Histogram", x="Duration (h)", y="Power Capacity (GW)")
    tools.save_figure(by_scenario(tools, plot).draw(), "storage_duration_histogram")
    tools.save_figure(by_scenario_and_region(tools, plot, num_regions).draw(), "storage_duration_histogram_by_region")
    plot = pn.ggplot(df, pn.aes(x="duration")) \
           + pn.geom_histogram(pn.aes(weight="energy"), binwidth=5) \
           + pn.labs(title="Storage Duration Histogram", x="Duration (h)", y="Energy Capacity (GWh)")
    tools.save_figure(by_scenario(tools, plot).draw(), "storage_duration_histogram_by_energy")
    tools.save_figure(by_scenario_and_region(tools, plot, num_regions).draw(), "storage_duration_histogram_by_region_and_energy")
def graph_buildout ( tools ) : df = tools . get_dataframe ( "storage_builds.csv" ) df = tools . transform . load_zone ( df ) df = df [ df [ "IncrementalPowerCapacityMW" ] != 0 ] df [ "duration" ] = df [ "IncrementalEnergyCapacityMWh" ] / df [ "IncrementalPowerCapacityMW" ] df [ "power" ] = df [ "IncrementalPowerCapacityMW" ] / 1e3 df [ "energy" ] = df [ "IncrementalEnergyCapacityMWh" ] / 1e3 df = tools . transform . build_year ( df ) pn = tools . pn num_regions = len ( df [ "region" ] . unique ( ) ) plot = pn . ggplot ( df , pn . aes ( x = 'duration' , y = "power" , color = "build_year" ) ) + pn . geom_point ( ) + pn . labs ( title = "Storage Buildout" , color = "Build Year" , x = "Duration (h)" , y = "Power Capacity (GW)" ) tools . save_figure ( by_scenario ( tools , plot ) . draw ( ) , "storage_duration" ) tools . save_figure ( by_scenario_and_region ( tools , plot , num_regions ) . draw ( ) , "storage_duration_by_region" ) plot = pn . ggplot ( df , pn . aes ( x = "duration" ) ) + pn . geom_histogram ( pn . aes ( weight = "power" ) , binwidth = 5 ) + pn . labs ( title = "Storage Duration Histogram" , x = "Duration (h)" , y = "Power Capacity (GW)" ) tools . save_figure ( by_scenario ( tools , plot ) . draw ( ) , "storage_duration_histogram" ) tools . save_figure ( by_scenario_and_region ( tools , plot , num_regions ) . draw ( ) , "storage_duration_histogram_by_region" ) plot = pn . ggplot ( df , pn . aes ( x = "duration" ) ) + pn . geom_histogram ( pn . aes ( weight = "energy" ) , binwidth = 5 ) + pn . labs ( title = "Storage Duration Histogram" , x = "Duration (h)" , y = "Energy Capacity (GWh)" ) tools . save_figure ( by_scenario ( tools , plot ) . draw ( ) , "storage_duration_histogram_by_energy" ) tools . save_figure ( by_scenario_and_region ( tools , plot , num_regions ) . draw ( ) , "storage_duration_histogram_by_region_and_energy" )
Create graphs relating to the storage that has been built
Create graphs relating to the storage that has been built
"""
    Create graphs relating to the storage that has been built
    """ # Filter out rows where there's no power built
tools