ladybug.psychchart module

Object for calculating PMV comfort from DataCollections.

class ladybug.psychchart.PsychrometricChart(temperature, relative_humidity, average_pressure=101325, legend_parameters=None, base_point=Point2D(0.00, 0.00), x_dim=1, y_dim=1500, min_temperature=-20, max_temperature=50, max_humidity_ratio=0.03, use_ip=False)[source]

Bases: object

Class for constructing psychrometric charts and plotting data on them.

Parameters:
  • temperature – Hourly, daily, or sub-hourly data collection of temperature values in Celsius or a single temperature value to be used for the whole analysis.

  • relative_humidity – Hourly, daily, or sub-hourly data collection of relative humidity values in % or a single relative humidity value to be used for the whole analysis.

  • average_pressure – Number for the average air pressure across the data plotted on the chart (Pa). (Default: 101325 Pa; pressure at sea level).

  • legend_parameters – An optional LegendParameter object to change the display of the PsychrometricChart. (Default: None).

  • base_point – A Point2D to be used as a starting point to generate the geometry of the plot. (Default: (0, 0)).

  • x_dim – A number to set the X dimension of each degree of temperature on the chart. (Default: 1).

  • y_dim – A number to set the Y dimension of a unity humidity ratio on the chart. Note that most maximum humidity ratios are around 0.03. (Default: 1500).

  • min_temperature – An integer for the minimum temperature on the chart in degrees. This should be celsius if use_ip is False and fahrenheit if use_ip is True. (Default: -20; suitable for celsius).

  • max_temperature – An integer for the maximum temperature on the chart in degrees. This should be celsius if use_ip is False and fahrenheit if use_ip is True. (Default: 50; suitable for celsius).

  • max_humidity_ratio – A value for the maximum humidity ratio in kg water / kg air. (Default: 0.03).

  • use_ip – Boolean to note whether temperature values should be plotted in Fahrenheit instead of Celsius. (Default: False).

Properties:
  • temperature

  • relative_humidity

  • average_pressure

  • legend_parameters

  • base_point

  • x_dim

  • y_dim

  • min_temperature

  • max_temperature

  • max_humidity_ratio

  • use_ip

  • saturation_line

  • chart_border

  • temperature_labels

  • temperature_label_points

  • temperature_lines

  • rh_labels

  • rh_label_points

  • rh_lines

  • hr_labels

  • hr_label_points

  • hr_lines

  • enthalpy_labels

  • enthalpy_label_points

  • enthalpy_lines

  • wb_labels

  • wb_label_points

  • wb_lines

  • title_text

  • title_location

  • x_axis_text

  • x_axis_location

  • y_axis_text

  • y_axis_location

  • data_points

  • time_matrix

  • hour_values

  • colored_mesh

  • legend

  • container

ToString()[source]

Overwrite .NET ToString.

data_mesh(data_collection, legend_parameters=None)[source]

Get a colored mesh for a data_collection aligned with the chart’s data.

Parameters:
  • data_collection – A data collection that is aligned with the temperature and humidity values of the chart.

  • legend_parameters – Optional legend parameters to customize the legend and look of the resulting mesh.

Returns:

A tuple with two values.

  • mesh: A colored Mesh2D similar to the chart’s colored_mesh property but where each face is colored with the average value of the input data_collection.

  • container: A GraphicContainer object for the mesh, which possesses a legend that corresponds to the mesh.

classmethod from_dict(data)[source]

Create PsychrometricChart from a dictionary

Parameters:

data – A python dictionary in the following format

{
'type': 'PsychrometricChart',
'temperature': {},  # data collection or value for temperature [C]
'relative_humidity': {},  # data collection or value for humidity [%]
'average_pressure': 101325,  # average atmospheric pressure [Pa]
'legend_parameters': {},  # legend parameters dictionary
'base_point': {},  # Point2D dictionary
'x_dim': 1.0,  # value for X dimension per degree
'y_dim': 1500.0,  # value for Y dimension for unity humidity ratio
'min_temperature': -20.0,  # value for minimum temperature
'max_temperature': 50.0,  # value for maximum temperature
'max_humidity_ratio': 0.03,  # value for maximum humidity ratio
'use_ip': False,  # boolean for whether to use IP values
}
classmethod from_epw(epw_file, legend_parameters=None, base_point=Point2D(0.00, 0.00), x_dim=1, y_dim=1500, min_temperature=-20, max_temperature=50, max_humidity_ratio=0.03, use_ip=False)[source]

Create a psychrometric chart object using the data in an epw file.

Parameters:
  • epw_file – Full path to epw weather file.

  • legend_parameters – An optional LegendParameter object to change the display of the PsychrometricChart. (Default: None).

  • base_point – A Point2D to be used as a starting point to generate the geometry of the plot. (Default: (0, 0)).

  • x_dim – A number to set the X dimension of each degree of temperature on the chart. (Default: 1).

  • y_dim – A number to set the Y dimension of unity humidity ratio on the chart. Note that most maximum humidity ratios are around 0.03. (Default: 1500).

  • min_temperature – An integer for the minimum temperature on the chart in degrees. This should be celsius if use_ip is False and fahrenheit if use_ip is True. (Default: -20; suitable for celsius).

  • max_temperature – An integer for the maximum temperature on the chart in degrees. This should be celsius if use_ip is False and fahrenheit if use_ip is True. (Default: 50; suitable for celsius).

  • max_humidity_ratio – A value for the maximum humidity ratio in kg water / kg air. (Default: 0.03).

  • use_ip – Boolean to note whether temperature values should be plotted in Fahrenheit instead of Celsius. (Default: False).

hr_y_value(humidity_ratio)[source]

Get the Y-coordinate associated with a certain HR on the chart.

Parameters:

humidity_ratio – A humidity ratio value in kg water / kg air.

plot_point(temperature, relative_humidity)[source]

Get a Point2D for a given temperature and relative humidity on the chart.

Parameters:
  • temperature – A temperature value, which should be in Celsius if use_ip is False and Fahrenheit is use_ip is True.

  • relative_humidity – A relative humidity value in % (from 0 to 100).

relative_humidity_polyline(rh, subdivisions=1)[source]

Get a Polyline2D for a given relative humidity value.

Parameters:
  • rh – A number between 0 and 100 for the relative humidity line to draw.

  • subdivisions – Integer for the number of subdivisions for every 5 degrees. (Default: 1).

t_x_value(temperature)[source]

Get the X-coordinate associated with a certain temperature on the chart.

Parameters:

temperature – A temperature value, which should be in Celsius if use_ip is False and Fahrenheit is use_ip is True.

to_dict()[source]

Get psychrometric chart as a dictionary.

ACCEPTABLE_COLLECTIONS = (<class 'ladybug.datacollection.DailyCollection'>, <class 'ladybug.datacollection.HourlyContinuousCollection'>, <class 'ladybug.datacollection.HourlyDiscontinuousCollection'>)
ENTH_TYPE = Enthalpy
TEMP_TYPE = Temperature
property average_pressure

the average air pressure across the data plotted on the chart (Pa).

property base_point

Point3D for the base point of this psychrometric chart.

property chart_border

Get a Polyline2D for the border of the chart (excluding saturation line).

property colored_mesh

Get a colored mesh for the number of hours for each part of the chart.

property container

Get the GraphicContainer for the colored mesh.

property data_points

Get a tuple of Point2Ds for each of the temperature and humidity values.

property enthalpy_label_points

Get a tuple of Point2Ds for the humidity ratio labels on the chart.

property enthalpy_labels

Get a tuple of text for the enthalpy labels on the chart.

property enthalpy_lines

Get a tuple of LineSegment2Ds for the humidity ratio labels on the chart.

property hour_values

Get a tuple for the number of hours associated with each colored_mesh face.

property hr_label_points

Get a tuple of Point2Ds for the humidity ratio labels on the chart.

property hr_labels

Get a tuple of text for the humidity ratio labels on the chart.

property hr_lines

Get a tuple of LineSegment2Ds for the humidity ratio labels on the chart.

property legend

The legend assigned to this graphic.

property legend_parameters

The legend parameters customizing this psychrometric chart.

property max_humidity_ratio

A value for the maximum humidity ratio in kg water / kg air.

property max_temperature

An integer for the maximum temperature on the chart.

Will be in celsius if use_ip is False and fahrenheit if use_ip is True.

property min_temperature

An integer for the minimum temperature on the chart.

Will be in celsius if use_ip is False and fahrenheit if use_ip is True.

property relative_humidity

The relative humidity assigned to this psychrometric chart.

property rh_label_points

Get a tuple of Point2Ds for the relative humidity labels on the chart.

property rh_labels

Get a tuple of text for the relative humidity labels on the chart.

property rh_lines

Get a tuple of Polyline2Ds for the relative humidity labels on the chart.

property saturation_line

Get a Polyline2D for the saturation line of the chart.

property temperature

The temperature assigned to this psychrometric chart [C].

property temperature_label_points

Get a tuple of Point2Ds for the temperature labels on the chart.

property temperature_labels

Get a tuple of text for the temperature labels on the chart.

property temperature_lines

Get a tuple of LineSegment2Ds for the temperature labels on the chart.

property time_matrix

Get a tuple of of tuples where each sub-tuple is a row of the mesh.

Each value in the resulting matrix corresponds to the number of temperature/ humidity points in a given cell of the mesh.

property title_location

Get a Point2D for the title of the chart.

property title_text

Get text for the title of the chart.

property use_ip

Boolean for whether temperature should be in Fahrenheit or Celsius.

property wb_label_points

Get a tuple of Point2Ds for the wet bulb labels on the chart.

property wb_labels

Get a tuple of text for the wet bulb labels on the chart.

property wb_lines

Get a tuple of LineSegment2Ds for the wet bulb temp labels on the chart.

property x_axis_location

Get a Point2D for the X-axis label of the chart.

property x_axis_text

Get text for the X-axis label of the chart.

property x_dim

The X dimension of each degree of temperature on the chart.

property y_axis_location

Get a Point2D for the Y-axis label of the chart.

property y_axis_text

Get text for the Y-axis label of the chart.

property y_dim

The Y dimension of a unity humidity ratio on the chart.