diff --git a/main.py b/main.py index 3baddf26..6d59f64d 100644 --- a/main.py +++ b/main.py @@ -1,4 +1,5 @@ from pathlib import Path +from scripts.district_heating_network.directory_manager import DirectoryManager import subprocess from scripts.ep_run_enrich import energy_plus_workflow from hub.imports.geometry_factory import GeometryFactory @@ -23,22 +24,24 @@ from hub.exports.exports_factory import ExportsFactory from scripts.pv_feasibility import pv_feasibility import matplotlib.pyplot as plt import numpy as np -# Specify the GeoJSON file path -data = {} -input_files_path = (Path(__file__).parent / 'input_files') -input_files_path.mkdir(parents=True, exist_ok=True) -geojson_file = process_geojson(x=-73.58001358793511, y=45.496445294438715, diff=0.0001) -geojson_file_path = input_files_path / 'output_buildings.geojson' -output_path = (Path(__file__).parent / 'out_files').resolve() -output_path.mkdir(parents=True, exist_ok=True) -energy_plus_output_path = output_path / 'energy_plus_outputs' -energy_plus_output_path.mkdir(parents=True, exist_ok=True) -simulation_results_path = (Path(__file__).parent / 'out_files' / 'simulation_results').resolve() -simulation_results_path.mkdir(parents=True, exist_ok=True) -sra_output_path = output_path / 'sra_outputs' -sra_output_path.mkdir(parents=True, exist_ok=True) -cost_analysis_output_path = output_path / 'cost_analysis' -cost_analysis_output_path.mkdir(parents=True, exist_ok=True) + +base_path = Path(__file__).parent +dir_manager = DirectoryManager(base_path) + +# Input files directory +input_files_path = dir_manager.create_directory('input_files') +geojson_file_path = input_files_path / 'test_geojson1.geojson' + +# Output files directory +output_path = dir_manager.create_directory('out_files') + +# Subdirectories for output files +energy_plus_output_path = dir_manager.create_directory('out_files/energy_plus_outputs') +simulation_results_path = dir_manager.create_directory('out_files/simulation_results') +sra_output_path = dir_manager.create_directory('out_files/sra_outputs') +cost_analysis_output_path = dir_manager.create_directory('out_files/cost_analysis') + +# Create city object city = GeometryFactory(file_type='geojson', path=geojson_file_path, height_field='height', diff --git a/scripts/district_heating_network/directory_manager.py b/scripts/district_heating_network/directory_manager.py new file mode 100644 index 00000000..df79c5bc --- /dev/null +++ b/scripts/district_heating_network/directory_manager.py @@ -0,0 +1,16 @@ +from pathlib import Path + + +class DirectoryManager: + def __init__(self, base_path): + self.base_path = Path(base_path) + self.directories = {} + + def create_directory(self, relative_path): + full_path = self.base_path / relative_path + full_path.mkdir(parents=True, exist_ok=True) + self.directories[relative_path] = full_path + return full_path + + def get_directory(self, relative_path): + return self.directories.get(relative_path, None)