updated commments in aggregate_hourly_data_by_period of API

pull/75/MERGE
13621160019@163.com 2021-10-28 21:53:24 +08:00
parent 0c1a2d9ab8
commit 5f285d7939
1 changed files with 3 additions and 3 deletions

View File

@ -12,7 +12,7 @@ import statistics
# rows_hourly: list of (start_datetime_utc, actual_value), should belong to one energy_category_id # rows_hourly: list of (start_datetime_utc, actual_value), should belong to one energy_category_id
# start_datetime_utc: start datetime in utc # start_datetime_utc: start datetime in utc
# end_datetime_utc: end datetime in utc # end_datetime_utc: end datetime in utc
# period_type: one of the following period types, 'hourly', 'daily', 'monthly' and 'yearly' # period_type: one of the following period types, 'hourly', 'daily', 'weekly', 'monthly' and 'yearly'
# Note: this procedure doesn't work with multiple energy categories # Note: this procedure doesn't work with multiple energy categories
######################################################################################################################## ########################################################################################################################
def aggregate_hourly_data_by_period(rows_hourly, start_datetime_utc, end_datetime_utc, period_type): def aggregate_hourly_data_by_period(rows_hourly, start_datetime_utc, end_datetime_utc, period_type):
@ -63,7 +63,7 @@ def aggregate_hourly_data_by_period(rows_hourly, start_datetime_utc, end_datetim
result_rows_weekly = list() result_rows_weekly = list()
# todo: add config.working_day_start_time_local # todo: add config.working_day_start_time_local
# todo: add config.minutes_to_count # todo: add config.minutes_to_count
# calculate the start datetime in utc of the first day in the first month in local # calculate the start datetime in utc of the monday in the first week in local
start_datetime_local = start_datetime_utc + timedelta(hours=int(config.utc_offset[1:3])) start_datetime_local = start_datetime_utc + timedelta(hours=int(config.utc_offset[1:3]))
weekday = start_datetime_local.weekday() weekday = start_datetime_local.weekday()
current_datetime_utc = \ current_datetime_utc = \
@ -166,7 +166,7 @@ def aggregate_hourly_data_by_period(rows_hourly, start_datetime_utc, end_datetim
result_rows_yearly = list() result_rows_yearly = list()
# todo: add config.working_day_start_time_local # todo: add config.working_day_start_time_local
# todo: add config.minutes_to_count # todo: add config.minutes_to_count
# calculate the start datetime in utc of the first day in the first month in local # calculate the start datetime in utc of the first day in the first year in local
start_datetime_local = start_datetime_utc + timedelta(hours=int(config.utc_offset[1:3])) start_datetime_local = start_datetime_utc + timedelta(hours=int(config.utc_offset[1:3]))
current_datetime_utc = start_datetime_local.replace(month=1, day=1, hour=0) - timedelta( current_datetime_utc = start_datetime_local.replace(month=1, day=1, hour=0) - timedelta(
hours=int(config.utc_offset[1:3])) hours=int(config.utc_offset[1:3]))