Small in the factories documentation
This commit is contained in:
parent
5752c5d31d
commit
fde837150d
|
@ -1,33 +0,0 @@
|
|||
"""
|
||||
bixi_feature module
|
||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||
"""
|
||||
from city_model_structure.city_object import CityObject
|
||||
|
||||
|
||||
class BixiFeature(CityObject):
|
||||
"""
|
||||
BixiFeature(CityObject) class
|
||||
"""
|
||||
def __init__(self, lod, surfaces, name, feature_type, coordinates):
|
||||
super().__init__(lod, surfaces, name, [])
|
||||
self._feature_type = feature_type
|
||||
self._coordinates = coordinates
|
||||
self._type = 'bixi_feature'
|
||||
|
||||
@property
|
||||
def feature_type(self):
|
||||
"""
|
||||
Get type of bixi feature
|
||||
:return: feature_type
|
||||
"""
|
||||
return self._feature_type
|
||||
|
||||
@property
|
||||
def gps_coordinates(self):
|
||||
"""
|
||||
Get bixi feature coordinates
|
||||
:return: [x, y, z]
|
||||
"""
|
||||
return self._coordinates
|
|
@ -156,7 +156,7 @@ class City:
|
|||
raise NotImplementedError
|
||||
|
||||
@property
|
||||
def lower_corner(self):
|
||||
def lower_corner(self) -> List[float]:
|
||||
"""
|
||||
Get city lower corner
|
||||
:return: [x,y,z]
|
||||
|
@ -164,7 +164,7 @@ class City:
|
|||
return self._lower_corner
|
||||
|
||||
@property
|
||||
def upper_corner(self):
|
||||
def upper_corner(self) -> List[float]:
|
||||
"""
|
||||
Get city upper corner
|
||||
:return: [x,y,z]
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
"""
|
||||
Composting plant module
|
||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||
"""
|
||||
from city_model_structure.city_object import CityObject
|
||||
|
||||
|
||||
class CompostingPlant(CityObject):
|
||||
"""
|
||||
CompostingPlant(CityObject) class
|
||||
"""
|
||||
def __init__(self, lod, surfaces, name, waste_type, capacity):
|
||||
super().__init__(lod, surfaces, name, [])
|
||||
self._waste_type = waste_type
|
||||
self._capacity = capacity
|
||||
self._type = 'composting_plant'
|
||||
|
||||
@property
|
||||
def waste_type(self):
|
||||
"""
|
||||
Get waste type treated in composting plant
|
||||
:return: str
|
||||
"""
|
||||
return self._waste_type
|
||||
|
||||
@property
|
||||
def capacity(self):
|
||||
"""
|
||||
Get capacity of composting plant in kg
|
||||
:return: float
|
||||
"""
|
||||
return self._capacity
|
|
@ -56,7 +56,7 @@ class TrafficNode(Node):
|
|||
self._coordinates = value
|
||||
|
||||
@property
|
||||
def prohibitions(self) -> List[(Edge, Edge)]:
|
||||
def prohibitions(self) -> [(Edge, Edge)]:
|
||||
"""
|
||||
Get node prohibitions
|
||||
:return: [(Edge, Edge)]
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
"""
|
||||
Tree module
|
||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||
"""
|
||||
from city_model_structure.city_object import CityObject
|
||||
|
||||
|
||||
class Tree(CityObject):
|
||||
"""
|
||||
Tree(CityObject) class
|
||||
"""
|
||||
def __init__(self, lod, surfaces, name, height, canopy):
|
||||
super().__init__(lod, surfaces, name, [])
|
||||
self._height = height
|
||||
self._canopy = canopy
|
||||
self._type = 'tree'
|
||||
|
||||
@property
|
||||
def height(self):
|
||||
"""
|
||||
Get height of tree in meters
|
||||
:return: float
|
||||
"""
|
||||
return self._height
|
||||
|
||||
@property
|
||||
def canopy(self):
|
||||
"""
|
||||
Get canopy of tree
|
||||
:return: Boolean
|
||||
"""
|
||||
return self._canopy
|
|
@ -25,7 +25,7 @@ class ExportsFactory:
|
|||
@property
|
||||
def _citygml(self):
|
||||
"""
|
||||
Export to citygml_classes with application domain extensions
|
||||
Export to citygml
|
||||
:return: None
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
@ -33,7 +33,7 @@ class ExportsFactory:
|
|||
@property
|
||||
def _energy_ade(self):
|
||||
"""
|
||||
Export to citygml_classes with application domain extensions
|
||||
Export to citygml with application domain extensions
|
||||
:return: None
|
||||
"""
|
||||
return EnergyAde(self._city, self._path)
|
||||
|
@ -57,7 +57,7 @@ class ExportsFactory:
|
|||
@property
|
||||
def _grounded_obj(self):
|
||||
"""
|
||||
Export the city geometry to obj
|
||||
Export the city geometry to obj with grounded coordinates
|
||||
:return: None
|
||||
"""
|
||||
return Obj(self._city, self._path).to_ground_points()
|
||||
|
@ -84,7 +84,7 @@ class ExportsFactory:
|
|||
|
||||
def export(self):
|
||||
"""
|
||||
Export the city model structure to the given export type
|
||||
Export the city given to the class using the given export type handler
|
||||
:return: None
|
||||
"""
|
||||
return getattr(self, self._export_type, lambda: None)
|
||||
|
|
|
@ -17,10 +17,10 @@ class ConfigurationHelper:
|
|||
self._config.read(config_file)
|
||||
|
||||
@property
|
||||
def max_location_distance_for_shared_walls(self):
|
||||
def max_location_distance_for_shared_walls(self) -> float:
|
||||
"""
|
||||
Get configured maximal distance between attributes to consider that they may share walls in meters
|
||||
:return: float
|
||||
:return: 5.0
|
||||
"""
|
||||
return self._config.getfloat('buildings', 'max_location_distance_for_shared_walls')
|
||||
|
||||
|
@ -28,7 +28,7 @@ class ConfigurationHelper:
|
|||
def min_coordinate(self) -> float:
|
||||
"""
|
||||
Get configured minimal coordinate value
|
||||
:return: float
|
||||
:return: -1.7976931348623157e+308
|
||||
"""
|
||||
return self._config.getfloat('buildings', 'min_coordinate')
|
||||
|
||||
|
@ -36,6 +36,6 @@ class ConfigurationHelper:
|
|||
def max_coordinate(self) -> float:
|
||||
"""
|
||||
Get configured maximal coordinate value
|
||||
:return: float
|
||||
:return: 1.7976931348623157e+308
|
||||
"""
|
||||
return self._config.getfloat('buildings', 'max_coordinate')
|
||||
|
|
|
@ -4,7 +4,6 @@ SPDX - License - Identifier: LGPL - 3.0 - or -later
|
|||
Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||
"""
|
||||
|
||||
|
||||
# universal constants
|
||||
KELVIN = 273.15
|
||||
|
||||
|
|
|
@ -12,27 +12,32 @@ class ConstructionFactory:
|
|||
"""
|
||||
PhysicsFactor class
|
||||
"""
|
||||
def __init__(self, handler, city, base_path=Path(Path(__file__).parent.parent / 'data/construction')):
|
||||
def __init__(self, handler, city, base_path=None):
|
||||
if base_path is None:
|
||||
base_path = Path(Path(__file__).parent.parent / 'data/construction')
|
||||
self._handler = '_' + handler.lower().replace(' ', '_')
|
||||
self._city = city
|
||||
self._base_path = base_path
|
||||
|
||||
def _nrel(self):
|
||||
"""
|
||||
Enrich the city by using NREL information
|
||||
"""
|
||||
UsPhysicsParameters(self._city, self._base_path).enrich_buildings()
|
||||
|
||||
def _nrcan(self):
|
||||
"""
|
||||
Enrich the city by using NRCAN information
|
||||
:alert: NRCAN handler only contains simplified construction information
|
||||
"""
|
||||
CaPhysicsParameters(self._city, self._base_path).enrich_buildings()
|
||||
|
||||
def enrich(self):
|
||||
"""
|
||||
Enrich the city with the construction information
|
||||
Enrich the city given to the class using the class given handler
|
||||
:return: None
|
||||
"""
|
||||
getattr(self, self._handler, lambda: None)()
|
||||
|
||||
def _enrich_debug(self):
|
||||
"""
|
||||
Enrich the city with the construction information
|
||||
:return: None
|
||||
"""
|
||||
self._nrel()
|
||||
|
|
|
@ -19,21 +19,33 @@ class GeometryFactory:
|
|||
self._path = path
|
||||
|
||||
@property
|
||||
def _citygml(self):
|
||||
def _citygml(self) -> City:
|
||||
"""
|
||||
Enrich the city by using CityGML information as data source
|
||||
:return: City
|
||||
"""
|
||||
return CityGml(self._path).city
|
||||
|
||||
@property
|
||||
def _obj(self):
|
||||
def _obj(self) -> City:
|
||||
"""
|
||||
Enrich the city by using OBJ information as data source
|
||||
:return: City
|
||||
"""
|
||||
return Obj(self._path).city
|
||||
|
||||
@property
|
||||
def _osm_subway(self):
|
||||
def _osm_subway(self) -> City:
|
||||
"""
|
||||
Enrich the city by using OpenStreetMap information as data source
|
||||
:return: City
|
||||
"""
|
||||
return OsmSubway(self._path).city
|
||||
|
||||
@property
|
||||
def city(self) -> City:
|
||||
"""
|
||||
Load the city model structure from a geometry source
|
||||
Enrich the city given to the class using the class given handler
|
||||
:return: City
|
||||
"""
|
||||
return getattr(self, self._file_type, lambda: None)
|
||||
|
|
|
@ -24,14 +24,20 @@ class SchedulesFactory:
|
|||
'Please ensure that the usage factory is called first.')
|
||||
|
||||
def _comnet(self):
|
||||
"""
|
||||
Enrich the city by using COMNET schedules as data source
|
||||
"""
|
||||
ComnetSchedules(self._city, self._base_path)
|
||||
|
||||
def _doe_idf(self):
|
||||
"""
|
||||
Enrich the city by using DOE IDF schedules as data source
|
||||
"""
|
||||
DoeIdf(self._city, self._base_path, 'doe_idf.xml')
|
||||
|
||||
def enrich(self):
|
||||
"""
|
||||
Enrich the city with the schedules information
|
||||
Enrich the city given to the class using the given schedule handler
|
||||
:return: None
|
||||
"""
|
||||
getattr(self, self._handler, lambda: None)()
|
||||
|
|
|
@ -14,24 +14,35 @@ class SensorsFactory:
|
|||
"""
|
||||
UsageFactory class
|
||||
"""
|
||||
def __init__(self, handler, city, end_point, base_path=Path(Path(__file__).parent.parent / 'data/sensors')):
|
||||
def __init__(self, handler, city, end_point, base_path=None):
|
||||
if base_path is None:
|
||||
base_path = Path(Path(__file__).parent.parent / 'data/sensors')
|
||||
self._handler = '_' + handler.lower().replace(' ', '_')
|
||||
self._city = city
|
||||
self._end_point = end_point
|
||||
self._base_path = base_path
|
||||
|
||||
def _cec(self):
|
||||
"""
|
||||
Enrich the city by using concordia energy consumption sensors as data source
|
||||
"""
|
||||
ConcordiaEnergyConsumption(self._city, self._end_point, self._base_path)
|
||||
|
||||
def _cgf(self):
|
||||
"""
|
||||
Enrich the city by using concordia gas flow sensors as data source
|
||||
"""
|
||||
ConcordiaGasFlow(self._city, self._end_point, self._base_path)
|
||||
|
||||
def _ct(self):
|
||||
"""
|
||||
Enrich the city by using concordia temperature sensors as data source
|
||||
"""
|
||||
ConcordiaTemperature(self._city, self._end_point, self._base_path)
|
||||
|
||||
def enrich(self):
|
||||
"""
|
||||
Enrich the city with the usage information
|
||||
Enrich the city given to the class using the given sensor handler
|
||||
:return: None
|
||||
"""
|
||||
getattr(self, self._handler, lambda: None)()
|
||||
|
|
|
@ -15,7 +15,9 @@ class UsageFactory:
|
|||
"""
|
||||
UsageFactory class
|
||||
"""
|
||||
def __init__(self, handler, city, base_path=Path(Path(__file__).parent.parent / 'data/usage')):
|
||||
def __init__(self, handler, city, base_path=None):
|
||||
if base_path is None:
|
||||
base_path = Path(Path(__file__).parent.parent / 'data/usage')
|
||||
self._handler = '_' + handler.lower().replace(' ', '_')
|
||||
self._city = city
|
||||
self._base_path = base_path
|
||||
|
@ -25,14 +27,20 @@ class UsageFactory:
|
|||
'Please ensure that the construction factory is called first.')
|
||||
|
||||
def _hft(self):
|
||||
"""
|
||||
Enrich the city with HFT usage library
|
||||
"""
|
||||
return HftUsageParameters(self._city, self._base_path).enrich_buildings()
|
||||
|
||||
def _ca(self):
|
||||
"""
|
||||
Enrich the city with Canada usage library
|
||||
"""
|
||||
return CaUsageParameters(self._city, self._base_path).enrich_buildings()
|
||||
|
||||
def enrich(self):
|
||||
"""
|
||||
Enrich the city with the usage information
|
||||
Enrich the city given to the class using the usage factory given handler
|
||||
:return: None
|
||||
"""
|
||||
getattr(self, self._handler, lambda: None)()
|
||||
|
|
|
@ -13,13 +13,18 @@ class WeatherFactory:
|
|||
WeatherFactory class
|
||||
"""
|
||||
|
||||
def __init__(self, handler, city, base_path=Path(Path(__file__).parent.parent / 'data/weather'), file_name=None):
|
||||
def __init__(self, handler, city, base_path=None, file_name=None):
|
||||
if base_path is None:
|
||||
base_path = Path(Path(__file__).parent.parent / 'data/weather')
|
||||
self._handler = '_' + handler.lower().replace(' ', '_')
|
||||
self._city = city
|
||||
self._base_path = base_path
|
||||
self._file_name = file_name
|
||||
|
||||
def _epw(self):
|
||||
"""
|
||||
Enrich the city with energy plus weather file
|
||||
"""
|
||||
# EnergyPlus Weather
|
||||
# to download files: https://energyplus.net/weather
|
||||
# description of the format: https://energyplus.net/sites/default/files/pdfs_v8.3.0/AuxiliaryPrograms.pdf
|
||||
|
@ -27,12 +32,15 @@ class WeatherFactory:
|
|||
return EpwWeatherParameters(self._city, _path, self._file_name)
|
||||
|
||||
def _xls(self):
|
||||
"""
|
||||
Enrich the city with ISO_52016_1_BESTEST_ClimData_2016.08.24 weather file
|
||||
"""
|
||||
name = 'ISO_52016_1_BESTEST_ClimData_2016.08.24'
|
||||
return XlsWeatherParameters(self._city, self._base_path, name)
|
||||
|
||||
def enrich(self):
|
||||
"""
|
||||
Enrich the city with the usage information
|
||||
Enrich the city given to the class using the given weather handler
|
||||
:return: None
|
||||
"""
|
||||
getattr(self, self._handler, lambda: None)()
|
||||
|
|
Loading…
Reference in New Issue
Block a user