-
Notifications
You must be signed in to change notification settings - Fork 224
Description
Description
There is a misspelling in the Python (and potentially Ruby) bindings for the RoofVegetation (EcoRoof) model. The setter method for the initial moisture content is missing a "t" in the middle of "Content", resulting in the name setInitialVolumetricMoistureConent. This inconsistency leads to AttributeErrors
Current Behavior
The RoofVegetation object only accepts the misspelled method setInitialVolumetricMoistureConent. Calling the correctly spelled method setInitialVolumetricMoistureContent (with a "t") results in an AttributeError
Expected Behavior
The method should be named setInitialVolumetricMoistureContent to maintain consistency with standard English spelling and the OpenStudio SDK naming conventions used in other classes.
Steps to reproduce
- Initialize an OpenStudio Model in Python.
- Create a RoofVegetation object.
- Attempt to set the initial moisture content using the correct spelling.
Function_list = ['setCADObjectId', 'setComment', 'setConductivityofDrySoil', 'setDensity', 'setDensityofDrySoil', 'setDisplayName', 'setDouble', 'setFieldComment', 'setGBXMLId', 'setHeightofPlants',
'setInitialVolumetricMoistureConent',
'setInitialVolumetricMoistureContentoftheSoilLayer', 'setInt', 'setLeafAreaIndex', 'setLeafEmissivity', 'setLeafReflectivity', 'setMinimumStomatalResistance', 'setMoistureDiffusionCalculationMethod', 'setName', 'setParent', 'setPointer', 'setQuantity', 'setResidualVolumetricMoistureContent', 'setResidualVolumetricMoistureContentoftheSoilLayer', 'setRoughness', 'setSaturationVolumetricMoistureContent', 'setSaturationVolumetricMoistureContentoftheSoilLayer', 'setSoilLayerName', 'setSolarAbsorptance', 'setSolarReflectance', 'setSpecificHeat', 'setSpecificHeatofDrySoil', 'setString', 'setThermalAbsorptance', 'setThermalConductance', 'setThermalConductivity', 'setThermalReflectance', 'setThermalResistance', 'setThermalResistivity', 'setThickness', 'setUnsigned', 'setVisibleAbsorptance', 'setVisibleReflectance']
import openstudio
model = openstudio.model.Model()
veg = openstudio.model.RoofVegetation(model)
This will fail with AttributeError: 'RoofVegetation' object has no attribute 'setInitialVolumetricMoistureContent'
try:
veg.setInitialVolumetricMoistureContent(0.2)
except AttributeError as e:
print(f"Caught expected error: {e}")
This succeeds due to the typo in the API
veg.setInitialVolumetricMoistureConent(0.2)
print("Successfully called misspelled method 'setInitialVolumetricMoistureConent'")
Possible Solution
No response
Operating System affected
Windows 11
Environment
openstudio.openStudioVersion() = 3.10.0
sys.version = 3.11.9 (tags/v3.11.9:de54cf5, Apr 2 2024, 10:12:12) [MSC v.1938 64 bit (AMD64)]
Architecture: x64
Version of OpenStudio
3.10.0
Context
No response