From 2f0da192939a0506f52c4056836720d2e7052a45 Mon Sep 17 00:00:00 2001 From: Pilar Date: Wed, 2 Jun 2021 10:55:04 -0400 Subject: [PATCH] some typos fixed --- city_model_structure/attributes/concordia_energy_sensor.py | 3 +-- data/sensors/concordia.json | 2 +- imports/sensors/concordia_energy_consumption.py | 5 ++--- imports/sensors_factory.py | 2 +- non_functional_tests/test_sensors_factory.py | 3 +-- 5 files changed, 6 insertions(+), 9 deletions(-) diff --git a/city_model_structure/attributes/concordia_energy_sensor.py b/city_model_structure/attributes/concordia_energy_sensor.py index 1b951dc7..5da97e8a 100644 --- a/city_model_structure/attributes/concordia_energy_sensor.py +++ b/city_model_structure/attributes/concordia_energy_sensor.py @@ -19,7 +19,7 @@ class ConcordiaEnergySensor(Sensor): self._interval = 5 self._interval_units = 'minutes' self._type = 'ConcordiaEnergySensor' - self._units = 'kWh' + self._units = 'kW' self._measures = pd.DataFrame(columns=["Date time", "Energy consumption"]) @property @@ -34,7 +34,6 @@ class ConcordiaEnergySensor(Sensor): def measures(self): self._measures.drop = None - def add_period(self, measures): """ Add or update a period measures to the dataframe diff --git a/data/sensors/concordia.json b/data/sensors/concordia.json index 52d3f5e0..0a7bae46 100644 --- a/data/sensors/concordia.json +++ b/data/sensors/concordia.json @@ -5,7 +5,7 @@ "TOTKWEV-MB.IC"] }, { "building" : "GM", - "sensors": ["MDICOR.GM", "MDI.001-650.IC"] + "sensors": ["MDICOR.GM"] } ] } \ No newline at end of file diff --git a/imports/sensors/concordia_energy_consumption.py b/imports/sensors/concordia_energy_consumption.py index f10022f8..9b49cd20 100644 --- a/imports/sensors/concordia_energy_consumption.py +++ b/imports/sensors/concordia_energy_consumption.py @@ -22,7 +22,7 @@ class ConcordiaEnergyConsumption: self._sensor_database = base_path metadata = True content = False - with open (Path(base_path / 'concordia.json').resolve()) as concordia_db: + with open(Path(base_path / 'concordia.json').resolve()) as concordia_db: self._sensor_database = json.load(concordia_db) for building in self._sensor_database['sensors']: @@ -38,7 +38,7 @@ class ConcordiaEnergyConsumption: if metadata: fields = line.split(',') if len(fields) > 2: - point = fields[0].replace(":","") + point = fields[0].replace(":", "") key = fields[1] if fields[1] in self._sensors: self._sensor_point[key] = point @@ -71,7 +71,6 @@ class ConcordiaEnergyConsumption: sensor.add_period(building_energy_consumption) building.sensors.append(sensor) - @staticmethod def clean_line(line): return line.replace('"', '').replace('\n', '') diff --git a/imports/sensors_factory.py b/imports/sensors_factory.py index 41b1ea51..55bbea75 100644 --- a/imports/sensors_factory.py +++ b/imports/sensors_factory.py @@ -25,4 +25,4 @@ class SensorsFactory: Enrich the city with the usages information :return: None """ - getattr(self, self._handler, lambda: None)() \ No newline at end of file + getattr(self, self._handler, lambda: None)() diff --git a/non_functional_tests/test_sensors_factory.py b/non_functional_tests/test_sensors_factory.py index bc45c921..37967dee 100644 --- a/non_functional_tests/test_sensors_factory.py +++ b/non_functional_tests/test_sensors_factory.py @@ -11,7 +11,6 @@ from city_model_structure.building import Building from imports.sensors_factory import SensorsFactory - class TestSensorsFactory(TestCase): """ TestSchedulesFactory TestCase @@ -46,7 +45,7 @@ class TestSensorsFactory(TestCase): self.assertTrue(sensor.type is 'ConcordiaEnergySensor') # force update last row update = pd.DataFrame([['2020-01-19 23:55:00', '12345.0']], columns=["Date time", "Energy consumption"]) - update = update.astype({"Date time": 'datetime64', "Energy consumption":'float64'}) + update = update.astype({"Date time": 'datetime64', "Energy consumption": 'float64'}) sensor.add_period(update) row = sensor.measures.loc[sensor.measures["Date time"] == '2020-01-19 23:55:00']['Energy consumption'].iloc[0] self.assertTrue(f'{row}' == '12345.0')