ladybug.header module

Ladybug Header

class ladybug.header.Header(data_type, unit, analysis_period, metadata=None)[source]

Bases: object

DataCollection header.

Header carries meatdata for DataCollections including data type, unit and analysis period.

Parameters
  • data_type – A DataType object. (e.g. Temperature)

  • unit – data_type unit (e.g. ‘C’).

  • analysis_period – A Ladybug AnalysisPeriod object.

  • metadata – Optional dictionary of additional metadata, containing information such as ‘source’, ‘city’, or ‘zone’.

Properties:
  • data_type

  • unit

  • analysis_period

  • metadata

ToString()[source]

Overwrite .NET ToString.

duplicate()[source]

Return a copy of the header.

classmethod from_csv_strings(csv_strings, analysis_period)[source]

Load a header from a list of CSV strings.

Parameters
  • csv_strings – A list of CSV strings representing the header.

  • analysis_period – An AnalysisPeriod object for the header.

classmethod from_dict(data)[source]

Create a header from a dictionary.

Parameters

data – A python dictionary in the following format

{
    "data_type": {},  # Type of data (e.g. Temperature)
    "unit": "",  # string
    "analysis_period": {},  # A Ladybug AnalysisPeriod
    "metadata": {}  # A dictionary of metadata
}
to_csv_strings(metadata_per_row=False)[source]

Return the header as a list of CSV strings.

Parameters

metadata_per_row – Boolean to note whether each metadata variable should be a separate item in the resulting list or all items should be on a single line. (Default: False).

to_dict()[source]

Return a header as a dictionary.

to_tuple()[source]

Return Ladybug header as a list.

property analysis_period

Get an AnalysisPeriod object.

property data_type

Get a DataType object.

property metadata

Get or set a dictionary of metadata associated with the Header.

property unit

Get a text string representing an abbreviated unit (eg. ‘C’).