From bf952d88e4b3410918e87bddba8c2a91db27e2ef Mon Sep 17 00:00:00 2001 From: Guille Date: Wed, 28 Oct 2020 13:57:56 -0400 Subject: [PATCH 1/2] Correct paths and unittest errors caused by refactoring --- factories/occupancy/occupancy_factory.py | 2 +- factories/usage/usage_feeders/us_base_usage_parameters.py | 2 +- helpers/configuration_helper.py | 2 +- tests/test_geometry_factory.py | 2 +- tests/test_occupancy_factory.py | 2 +- tests/test_physics_factory.py | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/factories/occupancy/occupancy_factory.py b/factories/occupancy/occupancy_factory.py index b3a915ed..8802bd04 100644 --- a/factories/occupancy/occupancy_factory.py +++ b/factories/occupancy/occupancy_factory.py @@ -12,7 +12,7 @@ class OccupancyFactory: """ PhysicsFactor class """ - def __init__(self, handler, city, base_path=Path(Path(__file__).parent.parent / 'data/occupancy')): + def __init__(self, handler, city, base_path=Path(Path(__file__).parent.parent.parent / 'data/occupancy')): self._handler = '_' + handler.lower().replace(' ', '_') self._city = city self._base_path = base_path diff --git a/factories/usage/usage_feeders/us_base_usage_parameters.py b/factories/usage/usage_feeders/us_base_usage_parameters.py index 4c87a5e9..9196affa 100644 --- a/factories/usage/usage_feeders/us_base_usage_parameters.py +++ b/factories/usage/usage_feeders/us_base_usage_parameters.py @@ -19,7 +19,7 @@ class UsBaseUsageParameters: self._city = city # todo: control not archetype found # ToDo: this is using the german library as a temporary approach, need to use/define a library for US - path = str(Path(__file__).parent.parent.parent / 'data/usage/de_library.xml') + path = str(Path(__file__).parent.parent.parent.parent / 'data/usage/de_library.xml') print('usage:', path) with open(path) as xml: self._library = xmltodict.parse(xml.read(), force_list='zoneUsageVariant') diff --git a/helpers/configuration_helper.py b/helpers/configuration_helper.py index 9601a1c7..c1a43256 100644 --- a/helpers/configuration_helper.py +++ b/helpers/configuration_helper.py @@ -104,4 +104,4 @@ class ConfigurationHelper: attributes to consider that they may share walls in meters :return: float """ - return self._config.getfloat('attributes', 'max_location_distance_for_shared_walls') + return self._config.getfloat('buildings', 'max_location_distance_for_shared_walls') diff --git a/tests/test_geometry_factory.py b/tests/test_geometry_factory.py index ac7597b7..f0b5ced5 100644 --- a/tests/test_geometry_factory.py +++ b/tests/test_geometry_factory.py @@ -24,7 +24,7 @@ class TestGeometryFactory(TestCase): def _get_citygml(self): if self._city_gml is None: - file_path = (self._example_path / 'attributes.gml').resolve() + file_path = (self._example_path / 'buildings.gml').resolve() self._city_gml = GeometryFactory('citygml', file_path).city self.assertIsNotNone(self._city_gml, 'city is none') return self._city_gml diff --git a/tests/test_occupancy_factory.py b/tests/test_occupancy_factory.py index ca9c964f..c818bcdf 100644 --- a/tests/test_occupancy_factory.py +++ b/tests/test_occupancy_factory.py @@ -33,7 +33,7 @@ class TestOccupancyFactory(TestCase): def _get_citygml_with_usage(self): if self._city_gml_with_usage is None: - file_path = (self._example_path / 'attributes.gml').resolve() + file_path = (self._example_path / 'buildings.gml').resolve() self._city_gml_with_usage = GeometryFactory('citygml', file_path).city self.assertIsNotNone(self._city_gml_with_usage, 'city is none') UsageFactory(self._handler, self._city_gml_with_usage) diff --git a/tests/test_physics_factory.py b/tests/test_physics_factory.py index 3415cc15..b7036cb6 100644 --- a/tests/test_physics_factory.py +++ b/tests/test_physics_factory.py @@ -25,7 +25,7 @@ class TestPhysicsFactory(TestCase): def _get_citygml(self): if self._city_gml is None: - file_path = (self._example_path / 'attributes.gml').resolve() + file_path = (self._example_path / 'buildings.gml').resolve() self._city_gml = GeometryFactory('citygml', file_path).city self.assertIsNotNone(self._city_gml, 'city is none') return self._city_gml From 97344e02486fbb72d9d2d1a1c233e0bd0409cea2 Mon Sep 17 00:00:00 2001 From: Guille Date: Wed, 28 Oct 2020 14:05:45 -0400 Subject: [PATCH 2/2] Correct class and file names to match CERC coding rules --- .../attributes/domestic_hot_water_facility.py | 4 ---- ...ances_facilities.py => electric_appliances_facility.py} | 6 +----- city_model_structure/attributes/household.py | 7 +------ city_model_structure/attributes/hvac_facility.py | 4 ---- .../{lighting_facilities.py => lighting_facility.py} | 2 +- city_model_structure/attributes/schedule_value.py | 5 +---- 6 files changed, 4 insertions(+), 24 deletions(-) rename city_model_structure/attributes/{electric_appliances_facilities.py => electric_appliances_facility.py} (89%) rename city_model_structure/attributes/{lighting_facilities.py => lighting_facility.py} (94%) diff --git a/city_model_structure/attributes/domestic_hot_water_facility.py b/city_model_structure/attributes/domestic_hot_water_facility.py index ecb3a588..300c803e 100644 --- a/city_model_structure/attributes/domestic_hot_water_facility.py +++ b/city_model_structure/attributes/domestic_hot_water_facility.py @@ -11,10 +11,6 @@ class DomesticHotWaterFacility: """ def __init__(self, number_of_baths, number_of_showers, number_of_basin, water_storage_volume): - """ - Constructor - """ - self._number_of_baths = number_of_baths self._number_of_showers = number_of_showers self._number_of_basin = number_of_basin diff --git a/city_model_structure/attributes/electric_appliances_facilities.py b/city_model_structure/attributes/electric_appliances_facility.py similarity index 89% rename from city_model_structure/attributes/electric_appliances_facilities.py rename to city_model_structure/attributes/electric_appliances_facility.py index 357968bd..e23d689a 100644 --- a/city_model_structure/attributes/electric_appliances_facilities.py +++ b/city_model_structure/attributes/electric_appliances_facility.py @@ -5,16 +5,12 @@ Copyright © 2020 Project Author Sanam Dabirian sanam.dabirian@mail.concordia.ca """ -class appliances_facilities: +class ElectricAppliancesFacility: """ Electric appliance facilities class """ def __init__(self, appliance_electric_power): - """ - Constructor - """ - self._appliance_electric_power = appliance_electric_power @property diff --git a/city_model_structure/attributes/household.py b/city_model_structure/attributes/household.py index 81f9a19b..ef1fe3e2 100644 --- a/city_model_structure/attributes/household.py +++ b/city_model_structure/attributes/household.py @@ -5,20 +5,15 @@ Copyright © 2020 Project Author Sanam Dabirian sanam.dabirian@mail.concordia.ca """ -class household: +class Household: """ Household class """ def __init__(self, resident_type, household_type): - """ - Constructor - """ - self._resident_type = resident_type self._household_type = household_type - @property def resident_type(self): """ diff --git a/city_model_structure/attributes/hvac_facility.py b/city_model_structure/attributes/hvac_facility.py index 9bde3160..3253dd7f 100644 --- a/city_model_structure/attributes/hvac_facility.py +++ b/city_model_structure/attributes/hvac_facility.py @@ -11,10 +11,6 @@ class HvacFacility: """ def __init__(self, temperature_setpoints, hvac_schedules): - """ - Constructor - """ - self._temperature_setpoints = temperature_setpoints self._hvac_schedules = hvac_schedules diff --git a/city_model_structure/attributes/lighting_facilities.py b/city_model_structure/attributes/lighting_facility.py similarity index 94% rename from city_model_structure/attributes/lighting_facilities.py rename to city_model_structure/attributes/lighting_facility.py index 62a84a04..c70fa87d 100644 --- a/city_model_structure/attributes/lighting_facilities.py +++ b/city_model_structure/attributes/lighting_facility.py @@ -5,7 +5,7 @@ Copyright © 2020 Project Author Sanam Dabirian sanam.dabirian@mail.concordia.ca """ -class lighting_facilities: +class LightingFacility: """ Lighting facilities class """ diff --git a/city_model_structure/attributes/schedule_value.py b/city_model_structure/attributes/schedule_value.py index c949bdaa..da3f0c7b 100644 --- a/city_model_structure/attributes/schedule_value.py +++ b/city_model_structure/attributes/schedule_value.py @@ -11,9 +11,6 @@ class ScheduleValue: """ def __init__(self, hour, probability): - """ - Constructor - """ self._hour = hour self._probability = probability @@ -31,4 +28,4 @@ class ScheduleValue: Get probabilities of occupants' presence :return: occupants' presence probabilities """ - return self._probability \ No newline at end of file + return self._probability