moved data folder to libs and changed:

def __init__(self, handler, city, base_path=Path(Path.cwd().parent / 'libs/data/physics')):

in physics_factory.py plus the paths in us_base_physics_parameters.py

Something similar should be done for usage_factory.py
This commit is contained in:
Pilar 2020-06-26 18:10:56 -07:00
parent b6bc582201
commit 5502261e16
7 changed files with 17 additions and 14 deletions

View File

@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.7 (libs)" jdkType="Python SDK" />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/venv38" />
</content>
<orderEntry type="jdk" jdkName="Python 3.8 (libs)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -42,7 +42,6 @@ class City:
transformer = Transformer.from_crs(input_reference, gps)
coordinates = transformer.transform(self.lower_corner[0], self.lower_corner[1])
self._location = GeometryHelper.get_location(coordinates[0], coordinates[1])
# rg.search(coordinates)
return self._location
@property

View File

@ -8,7 +8,6 @@ import math
import numpy as np
import open3d as o3d
import requests
import json
from trimesh import Trimesh
from trimesh import intersections
from helpers.configuration_helper import ConfigurationHelper
@ -21,7 +20,8 @@ class GeometryHelper:
def __init__(self, delta=0.5):
self._delta = delta
def adjacent_locations(self, location1, location2):
@staticmethod
def adjacent_locations(location1, location2):
"""
Determine when two buildings may be adjacent or not based in the dis
:param location1:

View File

@ -5,19 +5,20 @@ Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@conc
"""
from physics.physics_feeders.us_new_york_city_physics_parameters import UsNewYorkCityPhysicsParameters
from physics.physics_feeders.us_physics_parameters import UsPhysicsParameters
from pathlib import Path
class PhysicsFactory:
"""
PhysicsFactor class
"""
def __init__(self, handler, city, base_path='data/physics'):
def __init__(self, handler, city, base_path=Path(Path.cwd().parent / 'libs/data/physics')):
self._handler = '_' + handler.lower().replace(' ', '_')
self._city = city
self._base_path = base_path
self.factory()
def _us_new_york_city(self):
def _us_new_york(self):
UsNewYorkCityPhysicsParameters(self._city, self._base_path)
def _us(self):

View File

@ -4,8 +4,6 @@ UsPhysicsParameters as base class
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
"""
from pathlib import Path
import xmltodict
from city_model_structure.layer import Layer
@ -21,12 +19,14 @@ class UsBasePhysicsParameters:
self._climate_zone = climate_zone
self._buildings = buildings
# load US Library
path = str(Path.cwd() / base_path / 'us_constructions.xml')
path = str(base_path / 'us_constructions.xml')
print('physics construction:', path)
with open(path) as xml:
self._library = xmltodict.parse(xml.read(), force_list='layer')
# load US Archetypes
path = str(Path.cwd() / base_path / 'us_archetypes.xml')
path = str(base_path / 'us_archetypes.xml')
print('physics archetypes:', path)
with open(path) as xml:
self._archetypes = xmltodict.parse(xml.read(), force_list='layer')
for building in self._buildings:
@ -40,8 +40,8 @@ class UsBasePhysicsParameters:
# ToDo: remove this in the future
# ToDo: Raise WrongArchetype if not all the surface types are defined for the given city_object
if archetype is None:
print('Building ', city_object.name, 'has unknown archetype')
print('type: ', building_type, UsToLibraryTypes.yoc_to_standard(city_object.year_of_construction),
print('Building ', building.name, 'has unknown archetype')
print('type: ', building_type, UsToLibraryTypes.yoc_to_standard(building.year_of_construction),
self._climate_zone)
continue

View File

@ -16,7 +16,7 @@ class UsageFactory:
self._city = city
self.factory()
def _us_new_york_city(self):
def _us_new_york(self):
UsNewYorkCityUsageParameters(self._city)
def _ca(self):

View File

@ -20,6 +20,7 @@ class UsBaseUsageParameters:
# 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.cwd() / 'data/usage/de_library.xml')
print('usage:', path)
with open(path) as xml:
self._library = xmltodict.parse(xml.read(), force_list='zoneUsageVariant')
for city_object in self._city.buildings: