honeybee.typing module

Collection of methods for type input checking.

honeybee.typing.clean_and_id_ep_string(value, input_name='')[source]

Clean a string and add 8 unique characters to it to make it unique for EnergyPlus.

This includes stripping out all illegal characters and removing trailing white spaces. Strings longer than 50 characters will be truncated before adding the ID.

honeybee.typing.clean_and_id_rad_string(value, input_name='')[source]

Clean a string and add 8 unique characters to it to make it unique for Radiance.

This includes stripping out illegal characters and white spaces.

honeybee.typing.clean_and_id_string(value, input_name='')[source]

Clean a string and add 8 unique characters to it to make it unique.

Strings longer than 50 characters will be truncated before adding the ID. The resulting string will be valid for both Radiance and EnergyPlus.

honeybee.typing.clean_and_number_ep_string(value, existing_dict, input_name='')[source]

Clean a string for EnergyPlus and add an integer if found in the existing_dict.

This includes stripping out all illegal characters and removing trailing white spaces. Strings longer than 95 characters will be truncated before adding the integer.

Parameters
  • value – The text string to be cleaned and possibly given a unique integer.

  • existing_dict – A dictionary where the keys are text strings of existing items and the values are the number of times that the item has appeared in the model already.

honeybee.typing.clean_and_number_rad_string(value, existing_dict, input_name='')[source]

Clean a string for Radiance and add an integer if found in the existing_dict.

This includes stripping out illegal characters and white spaces.

Parameters
  • value – The text string to be cleaned and possibly given a unique integer.

  • existing_dict – A dictionary where the keys are text strings of existing items and the values are the number of times that the item has appeared in the model already.

honeybee.typing.clean_and_number_string(value, existing_dict, input_name='')[source]

Clean a string and add an integer to it if it is found in the existing_dict.

The resulting string will be valid for both Radiance and EnergyPlus.

Parameters
  • value – The text string to be cleaned and possibly given a unique integer.

  • existing_dict – A dictionary where the keys are text strings of existing items and the values are the number of times that the item has appeared in the model already.

honeybee.typing.clean_doe2_string(value, max_length=24)[source]

Clean and shorten a string for DOE-2 so that it can be a U-name.

This includes stripping out all illegal characters (including both non-ASCII and DOE-2 specific characters), removing trailing spaces, and passing the result through the readable_short_name function to hit the target max_length. Note that white spaces can be in the result with the assumption that the name will be enclosed in double quotes.

Note that this method does not do any check to ensure the string is unique.

honeybee.typing.clean_ep_string(value, input_name='')[source]

Clean a string for EnergyPlus that can be used for energy material names.

This includes stripping out all illegal characters, removing trailing spaces, and rasing an error if the name is not longer than 100 characters or no legal characters found.

honeybee.typing.clean_rad_string(value, input_name='')[source]

Clean a string for Radiance that can be used for rad material names.

This includes stripping out illegal characters and white spaces as well as raising an error if no legal characters are found.

honeybee.typing.clean_string(value, input_name='')[source]

Clean a string so that it is valid for both Radiance and EnergyPlus.

This will strip out spaces and special characters and raise an error if the string is empty after stripping or has more than 100 characters.

honeybee.typing.fixed_string_length(value, target_len=32)[source]

Truncate a string or add trailing spaces to hit a target character length.

This is useful when trying to construct human-readable tables of text.

honeybee.typing.float_in_range(value, mi=-inf, ma=inf, input_name='')[source]

Check a float value to be between minimum and maximum.

honeybee.typing.float_in_range_excl(value, mi=-inf, ma=inf, input_name='')[source]

Check a float value to be greater than minimum and less than maximum.

honeybee.typing.float_in_range_excl_incl(value, mi=-inf, ma=inf, input_name='')[source]

Check a float value to be greater than minimum and less than/equal to maximum.

honeybee.typing.float_in_range_incl_excl(value, mi=-inf, ma=inf, input_name='')[source]

Check a float value to be greater than/equal to minimum and less than maximum.

honeybee.typing.float_positive(value, input_name='')[source]

Check a float value to be positive.

honeybee.typing.int_in_range(value, mi=-inf, ma=inf, input_name='')[source]

Check an integer value to be between minimum and maximum.

honeybee.typing.int_positive(value, input_name='')[source]

Check if an integer value is positive.

honeybee.typing.invalid_dict_error(invalid_dict, error)[source]

Raise a ValueError for an invalid dictionary that failed to serialize.

This error message will include the identifier (and display_name) if they are present within the invalid_dict, making it easier for ens users to find the invalid object within large objects like Models.

Parameters
  • invalid_dict – A dictionary of an invalid honeybee object that failed to serialize.

  • error

honeybee.typing.list_with_length(value, length=3, item_type=<class 'float'>, input_name='')[source]

Try to create a list with a certain value.

honeybee.typing.normpath(value)[source]

Normalize path eliminating double slashes, etc and put it in quotes if needed.

honeybee.typing.readable_short_name(value, max_length=24)[source]

Convert a string into a shorter but readable version of itself.

This is useful when dealing with interfaces of file formats that have very strict character limits on names or identifiers (like in DOE-2/eQuest).

When ths input is less than or equal to the max length, the string will be left as-is. If not, then the lower-case vowels will be removed from the name, making the result abbreviated but still readable/recognizable. If the result is still not shorter than the max length, then spaces will be removed. Lastly, if all else fails to meet the max length, the middle characters will be, removed leaving the beginning and end as they are, which should typically help preserve the uniqueness of the name.

Note that this method does not do any check for illegal characters and presumes that the input is already composed of legal characters.

honeybee.typing.truncate_and_id_string(value, truncate_len=32, uuid_len=0, input_name='')[source]

Truncate a string to a length with an option to add unique characters at the end.

Note that all outputs will always be the truncate_len or less and the uuid_len just specifies the number of characters to replace at the end with unique ones.

The result will be valid for EnergyPlus, Radiance, and likely many more engines with different types of character restrictions.

honeybee.typing.tuple_with_length(value, length=3, item_type=<class 'float'>, input_name='')[source]

Try to create a tuple with a certain value.

honeybee.typing.valid_ep_string(value, input_name='')[source]

Check that a string is valid for EnergyPlus.

This is used for energy material names, schedule names, etc.

honeybee.typing.valid_rad_string(value, input_name='')[source]

Check that a string is valid for Radiance.

This is used for radiance modifier names, etc.

honeybee.typing.valid_string(value, input_name='')[source]

Check that a string is valid for both Radiance and EnergyPlus.

This is used for honeybee geometry object names.

honeybee.typing.wrapper = "'"

String wrapper.