occupancy to schedules

This commit is contained in:
pilar 2020-12-15 15:15:40 -05:00
parent 4a7dda045d
commit 74659b8a06
9 changed files with 79 additions and 78 deletions

View File

@ -0,0 +1,50 @@
"""
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 city_model_structure.city import City
from city_model_structure.city_object import CityObject
from factories.geometry_feeders.city_gml import CityGml
from factories.geometry_feeders.osm_subway import OsmSubway
class GeometryFactory:
"""
GeometryFactory class
"""
def __init__(self, file_type, path):
self._file_type = '_' + file_type.lower()
self._path = path
@property
def _citygml(self):
return CityGml(self._path).city
@property
def _geojson(self):
raise Exception('Not implemented')
@property
def _bim(self):
raise Exception('Not implemented')
@property
def city(self) -> City:
"""
Load the city model structure from a geometry source
:return: City
"""
return getattr(self, self._file_type, lambda: None)
@property
def _osm_subway(self):
return OsmSubway(self._path).subway_entrances
@property
def features(self) -> [CityObject]:
"""
Load the city model structure from a geometry source
:return: [CityObject]
"""
return getattr(self, self._file_type, lambda: None)

View File

@ -1,29 +0,0 @@
"""
SchedulesFactory retrieve the specific schedules module for the given standard
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
"""
from pathlib import Path
from factories.occupancy_feeders.usage_schedules import ComnetSchedules
class SchedulesFactory:
"""
SchedulesFactor class
"""
def __init__(self, handler, city, base_path=Path(Path(__file__).parent.parent / 'data/occupancy')):
self._handler = '_' + handler.lower().replace(' ', '_')
self._city = city
self._base_path = base_path
self.factory()
def _comnet(self):
ComnetSchedules(self._city, self._base_path)
def factory(self):
"""
Enrich the city with the schedules information
:return: None
"""
getattr(self, self._handler, lambda: None)()

View File

@ -1,50 +1,29 @@
"""
GeometryFactory retrieve the specific geometric module to load the given format
SchedulesFactory retrieve the specific schedules module for the given standard
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
"""
from city_model_structure.city import City
from city_model_structure.city_object import CityObject
from factories.geometry_feeders.city_gml import CityGml
from factories.geometry_feeders.osm_subway import OsmSubway
from pathlib import Path
from factories.occupancy_feeders.usage_schedules import ComnetSchedules
class GeometryFactory:
class SchedulesFactory:
"""
GeometryFactory class
SchedulesFactor class
"""
def __init__(self, file_type, path):
self._file_type = '_' + file_type.lower()
self._path = path
def __init__(self, handler, city, base_path=Path(Path(__file__).parent.parent / 'data/occupancy')):
self._handler = '_' + handler.lower().replace(' ', '_')
self._city = city
self._base_path = base_path
self.factory()
@property
def _citygml(self):
return CityGml(self._path).city
def _comnet(self):
ComnetSchedules(self._city, self._base_path)
@property
def _geojson(self):
raise Exception('Not implemented')
@property
def _bim(self):
raise Exception('Not implemented')
@property
def city(self) -> City:
def factory(self):
"""
Load the city model structure from a geometry source
:return: City
Enrich the city with the schedules information
:return: None
"""
return getattr(self, self._file_type, lambda: None)
@property
def _osm_subway(self):
return OsmSubway(self._path).subway_entrances
@property
def features(self) -> [CityObject]:
"""
Load the city model structure from a geometry source
:return: [CityObject]
"""
return getattr(self, self._file_type, lambda: None)
getattr(self, self._handler, lambda: None)()

View File

@ -8,7 +8,7 @@ from pathlib import Path
from unittest import TestCase
from city_model_structure.city import City
from factories.schedules_factory import GeometryFactory
from factories.geometry_factory import GeometryFactory
class TestGeometryFactory(TestCase):

View File

@ -5,10 +5,10 @@ Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@conc
"""
from pathlib import Path
from unittest import TestCase
from factories.schedules_factory import GeometryFactory
from factories.geometry_factory import GeometryFactory
from factories.physics_factory import PhysicsFactory
from factories.usage_factory import UsageFactory
from factories.occupancy_factory import SchedulesFactory
from factories.schedules_factory import SchedulesFactory
from helpers.idf_helper import IdfHelper
import os
import glob

View File

@ -6,7 +6,7 @@ Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@conc
from pathlib import Path
from unittest import TestCase
from factories.schedules_factory import GeometryFactory
from factories.geometry_factory import GeometryFactory
from factories.physics_factory import PhysicsFactory

View File

@ -1,19 +1,20 @@
"""
TestOccupancyFactory test and validate the city model structure occupancy parameters
TestSchedulesFactory test and validate the city model structure schedules
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
Contributors Pilar Monsalvete pilar_monsalvete@yahoo.es
"""
from pathlib import Path
from unittest import TestCase
from factories.schedules_factory import GeometryFactory
from factories.geometry_factory import GeometryFactory
from factories.usage_factory import UsageFactory
from factories.occupancy_factory import SchedulesFactory
from factories.schedules_factory import SchedulesFactory
class TestOccupancyFactory(TestCase):
class TestSchedulesFactory(TestCase):
"""
TestOccupancyFactory TestCase
TestSchedulesFactory TestCase
"""
def setUp(self) -> None:

View File

@ -6,7 +6,7 @@ Copyright © 2020 Project Author Pilar Monsalvete pilar_monsalvete@yahoo.es
from pathlib import Path
from unittest import TestCase
from factories.schedules_factory import GeometryFactory
from factories.geometry_factory import GeometryFactory
from factories.usage_factory import UsageFactory

View File

@ -7,7 +7,7 @@ from pathlib import Path
from unittest import TestCase
import numpy as np
from factories.schedules_factory import GeometryFactory
from factories.geometry_factory import GeometryFactory
from factories.weather_factory import WeatherFactory