honeybee_radiance.reader module

A collection of auxiliary functions for working with radiance files and objects.

honeybee_radiance.reader.parse_from_file(file_path)[source]

Parse a Radiance file.

This function breaks down the file into a list of radiance objects as separate strings.

Parameters:

file_path – Path to Radiance file

Returns:

A list of strings. Each string represents a different Radiance object.

Usage:

rad_obj_strs = parse_from_file('some_file.rad')
honeybee_radiance.reader.parse_from_string(full_string)[source]

Separate a Radiance file string into multiple strings for each object.

Parameters:

full_string – Radiance data as a single string. The string can be multiline.

Returns:

A list of strings. Each string represents a different Radiance primitive (geometry or modifier). Comments [#] and commands [!] are excluded.

honeybee_radiance.reader.parse_header(filepath)[source]

Return radiance file header if exist.

This method returns all the lines between #?RADIANCE and FORMAT=* and number of header lines including the white line after last header line.

Parameters:

filepath – Full path to Radiance file.

Returns:

line_count, header as a single multiline string

honeybee_radiance.reader.sensor_count_from_file(filepath)[source]

Return sensor count of a sensor grid file.

This function returns the sensor count of a sensor grid file. Comments [#] and empty lines will not be counted.

Parameters:

filepath – Full path to Radiance pts file.

Returns:

sensor_count

honeybee_radiance.reader.string_to_dict(string)[source]

Get a single Radiance string object as a primitive dictionary.

honeybee_radiance.reader.string_to_dicts(string)[source]

Convert a radiance string to a list of primitive dictionaries.

These primitive dictionaries can be seralized to honeybee-radiance Python objects using the from_primitive_dict methods on all primitive classes.

If the primitive modifier is not void or the primitive has other dependencies, the dependency must also be part of the input string and this method will ensure that the dependent output dictionaries are correctly nested so that they can be correctly serialized.

Returns:

A list of dictionaries.