diff --git a/hub/imports/geometry_factory.py b/hub/imports/geometry_factory.py index 59990fcf..5de35b95 100644 --- a/hub/imports/geometry_factory.py +++ b/hub/imports/geometry_factory.py @@ -55,6 +55,7 @@ class GeometryFactory: :return: City """ if self._data_frame is None: + print(self._path) self._data_frame = geopandas.read_file(self._path) return GPandas(self._data_frame).city @@ -96,4 +97,6 @@ class GeometryFactory: Enrich the city given to the class using the class given handler :return: City """ - return Geojson(self._path, self._height_field, self._year_of_construction_field, self._function_field).city + if self._data_frame is None: + self._data_frame = geopandas.read_file(self._path) + return GPandas(self._data_frame).city diff --git a/hub/unittests/test_energy_systems_air_source_hp.py b/hub/unittests/test_energy_systems_air_source_hp.py index f5933df1..8ca8a7ec 100644 --- a/hub/unittests/test_energy_systems_air_source_hp.py +++ b/hub/unittests/test_energy_systems_air_source_hp.py @@ -39,7 +39,7 @@ class TestEnergySystemsFactory(TestCase): :return: None """ city_file = "tests_data/C40_Final.gml" - self._output_path = "/tests_data/as_user_output.csv" + self._output_path = "tests_data/as_user_output.csv" self._city = GeometryFactory('citygml', path=city_file).city EnergySystemsFactory('air source hp', self._city).enrich() diff --git a/hub/unittests/test_energy_systems_water_to_water_hp.py b/hub/unittests/test_energy_systems_water_to_water_hp.py index e2909d96..d2096d6f 100644 --- a/hub/unittests/test_energy_systems_water_to_water_hp.py +++ b/hub/unittests/test_energy_systems_water_to_water_hp.py @@ -40,7 +40,7 @@ class TestEnergySystemsFactory(TestCase): :return: None """ city_file = "tests_data/C40_Final.gml" - self._output_path = "/tests_data/w2w_user_output.csv" + self._output_path = "tests_data/w2w_user_output.csv" self._city = GeometryFactory('citygml', path=city_file).city EnergySystemsFactory('water to water hp', self._city).enrich() diff --git a/hub/unittests/test_geometry_factory.py b/hub/unittests/test_geometry_factory.py index 6f2df014..25a2bc44 100644 --- a/hub/unittests/test_geometry_factory.py +++ b/hub/unittests/test_geometry_factory.py @@ -133,19 +133,6 @@ class TestGeometryFactory(TestCase): for building in city.buildings: self._check_surfaces(building) - def test_import_geopandas(self): - """ - Test geopandas import - """ - file = 'sample.geojson' - city = self._get_city(file, 'gpandas') - self.assertTrue(len(city.buildings) == 1) - self._check_buildings(city) - for building in city.buildings: - self._check_surfaces(building) - self.assertEqual(1912.0898135701814, building.volume) - self.assertEqual(146.19493345171213, building.floor_area) - def test_import_geojson(self): """ Test geojson import