From e613be147f05009a04fd64a2bc7c791f6bd297b1 Mon Sep 17 00:00:00 2001 From: Guille Date: Tue, 9 Jun 2020 14:07:47 -0400 Subject: [PATCH] Add code comment to the classes --- city_model_structure/city_object.py | 5 +++++ city_model_structure/internal_gains.py | 7 +++++++ city_model_structure/layer.py | 5 +++++ city_model_structure/material.py | 7 +++++++ city_model_structure/polyhedron.py | 5 +++++ city_model_structure/surface.py | 5 +++++ city_model_structure/thermal_boundary.py | 5 +++++ city_model_structure/thermal_opening.py | 5 +++++ city_model_structure/thermal_zone.py | 5 +++++ city_model_structure/usage_zone.py | 5 +++++ city_model_structure/window.py | 7 +++++++ geometry/geometry_factory.py | 5 +++++ geometry/geometry_feeders/city_gml.py | 7 +++++-- helpers/configuration.py | 5 +++++ helpers/geometry.py | 5 +++++ physics/physics_factory.py | 5 +++++ physics/physics_feeders/helpers/us_pluto_to_function.py | 7 +++++++ physics/physics_feeders/helpers/us_to_library_types.py | 7 +++++++ physics/physics_feeders/us_base_physics_parameters.py | 6 ++++++ .../physics_feeders/us_new_york_city_physics_parameters.py | 5 +++++ physics/physics_feeders/us_physics_parameters.py | 6 +++++- tests/test_geometry_factory.py | 5 +++++ tests/test_physics_factory.py | 5 +++++ usage/usage_factory.py | 5 +++++ usage/usage_feeders/de_usage_parameters.py | 7 ++++++- usage/usage_feeders/helpers/us_function_to_usage.py | 7 +++++++ usage/usage_feeders/helpers/us_pluto_to_usage.py | 5 +++++ usage/usage_feeders/us_base_usage_parameters.py | 5 +++++ usage/usage_feeders/us_new_york_city_usage_parameters.py | 5 +++++ usage/usage_feeders/us_usage_parameters.py | 5 +++++ 30 files changed, 164 insertions(+), 4 deletions(-) diff --git a/city_model_structure/city_object.py b/city_model_structure/city_object.py index 47355115..be2a3811 100644 --- a/city_model_structure/city_object.py +++ b/city_model_structure/city_object.py @@ -1,3 +1,8 @@ +""" +CityObject module +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca +""" from matplotlib import pylab from city_model_structure.polyhedron import Polyhedron from city_model_structure.thermal_zone import ThermalZone diff --git a/city_model_structure/internal_gains.py b/city_model_structure/internal_gains.py index 3f86d7c8..b2cca6fa 100644 --- a/city_model_structure/internal_gains.py +++ b/city_model_structure/internal_gains.py @@ -1,3 +1,10 @@ +""" +InternalGains module +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca +""" + + class InternalGains: def __init__(self): self._average_internal_gain_w_m2 = None diff --git a/city_model_structure/layer.py b/city_model_structure/layer.py index bb96b161..daaf4527 100644 --- a/city_model_structure/layer.py +++ b/city_model_structure/layer.py @@ -1,3 +1,8 @@ +""" +Layers module +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca +""" from city_model_structure.material import Material diff --git a/city_model_structure/material.py b/city_model_structure/material.py index 9a247003..71030a4f 100644 --- a/city_model_structure/material.py +++ b/city_model_structure/material.py @@ -1,3 +1,10 @@ +""" +Material module +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca +""" + + class Material: def __init__(self): self._conductivity_wm_k = None diff --git a/city_model_structure/polyhedron.py b/city_model_structure/polyhedron.py index 24385791..075d3a53 100644 --- a/city_model_structure/polyhedron.py +++ b/city_model_structure/polyhedron.py @@ -1,3 +1,8 @@ +""" +Polyhedron module +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca +""" import numpy as np import stl from helpers.geometry import Geometry diff --git a/city_model_structure/surface.py b/city_model_structure/surface.py index 675c417d..75d0c6c1 100644 --- a/city_model_structure/surface.py +++ b/city_model_structure/surface.py @@ -1,3 +1,8 @@ +""" +Surface module +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca +""" from __future__ import annotations import numpy as np import pyny3d.geoms as pn diff --git a/city_model_structure/thermal_boundary.py b/city_model_structure/thermal_boundary.py index 2b4c0eef..1326028d 100644 --- a/city_model_structure/thermal_boundary.py +++ b/city_model_structure/thermal_boundary.py @@ -1,3 +1,8 @@ +""" +ThermalBoundary module +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca +""" from city_model_structure.thermal_opening import ThermalOpening from city_model_structure.thermal_zone import ThermalZone from city_model_structure.layer import Layer diff --git a/city_model_structure/thermal_opening.py b/city_model_structure/thermal_opening.py index 9ad05494..c8207244 100644 --- a/city_model_structure/thermal_opening.py +++ b/city_model_structure/thermal_opening.py @@ -1,3 +1,8 @@ +""" +ThermalOpening module +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca +""" from helpers.configuration import Configuration diff --git a/city_model_structure/thermal_zone.py b/city_model_structure/thermal_zone.py index b9efbc30..0197b43c 100644 --- a/city_model_structure/thermal_zone.py +++ b/city_model_structure/thermal_zone.py @@ -1,3 +1,8 @@ +""" +ThermalZone module +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca +""" from typing import List from city_model_structure.thermal_boundary import ThermalBoundary from city_model_structure.usage_zone import UsageZone diff --git a/city_model_structure/usage_zone.py b/city_model_structure/usage_zone.py index 815fc407..e50ab84f 100644 --- a/city_model_structure/usage_zone.py +++ b/city_model_structure/usage_zone.py @@ -1,3 +1,8 @@ +""" +UsageZone module +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca +""" from city_model_structure.internal_gains import InternalGains from typing import List diff --git a/city_model_structure/window.py b/city_model_structure/window.py index 36085538..749dba24 100644 --- a/city_model_structure/window.py +++ b/city_model_structure/window.py @@ -1,3 +1,10 @@ +""" +Window module +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca +""" + + class Window: def __init__(self): self._conductivity_wm_k = None diff --git a/geometry/geometry_factory.py b/geometry/geometry_factory.py index a6de2c52..879b169f 100644 --- a/geometry/geometry_factory.py +++ b/geometry/geometry_factory.py @@ -1,3 +1,8 @@ +""" +GeometryFactory retrieve the specific geometric module to load the given format +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca +""" from geometry.geometry_feeders.city_gml import CityGml from city_model_structure.city import City diff --git a/geometry/geometry_feeders/city_gml.py b/geometry/geometry_feeders/city_gml.py index ad7c3104..f5331b1b 100644 --- a/geometry/geometry_feeders/city_gml.py +++ b/geometry/geometry_feeders/city_gml.py @@ -1,3 +1,8 @@ +""" +CityGml module parses citygml files and import the geometry into the city model structure +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca +""" import xmltodict import numpy as np from city_model_structure.city import City @@ -101,5 +106,3 @@ class CityGml: self._city.add_city_object(CityObject(name, lod, surfaces, terrains, year_of_construction, function, self._lower_corner)) return self._city - - diff --git a/helpers/configuration.py b/helpers/configuration.py index 0c971460..fe19855f 100644 --- a/helpers/configuration.py +++ b/helpers/configuration.py @@ -1,3 +1,8 @@ +""" +Configuration helper +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca +""" import configparser from pathlib import Path diff --git a/helpers/geometry.py b/helpers/geometry.py index c99dabff..6def3668 100644 --- a/helpers/geometry.py +++ b/helpers/geometry.py @@ -1,3 +1,8 @@ +""" +Geometry helper +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca +""" import math import numpy as np diff --git a/physics/physics_factory.py b/physics/physics_factory.py index af7c89ea..f7beff08 100644 --- a/physics/physics_factory.py +++ b/physics/physics_factory.py @@ -1,3 +1,8 @@ +""" +PhysicsFactory retrieve the specific physics module for the given region +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca +""" from physics.physics_feeders.us_new_york_city_physics_parameters import UsNewYorkCityPhysicsParameters from physics.physics_feeders.us_physics_parameters import UsPhysicsParameters diff --git a/physics/physics_feeders/helpers/us_pluto_to_function.py b/physics/physics_feeders/helpers/us_pluto_to_function.py index d2d917bb..65b3fab8 100644 --- a/physics/physics_feeders/helpers/us_pluto_to_function.py +++ b/physics/physics_feeders/helpers/us_pluto_to_function.py @@ -1,3 +1,10 @@ +""" +UsPlutoToFunction helper +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca +""" + + class UsPlutoToFunction: building_function = { 'A0': 'single family house', diff --git a/physics/physics_feeders/helpers/us_to_library_types.py b/physics/physics_feeders/helpers/us_to_library_types.py index c7ed1e46..e9194271 100644 --- a/physics/physics_feeders/helpers/us_to_library_types.py +++ b/physics/physics_feeders/helpers/us_to_library_types.py @@ -1,3 +1,10 @@ +""" +UsToLibraryTypes helper +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca +""" + + class UsToLibraryTypes(object): standards = { 'ASHRAE Std189': 1, diff --git a/physics/physics_feeders/us_base_physics_parameters.py b/physics/physics_feeders/us_base_physics_parameters.py index 787b6330..8eb34a72 100644 --- a/physics/physics_feeders/us_base_physics_parameters.py +++ b/physics/physics_feeders/us_base_physics_parameters.py @@ -1,3 +1,9 @@ +""" +UsBasePhysicParameters, model the us archetypes and material, used by UsNewYorkCityPhysicsParameters and +UsPhysicsParameters as base class +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca +""" import xmltodict from city_model_structure.layer import Layer from city_model_structure.material import Material diff --git a/physics/physics_feeders/us_new_york_city_physics_parameters.py b/physics/physics_feeders/us_new_york_city_physics_parameters.py index 9bb5549d..b54e2e86 100644 --- a/physics/physics_feeders/us_new_york_city_physics_parameters.py +++ b/physics/physics_feeders/us_new_york_city_physics_parameters.py @@ -1,3 +1,8 @@ +""" +UsNewYorkCityPhysicsParameters import the construction and material information for new york city +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca +""" from physics.physics_feeders.us_base_physics_parameters import UsBasePhysicsParameters from physics.physics_feeders.helpers.us_pluto_to_function import UsPlutoToFunction as Pf diff --git a/physics/physics_feeders/us_physics_parameters.py b/physics/physics_feeders/us_physics_parameters.py index 930bc879..aa877093 100644 --- a/physics/physics_feeders/us_physics_parameters.py +++ b/physics/physics_feeders/us_physics_parameters.py @@ -1,3 +1,8 @@ +""" +UsPhysicsParameters import the construction and material information for US +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca +""" from physics.physics_feeders.us_base_physics_parameters import UsBasePhysicsParameters from physics.physics_feeders.helpers.us_to_library_types import UsToLibraryTypes @@ -7,4 +12,3 @@ class UsPhysicsParameters(UsBasePhysicsParameters): self._city = city self._climate_zone = UsToLibraryTypes.city_to_climate_zone(city.name) super().__init__(self._climate_zone, self._city.city_objects, lambda function: function, base_path) - diff --git a/tests/test_geometry_factory.py b/tests/test_geometry_factory.py index 8b38d9a3..ae45ecf2 100644 --- a/tests/test_geometry_factory.py +++ b/tests/test_geometry_factory.py @@ -1,3 +1,8 @@ +""" +TestGeometryFactory test and validate the city model structure geometric parameters +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca +""" from unittest import TestCase from pathlib import Path from geometry.geometry_factory import GeometryFactory diff --git a/tests/test_physics_factory.py b/tests/test_physics_factory.py index 116ad42b..7c0bec48 100644 --- a/tests/test_physics_factory.py +++ b/tests/test_physics_factory.py @@ -1,3 +1,8 @@ +""" +TestPhysicsFactory test and validate the city model structure physics parameters +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca +""" from unittest import TestCase from pathlib import Path from geometry.geometry_factory import GeometryFactory diff --git a/usage/usage_factory.py b/usage/usage_factory.py index e287156f..7fb0d7af 100644 --- a/usage/usage_factory.py +++ b/usage/usage_factory.py @@ -1,3 +1,8 @@ +""" +UsageFactory retrieve the specific usage module for the given region +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca +""" from usage.usage_feeders.de_usage_parameters import DeUsageParameters from usage.usage_feeders.us_new_york_city_usage_parameters import UsNewYorkCityUsageParameters diff --git a/usage/usage_feeders/de_usage_parameters.py b/usage/usage_feeders/de_usage_parameters.py index 559bfde4..48ebd174 100644 --- a/usage/usage_feeders/de_usage_parameters.py +++ b/usage/usage_feeders/de_usage_parameters.py @@ -1,3 +1,8 @@ +""" +DeUsageParameters model the usage properties for a German building +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca +""" import xmltodict from pathlib import Path from usage.usage_feeders.helpers.us_function_to_usage import UsFunctionToUsage @@ -7,7 +12,7 @@ class DeUsageParameters: def __init__(self, city_objects): self._city_objects = city_objects - # load US Library + # load De Library path = str(Path.cwd() / 'data/usage/de_library.xml') with open(path) as xml: self._library = xmltodict.parse(xml.read()) diff --git a/usage/usage_feeders/helpers/us_function_to_usage.py b/usage/usage_feeders/helpers/us_function_to_usage.py index e8e46316..ef9816b1 100644 --- a/usage/usage_feeders/helpers/us_function_to_usage.py +++ b/usage/usage_feeders/helpers/us_function_to_usage.py @@ -1,3 +1,10 @@ +""" +UsFunctionToUsage helper +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca +""" + + class UsFunctionToUsage: building_usage = { 'full service restaurant': 'restaurant', diff --git a/usage/usage_feeders/helpers/us_pluto_to_usage.py b/usage/usage_feeders/helpers/us_pluto_to_usage.py index 48eb5295..f5cf1702 100644 --- a/usage/usage_feeders/helpers/us_pluto_to_usage.py +++ b/usage/usage_feeders/helpers/us_pluto_to_usage.py @@ -1,3 +1,8 @@ +""" +UsPlutoToUsage helper +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca +""" from usage.usage_feeders.helpers.us_function_to_usage import UsFunctionToUsage diff --git a/usage/usage_feeders/us_base_usage_parameters.py b/usage/usage_feeders/us_base_usage_parameters.py index 65009ab3..1b1434f1 100644 --- a/usage/usage_feeders/us_base_usage_parameters.py +++ b/usage/usage_feeders/us_base_usage_parameters.py @@ -1,3 +1,8 @@ +""" +UsBaseUsageParameters base class to model the usage properties for a building in NYC and US +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca +""" import xmltodict from pathlib import Path from city_model_structure.usage_zone import UsageZone diff --git a/usage/usage_feeders/us_new_york_city_usage_parameters.py b/usage/usage_feeders/us_new_york_city_usage_parameters.py index f7914252..d3a5a516 100644 --- a/usage/usage_feeders/us_new_york_city_usage_parameters.py +++ b/usage/usage_feeders/us_new_york_city_usage_parameters.py @@ -1,3 +1,8 @@ +""" +UsNewYorkCityUsageParameters model the usage properties for a NYC building +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca +""" from usage.usage_feeders.us_base_usage_parameters import UsBaseUsageParameters from usage.usage_feeders.helpers.us_pluto_to_usage import UsPlutoToUsage as Pu diff --git a/usage/usage_feeders/us_usage_parameters.py b/usage/usage_feeders/us_usage_parameters.py index a5247369..b24085d6 100644 --- a/usage/usage_feeders/us_usage_parameters.py +++ b/usage/usage_feeders/us_usage_parameters.py @@ -1,3 +1,8 @@ +""" +UsUsageParameters model the usage properties for a Us building +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca +""" from usage.usage_feeders.us_base_usage_parameters import UsBaseUsageParameters from usage.usage_feeders.helpers.us_function_to_usage import UsFunctionToUsage