hub/catalogs/data_model/greenery/vegetation.py

152 lines
3.8 KiB
Python
Raw Normal View History

"""
Greenery catalog data model Vegetation class
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
"""
from catalogs.data_model.greenery.plant_percentage import PlantPercentage
class Vegetation:
def __init__(self, category, vegetation, plant_percentages):
self._name = vegetation.name
self._category = category
self._soil_thickness = vegetation.thicknessOfSoil
self._management = vegetation.management
self._air_gap = vegetation.airGap
self._soil_name = vegetation.soil.name
self._soil_roughness = vegetation.soil.roughness
self._dry_soil_conductivity = vegetation.soil.conductivityOfDrySoil
self._dry_soil_density = vegetation.soil.densityOfDrySoil
self._dry_soil_specific_heat = vegetation.soil.specificHeatOfDrySoil
self._soil_thermal_absorptance = vegetation.soil.thermalAbsorptance
self._soil_solar_absorptance = vegetation.soil.solarAbsorptance
self._soil_visible_absorptance = vegetation.soil.visibleAbsorptance
self._soil_saturation_volumetric_moisture_content = vegetation.soil.saturationVolumetricMoistureContent
self._soil_residual_volumetric_moisture_content = vegetation.soil.residualVolumetricMoistureContent
self._soil_initial_volumetric_moisture_content = vegetation.soil.initialVolumetricMoistureContent
self._plant_percentages = plant_percentages
@property
def name(self):
"""
Get vegetation name
"""
return self._name
@property
def category(self):
"""
Get vegetation category
"""
return self._category
@property
def soil_thickness(self):
"""
Get soil thickness
"""
return self._soil_thickness
@property
def management(self):
"""
Get management
"""
return self._management
@property
def air_gap(self):
"""
Get air gap
"""
return self._air_gap
@property
def plant_percentages(self) -> [PlantPercentage]:
"""
Get plant percentages
"""
percentage = 0.0
for plant_percentage in self._plant_percentages:
percentage += float(plant_percentage.percentage)
if percentage > 100:
raise ValueError('the plant percentage in this vegetation is over 100%')
return self._plant_percentages
@property
def soil_name(self):
"""
Get soil name
"""
return self._soil_name
@property
def soil_roughness(self):
"""
Get soil roughness
"""
return self._soil_roughness
@property
def dry_soil_conductivity(self):
"""
Get soil dry conductivity
"""
return self._dry_soil_conductivity
@property
def dry_soil_density(self):
"""
Get soil dry density
"""
return self._dry_soil_density
@property
def dry_soil_specific_heat(self):
"""
Get soil dry specific heat
"""
return self._dry_soil_specific_heat
@property
def soil_thermal_absorptance(self):
"""
Get soil thermal absortance
"""
return self._soil_thermal_absorptance
@property
def soil_solar_absorptance(self):
"""
Get soil solar absortance
"""
return self._soil_solar_absorptance
@property
def soil_visible_absorptance(self):
"""
Get soil visible absortance
"""
return self._soil_visible_absorptance
@property
def soil_saturation_volumetric_moisture_content(self):
"""
Get soil saturation volumetric moisture content
"""
return self._soil_saturation_volumetric_moisture_content
@property
def soil_residual_volumetric_moisture_content(self):
"""
Get soil residual volumetric moisture content
"""
return self._soil_residual_volumetric_moisture_content
@property
def soil_initial_volumetric_moisture_content(self):
"""
Get soil initial volumetric moisture content
"""
return self._soil_initial_volumetric_moisture_content