Skip to content

Commit

Permalink
Merge pull request #3684 from architecture-building-systems/fix-synta…
Browse files Browse the repository at this point in the history
…x-to-pass-the-ruff-test

Fix syntax to pass the ruff test
  • Loading branch information
ShiZhongming authored Nov 12, 2024
2 parents 1163384 + 344e2af commit 37699ef
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 21 deletions.
4 changes: 2 additions & 2 deletions cea/default.config
Original file line number Diff line number Diff line change
Expand Up @@ -660,12 +660,12 @@ result-summary = true
result-summary.type = BooleanParameter
result-summary.help = True if generating a summary of the CEA results simulated.

[result-reader-summary]
[result-summary]
all-scenarios = false
all-scenarios.type = BooleanParameter
all-scenarios.help = True if reading through and summarising the results for all scenarios under this project. False if reading and summarising the results for the current scenario only.

[result-reader-analytics]
[result-analytics]
all-scenarios = false
all-scenarios.type = BooleanParameter
all-scenarios.help = True if reading through and analysing the results for all scenarios under this project. False if reading and analysing the results for the current scenario only.
Expand Down
12 changes: 6 additions & 6 deletions cea/scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -380,21 +380,21 @@ Utilities:
input-files:
- [get_zone_geometry]

- name: result-reader-summary
- name: result-summary
label: Get result summary (beta)
description: Collection of useful CEA results
interfaces: [cli, dashboard]
module: cea.utilities.result_reader_summary
parameters: ['general:scenario', result-reader-summary]
module: cea.utilities.result_summary
parameters: ['general:scenario', result-summary]
input-files:
- [get_zone_geometry]

- name: result-reader-analytics
- name: result-analytics
label: Get advanced analytics (beta)
description: Collection of advanced useful energy analytics
interfaces: [cli, dashboard]
module: cea.utilities.result_reader_analytics
parameters: ['general:scenario', result-reader-analytics]
module: cea.utilities.result_analytics
parameters: ['general:scenario', result-analytics]
input-files:
- [get_zone_geometry]

Expand Down
4 changes: 2 additions & 2 deletions cea/utilities/batch_process_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,9 @@ def main(config):
# Read and summarise project results
project_result_summary = config.batch_process_workflow.result_summary
if project_result_summary and project_boolean:
subprocess.run(['cea', 'result-reader-summary', '--all-scenarios', 'true'], env=my_env, check=True, capture_output=True)
subprocess.run(['cea', 'result-summary', '--all-scenarios', 'true'], env=my_env, check=True, capture_output=True)
elif project_result_summary and not project_boolean:
subprocess.run(['cea', 'result-reader-summary', '--all-scenarios', 'false'], env=my_env, check=True, capture_output=True)
subprocess.run(['cea', 'result-summary', '--all-scenarios', 'false'], env=my_env, check=True, capture_output=True)



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def calc_capacity_factor(gen_kwh, max_kw):
the unitless ratio of actual energy output over a year to the theoretical maximum energy output over that period.
"""
if type(gen_kwh) == float:
if isinstance(gen_kwh, float):
len_time_period = 8760
else:
len_time_period = len(gen_kwh)
Expand Down Expand Up @@ -716,7 +716,8 @@ def exec_read_and_analyse(cea_scenario):
analytics_results_dict['DC_plant_capacity_factor[-]'] = na
analytics_results_dict['DC_pump_capacity_factor[-]'] = na

if control_dict['skip_demand'] == False:
if not control_dict['skip_demand']:

analytics_results_dict['EUI - grid electricity [kWh/m2/yr]'] = cea_result_total_demand_buildings_df[
'GRID_MWhyr'].sum() / \
cea_result_total_demand_buildings_df[
Expand Down Expand Up @@ -765,7 +766,7 @@ def exec_read_and_analyse(cea_scenario):
cea_result_total_demand_buildings_df[
'GRID_MWhyr'].sum() * 1000)

if control_dict['old_generator_database'] == False:
if not control_dict['old_generator_database']:
module_capacity_kWp = module["capacity_Wp"] / 1000
module_area_m2 = module["module_area_m2"]
module_impact_kgco2m2 = module["module_embodied_kgco2m2"]
Expand All @@ -775,13 +776,13 @@ def exec_read_and_analyse(cea_scenario):
max_kw = module_capacity_kWp * n_modules

# capacity factor
if control_dict[panel_type]['skip_capacity_factor'] == False:
if not control_dict[panel_type]['skip_capacity_factor']:
analytics_results_dict[f'PV_{panel_type}_capacity_factor[-]'] = calc_capacity_factor(
cea_result_pv_buildings_df['E_PV_gen_kWh'],
max_kw)

# autarky
if control_dict[panel_type]['skip_autarky'] == False:
if not control_dict[panel_type]['skip_autarky']:
for time_period in time_period_options_autarky:
analytics_results_dict[
f'PV_{panel_type}_self_consumption_{time_period}[-]'] = calc_self_consumption(
Expand All @@ -794,7 +795,7 @@ def exec_read_and_analyse(cea_scenario):
cea_result_demand_hourly_df['district_GRID_kWh'],
time_period=time_period)

if control_dict[panel_type]['skip_specific_yield'] == False:
if not control_dict[panel_type]['skip_specific_yield']:
# specific yield
for time_period in time_period_options_yield:
if time_period in month_string_number:
Expand All @@ -811,7 +812,7 @@ def exec_read_and_analyse(cea_scenario):
time_period=time_period)


if control_dict[panel_type]['skip_generation_intensity'] == False:
if not control_dict[panel_type]['skip_generation_intensity']:
module_lifetime_years = int(module["LT_yr"])
lifetime_generation_kWh = projected_lifetime_output(cea_result_pv_hourly_df['E_PV_gen_kWh'].values,
module_lifetime_years)
Expand Down Expand Up @@ -842,7 +843,7 @@ def exec_read_and_analyse(cea_scenario):
analytics_results_dict[f'PV_{panel_type}_self_sufficiency_{time_period}[-]'] = na

# thermal power plants
if control_dict['skip_dh'] == False:
if not control_dict['skip_dh']:
cea_result_dh_thermal_df = pd.read_csv(dh_plant_thermal_path)
cea_result_dh_pumping_df = pd.read_csv(dh_plant_pumping_path)
analytics_results_dict['DH_plant_capacity_factor[-]'] = calc_capacity_factor(
Expand All @@ -852,7 +853,7 @@ def exec_read_and_analyse(cea_scenario):
analytics_results_dict['DH_pump_capacity_factor[-]'] = calc_capacity_factor(
cea_result_dh_pumping_df['pressure_loss_total_kW'],
cea_result_dh_pumping_df['pressure_loss_total_kW'].max())
if control_dict['skip_dc'] == False:
if not control_dict['skip_dc']:
cea_result_dc_thermal_df = pd.read_csv(dc_plant_thermal_path)
cea_result_dc_pumping_df = pd.read_csv(dc_plant_pumping_path)
analytics_results_dict['DC_plant_capacity_factor[-]'] = calc_capacity_factor(
Expand Down Expand Up @@ -884,7 +885,7 @@ def main(config):

project_path = config.general.project
scenario_name = config.general.scenario_name
project_boolean = config.result_reader_analytics.all_scenarios
project_boolean = config.result_analytics.all_scenarios

# deciding to run all scenarios or the current the scenario only
if project_boolean:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def main(config):

project_path = config.general.project
scenario_name = config.general.scenario_name
project_boolean = config.result_reader_summary.all_scenarios
project_boolean = config.result_summary.all_scenarios

# deciding to run all scenarios or the current the scenario only
if project_boolean:
Expand Down

0 comments on commit 37699ef

Please sign in to comment.