@@ -720,22 +720,7 @@ def post_solve(m, outdir):
720720 )
721721
722722
723- < << << << HEAD
724- def graph (tools ):
725- graph_capacity (tools )
726- graph_buildout_per_tech (tools )
727-
728-
729- def compare (tools ):
730- graph_buildout (tools )
731-
732-
733- == == == =
734- @graph (
735- "generation_capacity_per_period" ,
736- title = "Online Generation Capacity Per Period"
737- )
738- > >> >> >> b3590fdb (Redesign graphing API )
723+ @graph ("generation_capacity_per_period" , title = "Online Generation Capacity Per Period" )
739724def graph_capacity (tools ):
740725 # Load gen_cap.csv
741726 gen_cap = tools .get_dataframe ("gen_cap.csv" )
@@ -768,33 +753,25 @@ def graph_capacity(tools):
768753
769754 # Plot
770755 # Get a new set of axis to create a breakdown of the generation capacity
771- < << << << HEAD
772- ax = tools .get_axes (
773- out = "generation_capacity_per_period" ,
774- title = "Online generating capacity by period" ,
775- )
776756 capacity_df .plot (
777757 kind = "bar" ,
778- ax = ax ,
779- == == == =
780- capacity_df .plot (
781- kind = 'bar' ,
782758 ax = tools .get_axes (),
783- >> >> >> > b3590fdb (Redesign graphing API )
784759 stacked = True ,
785760 ylabel = "Capacity Online (GW)" ,
786761 xlabel = "Period" ,
787762 color = tools .get_colors (len (capacity_df .index )),
788763 )
789764
765+ tools .bar_label ()
766+
790767
791768@graph (
792769 "buildout_gen_per_period" ,
793770 title = "Built Capacity per Period" ,
794- supports_multi_scenario = True
771+ supports_multi_scenario = True ,
795772)
796773def graph_buildout (tools ):
797- build_gen = tools .get_dataframe ("BuildGen.csv" )
774+ build_gen = tools .get_dataframe ("BuildGen.csv" , dtype = { "GEN_BLD_YRS_1" : str } )
798775 build_gen = build_gen .rename (
799776 {
800777 "GEN_BLD_YRS_1" : "GENERATION_PROJECT" ,
@@ -804,13 +781,7 @@ def graph_buildout(tools):
804781 axis = 1 ,
805782 )
806783 build_gen = tools .transform .build_year (build_gen )
807- << < << << HEAD
808- gen = tools .get_dataframe (
809- "generation_projects_info" , from_inputs = True , all_scenarios = True
810- )
811- == == == =
812784 gen = tools .get_dataframe ("generation_projects_info" , from_inputs = True )
813- >> >> >> > b3590fdb (Redesign graphing API )
814785 gen = tools .transform .gen_type (gen )
815786 gen = gen [["GENERATION_PROJECT" , "gen_type" , "scenario_name" ]]
816787 build_gen = build_gen .merge (
@@ -845,33 +816,22 @@ def graph_buildout(tools):
845816
846817 # Plot
847818 # Get a new set of axis to create a breakdown of the generation capacity
848- < << << << HEAD
849- ax = tools .get_axes (out = "buildout_per_period" , title = "Built capacity per period" )
850819 build_gen .plot (
851820 kind = "bar" ,
852- ax = ax ,
853- == == == =
854- build_gen .plot (
855- kind = 'bar' ,
856821 ax = tools .get_axes (),
857- >> >> >> > b3590fdb (Redesign graphing API )
858822 stacked = True ,
859823 ylabel = "Capacity Online (GW)" ,
860824 xlabel = "Period" ,
861825 color = tools .get_colors (len (build_gen .index )),
862826 )
863- << < << << HEAD
864-
865- == == == =
866- >> > >> > > b3590fdb (Redesign graphing API )
867827
868828
869829@graph (
870830 "gen_buildout_per_tech_period" ,
871831 title = "Buildout relative to max allowed for period" ,
872832 note = "\n Note 1: This graph excludes predetermined buildout and projects that have no capacity limit."
873- "\n Technologies that contain projects with no capacity limit are marked by a * and their graphs may"
874- "be misleading."
833+ "\n Technologies that contain projects with no capacity limit are marked by a * and their graphs may"
834+ "be misleading." ,
875835)
876836def graph_buildout_per_tech (tools ):
877837 # Load gen_cap.csv
@@ -920,32 +880,16 @@ def graph_buildout_per_tech(tools):
920880 # Set the name of the legend.
921881 df = df .rename_axis ("Type" , axis = "columns" )
922882 # Add a * to tech
923- << << < << HEAD
924883 df = df .rename (
925884 lambda c : f"{ c } *" if c in unlimited_gen_types .values else c , axis = "columns"
926885 )
927- # Get axes to graph on
928- ax = tools .get_axes (
929- out = "gen_buildout_per_tech_no_pred" ,
930- title = "Buildout relative to max allowed for period" ,
931- note = "\n Note 1: This graph excludes predetermined buildout and projects that have no capacity limit."
932- "\n Technologies that contain projects with no capacity limit are marked by a * and their graphs may"
933- "be misleading." ,
934- )
935- == == == =
936- df = df .rename (lambda c : f"{ c } *" if c in unlimited_gen_types .values else c , axis = 'columns' )
937- >> >> > >> b3590fdb (Redesign graphing API )
938886 # Plot
939887 colors = tools .get_colors ()
940888 if colors is not None :
941889 # Add the same colors but with a * to support our legend.
942890 colors .update ({f"{ k } *" : v for k , v in colors .items ()})
943- << << < << HEAD
944- df .plot (ax = ax , kind = "line" , color = colors , xlabel = "Period" , marker = "x" )
945- == == == =
946891 ax = tools .get_axes ()
947- df .plot (ax = ax , kind = 'line' , color = colors , xlabel = 'Period' , marker = "x" )
948- >> >> > >> b3590fdb (Redesign graphing API )
892+ df .plot (ax = ax , kind = "line" , color = colors , xlabel = "Period" , marker = "x" )
949893 # Set the y-axis to use percent
950894 ax .yaxis .set_major_formatter (tools .mplt .ticker .PercentFormatter (1.0 ))
951895 # Horizontal line at 100%
0 commit comments