예제 #1
0
def calculate_ac_inv_costs(scenario, sum_results=True, exclude_branches=None):
    """Calculate cost of upgrading AC lines and/or transformers in a scenario.
    NEEM regions are used to find regional multipliers.

    :param powersimdata.scenario.scenario.Scenario scenario: scenario instance.
    :param bool sum_results: whether to sum data frame for each branch type. Defaults to
        True.
    :return: (*dict*) -- keys are {'line_cost', 'transformer_cost'}, values are either
        float if ``sum_results``, or pandas Series indexed by branch ID.
        Whether summed or not, values are $USD, inflation-adjusted to today.
    """

    base_grid = Grid(scenario.info["interconnect"].split("_"))
    grid = scenario.state.get_grid()

    # find upgraded AC lines
    grid_new = cp.deepcopy(grid)
    # Reindex so that we don't get NaN when calculating upgrades for new branches
    base_grid.branch = base_grid.branch.reindex(grid_new.branch.index).fillna(0)
    grid_new.branch.rateA = grid.branch.rateA - base_grid.branch.rateA
    grid_new.branch = grid_new.branch[grid_new.branch.rateA != 0.0]
    if exclude_branches is not None:
        present_exclude_branches = set(exclude_branches) & set(grid_new.branch.index)
        grid_new.branch.drop(index=present_exclude_branches, inplace=True)

    costs = _calculate_ac_inv_costs(grid_new, sum_results)
    return costs
예제 #2
0
def calculate_ac_inv_costs(scenario, sum_results=True, exclude_branches=None):
    """Given a Scenario object, calculate the total cost of building that scenario's
    upgrades of lines and transformers.
    Currently uses NEEM regions to find regional multipliers.
    Currently ignores financials, but all values are in 2010 $-year.
    Need to test that there aren't any na values in regional multipliers
    (some empty parts of table)

    :param powersimdata.scenario.scenario.Scenario scenario: scenario instance.
    :param boolean sum_results: if True, sum dataframe for each category.
    :return: (*dict*) -- Total costs (line costs, transformer costs) (in $2010).
    """

    base_grid = Grid(scenario.info["interconnect"].split("_"))
    grid = scenario.state.get_grid()

    # find upgraded AC lines
    grid_new = cp.deepcopy(grid)
    # Reindex so that we don't get NaN when calculating upgrades for new branches
    base_grid.branch = base_grid.branch.reindex(
        grid_new.branch.index).fillna(0)
    grid_new.branch.rateA = grid.branch.rateA - base_grid.branch.rateA
    grid_new.branch = grid_new.branch[grid_new.branch.rateA != 0.0]
    if exclude_branches is not None:
        present_exclude_branches = set(exclude_branches) & set(
            grid_new.branch.index)
        grid_new.branch.drop(index=present_exclude_branches, inplace=True)

    costs = _calculate_ac_inv_costs(grid_new, sum_results)
    return costs
예제 #3
0
    def __init__(self, interconnect):
        """Constructor.

        """
        if isinstance(interconnect, str):
            self.grid = Grid([interconnect])
        else:
            self.grid = Grid(interconnect)

        # Set attribute
        self.ct = {}
def test_add_electrification_by_zone():
    obj = ChangeTable(Grid("Eastern"))
    kind = "building"

    info = {
        "New York City": {
            "res_cooking": {
                "advanced_heat_pump_v2": 0.7
            }
        },
        "Western North Carolina": {
            "com_hot_water": {
                "standard_heat_pump_v1": 0.5,
                "advanced_heat_pump_v2": 0.5,
            }
        },
    }
    add_electrification(obj, kind, {"zone": info})

    sf = {"standard_heat_pump_v1": 0.2, "advanced_heat_pump_v2": 0.8}
    info = {"Maine": {"res_cooking": sf}}
    add_electrification(obj, kind, {"zone": info})

    result = obj.ct[kind]
    assert "Maine" in result["zone"]
    assert "New York City" in result["zone"]
예제 #5
0
    def extract(self, region, start_date, end_date, file_path, grid_model,
                no_impute, **kwargs):
        """See :py:func:`prereise.cli.data_sources.data_source.DataSource.extract`

        :param list region: list of regions to download wind farm data for
        :param str start_date: date designating when to start the data download
        :param str end_date: date designating when to end the data download
        :param str file_path: file location on local filesystem on where to store the data
        :param str grid_model: .mat file path for a grid model or a string supported by
            `powersimdata.input.grid.Grid.SUPPORTED_MODELS`
        :param bool no_impute: flag used to avoid naive gaussian imputing of missing data
        """
        assert datetime.strptime(start_date, DATE_FMT) <= datetime.strptime(
            end_date, DATE_FMT)

        grid = Grid(region, source=grid_model)
        wind_farms = grid.plant.groupby("type").get_group("wind")
        data, missing = rap.retrieve_data(wind_farms,
                                          start_date=start_date,
                                          end_date=end_date)
        if len(missing) > 0:
            logging.warning(f"There are {len(missing)} files missing")
            # Imputing any missing data in place
            if not no_impute:
                logging.warning(
                    "Performing naive gaussian imputing of missing data")
                impute.gaussian(data, wind_farms, inplace=True)
        data.to_pickle(file_path)
예제 #6
0
def write_bus_reeds_map():
    """Write bus location to ReEDS region mapping to file."""
    base_grid = Grid(["USA"])
    df_pts_bus = bus_to_reeds_reg(base_grid.bus)
    df_pts_bus.sort_index(inplace=True)
    os.makedirs(const.bus_reeds_regions_path, exist_ok=True)
    df_pts_bus.to_csv(const.bus_reeds_regions_path)
예제 #7
0
    def extract(
        self, region, method, year, file_path, email, key, grid_model, **kwargs
    ):
        """See :py:func:`prereise.cli.data_sources.data_source.DataSource.extract`

        :param list region: list of regions to download data for
        :param str method: string indicating the modeling for power output
        :param str year: string in the format YYYY denoting year to download from
        :param str file_path: file location on local filesystem on where to store the data
        :param str email: email used to sign up at https://developer.nrel.gov/signup/
        :param str key: API key that can be requested at https://developer.nrel.gov/signup/
        :param str grid_model: .mat file path for a grid model or a string supported by
            `powersimdata.input.grid.Grid.SUPPORTED_MODELS`
        """
        grid = Grid(region, source=grid_model)
        solar_plants = grid.plant.groupby("type").get_group("solar")
        if method == NAIVE_STRING:
            data = naive.retrieve_data(solar_plants, email, key, year)
        elif method == SAM_STRING:
            data = sam.retrieve_data_blended(
                email, key, solar_plants=solar_plants, year=year
            )
        else:
            raise ValueError(f"Unexpected method {method}")
        data.to_pickle(file_path)
예제 #8
0
    def get_base_grid(self):
        """Returns original grid.

        :return: (*powersimdata.input.grid.Grid*) -- a Grid object.
        """
        return Grid(
            self._scenario_info["interconnect"].split("_"),
            source=self._scenario_info["grid_model"],
        )
예제 #9
0
def calculate_gen_inv_costs(scenario, year, cost_case, sum_results=True):
    """Calculate cost of upgrading generators in a scenario. ReEDS regions are used to
    find regional multipliers.

    :param powersimdata.scenario.scenario.Scenario scenario: scenario instance.
    :param int/str year: building year.
    :param str cost_case: ATB cost case of data. *'Moderate'*: mid cost case,
        *'Conservative'*: generally higher costs, *'Advanced'*: generally lower costs
    :param bool sum_results: whether to sum data frame for plant costs. Defaults to
        True.
    :return: (*pandas.Series*) -- Overnight generation investment cost.
        If ``sum_results``, indices are technologies and values are total cost.
        Otherwise, indices are IDs of plants (including storage, which is given
        pseudo-plant-IDs), and values are individual generator costs.
        Whether summed or not, values are $USD, inflation-adjusted to today.

    .. todo:: it currently uses one (arbitrary) sub-technology. The rest of the costs
        are dropped. Wind and solar will need to be fixed based on the resource supply
        curves.
    """

    base_grid = Grid(scenario.info["interconnect"].split("_"))
    grid = scenario.state.get_grid()

    # Find change in generation capacity
    grid_new = cp.deepcopy(grid)
    # Reindex so that we don't get NaN when calculating upgrades for new generators
    base_grid.plant = base_grid.plant.reindex(grid_new.plant.index).fillna(0)
    grid_new.plant.Pmax = grid.plant.Pmax - base_grid.plant.Pmax
    # Find change in storage capacity
    # Reindex so that we don't get NaN when calculating upgrades for new storage
    base_grid.storage["gen"] = base_grid.storage["gen"].reindex(
        grid_new.storage["gen"].index, fill_value=0
    )
    grid_new.storage["gen"].Pmax = (
        grid.storage["gen"].Pmax - base_grid.storage["gen"].Pmax
    )
    grid_new.storage["gen"]["type"] = "storage"

    # Drop small changes
    grid_new.plant = grid_new.plant[grid_new.plant.Pmax > 0.01]

    costs = _calculate_gen_inv_costs(grid_new, year, cost_case, sum_results)
    return costs
def test_add_electrification():
    obj = ChangeTable(Grid("Texas"))
    kind = "building"

    sf = {"standard_heat_pump_v1": 0.7, "advanced_heat_pump_v2": 0.3}
    info = {"res_heating": sf}
    add_electrification(obj, kind, {"grid": info})

    with pytest.raises(ValueError):
        add_electrification(obj, "foo", {"grid": info})
예제 #11
0
def write_bus_reeds_map():
    """
    Maps the bus locations from the base USA grid to ReEDS regions.
    Writes out csv with bus numbers, associated ReEDS regions, and distances.
    """
    base_grid = Grid(["USA"])
    df_pts_bus = bus_to_reeds_reg(base_grid.bus)
    df_pts_bus.sort_index(inplace=True)
    os.makedirs(const.bus_reeds_regions_path, exist_ok=True)
    df_pts_bus.to_csv(const.bus_reeds_regions_path)
예제 #12
0
def write_bus_neem_map():
    """
    Maps the bus locations from the base USA grid to NEEM regions.
    Writes out csv with bus numbers, associated NEEM region, and lat/lon of bus
        (to check if consistent with bus location in _calculate_ac_inv_costs).
    """
    base_grid = Grid(["USA"])
    df_pts_bus = bus_to_neem_reg(base_grid.bus)
    df_pts_bus.sort_index(inplace=True)
    os.makedirs(const.bus_neem_regions_path, exist_ok=True)
    df_pts_bus.to_csv(const.bus_neem_regions_path)
예제 #13
0
    def __init__(self, grid_model, interconnect, table):
        """Constructor."""
        mi = ModelImmutables(grid_model)

        self.grid_model = mi.model
        self.interconnect = mi.interconnect_to_name(interconnect)

        self.base_grid = Grid(interconnect, source=grid_model)
        self.change_table = ChangeTable(self.base_grid)

        self.existing = table[table.interconnect == self.interconnect]
def test_add_electrification_combined():
    obj = ChangeTable(Grid("Eastern"))
    kind = "building"
    sf = {"standard_heat_pump_v1": 0.2, "advanced_heat_pump_v2": 0.8}
    zone = {"Maine": {"res_cooking": sf}}
    grid = {"res_heating": sf}

    info = {"grid": grid, "zone": zone}
    add_electrification(obj, kind, info)

    assert info == obj.ct[kind]
예제 #15
0
def calculate_dc_inv_costs(scenario, sum_results=True):
    """Given a Scenario object, calculate the total cost of that grid's dc line
        investment. Currently ignores financials, but all values are in 2015 $-year.

    :param powersimdata.scenario.scenario.Scenario scenario: scenario instance.
    :param boolean sum_results: if True, sum Series to return float.
    :return: (*pandas.Series/float*) -- [Summed] dc line costs.
    """
    base_grid = Grid(scenario.info["interconnect"].split("_"))
    grid = scenario.state.get_grid()

    grid_new = cp.deepcopy(grid)
    # Reindex so that we don't get NaN when calculating upgrades for new DC lines
    base_grid.dcline = base_grid.dcline.reindex(
        grid_new.dcline.index).fillna(0)
    # find upgraded DC lines
    grid_new.dcline.Pmax = grid.dcline.Pmax - base_grid.dcline.Pmax
    grid_new.dcline = grid_new.dcline[grid_new.dcline.Pmax != 0.0]

    costs = _calculate_dc_inv_costs(grid_new, sum_results)
    return costs
예제 #16
0
 def _set_ct_and_grid(self):
     """Sets change table and grid."""
     base_grid = Grid(
         self._scenario_info["interconnect"].split("_"),
         source=self._scenario_info["grid_model"],
     )
     if self._scenario_info["change_table"] == "Yes":
         input_data = InputData()
         self.ct = input_data.get_data(self._scenario_info, "ct")
         self.grid = TransformGrid(base_grid, self.ct).get_grid()
     else:
         self.ct = {}
         self.grid = base_grid
예제 #17
0
def calculate_dc_inv_costs(scenario, sum_results=True):
    """Calculate cost of upgrading HVDC lines in a scenario.

    :param powersimdata.scenario.scenario.Scenario scenario: scenario instance.
    :param bool sum_results: whether to sum series to return total cost. Defaults to
        True.
    :return: (*pandas.Series/float*) -- cost of upgrading HVDC lines, in $USD,
        inflation-adjusted to today. If ``sum_results``, a float is returned, otherwise
        a Series.
    """
    base_grid = Grid(scenario.info["interconnect"].split("_"))
    grid = scenario.state.get_grid()

    grid_new = cp.deepcopy(grid)
    # Reindex so that we don't get NaN when calculating upgrades for new DC lines
    base_grid.dcline = base_grid.dcline.reindex(grid_new.dcline.index).fillna(0)
    # find upgraded DC lines
    grid_new.dcline.Pmax = grid.dcline.Pmax - base_grid.dcline.Pmax
    grid_new.dcline = grid_new.dcline[grid_new.dcline.Pmax != 0.0]

    costs = _calculate_dc_inv_costs(grid_new, sum_results)
    return costs
예제 #18
0
def calculate_gen_inv_costs(scenario, year, cost_case, sum_results=True):
    """Given a Scenario object, calculate the total cost of building that scenario's
        upgrades of generation.
    Currently only uses one (arbutrary) sub-technology. Drops the rest of the costs.
        Will want to fix for wind/solar (based on resource supply curves).
    Currently uses ReEDS regions to find regional multipliers.

    :param powersimdata.scenario.scenario.Scenario scenario: scenario instance.
    :param int/str year: year of builds.
    :param str cost_case: the ATB cost case of data:
        'Moderate': mid cost case,
        'Conservative': generally higher costs,
        'Advanced': generally lower costs
    :return: (*pandas.DataFrame*) -- Total generation investment cost summed by
        technology.
    """

    base_grid = Grid(scenario.info["interconnect"].split("_"))
    grid = scenario.state.get_grid()

    # Find change in generation capacity
    grid_new = cp.deepcopy(grid)
    # Reindex so that we don't get NaN when calculating upgrades for new generators
    base_grid.plant = base_grid.plant.reindex(grid_new.plant.index).fillna(0)
    grid_new.plant.Pmax = grid.plant.Pmax - base_grid.plant.Pmax
    # Find change in storage capacity
    # Reindex so that we don't get NaN when calculating upgrades for new storage
    base_grid.storage["gen"] = base_grid.storage["gen"].reindex(
        grid_new.storage["gen"].index, fill_value=0)
    grid_new.storage["gen"].Pmax = (grid.storage["gen"].Pmax -
                                    base_grid.storage["gen"].Pmax)
    grid_new.storage["gen"]["type"] = "storage"

    # Drop small changes
    grid_new.plant = grid_new.plant[grid_new.plant.Pmax > 0.01]

    costs = _calculate_gen_inv_costs(grid_new, year, cost_case, sum_results)
    return costs
예제 #19
0
    def _set_ct_and_grid(self):
        """Sets change table and grid."""
        input_data = InputData(data_loc=self.data_loc)
        grid_mat_path = input_data.get_data(self._scenario_info, "grid")
        self.grid = Grid(
            interconnect=[None],
            source=grid_mat_path,
            engine=self._scenario_info["engine"],
        )

        if self._scenario_info["change_table"] == "Yes":
            self.ct = input_data.get_data(self._scenario_info, "ct")
        else:
            self.ct = {}
예제 #20
0
def calculate_mw_miles(scenario, exclude_branches=None):
    """Given a Scenario object, calculate the number of upgraded lines and
    transformers, and the total upgrade quantity (in MW and MW-miles).
    Currently only supports change tables that specify branches' id, not
    zone name. Currently lumps Transformer and TransformerWinding upgrades
    together.

    :param powersimdata.scenario.scenario.Scenario scenario: scenario instance.
    :param list/tuple/set/None exclude_branches: branches to exclude.
    :return: (*dict*) -- Upgrades to the branches.
    """

    original_grid = Grid(scenario.info["interconnect"].split("_"))
    ct = scenario.state.get_ct()
    upgrades = _calculate_mw_miles(original_grid, ct, exclude_branches)
    return upgrades
def test_export_grid_to_pypsa():
    grid = Grid("USA")

    n = export_to_pypsa(grid, add_substations=False)
    assert len(n.snapshots) == 1
    assert not n.loads_t.p.empty
    assert not n.generators_t.p.empty
    assert len(n.buses) == len(grid.bus)
    assert_columns_deleted(n)

    n = export_to_pypsa(grid, add_all_columns=True, add_substations=False)
    assert len(n.snapshots) == 1
    assert not n.loads_t.p.empty
    assert not n.generators_t.p.empty
    assert len(n.buses) == len(grid.bus)
    assert_columns_preserved(n)

    n = export_to_pypsa(grid, add_substations=True)
    assert len(n.buses) == len(grid.sub) + len(grid.bus)
예제 #22
0
def test_aggregate_demand():
    grid = Grid("Texas")
    ct = ChangeTable(grid)
    kind = "building"
    zone_info = {"East": {"res_cooking": {"advanced_heat_pump_v2": 0.7}}}
    grid_info = {"res_cooking": {"advanced_heat_pump_v2": 0.3}}
    ct.add_electrification(kind, {"zone": zone_info, "grid": grid_info})

    mock_input = MockProfileInput(grid)
    demand = mock_input.get_data(None, "demand")
    mock_input.get_profile = lambda *args: demand

    td = TransformDemand(grid, ct, kind)
    td._profile_data = mock_input
    result = td.value()

    pd.testing.assert_series_equal(0.7 * demand.loc[:, 308], result.loc[:,
                                                                        308])
    pd.testing.assert_frame_equal(0.3 * demand.loc[:, :307],
                                  result.loc[:, :307])
예제 #23
0
def test_profile_mappings():
    grid = Grid("Texas")
    ct = ChangeTable(grid)
    grid_info = {"res_heating": {"standard_heat_pump_v2": 0.3}}
    zone_info = {
        "East": {
            "res_cooking": {
                "advanced_heat_pump_v2": 0.7
            }
        },
        "Coast": {
            "com_hot_water": {
                "standard_heat_pump_v1": 0.6,
                "advanced_heat_pump_v2": 0.4,
            }
        },
        "Far West": {
            "res_cooking": {
                "standard_heat_pump_v1": 0.2,
                "advanced_heat_pump_v2": 0.3
            }
        },
    }

    kind = "building"
    ct.add_electrification(kind, {"zone": zone_info, "grid": grid_info})
    td = TransformDemand(grid, ct, kind)

    actual = td.p2g
    expected = {"res_heating_standard_heat_pump_v2.csv": 0.3}
    assert expected == actual

    actual = td.p2z
    expected = {
        "res_cooking_advanced_heat_pump_v2.csv": [(308, 0.7), (301, 0.3)],
        "com_hot_water_standard_heat_pump_v1.csv": [(307, 0.6)],
        "com_hot_water_advanced_heat_pump_v2.csv": [(307, 0.4)],
        "res_cooking_standard_heat_pump_v1.csv": [(301, 0.2)],
    }

    assert expected == actual
예제 #24
0
def test():
    """Prints power output profile of wind farms in Washington state.

    """
    site = te_wind.get_nrel_site(['WA'])

    grid = Grid(['Western'])
    wind_farm = grid.plant.groupby('type').get_group('wind')

    closest_site = te_wind.site2farm(site, wind_farm[['lat', 'lon']])

    start_date = te_wind.pd.Timestamp('2010-01-01')
    end_date = te_wind.pd.Timestamp('2010-01-01 23:55:00')
    date_range = te_wind.pd.date_range(start_date, end_date, freq='5min')

    data = te_wind.get_data(closest_site, date_range)

    [power, _] = te_wind.dict2frame(data, date_range, closest_site)
    profile = te_wind.get_profile(power, wind_farm, closest_site)
    print(profile.head())
    print('Test Done')
예제 #25
0
def get_profile_by_state(profile, state, grid=None):
    """Decompose total hydro profile into plant level profile based on hydro
    generator capacities in the query state.

    :param pandas.Series/list profile: profile in query state.
    :param str state: the query state.
    :param powersimdata.input.grid.Grid grid: Grid instance. Use the generator
        capacities in the given grid if provided, otherwise use the base grid.
    :return: (*pandas.DataFrame*) -- hydro profile for each plant
        in the query state.
    :raises TypeError: if profile is not a time-series and/or
        state is not a str.
    :raises ValueError: if state is invalid.
    """
    if not isinstance(profile, (pd.Series, list)):
        raise TypeError("profile must be a pandas.Series object or list")
    if not isinstance(state, str):
        raise TypeError("state must be a str")

    if state not in abv2loadzone.keys():
        raise ValueError("Invalid state. Possible states are %s" %
                         " | ".join(set(abv2loadzone.keys())))
    if not grid:
        grid = Grid([abv2interconnect[state]])

    plant = grid.plant
    hydro_plant_in_state = plant[(plant.type == "hydro") & (
        plant["zone_name"].isin(abv2loadzone[state]))]

    hydro_capacity_in_state = hydro_plant_in_state["Pmax"].sum()
    hydro_profile = pd.DataFrame(columns=hydro_plant_in_state.index,
                                 index=profile.index)

    for i in hydro_profile.columns:
        factor = hydro_plant_in_state.loc[i]["Pmax"] / hydro_capacity_in_state
        plant_profile = [v * factor for v in profile]
        hydro_profile[i] = plant_profile.copy()

    return hydro_profile
예제 #26
0
    def extract(
        self, region, start_date, end_date, file_path, key, grid_model, **kwargs
    ):
        """See :py:func:`prereise.cli.data_sources.data_source.DataSource.extract`

        :param list region: list of regions to download data for
        :param str start_date: date designating when to start the data download
        :param str end_date: date designating when to end the data download
        :param str file_path: file location on local filesystem on where to store the data
        :param str key: API key that can be requested at https://developer.nrel.gov/signup/
        :param str grid_model: .mat file path for a grid model or a string supported by
            `powersimdata.input.grid.Grid.SUPPORTED_MODELS`
        """
        assert datetime.strptime(start_date, DATE_FMT) <= datetime.strptime(
            end_date, DATE_FMT
        )
        grid = Grid(region, source=grid_model)
        solar_plants = grid.plant.groupby("type").get_group("solar")
        data = ga_wind.retrieve_data(
            solar_plants, key, start_date=start_date, end_date=end_date
        )
        data.to_pickle(file_path)
예제 #27
0
def create_change_table(input_targets, ref_scenario):
    """Using a reference scenario, create a change table which scales all
    plants in a base grid to capacities matching the reference grid, with
    the exception of wind and solar plants which are scaled up according to
    the clean capacity scaling logic.

    :param pandas.DataFrame input_targets: table of targets, with previous and
        next capacities.
    :param powersimdata.scenario.scenario.Scenario ref_scenario: reference scenario
        to mimic.
    :return: (*dict*) -- dictionary to be passed to a change table.
    """
    epsilon = 1e-3
    interconnect = ref_scenario.info["interconnect"]
    base_grid = Grid([interconnect])
    grid_zones = base_grid.plant.zone_name.unique()
    ref_grid = ref_scenario.state.get_grid()
    ct = mimic_generation_capacity(base_grid, ref_grid)
    for region in input_targets.index:
        prev_solar = input_targets.loc[region, "solar.prev_capacity"]
        prev_wind = input_targets.loc[region, "wind.prev_capacity"]
        next_solar = input_targets.loc[region, "solar.next_capacity"]
        next_wind = input_targets.loc[region, "wind.next_capacity"]
        zone_names = area_to_loadzone(ref_scenario.info["grid_model"], region)
        zone_ids = [
            base_grid.zone2id[n] for n in zone_names if n in grid_zones
        ]
        if prev_solar > 0:
            scale = next_solar / prev_solar
            if abs(scale - 1) > epsilon:
                for id in zone_ids:
                    _apply_zone_scale_factor_to_ct(ct, "solar", id, scale)
        if prev_wind > 0:
            scale = next_wind / prev_wind
            if abs(scale - 1) > epsilon:
                for id in zone_ids:
                    _apply_zone_scale_factor_to_ct(ct, "wind", id, scale)
    return ct
def grid():
    return Grid(["USA"])
예제 #29
0
def test_that_fields_are_not_modified_when_loading_another_grid():
    western_grid = Grid(["Western"])
    western_plant_original_shape = western_grid.plant.shape
    Grid(["Eastern"])
    assert western_plant_original_shape == western_grid.plant.shape
예제 #30
0
def test_grid_eq_success_simple(base_texas):
    assert base_texas == Grid(["Texas"])