postreise.analyze package¶
Subpackages¶
- postreise.analyze.generation package
- Subpackages
- postreise.analyze.generation.tests package
- Submodules
- postreise.analyze.generation.tests.test_binding module
- postreise.analyze.generation.tests.test_capacity module
- postreise.analyze.generation.tests.test_costs module
- postreise.analyze.generation.tests.test_curtailment module
- postreise.analyze.generation.tests.test_emissions module
- postreise.analyze.generation.tests.test_summarize module
- Module contents
- postreise.analyze.generation.tests package
- Submodules
- postreise.analyze.generation.binding module
- postreise.analyze.generation.capacity module
- postreise.analyze.generation.costs module
- postreise.analyze.generation.curtailment module
calculate_curtailment_percentage_by_resources()
calculate_curtailment_time_series()
calculate_curtailment_time_series_by_areas()
calculate_curtailment_time_series_by_areas_and_resources()
calculate_curtailment_time_series_by_resources()
calculate_curtailment_time_series_by_resources_and_areas()
get_curtailment_time_series()
summarize_curtailment_by_bus()
summarize_curtailment_by_location()
- postreise.analyze.generation.emissions module
- postreise.analyze.generation.summarize module
- Module contents
- Subpackages
- postreise.analyze.tests package
- Submodules
- postreise.analyze.tests.test_demand module
- postreise.analyze.tests.test_time module
test_change_time_zone()
test_change_time_zone_argument_type()
test_change_time_zone_argument_value()
test_daily_resampling_incomplete_and_time_shift_mean()
test_daily_resampling_incomplete_and_time_shift_sum()
test_daily_resampling_incomplete_mean()
test_daily_resampling_incomplete_sum()
test_daily_resampling_mean()
test_daily_resampling_sum()
test_daily_resampling_time_shift_mean()
test_daily_resampling_time_shift_sum()
test_is_24_hour_format()
test_is_dst()
test_monthly_resampling_incomplete_and_time_shift_mean()
test_monthly_resampling_incomplete_and_time_shift_sum()
test_monthly_resampling_incomplete_mean()
test_monthly_resampling_incomplete_sum()
test_monthly_resampling_mean()
test_monthly_resampling_sum()
test_monthly_resampling_time_shift_mean()
test_monthly_resampling_time_shift_sum()
test_resampling_argument_value()
test_slicing()
test_slicing_argument_value()
test_weekly_resampling_incomplete_and_time_shift_mean()
test_weekly_resampling_incomplete_and_time_shift_sum()
test_weekly_resampling_incomplete_mean()
test_weekly_resampling_incomplete_sum()
test_weekly_resampling_mean()
test_weekly_resampling_sum()
test_weekly_resampling_time_shift_mean()
test_weekly_resampling_time_shift_sum()
- Module contents
- postreise.analyze.transmission package
Submodules¶
postreise.analyze.demand module¶
- postreise.analyze.demand.get_demand_time_series(scenario, area, area_type=None)[source]¶
Get time series demand in certain area of a scenario
- Parameters:
scenario (powersimdata.scenario.scenario.Scenario) – scenario instance
area (str) – one of loadzone, state, state abbreviation, interconnect, ‘all’
area_type (str) – one of ‘loadzone’, ‘state’, ‘state_abbr’, ‘interconnect’
- Returns:
(pandas.Series) – time series of total demand, index: time stamps, column: demand values
- postreise.analyze.demand.get_net_demand_time_series(scenario, area, area_type=None)[source]¶
Get time series net demand in certain area of a scenario
- Parameters:
scenario (powersimdata.scenario.scenario.Scenario) – scenario instance
area (str) – one of loadzone, state, state abbreviation, interconnect, ‘all’
area_type (str) – one of ‘loadzone’, ‘state’, ‘state_abbr’, ‘interconnect’
- Returns:
(pandas.Series) – time series of total demand, index: time stamps, column: net demand values
postreise.analyze.time module¶
- postreise.analyze.time.change_time_zone(ts, tz)[source]¶
Convert hourly time series to new time zone. UTC is assumed if no time zone is assigned to the input time series.
- Parameters:
ts (pandas.DataFrame/pands.Series) – time series.
tz (str) – new time zone.
- Returns:
(pandas.DataFrame/pandas.Series) – time series with new time zone.
- Raises:
TypeError – if tz is not a str.
ValueError – if tz is invalid or the time series has already been resampled.
- postreise.analyze.time.is_24_hour_format(time)[source]¶
Check if the input string is in 24-hour format
- Parameters:
time (str) – input string
- Returns:
(bool) – the input string is in 24-hour format or not
- postreise.analyze.time.is_dst(ts)[source]¶
Flag Daylight Saving Time (DST) in a time series.
- Parameters:
ts (pandas.DataFrame/pands.Series) – time series.
- Returns:
(bool) – True if time zone observes DST.
- postreise.analyze.time.resample_time_series(ts, freq, agg='sum')[source]¶
Resample a time series.
- Parameters:
ts (pandas.DataFrame/pandas.Series) – time series to resample.
freq (str) – frequency. Either ‘D’ (day), ‘W’ (week), ‘M’ (month).
agg (str) – aggregation method. Either ‘sum’ or ‘mean’.
- Returns:
(pandas.DataFrame/pandas.Series) – the resampled time series.
- Raises:
ValueError – if freq is not one of ‘D’, ‘W’, ‘M’ or agg is not one of ‘sum’ or ‘mean’ or ts is time zone aware with DST.
Note
When resampling:
the left side of the bin interval is closed.
the left bin edge is used to label the interval.
intervals start at midnight when freq is ‘D’.
intervals start on Sunday when freq is ‘W’.
incomplete days, weeks and months are clipped when agg is ‘sum’.
incomplete days, weeks and months are calculated using available data samples when agg is ‘mean’.
- postreise.analyze.time.slice_time_series(ts, start, end, between_time=None, dayofweek=None)[source]¶
Slice a time series.
- Parameters:
ts (pandas.DataFrame/pandas.Series) – time series to slice.
start (pandas.Timestamp/numpy.datetime64/datetime.datetime) – start date.
end (pandas.Timestamp/numpy.datetime64/datetime.datetime) – end date.
between_time (list) – specify the start hour and end hour of each day inclusively, default to None, which includes every hour of a day. Note that if the end hour is set before the start hour, the complementary hours of a day are picked.
dayofweek (set) – specify the interest days of week, which is a subset of integers in [0, 6] with 0 being Monday and 6 being Sunday, default to None, which includes every day of a week.
- Returns:
(pandas.DataFrame/pandas.Series) – the sliced time series.
- Raises:
TypeError – if between_time is provided but not a list and/or if not all elements of between_time are strings and/or if dayofweek is provided but not a set.
ValueError – if between_time is provided but does not have exactly two elements and/or if not all elements of between_time are in 24 hour format and/or if dayofweek is provided but not a subset of integers in [0, 6].