Exemplo n.º 1
0
 def test_get_curtailment_time_series(self):
     arg = [(scenario, "Washington"), (scenario, "Bay Area"),
            (scenario, "all")]
     expected_return = [
         pd.DataFrame(
             {
                 "solar_curtailment":
                 mock_curtailment["solar"].sum(axis=1).values,
             },
             index=mock_solar.index,
         ),
         pd.DataFrame(
             {
                 "wind_curtailment":
                 mock_curtailment["wind"].sum(axis=1).values,
                 "wind_offshore_curtailment":
                 mock_curtailment["wind_offshore"].sum(axis=1).values,
             },
             index=mock_wind.index,
         ),
         pd.DataFrame(
             {
                 "solar_curtailment":
                 mock_curtailment["solar"].sum(axis=1).values,
                 "wind_curtailment":
                 mock_curtailment["wind"].sum(axis=1).values,
                 "wind_offshore_curtailment":
                 mock_curtailment["wind_offshore"].sum(axis=1).values,
             },
             index=mock_pg.index,
         ),
     ]
     for a, e in zip(arg, expected_return):
         check_dataframe_matches(get_curtailment_time_series(*a), e)
Exemplo n.º 2
0
def test_get_generation_time_series_by_resources():
    arg = [(scenario, "Washington", "wind"), (scenario, "Oregon", "hydro")]
    expected = [
        pd.DataFrame({"wind": mock_pg["B"]}),
        pd.DataFrame({"hydro": mock_pg[["C", "D"]].sum(axis=1)}),
    ]
    for a, e in zip(arg, expected):
        check_dataframe_matches(get_generation_time_series_by_resources(*a), e)
Exemplo n.º 3
0
def test_sum_capacity_by_type_zone():
    expected_df = pd.DataFrame(
        {
            201: [9000, 5000],
            202: [0, 4000]
        },
        index=["solar", "wind"],
    )
    check_dataframe_matches(expected_df, sum_capacity_by_type_zone(scenario))
Exemplo n.º 4
0
 def test_sum_generation(self):
     expected_return = pd.DataFrame({
         "type": ["hydro", "solar", "wind"],
         1: [0, 10, 15],
         2: [23, 0, 0]
     })
     expected_return.set_index("type", inplace=True)
     summed_generation = sum_generation_by_type_zone(self.scenario)
     check_dataframe_matches(summed_generation, expected_return)
Exemplo n.º 5
0
def test_sum_generation_by_state_values_scaled(sim_gen_result):
    expected_return = pd.DataFrame(
        {
            "hydro": [0.023, 0, 0, 0.023, 0.023],
            "solar": [0, 0, 0.01, 0.01, 0.01],
            "wind": [0, 0.015, 0, 0.015, 0.015],
        },
        index=["California", "Oregon", "Washington", "Western", "all"],
    )
    check_dataframe_matches(sim_gen_result, expected_return)