update pylintrc and correct setup.py
This commit is contained in:
parent
eeb75c101f
commit
6809a4fca3
|
@ -46,7 +46,7 @@ class InselMonthlyEnergyBalance:
|
||||||
if building.internal_zones is not None:
|
if building.internal_zones is not None:
|
||||||
for internal_zone in building.internal_zones:
|
for internal_zone in building.internal_zones:
|
||||||
if internal_zone.thermal_zones is None:
|
if internal_zone.thermal_zones is None:
|
||||||
logging.warning(f'Building %s has missing values. Monthly Energy Balance cannot be processed', building.name)
|
logging.warning('Building %s has missing values. Monthly Energy Balance cannot be processed', building.name)
|
||||||
break
|
break
|
||||||
self._contents.append(
|
self._contents.append(
|
||||||
self._generate_meb_template(building, output_path, self._radiation_calculation_method, self._weather_format)
|
self._generate_meb_template(building, output_path, self._radiation_calculation_method, self._weather_format)
|
||||||
|
@ -69,7 +69,6 @@ class InselMonthlyEnergyBalance:
|
||||||
file_name = self._insel_files_paths[i_file]
|
file_name = self._insel_files_paths[i_file]
|
||||||
with open(Path(self._path / file_name).resolve(), 'w', encoding='utf8') as insel_file:
|
with open(Path(self._path / file_name).resolve(), 'w', encoding='utf8') as insel_file:
|
||||||
insel_file.write(content)
|
insel_file.write(content)
|
||||||
return
|
|
||||||
|
|
||||||
def _sanity_check(self):
|
def _sanity_check(self):
|
||||||
levels_of_detail = self._city.level_of_detail
|
levels_of_detail = self._city.level_of_detail
|
||||||
|
@ -142,9 +141,9 @@ class InselMonthlyEnergyBalance:
|
||||||
parameters.append(f'{internal_zone.thermal_zones[0].total_floor_area * percentage_usage} '
|
parameters.append(f'{internal_zone.thermal_zones[0].total_floor_area * percentage_usage} '
|
||||||
f'% BP(11) #1 Area of zone {i + 1} (m2)')
|
f'% BP(11) #1 Area of zone {i + 1} (m2)')
|
||||||
total_internal_gain = 0
|
total_internal_gain = 0
|
||||||
for ig in usage.internal_gains:
|
for i_gain in usage.internal_gains:
|
||||||
internal_gain = ig.average_internal_gain * (ig.convective_fraction + ig.radiative_fraction)
|
internal_gain = i_gain.average_internal_gain * (i_gain.convective_fraction + i_gain.radiative_fraction)
|
||||||
for schedule in ig.schedules:
|
for schedule in i_gain.schedules:
|
||||||
total_values = sum(schedule.values)
|
total_values = sum(schedule.values)
|
||||||
total_hours = 0
|
total_hours = 0
|
||||||
for day_type in schedule.day_types:
|
for day_type in schedule.day_types:
|
||||||
|
|
|
@ -29,7 +29,7 @@ class Obj:
|
||||||
file_name = self._city.name + '.obj'
|
file_name = self._city.name + '.obj'
|
||||||
file_path = (Path(self._path).resolve() / file_name).resolve()
|
file_path = (Path(self._path).resolve() / file_name).resolve()
|
||||||
vertices = {}
|
vertices = {}
|
||||||
with open(file_path, 'w') as obj:
|
with open(file_path, 'w', encoding='utf-8') as obj:
|
||||||
obj.write("# cerc-hub export\n")
|
obj.write("# cerc-hub export\n")
|
||||||
vertex_index = 0
|
vertex_index = 0
|
||||||
faces = []
|
faces = []
|
||||||
|
@ -42,7 +42,7 @@ class Obj:
|
||||||
face = 'f '
|
face = 'f '
|
||||||
for coordinate in surface.perimeter_polygon.coordinates:
|
for coordinate in surface.perimeter_polygon.coordinates:
|
||||||
vertex = self._to_vertex(coordinate)
|
vertex = self._to_vertex(coordinate)
|
||||||
if vertex not in vertices.keys():
|
if vertex not in vertices:
|
||||||
vertex_index += 1
|
vertex_index += 1
|
||||||
vertices[vertex] = vertex_index
|
vertices[vertex] = vertex_index
|
||||||
current = vertex_index
|
current = vertex_index
|
||||||
|
|
|
@ -73,7 +73,7 @@ class SimplifiedRadiosityAlgorithm:
|
||||||
representative_building = self._city.buildings[0]
|
representative_building = self._city.buildings[0]
|
||||||
content += f'{day} {month} {hour} {representative_building.global_horizontal[cte.HOUR].epw[i]} ' \
|
content += f'{day} {month} {hour} {representative_building.global_horizontal[cte.HOUR].epw[i]} ' \
|
||||||
f'{representative_building.beam[cte.HOUR].epw[i]}\n'
|
f'{representative_building.beam[cte.HOUR].epw[i]}\n'
|
||||||
with open(file, "w") as file:
|
with open(file, 'w', encoding='utf-8') as file:
|
||||||
file.write(content)
|
file.write(content)
|
||||||
|
|
||||||
def _export_sra_xml(self):
|
def _export_sra_xml(self):
|
||||||
|
@ -139,5 +139,5 @@ class SimplifiedRadiosityAlgorithm:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
with open(self._file_name, "w") as file:
|
with open(self._file_name, 'w', encoding='utf-8') as file:
|
||||||
file.write(xmltodict.unparse(sra, pretty=True, short_empty_elements=True))
|
file.write(xmltodict.unparse(sra, pretty=True, short_empty_elements=True))
|
||||||
|
|
|
@ -28,5 +28,5 @@ class Triangular:
|
||||||
for building in self._city.buildings:
|
for building in self._city.buildings:
|
||||||
trimesh = trimesh.union(building.simplified_polyhedron.trimesh)
|
trimesh = trimesh.union(building.simplified_polyhedron.trimesh)
|
||||||
|
|
||||||
with open(file_path, self._write_mode) as file:
|
with open(file_path, self._write_mode, encoding='utf-8') as file:
|
||||||
file.write(trimesh.export(file_type=self._triangular_format))
|
file.write(trimesh.export(file_type=self._triangular_format))
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
"""
|
"""
|
||||||
Constant module
|
Auth module
|
||||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||||
Copyright © 2023 Concordia CERC group
|
Copyright © 2023 Concordia CERC group
|
||||||
Project Coder Peter Yefi peteryefi@gmail.com
|
Project Coder Peter Yefi peteryefi@gmail.com
|
||||||
|
@ -9,6 +9,9 @@ import bcrypt
|
||||||
|
|
||||||
|
|
||||||
class Auth(object):
|
class Auth(object):
|
||||||
|
"""
|
||||||
|
Auth class
|
||||||
|
"""
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def hash_password(password: str) -> str:
|
def hash_password(password: str) -> str:
|
||||||
|
|
|
@ -204,8 +204,8 @@ MIN_FLOAT = float('-inf')
|
||||||
# Tools
|
# Tools
|
||||||
SRA = 'sra'
|
SRA = 'sra'
|
||||||
INSEL_MEB = 'insel meb'
|
INSEL_MEB = 'insel meb'
|
||||||
COOLING_PEAK_LOAD = f'cooling peak load'
|
COOLING_PEAK_LOAD = 'cooling peak load'
|
||||||
HEATING_PEAK_LOAD = f'heating peak load'
|
HEATING_PEAK_LOAD = 'heating peak load'
|
||||||
|
|
||||||
# Costs units
|
# Costs units
|
||||||
CURRENCY_PER_SQM = 'currency/m2'
|
CURRENCY_PER_SQM = 'currency/m2'
|
||||||
|
|
|
@ -10,6 +10,9 @@ import hub.helpers.constants as cte
|
||||||
|
|
||||||
|
|
||||||
class AlkisFunctionToHubFunction:
|
class AlkisFunctionToHubFunction:
|
||||||
|
"""
|
||||||
|
Alkis function to hub function class
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._dictionary = {"1000": cte.RESIDENTIAL,
|
self._dictionary = {"1000": cte.RESIDENTIAL,
|
||||||
|
@ -183,4 +186,8 @@ class AlkisFunctionToHubFunction:
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def dictionary(self) -> dict:
|
def dictionary(self) -> dict:
|
||||||
|
"""
|
||||||
|
Get the dictionary
|
||||||
|
:return: {}
|
||||||
|
"""
|
||||||
return self._dictionary
|
return self._dictionary
|
||||||
|
|
|
@ -9,7 +9,9 @@ import hub.helpers.constants as cte
|
||||||
|
|
||||||
|
|
||||||
class HftFunctionToHubFunction:
|
class HftFunctionToHubFunction:
|
||||||
|
"""
|
||||||
|
Hft function to hub function class
|
||||||
|
"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._dictionary = {
|
self._dictionary = {
|
||||||
'residential': cte.RESIDENTIAL,
|
'residential': cte.RESIDENTIAL,
|
||||||
|
@ -29,4 +31,8 @@ class HftFunctionToHubFunction:
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def dictionary(self) -> dict:
|
def dictionary(self) -> dict:
|
||||||
|
"""
|
||||||
|
Get the dictionary
|
||||||
|
:return: {}
|
||||||
|
"""
|
||||||
return self._dictionary
|
return self._dictionary
|
||||||
|
|
|
@ -9,6 +9,9 @@ import hub.helpers.constants as cte
|
||||||
|
|
||||||
|
|
||||||
class HubFunctionToMontrealCustomCostsFunction:
|
class HubFunctionToMontrealCustomCostsFunction:
|
||||||
|
"""
|
||||||
|
Hub function to montreal custom cost function
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._dictionary = {
|
self._dictionary = {
|
||||||
|
@ -75,4 +78,8 @@ class HubFunctionToMontrealCustomCostsFunction:
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def dictionary(self) -> dict:
|
def dictionary(self) -> dict:
|
||||||
|
"""
|
||||||
|
Get the dictionary
|
||||||
|
:return: {}
|
||||||
|
"""
|
||||||
return self._dictionary
|
return self._dictionary
|
||||||
|
|
|
@ -9,7 +9,9 @@ import hub.helpers.constants as cte
|
||||||
|
|
||||||
|
|
||||||
class HubFunctionToNrcanConstructionFunction:
|
class HubFunctionToNrcanConstructionFunction:
|
||||||
|
"""
|
||||||
|
Hub function to nrcan construction function class
|
||||||
|
"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._dictionary = {
|
self._dictionary = {
|
||||||
cte.RESIDENTIAL: 'MidriseApartment',
|
cte.RESIDENTIAL: 'MidriseApartment',
|
||||||
|
@ -75,4 +77,8 @@ class HubFunctionToNrcanConstructionFunction:
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def dictionary(self) -> dict:
|
def dictionary(self) -> dict:
|
||||||
|
"""
|
||||||
|
Get the dictionary
|
||||||
|
:return: {}
|
||||||
|
"""
|
||||||
return self._dictionary
|
return self._dictionary
|
||||||
|
|
|
@ -9,6 +9,9 @@ import hub.helpers.constants as cte
|
||||||
|
|
||||||
|
|
||||||
class HubFunctionToNrelConstructionFunction:
|
class HubFunctionToNrelConstructionFunction:
|
||||||
|
"""
|
||||||
|
Hub function to nrel construction function
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._dictionary = {
|
self._dictionary = {
|
||||||
|
@ -75,4 +78,8 @@ class HubFunctionToNrelConstructionFunction:
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def dictionary(self) -> dict:
|
def dictionary(self) -> dict:
|
||||||
|
"""
|
||||||
|
Get the dictionary
|
||||||
|
:return: {}
|
||||||
|
"""
|
||||||
return self._dictionary
|
return self._dictionary
|
||||||
|
|
|
@ -9,6 +9,9 @@ import hub.helpers.constants as cte
|
||||||
|
|
||||||
|
|
||||||
class HubUsageToComnetUsage:
|
class HubUsageToComnetUsage:
|
||||||
|
"""
|
||||||
|
Hub usage to comnet usage class
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._dictionary = {
|
self._dictionary = {
|
||||||
|
@ -75,4 +78,8 @@ class HubUsageToComnetUsage:
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def dictionary(self) -> dict:
|
def dictionary(self) -> dict:
|
||||||
|
"""
|
||||||
|
Get the dictionary
|
||||||
|
:return: {}
|
||||||
|
"""
|
||||||
return self._dictionary
|
return self._dictionary
|
||||||
|
|
|
@ -9,6 +9,9 @@ import hub.helpers.constants as cte
|
||||||
|
|
||||||
|
|
||||||
class HubUsageToHftUsage:
|
class HubUsageToHftUsage:
|
||||||
|
"""
|
||||||
|
Hub usage to hft usage class
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._dictionary = {
|
self._dictionary = {
|
||||||
|
@ -75,4 +78,8 @@ class HubUsageToHftUsage:
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def dictionary(self) -> dict:
|
def dictionary(self) -> dict:
|
||||||
|
"""
|
||||||
|
Get the dictionary
|
||||||
|
:return: {}
|
||||||
|
"""
|
||||||
return self._dictionary
|
return self._dictionary
|
||||||
|
|
|
@ -9,6 +9,9 @@ import hub.helpers.constants as cte
|
||||||
|
|
||||||
|
|
||||||
class HubUsageToNrcanUsage:
|
class HubUsageToNrcanUsage:
|
||||||
|
"""
|
||||||
|
Hub usage to nrcan usage class
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._dictionary = {
|
self._dictionary = {
|
||||||
|
@ -75,4 +78,8 @@ class HubUsageToNrcanUsage:
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def dictionary(self) -> dict:
|
def dictionary(self) -> dict:
|
||||||
|
"""
|
||||||
|
Get the dictionary
|
||||||
|
:return: {}
|
||||||
|
"""
|
||||||
return self._dictionary
|
return self._dictionary
|
||||||
|
|
|
@ -9,7 +9,9 @@ import hub.helpers.constants as cte
|
||||||
|
|
||||||
|
|
||||||
class MontrealDemandTypeToHubEnergyDemandType:
|
class MontrealDemandTypeToHubEnergyDemandType:
|
||||||
|
"""
|
||||||
|
Montreal demand type to hub energy demand type
|
||||||
|
"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._dictionary = {'heating': cte.HEATING,
|
self._dictionary = {'heating': cte.HEATING,
|
||||||
'cooling': cte.COOLING,
|
'cooling': cte.COOLING,
|
||||||
|
@ -19,4 +21,8 @@ class MontrealDemandTypeToHubEnergyDemandType:
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def dictionary(self) -> dict:
|
def dictionary(self) -> dict:
|
||||||
|
"""
|
||||||
|
Get the dictionary
|
||||||
|
:return: {}
|
||||||
|
"""
|
||||||
return self._dictionary
|
return self._dictionary
|
||||||
|
|
|
@ -9,7 +9,9 @@ import hub.helpers.constants as cte
|
||||||
|
|
||||||
|
|
||||||
class PlutoFunctionToHubFunction:
|
class PlutoFunctionToHubFunction:
|
||||||
|
"""
|
||||||
|
Pluto function to hub function class
|
||||||
|
"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._dictionary = {
|
self._dictionary = {
|
||||||
'A0': cte.SINGLE_FAMILY_HOUSE,
|
'A0': cte.SINGLE_FAMILY_HOUSE,
|
||||||
|
@ -214,4 +216,8 @@ class PlutoFunctionToHubFunction:
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def dictionary(self) -> dict:
|
def dictionary(self) -> dict:
|
||||||
|
"""
|
||||||
|
Get the dictionary
|
||||||
|
:return: {}
|
||||||
|
"""
|
||||||
return self._dictionary
|
return self._dictionary
|
||||||
|
|
|
@ -7,12 +7,12 @@ Code contributors: Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concord
|
||||||
"""
|
"""
|
||||||
import math
|
import math
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from typing import Dict
|
||||||
|
|
||||||
import numpy as np
|
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
from trimesh import Trimesh
|
from trimesh import Trimesh
|
||||||
from trimesh import intersections
|
from trimesh import intersections
|
||||||
from typing import Dict
|
import numpy as np
|
||||||
|
|
||||||
from hub.city_model_structure.attributes.polygon import Polygon
|
from hub.city_model_structure.attributes.polygon import Polygon
|
||||||
from hub.city_model_structure.attributes.polyhedron import Polyhedron
|
from hub.city_model_structure.attributes.polyhedron import Polyhedron
|
||||||
|
@ -20,6 +20,9 @@ from hub.helpers.location import Location
|
||||||
|
|
||||||
|
|
||||||
class MapPoint:
|
class MapPoint:
|
||||||
|
"""
|
||||||
|
Map point class
|
||||||
|
"""
|
||||||
def __init__(self, x, y):
|
def __init__(self, x, y):
|
||||||
self._x = int(x)
|
self._x = int(x)
|
||||||
self._y = int(y)
|
self._y = int(y)
|
||||||
|
@ -47,9 +50,8 @@ class MapPoint:
|
||||||
def __getitem__(self, index):
|
def __getitem__(self, index):
|
||||||
if index == 0:
|
if index == 0:
|
||||||
return self._x
|
return self._x
|
||||||
elif index == 1:
|
if index == 1:
|
||||||
return self._y
|
return self._y
|
||||||
else:
|
|
||||||
raise IndexError('Index error')
|
raise IndexError('Index error')
|
||||||
|
|
||||||
|
|
||||||
|
@ -146,11 +148,11 @@ class GeometryHelper:
|
||||||
building_key = f'{building.name}_{building_start_coordinate}_{neighbour_start_coordinate}'
|
building_key = f'{building.name}_{building_start_coordinate}_{neighbour_start_coordinate}'
|
||||||
|
|
||||||
# Add my neighbour info to my shared lines
|
# Add my neighbour info to my shared lines
|
||||||
if building.name in lines_information.keys() and neighbour_key in lines_information[building.name]:
|
if building.name in lines_information and neighbour_key in lines_information[building.name]:
|
||||||
shared_points = int(lines_information[building.name][neighbour_key]['shared_points'])
|
shared_points = int(lines_information[building.name][neighbour_key]['shared_points'])
|
||||||
lines_information[building.name][neighbour_key]['shared_points'] = shared_points + 1
|
lines_information[building.name][neighbour_key]['shared_points'] = shared_points + 1
|
||||||
else:
|
else:
|
||||||
if building.name not in lines_information.keys():
|
if building.name not in lines_information:
|
||||||
lines_information[building.name] = {}
|
lines_information[building.name] = {}
|
||||||
lines_information[building.name][neighbour_key] = {
|
lines_information[building.name][neighbour_key] = {
|
||||||
'neighbour_name': neighbour.name,
|
'neighbour_name': neighbour.name,
|
||||||
|
@ -166,11 +168,11 @@ class GeometryHelper:
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add my info to my neighbour shared lines
|
# Add my info to my neighbour shared lines
|
||||||
if neighbour.name in lines_information.keys() and building_key in lines_information[neighbour.name]:
|
if neighbour.name in lines_information and building_key in lines_information[neighbour.name]:
|
||||||
shared_points = int(lines_information[neighbour.name][building_key]['shared_points'])
|
shared_points = int(lines_information[neighbour.name][building_key]['shared_points'])
|
||||||
lines_information[neighbour.name][building_key]['shared_points'] = shared_points + 1
|
lines_information[neighbour.name][building_key]['shared_points'] = shared_points + 1
|
||||||
else:
|
else:
|
||||||
if neighbour.name not in lines_information.keys():
|
if neighbour.name not in lines_information:
|
||||||
lines_information[neighbour.name] = {}
|
lines_information[neighbour.name] = {}
|
||||||
lines_information[neighbour.name][building_key] = {
|
lines_information[neighbour.name][building_key] = {
|
||||||
'neighbour_name': building.name,
|
'neighbour_name': building.name,
|
||||||
|
@ -262,8 +264,8 @@ class GeometryHelper:
|
||||||
# once triangulate_polygon in Polygon class is solved
|
# once triangulate_polygon in Polygon class is solved
|
||||||
|
|
||||||
normal_plane_opp = [None] * len(normal_plane)
|
normal_plane_opp = [None] * len(normal_plane)
|
||||||
for i in range(0, len(normal_plane)):
|
for index, normal in enumerate(normal_plane):
|
||||||
normal_plane_opp[i] = - normal_plane[i]
|
normal_plane_opp[index] = - normal
|
||||||
|
|
||||||
section_1 = intersections.slice_mesh_plane(trimesh, normal_plane, point_plane)
|
section_1 = intersections.slice_mesh_plane(trimesh, normal_plane, point_plane)
|
||||||
if section_1 is None:
|
if section_1 is None:
|
||||||
|
@ -293,8 +295,8 @@ class GeometryHelper:
|
||||||
distance = math.inf
|
distance = math.inf
|
||||||
country = 'Unknown'
|
country = 'Unknown'
|
||||||
city = 'Unknown'
|
city = 'Unknown'
|
||||||
with open(_data_path, 'r', encoding='utf-8') as f:
|
with open(_data_path, 'r', encoding='utf-8') as file:
|
||||||
for line_number, line in enumerate(f):
|
for _, line in enumerate(file):
|
||||||
fields = line.split('\t')
|
fields = line.split('\t')
|
||||||
file_city_name = fields[2]
|
file_city_name = fields[2]
|
||||||
file_latitude = float(fields[4])
|
file_latitude = float(fields[4])
|
||||||
|
@ -316,7 +318,7 @@ class GeometryHelper:
|
||||||
:return: float
|
:return: float
|
||||||
"""
|
"""
|
||||||
power = 0
|
power = 0
|
||||||
for dimension in range(0, len(vertex1)):
|
for dimension, current_vertex in enumerate(vertex1):
|
||||||
power += math.pow(vertex2[dimension] - vertex1[dimension], 2)
|
power += math.pow(vertex2[dimension] - current_vertex, 2)
|
||||||
distance = math.sqrt(power)
|
distance = math.sqrt(power)
|
||||||
return distance
|
return distance
|
||||||
|
|
|
@ -1,19 +1,25 @@
|
||||||
"""
|
"""
|
||||||
Monthly values
|
Monthly values module
|
||||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||||
Copyright © 2020 Project Author Pilar Monsalvete pilar_monsalvete@yahoo.es
|
Copyright © 2020 Project Author Pilar Monsalvete pilar_monsalvete@yahoo.es
|
||||||
"""
|
"""
|
||||||
|
import calendar as cal
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import calendar as cal
|
|
||||||
|
|
||||||
|
|
||||||
class MonthlyValues:
|
class MonthlyValues:
|
||||||
|
"""
|
||||||
|
Monthly values class
|
||||||
|
"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._month_hour = None
|
self._month_hour = None
|
||||||
|
|
||||||
def get_mean_values(self, values):
|
def get_mean_values(self, values):
|
||||||
|
"""
|
||||||
|
Calculates the mean values for each month
|
||||||
|
:return: DataFrame(float)
|
||||||
|
"""
|
||||||
out = None
|
out = None
|
||||||
if values is not None:
|
if values is not None:
|
||||||
if 'month' not in values.columns:
|
if 'month' not in values.columns:
|
||||||
|
@ -23,6 +29,10 @@ class MonthlyValues:
|
||||||
return out
|
return out
|
||||||
|
|
||||||
def get_total_month(self, values):
|
def get_total_month(self, values):
|
||||||
|
"""
|
||||||
|
Calculates the total value for each month
|
||||||
|
:return: DataFrame(int)
|
||||||
|
"""
|
||||||
out = None
|
out = None
|
||||||
if values is not None:
|
if values is not None:
|
||||||
if 'month' not in values.columns:
|
if 'month' not in values.columns:
|
||||||
|
|
|
@ -48,6 +48,10 @@ class PeakLoads:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def peak_loads_from_hourly(hourly_values):
|
def peak_loads_from_hourly(hourly_values):
|
||||||
|
"""
|
||||||
|
Get peak loads from hourly
|
||||||
|
:return: [int]
|
||||||
|
"""
|
||||||
month = 1
|
month = 1
|
||||||
peaks = [0 for _ in range(12)]
|
peaks = [0 for _ in range(12)]
|
||||||
for i, value in enumerate(hourly_values):
|
for i, value in enumerate(hourly_values):
|
||||||
|
@ -59,6 +63,10 @@ class PeakLoads:
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def heating_peak_loads_from_methodology(self):
|
def heating_peak_loads_from_methodology(self):
|
||||||
|
"""
|
||||||
|
Get heating peak loads by calculate
|
||||||
|
:return: [int]
|
||||||
|
"""
|
||||||
if not self._can_be_calculated():
|
if not self._can_be_calculated():
|
||||||
return None
|
return None
|
||||||
monthly_heating_loads = []
|
monthly_heating_loads = []
|
||||||
|
@ -79,13 +87,16 @@ class PeakLoads:
|
||||||
heating_load_ventilation_sensible = loads.get_heating_ventilation_load_sensible(heating_ambient_temperature)
|
heating_load_ventilation_sensible = loads.get_heating_ventilation_load_sensible(heating_ambient_temperature)
|
||||||
heating_load_ventilation_latent = 0
|
heating_load_ventilation_latent = 0
|
||||||
heating_load = heating_load_transmitted + heating_load_ventilation_sensible + heating_load_ventilation_latent
|
heating_load = heating_load_transmitted + heating_load_ventilation_sensible + heating_load_ventilation_latent
|
||||||
if heating_load < 0:
|
heating_load = max(heating_load, 0)
|
||||||
heating_load = 0
|
|
||||||
monthly_heating_loads.append(heating_load)
|
monthly_heating_loads.append(heating_load)
|
||||||
return monthly_heating_loads
|
return monthly_heating_loads
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def cooling_peak_loads_from_methodology(self):
|
def cooling_peak_loads_from_methodology(self):
|
||||||
|
"""
|
||||||
|
Get cooling peak loads by calculate
|
||||||
|
:return: [int]
|
||||||
|
"""
|
||||||
if not self._can_be_calculated():
|
if not self._can_be_calculated():
|
||||||
return None
|
return None
|
||||||
monthly_cooling_loads = []
|
monthly_cooling_loads = []
|
||||||
|
@ -113,7 +124,6 @@ class PeakLoads:
|
||||||
|
|
||||||
cooling_load_latent = 0
|
cooling_load_latent = 0
|
||||||
cooling_load = cooling_load_sensible + cooling_load_latent
|
cooling_load = cooling_load_sensible + cooling_load_latent
|
||||||
if cooling_load > 0:
|
cooling_load = min(cooling_load, 0)
|
||||||
cooling_load = 0
|
|
||||||
monthly_cooling_loads.append(abs(cooling_load))
|
monthly_cooling_loads.append(abs(cooling_load))
|
||||||
return monthly_cooling_loads
|
return monthly_cooling_loads
|
||||||
|
|
|
@ -15,8 +15,11 @@ def validate_import_export_type(cls_name: type, handler: str):
|
||||||
:param handler: import export handler
|
:param handler: import export handler
|
||||||
:return: None
|
:return: None
|
||||||
"""
|
"""
|
||||||
functions = [function[1:] for function in dir(cls_name) if (type(getattr(cls_name, function)) is property or callable(getattr(cls_name, function))) and function in cls_name.__dict__ and function[0] == '_' and function != '__init__']
|
functions = [
|
||||||
|
function[1:] for function in dir(cls_name)
|
||||||
|
if type(getattr(cls_name, function)) in (property, callable(getattr(cls_name, function))) and function in cls_name.__dict__ and function[0] == '_' and function != '__init__'
|
||||||
|
]
|
||||||
if handler.lower() not in functions:
|
if handler.lower() not in functions:
|
||||||
error_message = f'Wrong import type [{handler}]. Valid functions include {functions}'
|
error_message = f'Wrong import type [{handler}]. Valid functions include {functions}'
|
||||||
logging.error(error_message)
|
logging.error(error_message)
|
||||||
raise Exception(error_message)
|
raise ValueError(error_message)
|
||||||
|
|
|
@ -25,4 +25,3 @@ triangle
|
||||||
psycopg2-binary
|
psycopg2-binary
|
||||||
Pillow
|
Pillow
|
||||||
pathlib
|
pathlib
|
||||||
pickle5
|
|
Loading…
Reference in New Issue
Block a user