Skip to content

Commit

Permalink
refactor: update references to postreise.analyze.check
Browse files Browse the repository at this point in the history
  • Loading branch information
danielolsen committed Jun 29, 2021
1 parent 357dc1f commit d49269c
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 28 deletions.
3 changes: 2 additions & 1 deletion postreise/analyze/generation/binding.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from postreise.analyze.check import _check_epsilon, _check_scenario_is_in_analyze_state
from powersimdata.input.check import _check_epsilon
from powersimdata.scenario.check import _check_scenario_is_in_analyze_state


def pmin_constraints(scenario, epsilon=1e-3):
Expand Down
5 changes: 2 additions & 3 deletions postreise/analyze/generation/capacity.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import numpy as np

from postreise.analyze.check import (
from powersimdata.input.check import (
_check_number_hours_to_analyze,
_check_resources_are_in_grid_and_format,
_check_scenario_is_in_analyze_state,
)
from powersimdata.input.helpers import (
get_plant_id_for_resources_in_area,
get_storage_id_in_area,
)
from powersimdata.scenario.check import _check_scenario_is_in_analyze_state


def calculate_NLDC(scenario, resources, hours=100): # noqa: N802
Expand Down
12 changes: 6 additions & 6 deletions postreise/analyze/generation/curtailment.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import pandas as pd

from postreise.analyze.check import (
from powersimdata.input.check import (
_check_areas_are_in_grid_and_format,
_check_resources_are_renewable_and_format,
_check_scenario_is_in_analyze_state,
)
from postreise.analyze.generation.summarize import (
get_generation_time_series_by_resources,
)
from powersimdata.input.helpers import (
decompose_plant_data_frame_into_areas,
Expand All @@ -18,6 +13,11 @@
summarize_plant_to_bus,
summarize_plant_to_location,
)
from powersimdata.scenario.check import _check_scenario_is_in_analyze_state

from postreise.analyze.generation.summarize import (
get_generation_time_series_by_resources,
)


def calculate_curtailment_time_series(scenario):
Expand Down
9 changes: 3 additions & 6 deletions postreise/analyze/generation/emissions.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import numpy as np
import pandas as pd
from powersimdata.input.check import _check_grid_type, _check_time_series
from powersimdata.network.model import ModelImmutables
from powersimdata.scenario.check import _check_scenario_is_in_analyze_state

from postreise.analyze.check import (
_check_grid,
_check_scenario_is_in_analyze_state,
_check_time_series,
)
from postreise.analyze.generation.costs import calculate_costs


Expand Down Expand Up @@ -88,7 +85,7 @@ def summarize_emissions_by_bus(emissions, grid):
if (emissions < -1e-3).any(axis=None):
raise ValueError("emissions must be non-negative")

_check_grid(grid)
_check_grid_type(grid)
plant = grid.plant

# sum by generator
Expand Down
13 changes: 5 additions & 8 deletions postreise/analyze/generation/summarize.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
import numpy as np
import pandas as pd
from powersimdata.network.model import ModelImmutables
from powersimdata.scenario.scenario import Scenario

from postreise.analyze.check import (
_check_data_frame,
_check_resources_and_format,
_check_scenario_is_in_analyze_state,
)
from powersimdata.input.check import _check_data_frame, _check_resources_and_format
from powersimdata.input.helpers import (
get_plant_id_for_resources_in_area,
get_storage_id_in_area,
)
from powersimdata.network.model import ModelImmutables
from powersimdata.scenario.check import _check_scenario_is_in_analyze_state
from powersimdata.scenario.scenario import Scenario

from postreise.analyze.time import change_time_zone, slice_time_series


Expand Down
3 changes: 2 additions & 1 deletion postreise/analyze/generation/tests/test_binding.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import unittest

import pandas as pd
from powersimdata.input.check import _check_epsilon
from powersimdata.scenario.check import _check_scenario_is_in_analyze_state
from powersimdata.tests.mock_scenario import MockScenario

from postreise.analyze.check import _check_epsilon, _check_scenario_is_in_analyze_state
from postreise.analyze.generation.binding import (
pmax_constraints,
pmin_constraints,
Expand Down
6 changes: 4 additions & 2 deletions postreise/analyze/time.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import pandas as pd
import pytz

from postreise.analyze.check import _check_date_range_in_time_series, _check_time_series
from powersimdata.input.check import (
_check_date_range_in_time_series,
_check_time_series,
)


def is_24_hour_format(time):
Expand Down
2 changes: 1 addition & 1 deletion postreise/plot/plot_shadowprice_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
from bokeh.plotting import figure
from bokeh.tile_providers import Vendors, get_provider
from bokeh.transform import linear_cmap
from powersimdata.input.check import _check_date
from powersimdata.scenario.scenario import Scenario

from postreise.analyze.check import _check_date
from postreise.plot.colors import shadow_price_pallette
from postreise.plot.projection_helpers import project_branch, project_bus

Expand Down

0 comments on commit d49269c

Please sign in to comment.