ladybug package

Submodules

ladybug.analysisperiod module

Ladybug analysis period class.

class ladybug.analysisperiod.AnalysisPeriod(st_month=1, st_day=1, st_hour=0, end_month=12, end_day=31, end_hour=23, timestep=1, is_leap_year=False)[source]

Bases: object

Ladybug Analysis Period.

A continuous analysis period between two days of the year between certain hours.

st_month

An integer between 1-12 for starting month (default = 1)

st_day

An integer between 1-31 for starting day (default = 1). Note that some months are shorter than 31 days.

st_hour

An integer between 0-23 for starting hour (default = 0)

end_month

An integer between 1-12 for ending month (default = 12)

end_day

An integer between 1-31 for ending day (default = 31) Note that some months are shorter than 31 days.

end_hour

An integer between 0-23 for ending hour (default = 23)

timestep

An integer number from 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30, 60

Class methods:
from_string: Create an Analysis Period object from an analysis period string.
%s/%s to %s/%s between %s to %s @%s
Properties:

isAnalysisPeriod: Always return True. Useful for type checking. datetimes: Sorted list of datetimes in this analysis period. hoys: A sorted list of hours of year in this analysis period. int_hoys: A sorted list of hours of year values in this analysis period as

integers.

is_annual: Check if an analysis period is annual. is_overnight: If an analysis perido is not overnight each segments of hours

will be in the same day (self.st_time.hoy < self.end_time.hoy)
is_reversed: A reversed analysis period defines a period that starting month
is after ending month (e.g DEC to JUN)
NUMOFDAYSEACHMONTH = (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
NUMOFDAYSEACHMONTHLEAP = (31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
ToString()[source]

Overwrite .NET representation.

VALIDTIMESTEPS = {1: 60, 2: 30, 3: 20, 4: 15, 5: 12, 6: 10, 10: 6, 12: 5, 15: 4, 20: 3, 30: 2, 60: 1}
datetimes

A sorted list of datetimes in this analysis period.

end_day

Start day.

end_hour

Start hour.

end_month

Start month.

classmethod from_analysis_period(analysis_period=None)[source]

Create and AnalysisPeriod from an analysis period.

This method is useful to be called from inside Grasshopper or Dynamo

classmethod from_json(data)[source]

Create an analysis period from a dictionary. :param data: { :param st_month: An integer between 1-12 for starting month (default = 1) :param st_day: An integer between 1-31 for starting day (default = 1).

Note that some months are shorter than 31 days.
Parameters:
  • st_hour – An integer between 0-23 for starting hour (default = 0)
  • end_month – An integer between 1-12 for ending month (default = 12)
  • end_day – An integer between 1-31 for ending day (default = 31) Note that some months are shorter than 31 days.
  • end_hour – An integer between 0-23 for ending hour (default = 23)
  • timestep – An integer number from 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30, 60
  • }
classmethod from_string(analysis_period_string)[source]

Create an Analysis Period object from an analysis period string.

%s/%s to %s/%s between %s to %s @%s

hoys

A sorted list of hours of year in this analysis period.

hoys_int

A sorted list of hours of year values in this analysis period as integers.

isAnalysisPeriod

Return True.

is_annual

Check if an analysis period is annual.

is_leap_year

A boolean to indicate if analysis period is for a leap year.

is_overnight

Return True if the analysis period is overnight.

If an analysis perido is overnight each segments of hours will be in two different days (e.g. from 9pm to 2am).

is_possible_hour(hour)[source]

Check if a float hour is a possible hour for this analysis period.

is_reversed

Return True if the analysis period is reversed.

A reversed analysis period defines a period that starting month is after ending month (e.g DEC to JUN).

is_time_included(time)[source]

Check if time is included in analysis period.

Return True if time is inside this analysis period, otherwise return False

Parameters:time – A DateTime to be tested
Returns:A boolean. True if time is included in analysis period
st_day

Start day.

st_hour

Start hour.

st_month

Start month.

to_json()[source]

Convert the analysis period to a dictionary.

ladybug.color module

Ladybug color, colorsets and colorrange.

class ladybug.color.Color(r, g, b)[source]

Bases: object

Ladybug RGB color.

r

red value 0-255, default: 0

g

green value 0-255, default: 0

b

blue red value 0-255, default: 0

ToString()[source]

Overwrite .NET ToString.

b

Return B value.

g

Return G value.

r

Return R value.

class ladybug.color.ColorRange(colors=None, domain=None, chart_type=0)[source]

Bases: object

Ladybug Color-range repository.

A list of default Ladybug colorRanges

Parameters:
  • range
  • colors – A list of colors. Colors should be input as R, G, B values. Default: Colorset[1]
  • domain – A list of numbers or strings. For numerical values it should be sorted from min to max. Default: [‘min’, ‘max’]
  • chart_type – 0: continuous, 1: segmented, 2: ordinal. Default: 0 In segmented and ordinal mode number of values should match number of colors Ordinal values can be strings and well as numericals
Usage:

## colorRange = ColorRange(chart_type = 1) colorRange.domain = [100, 2000] colorRange.colors = [Color(75, 107, 169), Color(245, 239, 103),

Color(234, 38, 0)]

print(colorRange.color(99)) print(colorRange.color(100)) print(colorRange.color(2000)) print(colorRange.color(2001)) >> <R:75, G:107, B:169> >> <R:245, G:239, B:103> >> <R:245, G:239, B:103> >> <R:234, G:38, B:0>

## colorRange = ColorRange(chart_type = 1) colorRange.domain = [100, 2000] colorRange.colors = [Color(75, 107, 169), Color(245, 239, 103),

Color(234, 38, 0)]

colorRange.color(300) >> <R:245, G:239, B:103>

## colorRange = ColorRange(chart_type = 2) colorRange.domain = [“cold”, “comfortable”, “hot”] colorRange.colors = [Color(75, 107, 169), Color(245, 239, 103),

Color(234, 38, 0)]

colorRange.color(“comfortable”) >> <R:245, G:239, B:103>

color(value)[source]

Return color for an input value.

colors

Return list of colors.

ctype

Chart type.

domain

Return domain.

is_domain_set

Return if Domain is set for this color-range.

class ladybug.color.Colorset[source]

Bases: object

Ladybug Color-range repository.

A list of default Ladybug colorsets for color range:
0 - original Ladybug 1 - nuanced Ladybug 2 - Multi-colored Ladybug 3 - View Analysis 1 4 - View Analysis 2 (Red,Green,Blue) 5 - Sunlight Hours 6 - ecotect 7 - thermal Comfort Percentage 8 - thermal Comfort Colors 9 - thermal Comfort Colors (UTCI) 10 - Hot Hours 11 - Cold Hours 12 - Shade Benefit/Harm 13 - thermal Comfort Colors v2 (UTCI) 14 - Shade Harm 15 - Shade Benefit 16 - Black to White 17 - CFD Colors 1 18 - CFD Colors 2 19 - Energy Balance 20 - THERM 21 - Cloud Cover

Usage:

# initiare colorsets cs = Colorset() print(cs[0]) >> [<R:75, G:107, B:169>, <R:115, G:147, B:202>, <R:170, G:200, B:247>,

<R:193, G:213, B:208>, <R:245, G:239, B:103>, <R:252, G:230, B:74>, <R:239, G:156, B:21>, <R:234, G:123, B:0>, <R:234, G:74, B:0>, <R:234, G:38, B:0>]
classmethod black_to_white()[source]

Black to white colors.

classmethod cfd_colors_1()[source]

CFD colors 1.

classmethod cfd_colors_2()[source]

CFD colors 2.

classmethod cloud_cover()[source]

Cloud Cover colors.

classmethod cold_hours()[source]

Cold Hours.

classmethod ecotect()[source]

ecotect colors.

classmethod energy_balance()[source]

Energy Balance colors.

classmethod hot_hours()[source]

Hot Hours.

classmethod multi_colored()[source]

Multi-colored legend.

classmethod nuanced()[source]

nuanced Ladybug colors.

classmethod original()[source]

original Ladybug colors.

classmethod shade_benefit()[source]

Shade Benefit colors.

classmethod shade_benefit_harm()[source]

Shade Benefit Harm colors.

classmethod shade_harm()[source]

Shade Harm colors.

classmethod sunlight_hours()[source]

sunlight_hours colors.

classmethod therm()[source]

THERM colors.

classmethod thermal_comfort()[source]

thermal Comfort colors.

classmethod thermal_comfort_percentage()[source]

thermal Comfort percentage.

classmethod thermal_comfort_utci_1()[source]

thermal Comfort UTCI 1.

classmethod thermal_comfort_utci_2()[source]

thermal Comfort UTCI 2.

classmethod view_analysis1()[source]

View analysis colors.

classmethod view_analysis2()[source]

View Analysis 2 colors.

ladybug.datacollection module

Ladybug data collection.

class ladybug.datacollection.DataCollection(data=None, header=None)[source]

Bases: object

A list of data with a header.

ToString()[source]

Overwrite .NET ToString method.

append(d)[source]

Append a single item to the list.

static average(data)[source]

Return average value for a list of ladybug data.

average_data()[source]

Return average value for data collection.

average_data_monthly(data)[source]

Return a dictionary of values for average values for available months.

average_data_monthly_for_each_hour(data)[source]

Calculate average value for each hour during each month.

This method returns a dictionary with nested dictionaries for each hour

average_monthly()[source]

Return a dictionary of values for average values for available months.

average_monthly_for_each_hour()[source]

Calculate average value for each hour during each month.

This method returns a dictionary with nested dictionaries for each hour

datetimes

Return datetimes for this collection as a tuple.

duplicate()[source]

Duplicate current data list.

extend(new_data)[source]

Extend a number of items to the end of items.

filter_by_analysis_period(analysis_period=None)[source]

Filter a list based on an analysis period.

Parameters:period (analysis) – A Ladybug analysis period
Returns:A new _dataList with filtered data

Usage:

# start of Feb to end of Mar analysis_period = Analysis_period(2,1,1,3,31,24) epw = EPW(“c:/ladybug/weatherdata.epw”) DBT = epw.dry_bulb_temperature filteredDBT = DBT.filter_by_analysis_period(analysis_period)
filter_by_conditional_statement(statement)[source]

Filter the list based on a conditional statement.

Parameters:statement – A conditional statement as a string (e.g. x>25 and x%5==0). The variable should always be named as x
Returns:A new _dataList with filtered data

Usage:

epw = EPW(“c:/ladybug/weatherdata.epw”) DBT = epw.dry_bulb_temperature # filter data for when dry bulb temperature is more then 25 filtered_DBT = DBT.filter_by_conditional_statement(‘x > 25’) # get the list of time stamps that meet the conditional statement print(filtered_DBT.time_stamps)
filter_by_hoys(hoys)[source]

Filter the list based on an analysis period.

Parameters:hoys – A List of hours of the year 0..8759
Returns:A new _dataList with filtered data

Usage:

hoys = range(1,48) # The first two days of the year epw = EPW(“c:/ladybug/weatherdata.epw”) DBT = epw.dry_bulb_temperature filteredDBT = DBT.filter_by_hoys(hoys)
filter_by_moys(moys)[source]

Filter the list based on a list of minutes of the year.

Parameters:moys – A List of minutes of the year [0..8759 * 60]
Returns:A new _dataList with filtered data

Usage:

moys = range(0, 48 * 60) # The first two days of the year epw = EPW(“c:/ladybug/weatherdata.epw”) DBT = epw.dry_bulb_temperature filteredDBT = DBT.filter_by_moys(moys)
filter_by_pattern(pattern)[source]

Filter the list based on a list of Boolean.

Length of Boolean should be equal to length of values in _dataList

Parameters:pattern – A list of True, False values
Returns:A new _dataList with filtered data
classmethod from_data_and_analysis_period(data, analysis_period, header=None)[source]

Create a list from data and analysis period.

classmethod from_data_and_datetimes(data, datetimes, header=None)[source]

Create a list from data and dateteimes.

classmethod from_json(data)[source]

Create a data collection from a dictionary.

Parameters:
  • { – “data”: [], //An array of Ladybug data points, “header”: {} // A Ladybug header
  • }
classmethod from_list(lst, location=None, data_type=None, unit=None, analysis_period=None)[source]

Create a data collection from a list.

lst items can be DataPoint or other values.

Parameters:
  • lst – A list of data.
  • location – location data as a ladybug Location or location string (Default: unknown).
  • data_type – Type of data (e.g. Temperature) (Default: unknown).
  • unit – data_type unit (Default: unknown).
  • analysis_period – A Ladybug analysis period (Defualt: None)
group_by_day(day_range=xrange(1, 366))[source]

Return a dictionary of values where values are grouped by each day of year.

Key values are between 1-365

Parameters:
  • day_range – A list of numbers for days. Default is 1-365
  • user_dataList – An optional data list of DataPoint to be processed

Usage:

epwfile = EPW(“epw file address”) daily_values = epwfile.dry_bulb_temperature.group_by_day(range(1, 30)) print(daily_values[2]) # returns values for the second day of year
group_by_hour(hour_range=xrange(24))[source]

Return a dictionary of values where values are grouped by each hour of day.

Key values are between 0-23

Parameters:
  • hour_range – A list of numbers for hours. Default is 1-24
  • user_dataList – An optional data list of DataPoint to be processed

Usage:

epwfile = EPW(“epw file address”) monthly_values = epwfile.dry_bulb_temperature.group_by_month([1]) grouped_hourly_data = epwfile.dry_bulb_temperature.group_data_dataBy_hour(

monthly_values[1])
for hour, data in grouped_hourly_data.items():
print(“average temperature values for hour {} during JAN is {} {}”
.format(hour, core._dataList.average(data), DBT.header.unit))
group_by_month(month_range=xrange(1, 13))[source]

Return a dictionary of values where values are grouped for each month.

Key values are between 1-12

Parameters:month_range – A list of numbers for months. Default is 1-12

Usage:

epwfile = EPW(“epw file address”) monthly_values = epwfile.dry_bulb_temperature.group_by_month() print(monthly_values[2]) # returns values for the month of March
static group_data_by_day(data, day_range=xrange(1, 366))[source]

Return a dictionary of values where values are grouped by each day of year.

Key values are between 1-365

Parameters:
  • data – A list of DataPoint to be processed
  • day_range – A list of numbers for days. Default is 1-365
static group_data_by_hour(data, hour_range=xrange(24))[source]

Return a dictionary of values where values are grouped by each hour of day.

Key values are between 0-23

Parameters:
  • data – A list of DataPoint to be processed
  • hour_range – A list of numbers for hours. Default is 1-24
static group_data_by_month(data, month_range=xrange(1, 13))[source]

Return a dictionary of values where values are grouped for each month.

Key values are between 1-12

Parameters:
  • data – A list of DataPoint to be processed
  • month_range – A list of numbers for months. Default is 1-12
header

Get or set header.

insert(i, d)[source]

Insert an item at a given position.

interpolate_data(timestep, cumulative=False)[source]

Interpolate data for a finer timestep using a linear interpolation.

Parameters:
  • timestep – Target timestep as an integer. Target timestep must be divisable by current timestep.
  • cumulative – A boolean that sets whether the interpolation should treat the data colection values as cumulative, in which case the value at each timestep is the value over that timestep (instead of over the hour). The default is set to False to yeild average values in between each of the hours.
pop(i=-1)[source]

Remove the item at the given position in the data collection, and return it.

If no index is specified, a.pop() removes and returns the last item in the list.

to_json()[source]

Convert data collection to a dictionary.

update_data_for_an_hour(value, hour_of_year)[source]

Replace current value in data list with a new value for a specific hoy.

Parameters:
  • value – A single value
  • hours_of_year – The hour of the year
update_data_for_analysis_period(values, analysis_period)[source]

Update values with new set of values for an analysis period.

Length of values should be equal to number of hours in analysis period.

Parameters:
  • values – A list of values to be replaced in the file
  • analysis_period – An analysis period for input the input values. Default is set to the whole year.
update_data_for_hours_of_year(values, hours_of_year)[source]

Update values new set of values for a list of hours of the year.

Length of values should be equal to number of hours in hours of year.

Parameters:
  • values – A list of values to be replaced in the file
  • hours_of_year – A list of hoy between 1 and 8760
values

Return the list of values.

static xxrange(start, end, step_count)[source]

Generate n values between start and end.

ladybug.datatype module

Ladybug data types.

class ladybug.datatype.Angle(value, datetime=None, standard='SI', nickname=None)[source]

Bases: ladybug.datatype.DataPoint

Angle.

value

Input value

datetime

Date time data for this value (Default: None)

standard

‘SI’ or ‘IP’ (Default: ‘SI’)

nickname

Optional nickname for data (e.g. Dew Point Temperature)

maximum = 360
minimum = 0
missing = 999
to_ip

Return the value in IP assuming input value is in SI.

to_si

Return the value in SI assuming input value is in IP.

unitIP = 'radians'
unitSI = 'degrees'
value_type

alias of int

class ladybug.datatype.Clothing(value, datetime=None, standard='SI', nickname=None)[source]

Bases: ladybug.datatype.DataPoint

Clothing Level (clo).

value

Input value

datetime

Date time data for this value (Default: None)

standard

‘SI’ or ‘IP’ (Default: ‘SI’)

nickname

Optional nickname for data (e.g. Dew Point Temperature)

minimum = 0
unitIP = 'clo'
unitSI = 'clo'
value_type

alias of float

class ladybug.datatype.DataPoint(value, datetime=None, standard='SI', nickname=None)[source]

Bases: ladybug.datatype.DataTypeBase

A single Ladybug data point.

value

Input value

datetime

Date time data for this value (Default: None)

standard

‘SI’ or ‘IP’ (Default: ‘SI’)

nickname

Optional nickname for data (e.g. Dew Point Temperature)

classmethod from_data(value)[source]

Try to create a DataPoint from input data.

isDataPoint

Return True if Ladybug data point.

maximum = inf
minimum = -inf
missing = None
unitIP = None
unitSI = None
value_type = None
class ladybug.datatype.DataTypeBase(value, datetime=None, standard=None, nickname=None)[source]

Bases: object

Base type for data.

value

Input value

datetime

Date time data for this value (Default: None)

standard

‘SI’ or ‘IP’ (Default: ‘SI’)

nickname

Optional nickname for data (e.g. Dew Point Temperature)

ToString()[source]

Overwrite .NET representation.

convert_to_ip()[source]

change value to IP.

To only get the value in IP use to_ip property.

convert_to_si()[source]

Change value to SI.

To only get the value in SI use to_si property.

datetime
classmethod from_json(data)[source]

Create a data point from a dictionary.

Parameters:json_data

Data as a dictionary. {

”value”: A number or a string, “standard”: SI/IP, “datetime”: {}, // A ladybug datetime schema “nickname”: A string for nickname

}

is_in_range(value, raise_exception=False)[source]

check if the value is in range.

maximum = inf
minimum = -inf
missing = None
mute = False
nickname
standard

standard SI/IP

to_ip

Write a static method that converts a value from SI to IP.

to_json()[source]

Get data point as a json object

to_si

Write a static method that converts a value from IP to SI.

unit

Return current Unit.

unitIP = None
unitSI = None
value

Get/set value.

value_type = None
class ladybug.datatype.DewPointTemperature(value, datetime=None, standard='SI', nickname=None)[source]

Bases: ladybug.datatype.Temperature

Dew point temperature.

value

Input value

datetime

Date time data for this value (Default: None)

standard

‘SI’ or ‘IP’ (Default: ‘SI’)

nickname

Optional nickname for data (e.g. Dew Point Temperature)

maximum = 70
minimum = -70
class ladybug.datatype.Distance(value, datetime=None, standard='SI', nickname=None, conversion=1)[source]

Bases: ladybug.datatype.DataPoint

Distance.

value

Input value

datetime

Date time data for this value (Default: None)

standard

‘SI’ or ‘IP’ (Default: ‘SI’)

nickname

Optional nickname for data (e.g. Dew Point Temperature)

conversion

Optional value for conversion to meters or foot before creating the object.

minimum = 0
to_ip

Return the value in IP assuming input value is in SI.

to_si

Return the value in SI assuming input value is in IP.

unitIP = 'foot'
unitSI = 'm'
value_type

alias of float

class ladybug.datatype.DryBulbTemperature(value, datetime=None, standard='SI', nickname=None)[source]

Bases: ladybug.datatype.Temperature

Dry bulb temperature.

value

Input value

datetime

Date time data for this value (Default: None)

standard

‘SI’ or ‘IP’ (Default: ‘SI’)

nickname

Optional nickname for data (e.g. Dew Point Temperature)

maximum = 70
minimum = -70
class ladybug.datatype.Illuminance(value, datetime=None, standard='SI', nickname=None)[source]

Bases: ladybug.datatype.DataPoint

Illuminance.

value

Input value

datetime

Date time data for this value (Default: None)

standard

‘SI’ or ‘IP’ (Default: ‘SI’)

nickname

Optional nickname for data (e.g. Dew Point Temperature)

minimum = 0
missing = 999999
to_ip

Return the value in IP assuming input value is in SI.

to_si

Return the value in SI assuming input value is in IP.

unitIP = 'fc'
unitSI = 'lux'
value_type

alias of int

class ladybug.datatype.Luminance(value, datetime=None, standard='SI', nickname=None)[source]

Bases: ladybug.datatype.Illuminance

Luminance.

value

Input value

datetime

Date time data for this value (Default: None)

standard

‘SI’ or ‘IP’ (Default: ‘SI’)

nickname

Optional nickname for data (e.g. Dew Point Temperature)

minimum = 0
missing = 9999
unitIP = 'Cd/ft2'
unitSI = 'Cd/m2'
value_type

alias of int

class ladybug.datatype.MetabolicRate(value, datetime=None, standard='SI', nickname=None)[source]

Bases: ladybug.datatype.DataPoint

Metabolic Rate (met).

value

Input value

datetime

Date time data for this value (Default: None)

standard

‘SI’ or ‘IP’ (Default: ‘SI’)

nickname

Optional nickname for data (e.g. Dew Point Temperature)

minimum = 0
unitIP = 'met'
unitSI = 'met'
value_type

alias of float

class ladybug.datatype.PercentagePeopleDissatisfied(value, datetime=None, standard='SI', nickname=None)[source]

Bases: ladybug.datatype.DataPoint

Percentage of People Dissatisfied (PPD).

value

Input value

datetime

Date time data for this value (Default: None)

standard

‘SI’ or ‘IP’ (Default: ‘SI’)

nickname

Optional nickname for data (e.g. Dew Point Temperature)

maximum = 100
minimum = 0
unitIP = '%'
unitSI = '%'
value_type

alias of float

class ladybug.datatype.PredictedMeanVote(value, datetime=None, standard='SI', nickname=None)[source]

Bases: ladybug.datatype.DataPoint

Predicted Mean Vote (PMV).

value

Input value

datetime

Date time data for this value (Default: None)

standard

‘SI’ or ‘IP’ (Default: ‘SI’)

nickname

Optional nickname for data (e.g. Dew Point Temperature)

maximum = 50
minimum = -50
unitIP = 'PMV'
unitSI = 'PMV'
value_type

alias of float

class ladybug.datatype.Pressure(value, datetime=None, standard='SI', nickname=None)[source]

Bases: ladybug.datatype.DataPoint

Atmospheric Pressure.

value

Input value

datetime

Date time data for this value (Default: None)

standard

‘SI’ or ‘IP’ (Default: ‘SI’)

nickname

Optional nickname for data (e.g. Dew Point Temperature)

maximum = 120000
minimum = 31000
missing = 999999
to_ip

Return the value in IP.

to_si

Return the value in SI.

unitIP = 'in'
unitSI = 'Pa'
value_type

alias of int

class ladybug.datatype.Radiation(value, datetime=None, standard='SI', nickname=None)[source]

Bases: ladybug.datatype.DataPoint

Radiation.

value

Input value

datetime

Date time data for this value (Default: None)

standard

‘SI’ or ‘IP’ (Default: ‘SI’)

nickname

Optional nickname for data (e.g. Dew Point Temperature)

minimum = 0
missing = 9999
to_ip

Return the value in IP assuming input value is in SI.

to_si

Return the value in SI assuming input value is in IP.

unitIP = 'BTU/ft2'
unitSI = 'Wh/m2'
value_type

alias of int

class ladybug.datatype.RelativeHumidity(value, datetime=None, standard='SI', nickname=None)[source]

Bases: ladybug.datatype.DataPoint

Relative humidity.

value

Input value

datetime

Date time data for this value (Default: None)

standard

‘SI’ or ‘IP’ (Default: ‘SI’)

nickname

Optional nickname for data (e.g. Dew Point Temperature)

maximum = 100
minimum = 0
missing = 999
to_ip

Return the value in IP.

to_si

Return the value in SI.

unitIP = '%'
unitSI = '%'
value_type

alias of int

class ladybug.datatype.SkyPatch(value, vector, id=None)[source]

Bases: ladybug.datatype.DataPoint

SkyPatch.

value

Input value

vector

Sky vector as a tuple

id

patch number

id

Sky patch number.

minimum = 0
unitIP = 'steradian'
unitSI = 'steradian'
value_type

alias of float

vector
class ladybug.datatype.Speed(value, datetime=None, standard='SI', nickname=None)[source]

Bases: ladybug.datatype.DataPoint

Speed.

value

Input value

datetime

Date time data for this value (Default: None)

standard

‘SI’ or ‘IP’ (Default: ‘SI’)

nickname

Optional nickname for data (e.g. Dew Point Temperature)

minimum = 0
missing = 999
to_ip

Return the value in IP assuming input value is in SI.

to_si

Return the value in SI assuming input value is in IP.

unitIP = 'mph'
unitSI = 'm/s'
value_type

alias of float

class ladybug.datatype.Temperature(value, datetime=None, standard='SI', nickname=None)[source]

Bases: ladybug.datatype.DataPoint

Base type for temperature.

value

Input value

datetime

Date time data for this value (Default: None)

standard

‘SI’ or ‘IP’ (Default: ‘SI’)

nickname

Optional nickname for data (e.g. Dew Point Temperature)

maximum = inf
minimum = -inf
missing = 99.9
to_ip

Return the value in F assuming input value is in C.

to_si

Return the value in C assuming input value is in F.

unitIP = 'F'
unitSI = 'C'
value_type

alias of float

class ladybug.datatype.Tenth(value, datetime=None, standard='SI', nickname=None)[source]

Bases: ladybug.datatype.DataPoint

Tenth.

value

Input value

datetime

Date time data for this value (Default: None)

standard

‘SI’ or ‘IP’ (Default: ‘SI’)

nickname

Optional nickname for data (e.g. Dew Point Temperature)

maximum = 10
minimum = 0
missing = 99
unitIP = None
unitSI = None
value_type

alias of int

class ladybug.datatype.Thousandths(value, datetime=None, standard='SI', nickname=None)[source]

Bases: ladybug.datatype.DataPoint

Thousandths.

value

Input value

datetime

Date time data for this value (Default: None)

standard

‘SI’ or ‘IP’ (Default: ‘SI’)

nickname

Optional nickname for data (e.g. Dew Point Temperature)

minimum = 0
missing = 999
unitIP = 'thousandths'
unitSI = 'thousandths'
value_type

alias of float

class ladybug.datatype.Time(value, datetime=None, standard='SI', nickname=None)[source]

Bases: ladybug.datatype.DataPoint

Time.

value

Input value

datetime

Date time data for this value (Default: None)

standard

‘SI’ or ‘IP’ (Default: ‘SI’)

nickname

Optional nickname for data (e.g. Dew Point Temperature)

minimum = 0
missing = 356400
unitIP = 'second'
unitSI = 'second'
value_type

alias of int

class ladybug.datatype.WindSpeed(value, datetime=None, standard='SI', nickname=None)[source]

Bases: ladybug.datatype.Speed

Wind Speed.

value

Input value

datetime

Date time data for this value (Default: None)

standard

‘SI’ or ‘IP’ (Default: ‘SI’)

nickname

Optional nickname for data (e.g. Dew Point Temperature)

maximum = 40

ladybug.dt module

Ladybug datetime.

class ladybug.dt.DateTime[source]

Bases: datetime.datetime

Create Ladybug Date time.

Parameters:
  • month – A value for month between 1-12 (Defualt: 1).
  • day – A value for day between 1-31 (Defualt: 1).
  • hour – A value for hour between 0-23 (Defualt: 0).
  • minute – A value for month between 0-59 (Defualt: 0).
  • leap_year – A boolean to indicate if datetime is for a leap year (Default: False).
ToString()[source]

Overwrite .NET ToString.

add_hour(hour)[source]

Create a new DateTime from this time + timedelta.

Parameters:hours – A float value in hours (e.g. .5 = half an hour)
add_minute(minute)[source]

Create a new DateTime after the minutes are added.

Parameters:minute – An integer value for minutes.
doy

Calculate day of the year for this date time.

float_hour

Get hour and minute as a float value (e.g. 6.25 for 6 – 15).

classmethod from_date_time_string(datetime_string, leap_year=False)[source]

Create Ladybug DateTime from a DateTime string.

Usage:

dt = DateTime.from_date_time_string(“31 Dec 12:00”)
classmethod from_hoy(hoy, leap_year=False)[source]

Create Ladybug Datetime from an hour of the year.

Parameters:hoy – A float value 0 <= and < 8760
classmethod from_json(data)[source]

Creat datetime from a dictionary.

Parameters:
  • data

    { ‘month’: A value for month between 1-12. (Defualt: 1) ‘day’: A value for day between 1-31. (Defualt: 1) ‘hour’: A value for hour between 0-23. (Defualt: 0) ‘minute’: A value for month between 0-59. (Defualt: 0)

  • }
classmethod from_moy(moy, leap_year=False)[source]

Create Ladybug Datetime from a minute of the year.

Parameters:moy – An integer value 0 <= and < 525600
hoy

Calculate hour of the year for this date time.

int_hoy

Calculate hour of the year for this date time as an integer.

This output assumes the minute is 0.

isDateTime

Check if data is ladybug data.

moy

Calculate minute of the year for this date time.

sub_hour(hour)[source]

Create a new DateTime from this time - timedelta.

Parameters:hour – A float value in hours (e.g. .5 is half an hour and 2 is two hours).
sub_minute(minute)[source]

Create a new DateTime after the minutes are subtracted.

Parameters:minute – An integer value for the number of minutes.
to_json()[source]

Get date time as a dictionary.

to_simple_string(separator='_')[source]

Return a simplified string.

ladybug.epw module

class ladybug.epw.EPW(file_path=None)[source]

Bases: object

Import epw data from a local epw file.

Parameters:file_path – Local file address to an epw file.
properties:
years dry_bulb_temperature dew_point_temperature relative_humidity atmospheric_station_pressure extraterrestrial_horizontal_radiation extraterrestrial_direct_normal_radiation horizontal_infrared_radiation_intensity global_horizontal_radiation direct_normal_radiation diffuse_horizontal_radiation global_horizontal_illuminance direct_normal_illuminance diffuse_horizontal_illuminance zenith_luminance wind_direction wind_speed total_sky_cover opaque_sky_cover visibility ceiling_height present_weather_observation present_weather_codes precipitable_water aerosol_optical_depth snow_depth days_since_last_snowfall albedo liquid_precipitation_depth liquid_precipitation_quantity sky_temperature
ToString()[source]

Overwrite .NET ToString.

aerosol_optical_depth

Return annual Aerosol Optical Depth as a Ladybug Data List.

This is the value for Aerosol Optical Depth in thousandths. It is not currently used in EnergyPlus calculations. Missing value is .999.

Read more at: https://energyplus.net/sites/all/modules/custom/nrel_custom/pdfs
/pdfs_v8.4.0/AuxiliaryPrograms.pdf (Chapter 2.9.1)
albedo

Return annual Albedo values as a Ladybug Data List.

The ratio (unitless) of reflected solar irradiance to global horizontal irradiance. It is not currently used in EnergyPlus.

Read more at: https://energyplus.net/sites/all/modules/custom/nrel_custom/pdfs
/pdfs_v8.4.0/AuxiliaryPrograms.pdf (Chapter 2.9.1)
atmospheric_station_pressure

Return annual Atmospheric Station Pressure as a Ladybug Data List.

This is the station pressure in Pa at the time indicated. Valid values range from 31,000 to 120,000. (These values were chosen from the standard barometric pressure for all elevations of the World). Missing value for this field is 999999 Read more at: https://energyplus.net/sites/all/modules/custom/nrel_custom/pdfs

/pdfs_v8.4.0/AuxiliaryPrograms.pdf (Chapter 2.9.1)
ceiling_height

Return annual Ceiling Height as a Ladybug Data List.

This is the value for ceiling height in m. (77777 is unlimited ceiling height. 88888 is cirroform ceiling.) It is not currently used in EnergyPlus calculations. Missing value is 99999

Read more at: https://energyplus.net/sites/all/modules/custom/nrel_custom/pdfs
/pdfs_v8.4.0/AuxiliaryPrograms.pdf (Chapter 2.9.1)
days_since_last_snowfall

Return annual Days Since Last Snow Fall as a Ladybug Data List.

This is the value for Days Since Last Snowfall. It is not currently used in EnergyPlus calculations. Missing value is 99.

Read more at: https://energyplus.net/sites/all/modules/custom/nrel_custom/pdfs
/pdfs_v8.4.0/AuxiliaryPrograms.pdf (Chapter 2.9.1)
dew_point_temperature

Return annual Dew Point Temperature as a Ladybug Data List.

This is the dew point temperature in C at the time indicated. Note that this is a full numeric field (i.e. 23.6) and not an integer representation with tenths. Valid values range from -70 C to 70 C. Missing value for this field is 99.9 Read more at: https://energyplus.net/sites/all/modules/custom/nrel_custom/pdfs

/pdfs_v8.4.0/AuxiliaryPrograms.pdf (Chapter 2.9.1)
diffuse_horizontal_illuminance

Return annual Diffuse Horizontal Illuminance as a Ladybug Data List.

This is the Diffuse Horizontal Illuminance in lux. (Average amount of illuminance in hundreds of lux received from the sky (excluding the solar disk) on a horizontal surface during the number of minutes preceding the time indicated.) It is not currently used in EnergyPlus calculations. It should have a minimum value of 0; missing value for this field is 999999 and will be considered missing if greater than or equal to 999900.

Read more at: https://energyplus.net/sites/all/modules/custom/nrel_custom/pdfs
/pdfs_v8.4.0/AuxiliaryPrograms.pdf (Chapter 2.9.1)
diffuse_horizontal_radiation

Return annual Diffuse Horizontal Radiation as a Ladybug Data List.

This is the Diffuse Horizontal Radiation in Wh/m2. (Amount of solar radiation in Wh/m2 received from the sky (excluding the solar disk) on a horizontal surface during the number of minutes preceding the time indicated.) If the field is missing ( >= 9999) or invalid ( < 0), it is set to 0. Counts of such missing values are totaled and presented at the end of the runperiod Read more at: https://energyplus.net/sites/all/modules/custom/nrel_custom/pdfs /pdfs_v8.4.0/AuxiliaryPrograms.pdf (Chapter 2.9.1)

direct_normal_illuminance

Return annual Direct Normal Illuminance as a Ladybug Data List.

This is the Direct Normal Illuminance in lux. (Average amount of illuminance in hundreds of lux received directly from the solar disk on a surface perpendicular to the sun’s rays, during the number of minutes preceding the time indicated.) It is not currently used in EnergyPlus calculations. It should have a minimum value of 0; missing value for this field is 999999 and will be considered missing if greater than or equal to 999900.

Read more at: https://energyplus.net/sites/all/modules/custom/nrel_custom/pdfs
/pdfs_v8.4.0/AuxiliaryPrograms.pdf (Chapter 2.9.1)
direct_normal_radiation

Return annual Direct Normal Radiation as a Ladybug Data List.

This is the Direct Normal Radiation in Wh/m2. (Amount of solar radiation in Wh/m2 received directly from the solar disk on a surface perpendicular to the sun’s rays, during the number of minutes preceding the time indicated.) If the field is missing ( >= 9999) or invalid ( < 0), it is set to 0. Counts of such missing values are totaled and presented at the end of the runperiod. Read more at: https://energyplus.net/sites/all/modules/custom/nrel_custom/pdfs

/pdfs_v8.4.0/AuxiliaryPrograms.pdf (Chapter 2.9.1)
dry_bulb_temperature

Return annual Dry Bulb Temperature as a Ladybug Data List.

This is the dry bulb temperature in C at the time indicated. Note that this is a full numeric field (i.e. 23.6) and not an integer representation with tenths. Valid values range from -70C to 70 C. Missing value for this field is 99.9

Read more at: https://energyplus.net/sites/all/modules/custom/nrel_custom/pdfs
/pdfs_v8.4.0/AuxiliaryPrograms.pdf (Chapter 2.9.1)
extraterrestrial_direct_normal_radiation

Return annual Extraterrestrial Direct Normal Radiation as a Ladybug Data List.

This is the Extraterrestrial Direct Normal Radiation in Wh/m2. (Amount of solar radiation in Wh/m2 received on a surface normal to the rays of the sun at the top of the atmosphere during the number of minutes preceding the time indicated). It is not currently used in EnergyPlus calculations. It should have a minimum value of 0; missing value for this field is 9999. Read more at: https://energyplus.net/sites/all/modules/custom/nrel_custom/pdfs

/pdfs_v8.4.0/AuxiliaryPrograms.pdf (Chapter 2.9.1)
extraterrestrial_horizontal_radiation

Return annual Extraterrestrial Horizontal Radiation as a Ladybug Data List.

This is the Extraterrestrial Horizontal Radiation in Wh/m2. It is not currently used in EnergyPlus calculations. It should have a minimum value of 0; missing value for this field is 9999. Read more at: https://energyplus.net/sites/all/modules/custom/nrel_custom/pdfs

/pdfs_v8.4.0/AuxiliaryPrograms.pdf (Chapter 2.9.1)
file_name

Get epw file name.

file_path

Get path to epw file.

folder

Get epw file folder.

global_horizontal_illuminance

Return annual Global Horizontal Illuminance as a Ladybug Data List.

This is the Global Horizontal Illuminance in lux. (Average total amount of direct and diffuse illuminance in hundreds of lux received on a horizontal surface during the number of minutes preceding the time indicated.) It is not currently used in EnergyPlus calculations. It should have a minimum value of 0; missing value for this field is 999999 and will be considered missing if greater than or equal to 999900. Read more at: https://energyplus.net/sites/all/modules/custom/nrel_custom/pdfs

/pdfs_v8.4.0/AuxiliaryPrograms.pdf (Chapter 2.9.1)
global_horizontal_radiation

Return annual Global Horizontal Radiation as a Ladybug Data List.

This is the Global Horizontal Radiation in Wh/m2. (Total amount of direct and diffuse solar radiation in Wh/m2 received on a horizontal surface during the number of minutes preceding the time indicated.) It is not currently used in EnergyPlus calculations. It should have a minimum value of 0; missing value for this field is 9999. Read more at: https://energyplus.net/sites/all/modules/custom/nrel_custom/pdfs

/pdfs_v8.4.0/AuxiliaryPrograms.pdf (Chapter 2.9.1)
header

Return epw file header.

horizontal_infrared_radiation_intensity

Return annual Horizontal Infrared Radiation Intensity as a Ladybug Data List.

This is the Horizontal Infrared Radiation Intensity in Wh/m2. If it is missing, it is calculated from the Opaque Sky Cover field as shown in the following explanation. It should have a minimum value of 0; missing value for this field is 9999. Read more at: https://energyplus.net/sites/all/modules/custom/nrel_custom/pdfs

/pdfs_v8.4.0/AuxiliaryPrograms.pdf (Chapter 2.9.1)
import_data_by_field(field_number)[source]

Return annual values for any field_number in epw file.

This is a useful method to get the values for fields that Ladybug currently doesn’t import by default. You can find list of fields by typing EPWFields.fields

Parameters:
  • field_number – a value between 0 to 34 for different available epw fields.
  • Year (0) –
  • Month (1) –
  • Day (2) –
  • Hour (3) –
  • Minute (4) –
  • -
  • Dry Bulb Temperature (6) –
  • Dew Point Temperature (7) –
  • Relative Humidity (8) –
  • Atmospheric Station Pressure (9) –
  • Extraterrestrial Horizontal Radiation (10) –
  • Extraterrestrial Direct Normal Radiation (11) –
  • Horizontal Infrared Radiation Intensity (12) –
  • Global Horizontal Radiation (13) –
  • Direct Normal Radiation (14) –
  • Diffuse Horizontal Radiation (15) –
  • Global Horizontal Illuminance (16) –
  • Direct Normal Illuminance (17) –
  • Diffuse Horizontal Illuminance (18) –
  • Zenith Luminance (19) –
  • Wind Direction (20) –
  • Wind Speed (21) –
  • Total Sky Cover (22) –
  • Opaque Sky Cover (23) –
  • Visibility (24) –
  • Ceiling Height (25) –
  • Present Weather Observation (26) –
  • Present Weather Codes (27) –
  • Precipitable Water (28) –
  • Aerosol Optical Depth (29) –
  • Snow Depth (30) –
  • Days Since Last Snowfall (31) –
  • Albedo (32) –
  • Liquid Precipitation Depth (33) –
  • Liquid Precipitation Quantity (34) –
Returns:

An annual Ladybug list

is_data_loaded

Return True if weather data is loaded.

is_location_loaded

Return True if location data is loaded.

liquid_precipitation_depth

Return annual liquid precipitation depth as a Ladybug Data List.

The amount of liquid precipitation (mm) observed at the indicated time for the period indicated in the liquid precipitation quantity field. If this value is not missing, then it is used and overrides the “precipitation” flag as rainfall. Conversely, if the precipitation flag shows rain and this field is missing or zero, it is set to 1.5 (mm).

Read more at: https://energyplus.net/sites/all/modules/custom/nrel_custom/pdfs
/pdfs_v8.4.0/AuxiliaryPrograms.pdf (Chapter 2.9.1)
liquid_precipitation_quantity

Return annual Liquid Precipitation Quantity as a Ladybug Data List.

The period of accumulation (hr) for the liquid precipitation depth field. It is not currently used in EnergyPlus.

Read more at: https://energyplus.net/sites/all/modules/custom/nrel_custom/
pdfs/pdfs_v8.4.0/AuxiliaryPrograms.pdf (Chapter 2.9.1)
location

Return location data.

opaque_sky_cover

Return annual Opaque Sky Cover as a Ladybug Data List.

This is the value for opaque sky cover (tenths of coverage). (i.e. 1 is 1/10 covered. 10 is total coverage). (Amount of sky dome in tenths covered by clouds or obscuring phenomena that prevent observing the sky or higher cloud layers at the time indicated.) This is not used unless the field for Horizontal Infrared Radiation Intensity is missing and then it is used to calculate Horizontal Infrared Radiation Intensity. Minimum value is 0; maximum value is 10; missing value is 99.

Read more at: https://energyplus.net/sites/all/modules/custom/nrel_custom/pdfs
/pdfs_v8.4.0/AuxiliaryPrograms.pdf (Chapter 2.9.1)
precipitable_water

Return annual Precipitable Water as a Ladybug Data List.

This is the value for Precipitable Water in mm. (This is not rain - rain is inferred from the PresWeathObs field but a better result is from the Liquid Precipitation Depth field). It is not currently used in EnergyPlus calculations (primarily due to the unreliability of the reporting of this value). Missing value is 999.

Read more at: https://energyplus.net/sites/all/modules/custom/nrel_custom/pdfs
/pdfs_v8.4.0/AuxiliaryPrograms.pdf (Chapter 2.9.1)
present_weather_codes

Return annual Present Weather Codes as a Ladybug Data List.

The present weather codes field is assumed to follow the TMY2 conventions for this field. Note that though this field may be represented as numeric (e.g. in the CSV format), it is really a text field of 9 single digits. This convention along with values for each “column” (left to right) is presented in Table 16. Note that some formats (e.g. TMY) does not follow this convention - as much as possible, the present weather codes are converted to this convention during WeatherConverter processing. Also note that the most important fields are those representing liquid precipitation - where the surfaces of the building would be wet. EnergyPlus uses “Snow Depth” to determine if snow is on the ground.

Read more at: https://energyplus.net/sites/all/modules/custom/nrel_custom/pdfs
/pdfs_v8.4.0/AuxiliaryPrograms.pdf (Chapter 2.9.1)
present_weather_observation

Return annual Present Weather Observation as a Ladybug Data List.

If the value of the field is 0, then the observed weather codes are taken from the following field. If the value of the field is 9, then “missing” weather is assumed. Since the primary use of these fields (Present Weather Observation and Present Weather Codes) is for rain/wet surfaces, a missing observation field or a missing weather code implies no rain.

Read more at: https://energyplus.net/sites/all/modules/custom/nrel_custom/pdfs
/pdfs_v8.4.0/AuxiliaryPrograms.pdf (Chapter 2.9.1)
relative_humidity

Return annual Relative Humidity as a Ladybug Data List.

This is the Relative Humidity in percent at the time indicated. Valid values range from 0% to 110%. Missing value for this field is 999. Read more at: https://energyplus.net/sites/all/modules/custom/nrel_custom/pdfs

/pdfs_v8.4.0/AuxiliaryPrograms.pdf (Chapter 2.9.1)
save(folder=None, file_name=None)[source]

Save epw object as an epw file.

sky_temperature

Return annual Sky Temperature as a Ladybug Data List.

This value in degrees Celcius is derived from the Horizontal Infrared Radiation Intensity in Wh/m2. It represents the long wave radiant temperature of the sky Read more at: https://bigladdersoftware.com/epx/docs/8-9/engineering-reference

/climate-calculations.html#energyplus-sky-temperature-calculation
snow_depth

Return annual Snow Depth as a Ladybug Data List.

This is the value for Snow Depth in cm. This field is used to tell when snow is on the ground and, thus, the ground reflectance may change. Missing value is 999.

Read more at: https://energyplus.net/sites/all/modules/custom/nrel_custom/pdfs
/pdfs_v8.4.0/AuxiliaryPrograms.pdf (Chapter 2.9.1)
to_wea(file_path=None, hoys=None)[source]

Write an wea file from the epw file.

WEA carries radiation values from epw. Gendaymtx uses these values to generate the sky. For an annual analysis it is identical to using epw2wea.

Parameters:
  • file_path – Full file path for output file.
  • hoys – List of hours of the year. Default is 0-8759.
total_sky_cover

Return annual Total Sky Cover as a Ladybug Data List.

This is the value for total sky cover (tenths of coverage). (i.e. 1 is 1/10 covered. 10 is total coverage). (Amount of sky dome in tenths covered by clouds or obscuring phenomena at the hour indicated at the time indicated.) Minimum value is 0; maximum value is 10; missing value is 99.

Read more at: https://energyplus.net/sites/all/modules/custom/nrel_custom/pdfs
/pdfs_v8.4.0/AuxiliaryPrograms.pdf (Chapter 2.9.1)
visibility

Return annual Visibility as a Ladybug Data List.

This is the value for visibility in km. (Horizontal visibility at the time indicated.) It is not currently used in EnergyPlus calculations. Missing value is 9999.

Read more at: https://energyplus.net/sites/all/modules/custom/nrel_custom/pdfs
/pdfs_v8.4.0/AuxiliaryPrograms.pdf (Chapter 2.9.1)
wind_direction

Return annual Wind Direction as a Ladybug Data List.

This is the Wind Direction in degrees where the convention is that North=0.0, East=90.0, South=180.0, West=270.0. (Wind direction in degrees at the time indicated. If calm, direction equals zero.) Values can range from 0 to 360. Missing value is 999.

Read more at: https://energyplus.net/sites/all/modules/custom/nrel_custom/pdfs
/pdfs_v8.4.0/AuxiliaryPrograms.pdf (Chapter 2.9.1)
wind_speed

Return annual Wind Speed as a Ladybug Data List.

This is the wind speed in m/sec. (Wind speed at time indicated.) Values can range from 0 to 40. Missing value is 999.

Read more at: https://energyplus.net/sites/all/modules/custom/nrel_custom/pdfs
/pdfs_v8.4.0/AuxiliaryPrograms.pdf (Chapter 2.9.1)
years

Return years as a Ladybug Data List.

zenith_luminance

Return annual Zenith Luminance as a Ladybug Data List.

This is the Zenith Illuminance in Cd/m2. (Average amount of luminance at the sky’s zenith in tens of Cd/m2 during the number of minutes preceding the time indicated.) It is not currently used in EnergyPlus calculations. It should have a minimum value of 0; missing value for this field is 9999.

Read more at: https://energyplus.net/sites/all/modules/custom/nrel_custom/pdfs
/pdfs_v8.4.0/AuxiliaryPrograms.pdf (Chapter 2.9.1)
class ladybug.epw.EPWField(field_dict)[source]

Bases: object

An EPW field.

name

Name of the field.

type

field value type (e.g. int, float, str)

unit

Field unit.

class ladybug.epw.EPWFields[source]

Bases: object

EPW weather file fields.

Read more at: https://energyplus.net/sites/all/modules/custom/nrel_custom/pdfs/

pdfs_v8.4.0/AuxiliaryPrograms.pdf

(Chapter 2.9.1)

FIELDS = {0: {'type': <type 'int'>, 'name': 'Year', 'middle_hour': False}, 1: {'type': <type 'int'>, 'name': 'Month', 'middle_hour': False}, 2: {'type': <type 'int'>, 'name': 'Day', 'middle_hour': False}, 3: {'type': <type 'int'>, 'name': 'Hour', 'middle_hour': False}, 4: {'type': <type 'int'>, 'name': 'Minute', 'middle_hour': False}, 5: {'type': <type 'str'>, 'name': 'Uncertainty Flags', 'middle_hour': False}, 6: {'name': 'Dry Bulb Temperature', 'missing': 99.9, 'max': 70, 'min': -70, 'type': <type 'float'>, 'unit': 'C', 'middle_hour': False}, 7: {'name': 'Dew Point Temperature', 'missing': 99.9, 'max': 70, 'min': -70, 'type': <type 'float'>, 'unit': 'C', 'middle_hour': False}, 8: {'name': 'Relative Humidity', 'min': 0, 'max': 110, 'missing': 999, 'type': <type 'int'>, 'unit': '%', 'middle_hour': False}, 9: {'name': 'Atmospheric Station Pressure', 'min': 31000, 'max': 120000, 'missing': 999999, 'type': <type 'int'>, 'unit': 'Pa', 'middle_hour': False}, 10: {'name': 'Extraterrestrial Horizontal Radiation', 'min': 0, 'missing': 9999, 'type': <type 'int'>, 'unit': 'Wh/m2', 'middle_hour': True}, 11: {'name': 'Extraterrestrial Direct Normal Radiation', 'min': 0, 'missing': 9999, 'type': <type 'int'>, 'unit': 'Wh/m2', 'middle_hour': True}, 12: {'name': 'Horizontal Infrared Radiation Intensity', 'min': 0, 'missing': 9999, 'type': <type 'int'>, 'unit': 'Wh/m2', 'middle_hour': False}, 13: {'name': 'Global Horizontal Radiation', 'min': 0, 'missing': 9999, 'type': <type 'int'>, 'unit': 'Wh/m2', 'middle_hour': True}, 14: {'name': 'Direct Normal Radiation', 'min': 0, 'missing': 9999, 'type': <type 'int'>, 'unit': 'Wh/m2', 'middle_hour': True}, 15: {'name': 'Diffuse Horizontal Radiation', 'min': 0, 'missing': 9999, 'type': <type 'int'>, 'unit': 'Wh/m2', 'middle_hour': True}, 16: {'name': 'Global Horizontal Illuminance', 'min': 0, 'missing': 999999, 'type': <type 'int'>, 'unit': 'lux', 'middle_hour': True}, 17: {'name': 'Direct Normal Illuminance', 'min': 0, 'missing': 999999, 'type': <type 'int'>, 'unit': 'lux', 'middle_hour': True}, 18: {'name': 'Diffuse Horizontal Illuminance', 'min': 0, 'missing': 999999, 'type': <type 'int'>, 'unit': 'lux', 'middle_hour': True}, 19: {'name': 'Zenith Luminance', 'min': 0, 'missing': 9999, 'type': <type 'int'>, 'unit': 'Cd/m2', 'middle_hour': True}, 20: {'name': 'Wind Direction', 'min': 0, 'max': 360, 'missing': 999, 'type': <type 'int'>, 'unit': 'degrees', 'middle_hour': False}, 21: {'name': 'Wind Speed', 'min': 0, 'max': 40, 'missing': 999, 'type': <type 'float'>, 'unit': 'm/s', 'middle_hour': False}, 22: {'name': 'Total Sky Cover', 'min': 0, 'max': 10, 'missing': 99, 'type': <type 'int'>, 'middle_hour': False}, 23: {'middle_hour': False, 'type': <type 'int'>, 'name': 'Opaque Sky Cover', 'missing': 99}, 24: {'middle_hour': False, 'type': <type 'float'>, 'name': 'Visibility', 'unit': 'km', 'missing': 9999}, 25: {'middle_hour': False, 'type': <type 'int'>, 'name': 'Ceiling Height', 'unit': 'm', 'missing': 99999}, 26: {'type': <type 'int'>, 'name': 'Present Weather Observation', 'middle_hour': False}, 27: {'type': <type 'int'>, 'name': 'Present Weather Codes', 'middle_hour': False}, 28: {'middle_hour': False, 'type': <type 'int'>, 'name': 'Precipitable Water', 'unit': 'mm', 'missing': 999}, 29: {'middle_hour': False, 'type': <type 'float'>, 'name': 'Aerosol Optical Depth', 'unit': 'thousandths', 'missing': 999}, 30: {'middle_hour': False, 'type': <type 'int'>, 'name': 'Snow Depth', 'unit': 'cm', 'missing': 999}, 31: {'middle_hour': False, 'type': <type 'int'>, 'name': 'Days Since Last Snowfall', 'missing': 99}, 32: {'middle_hour': False, 'type': <type 'float'>, 'name': 'Albedo', 'missing': 999}, 33: {'middle_hour': False, 'type': <type 'float'>, 'name': 'Liquid Precipitation Depth', 'unit': 'mm', 'missing': 999}, 34: {'middle_hour': False, 'type': <type 'float'>, 'name': 'Liquid Precipitation Quantity', 'unit': 'hr', 'missing': 99}}
classmethod field_by_number(field_number)[source]

Return an EPWField based on field number.

0 Year 1 Month 2 Day 3 Hour 4 Minute - 6 Dry Bulb Temperature 7 Dew Point Temperature 8 Relative Humidity 9 Atmospheric Station Pressure 10 Extraterrestrial Horizontal Radiation 11 Extraterrestrial Direct Normal Radiation 12 Horizontal Infrared Radiation Intensity 13 Global Horizontal Radiation 14 Direct Normal Radiation 15 Diffuse Horizontal Radiation 16 Global Horizontal Illuminance 17 Direct Normal Illuminance 18 Diffuse Horizontal Illuminance 19 Zenith Luminance 20 Wind Direction 21 Wind Speed 22 Total Sky Cover 23 Opaque Sky Cover 24 Visibility 25 Ceiling Height 26 Present Weather Observation 27 Present Weather Codes 28 Precipitable Water 29 Aerosol Optical Depth 30 Snow Depth 31 Days Since Last Snowfall 32 Albedo 33 Liquid Precipitation Depth 34 Liquid Precipitation Quantity

ladybug.geometry module

ladybug.header module

Ladybug Header.

Header is useful for creating list of ladybug data.

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

Bases: object

data collection header.

Header carries data for location, data type, unit and analysis period

location

location data as a ladybug Location or location string (Default: None).

data_type

Type of data (e.g. Temperature) (Default: None).

unit

data_type unit (Default: None).

analysis_period

A Ladybug analysis period (Defualt: None)

middle_hour

A boolean to set whether the values are interpreted as falling on the middle of the hour (True) or the start of the hour (False). (Default: False)

ToString()[source]

Overwrite .NET ToString.

duplicate()[source]

Duplicate header.

classmethod from_header(header)[source]

Try to generate a header from a header or a header string.

classmethod from_json(data)[source]

Create a header from a dictionary.

Parameters:
  • data

    { “location”: {}, // A Ladybug location “data_type”: string, //Type of data (e.g. Temperature) (Default: None). “unit”: string, “analysis_period”: {}, // A Ladybug AnalysisPeriod, “middle_hour”: {} // Whether values fall in the middle of the hour

  • }
isHeader

Return True.

to_json()[source]

Return a header as a dictionary.

to_tuple()[source]

Return Ladybug header as a list.

ladybug.legendparameters module

class ladybug.legendparameters.LegendParameters(legend_range=None, number_of_segments=11, colors=None, chart_type=0)[source]

Bases: object

Ladybug lagend parameters.

legend_range

Input a list of numbers or strings to set the boundary of legend. The default is [‘min’, ‘max’]

number_of_segments

An interger representing the number of steps between the high and low boundary of the legend. The default is set to 11 and any custom values put in here should always be greater than or equal to 2.

colors

An optional list of colors. Default is Ladybug’s default colorset

chart_type

0: continuous, 1: segmented, 2: ordinal. Default: 0. Ordinal values can be strings and well as numericals

title

Legend title. It’s usually analysis unit

font

An optional text string that sets the font of the text. Examples include “Arial”, “Times New Roman” or “Courier” (all without quotations). The text input here can be any font that is on your computer but the font must be of an Editable file type (as seen in the font folder off of your control panel). Font files that are print and Preview will not work. If you wish to use a Bold version of the font, include a “, Bold” at the end of the font name (example: “Arial, Bold”).

fontSize

An optional number to set the size of the text in model’s units.

scale

Input a number here to change the scale of the legend. The default is set to 1.

basePlane

Input a plane to change the location and orientation of the legend. The default is set to the right of the analysis scene in XY plane.

vertical

Set to False to get a horizontal legend. Default is vertical.

Usage:

lp = LegendParameters(legend_range = [2, 28]) print(lp.color(10))
ToString()[source]

Overwrite .NET ToString.

calculate_color(value)[source]

Calculate color for a specific value.

calculate_colors(values)[source]

Return a list (or list of lists) of colors based on input values.

colors

Get or set list of colors.

domain

Get or set color range domain.

geometry()[source]

Calculate legend geometry.

is_domain_set

Check if the domain is set.

set_domain(values)[source]

Set domain of the colors based on min and max of a list of values.

text()[source]

Return legend text.

ladybug.listoperations module

Useful functions for list operations.

ladybug.listoperations.duplicate(value, list_length)[source]

Take a single value and duplicate it a certain number of times.

Parameters:
  • value – A value that you want to duplicate
  • list_length – The number of times to duplicate the object.

Usage:

value = 1.2 list_length = 5 duplicate(value, list_length) >> [ 1.2, 1.2, 1.2, 1.2, 1.2]
ladybug.listoperations.flatten(input_list)[source]

Return a flattened genertor from an input list.

Usage:

input_list = [[‘a’], [‘b’, ‘c’, ‘d’], [[‘e’]], [‘f’]] list(flatten(input_list)) >> [‘a’, ‘b’, ‘c’, ‘d’, ‘e’, ‘f’]
ladybug.listoperations.unflatten(guide, falttened_input)[source]

Unflatten a falttened generator.

Parameters:
  • guide – A guide list to follow the structure
  • falttened_input – A flattened iterator object

Usage:

guide = [[“a”], [“b”,”c”,”d”], [[“e”]], [“f”]] input_list = [0, 1, 2, 3, 4, 5, 6, 7] unflatten(guide, iter(input_list)) >> [[0], [1, 2, 3], [[4]], [5]]

ladybug.location module

Ladybug location.

class ladybug.location.Location(city=None, country=None, latitude=0, longitude=0, time_zone=0, elevation=0, station_id=None, source=None)[source]

Bases: object

Ladybug Location.

city

Name of the city as a string.

country

Name of the country as a string.

latitude

Location latitude between -90 and 90 (Default: 0).

longitude

Location longitude between -180 (west) and 180 (east) (Default: 0).

time_zone

Time zone between -12 hours (west) and 12 hours (east) (Default: 0).

elevation

A number for elevation of the location.

station_id

Id of the location if the location is represnting a weather station.

source

Source of data (e.g. TMY, TMY3).

ToString()[source]

Overwrite .NET ToString.

city
country
duplicate()[source]

Duplicate location.

elevation

Location elevation.

ep_style_location_string

Return EnergyPlus’s location string.

classmethod from_json(loc_json)[source]

Create a location from json. {

“city”: “-“, “latitude”: 0, “longitude”: 0, “time_zone”: 0, “elevation”: 0

}

classmethod from_location(location)[source]

Try to create a Ladybug location from a location string.

Parameters:locationString – Location string

Usage:

l = Location.from_location(locationString)
isLocation

Return Ture.

latitude

Location latitude.

longitude

Location longitude.

meridian

Location meridian west of Greenwich.

source
station_id
time_zone

Location time zone.

to_json()[source]

Create a location from json. {

“city”: “-“, “latitude”: 0, “longitude”: 0, “time_zone”: 0, “elevation”: 0

}

ladybug.output module

ladybug.psychrometrics module

A list of useful functions for psychrometrics

ladybug.psychrometrics.find_air_temp_from_enthalpy(enthalpy, abs_humid)[source]

Calculates Air Temperature (C).

The calculation at Enthalpy enthalpy (kJ/kg) and Humidity Ratio abs_humid (kg water/kg air).

ladybug.psychrometrics.find_air_temp_from_wet_bulb(wet_bulb, rel_humid, avg_bar_press=101325)[source]

Calculates Air Temperature (C) at Wet Bulb Temperature wet_bulb (C), Relative Humidity rel_humid (%) and Barometric Pressure avg_bar_press (Pa).

ladybug.psychrometrics.find_dew_point(db_temp, rh)[source]

Calculates Dew Point Temperature (C) at Temperature db_temp (C) and Relative Humidity rh (%).

ladybug.psychrometrics.find_enthalpy(air_temp, humid_ratio)[source]

Calculates Enthalpy (kJ/kg) at Humidity Ratio humid_ratio (kg water/kg air) and at Temperature air_temp (C).

ladybug.psychrometrics.find_humid_ratio(air_temp, rel_humid, bar_press=101325)[source]

Calculates Humidity Ratio (kg water/kg air), Partial Pressure (Pa), and saturation_pressure (Pa) at a given at Temperature air_temp (C), Relative Humidity rel_humid (%), and Barometric Pressure bar_press (Pa).

ladybug.psychrometrics.find_rel_humid_from_dry_bulb_dew_pt(air_temp, dew_pt)[source]

Calculates Relative Humidity (%).

Relative humidity is calculated at Temperature air_temp (C), and Dew Point dew_pt (C).

ladybug.psychrometrics.find_rel_humid_from_humid_ratio(abs_humid, air_temp, bar_press=101325)[source]

Calculates Relative Humidity (%) at Humidity Ratio abs_humid (kg water/kg air), Temperature air_temp (C), and Barometric Pressure bar_press (Pa).

ladybug.psychrometrics.find_saturated_vapor_pressure_high_accuracy(t_kelvin)[source]

Calculates Saturated Vapor Pressure (Pa) at Temperature t_kelvin (K) to a high accuracy. The function accounts for the different behaviour of above and below the freezing point of water.

ladybug.psychrometrics.find_saturated_vapor_pressure_torr(temperature)[source]

Calculates Saturated Vapor Pressure (Torr) at Temperature T (C) Used frequently throughtout the pmv comfort functions.

ladybug.psychrometrics.find_wet_bulb(db_temp, rh, psta=101325)[source]

Calculates Wet Bulb Temperature (C) at Temperature db_temp (C), Relative Humidity rh (%), and Barometric Pressure psta (Pa).

ladybug.stat module

class ladybug.stat.Stat(file_path=None)[source]

Bases: object

Import data from a local .stat file.

Parameters:file_path – Local file address to a .stat file.
properties:
location ashrae_climate_zone koppen_climate_zone monthly_tau_beam monthly_tau_diffuse
ToString()[source]

Overwrite .NET ToString.

ashrae_climate_zone

Return a text string indicating the ASHRAE climate zone.

ASHRAE climate zones are frequently used to make suggestions for heating and cooling systems and correspond to recommendations for insulation levels of a building.

file_name

Get stat file name.

file_path

Get or set path to stat file.

folder

Get stat file folder.

header

Return stat file header.

import_data()[source]

Import data from a stat file.

is_data_loaded

Return True if data is loaded.

koppen_climate_zone

Return a text string indicating the Koppen climate zone.

The Koppen climate classification is the most widely used climate classification system and combines average annual and monthly temperatures, precipitation, and the seasonality of precipitation.

location

Return ladybug location object.

monthly_tau_beam

Return a list of 12 float values for monthly beam optical depth.

These values can be used to generate ASHRAE Revised Clear Skies, which are intended to determine peak solar load and sizing parmeters for HVAC systems.

monthly_tau_diffuse

Return a list of 12 float values for monthly diffuse optical depth.

These values can be used to generate ASHRAE Revised Clear Skies, which are intended to determine peak solar load and sizing parmeters for HVAC systems.

ladybug.sunpath module

class ladybug.sunpath.Sun(datetime, altitude, azimuth, is_solar_time, is_daylight_saving, north_angle, data=None)[source]

Bases: object

Sun.

datetime

A DateTime that represents the datetime for this sun_vector

altitude

Solar Altitude in radians

azimuth

Solar Azimuth in radians

is_solar_time

A Boolean that indicates if datetime represents the solar time.

is_daylight_saving

A Boolean that indicates if datetime is calculated for Daylight saving period

north_angle

North angle of the sunpath in Degrees. This will be only used to calculate the solar vector.

PI = 3.141592653589793
ToString()[source]

Overwrite .NET ToString method.

altitude

Return solar altitude in degrees.

altitude_in_radians

Return solar altitude in radians.

azimuth

Return solar azimuth in degrees.

azimuth_in_radians

Return solar azimuth in radians.

data

Get or set data to this sun position.

datetime

Return datetime.

hoy

Return Hour of the year.

is_daylight_saving

Return a Boolean that indicates is datetime is solar time.

is_during_day

Check if this sun position is during day.

is_solar_time

Return a Boolean that indicates is datetime is solar time.

north_angle

Return north angle for +YAxis.

sun_vector

Sun vector for this sun.

Sun vector faces downward(e.g. z will be negative.)

class ladybug.sunpath.Sunpath(latitude=0, longitude=0, time_zone=0, north_angle=0, daylight_saving_period=None)[source]

Bases: object

Calculates sun path.

latitude

The latitude of the location in degrees. Values must be between -90 and 90. Default is set to the equator.

longitude

The longitude of the location in degrees (Default: 0)

time_zone

A number representing the time zone of the location you are constructing. This can improve the accuracy of the resulting sun plot. The time zone should follow the epw convention and should be between -12 and +12, where 0 is at Greenwich, UK, positive values are to the East of Greenwich and negative values are to the West.

north_angle

Angle to north (0-360). 90 is west and 270 is east (Default: 0)

daylight_saving_period

An analysis period for daylight saving. (Default: None)

Usage:

import ladybug.sunpath as sunpath # initiate sunpath sp = sunpath.Sunpath(50) sun = sp.calculate_sun(1, 1, 12) # calculate sun data for Jan 1 at noon print(sun.azimuth, sun.altitude)
PI = 3.141592653589793
calculate_sun(month, day, hour, is_solar_time=False)[source]

Get Sun data for an hour of the year.

Parameters:
  • month – An integer between 1-12
  • day – An integer between 1-31
  • hour – A positive number between 0..23
  • is_solar_time – A boolean to indicate if the input hour is solar time. (Default: False)
Returns:

A sun object for this particular time

calculate_sun_from_date_time(datetime, is_solar_time=False)[source]

Get Sun for an hour of the year.

This code is originally written by Trygve Wastvedt (Trygve.Wastvedt@gmail.com) based on (NOAA) and modified by Chris Mackey and Mostapha Roudsari

Parameters:
  • datetime – Ladybug datetime
  • is_solar_time – A boolean to indicate if the input hour is solar time. (Default: False)
Returns:

A sun object for this particular time

calculate_sun_from_hoy(hoy, is_solar_time=False)[source]

Get Sun data for an hour of the year.

Parameters:
  • datetime – Ladybug datetime
  • is_solar_time – A boolean to indicate if the input hour is solar time (Default: False).
Returns:

A sun object for this particular time

calculate_sunrise_sunset(month, day, depression=0.833, is_solar_time=False)[source]

Calculate sunrise, noon and sunset.

Returns:A dictionary. Keys are (“sunrise”, “noon”, “sunset”)
calculate_sunrise_sunset_from_datetime(datetime, depression=0.833, is_solar_time=False)[source]

Calculate sunrise, sunset and noon for a day of year.

daylight_saving_period
draw_sunpath(hoys=None, origin=None, scale=1, sun_scale=1, annual=True, rem_night=True)[source]

Create sunpath geometry. This method should only be used from the + libraries.

Parameters:
  • hoys – An optional list of hours of the year(default: None).
  • origin – Sunpath origin(default: (0, 0, 0)).
  • scale – Sunpath scale(default: 1).
  • sun_scale – Scale for the sun spheres(default: 1).
  • annual – Set to True to draw an annual sunpath. Otherwise a daily sunpath is drawn.
  • rem_night – Remove suns which are under the horizon(night!).
Returns:

A collection of curves for base plot. analemma_curves: A collection of analemma_curves. daily_curves: A collection of daily_curves. suns: A list of suns.

Return type:

base_curves

classmethod from_location(location, north_angle=0, daylight_saving_period=None)[source]

Create a sun path from a LBlocation.

is_daylight_saving_hour(datetime)[source]

Check if a datetime is a daylight saving time.

is_leap_year

Indicate is sunpath calculated for a leap year.

latitude

Get/set latitude in degrees.

longitude

Get longitude in degrees.

north_angle
time_zone

ladybug.sunpathplus module

ladybug.wea module

Wea weather file.

class ladybug.wea.Wea(location, direct_normal_radiation, diffuse_horizontal_radiation, timestep=1, is_leap_year=False)[source]

Bases: object

An annual WEA object containing solar radiation.

location

Ladybug location object.

direct_normal_radiation

An annual DataCollection of direct normal radiation values.

diffuse_horizontal_radiation

An annual DataCollection of diffuse horizontal radiation values for every hourly timestep of the year.

timestep

An optional integer to set the number of time steps per hour. Default is 1 for one value per hour.

is_leap_year

A boolean to indicate if values are representing a leap year. Default is False.

ToString()[source]

Overwrite .NET ToString.

datetimes

Datetimes in wea file.

static day_count(is_leap_year)[source]

Number of days in this Wea file.

Keep in mind that wea file is an annual file but this value will be different for a leap year

diffuse_horizontal_radiation

Get or set the diffuse horizontal radiation.

direct_horizontal_radiation

Returns the direct radiation on a horizontal surface at each timestep.

Note that this is different from the direct_normal_radiation needed to construct a Wea, which is NORMAL and not HORIZONTAL.

direct_normal_radiation

Get or set the direct normal radiation.

directional_radiation(altitude=90, azimuth=180, ground_reflectance=0.2, isotrophic=True)[source]

Returns the radiation components facing a given altitude and azimuth.

This method computes unobstructed solar flux facing a given altitude and azimuth. The default is set to return the golbal horizontal radiation, assuming an altitude facing straight up (90 degrees).

Parameters:
  • altitude – A number between -90 and 90 that represents the altitude at which radiation is being evaluated in degrees.
  • azimuth – A number between 0 and 360 that represents the azimuth at wich radiation is being evaluated in degrees.
  • ground_reflectance – A number between 0 and 1 that represents the reflectance of the ground. Default is set to 0.2.
  • isotrophic – A boolean value that sets whether an istotrophic sky is used (as opposed to an anisotrophic sky). An isotrophic sky assummes an even distribution of diffuse radiation across the sky while an anisotrophic sky places more diffuse radiation near the solar disc. Default is set to True for isotrophic
Returns:

A list of total solar radiation at each timestep. direct_radiation: A list of direct solar radiation at each timestep. diffuse_radiation: A list of diffuse sky solar radiation

at each timestep.

reflected_radiation: A list of ground reflected solar radiation

at each timestep.

Return type:

total_radiation

classmethod from_ashrae_clear_sky(location, sky_clearness=1, timestep=1, is_leap_year=False)[source]

Create a wea object representing an original ASHRAE Clear Sky.

The original ASHRAE Clear Sky is intended to determine peak solar load and sizing parmeters for HVAC systems. It is not the sky model currently recommended by ASHRAE since it usually overestimates the amount of solar radiation in comparison to the newer ASHRAE Revised Clear Sky (“Tau Model”). However, the original model here is still useful for cases where monthly optical depth values are not known. For more information on the ASHRAE Clear Sky model, see the EnergyPlus Engineering Reference: https://bigladdersoftware.com/epx/docs/8-9/engineering-reference/climate-calculations.html

Parameters:
  • location – Ladybug location object.
  • sky_clearness – A factor that will be multiplied by the output of the model. This is to help account for locations where clear, dry skies predominate (e.g., at high elevations) or, conversely, where hazy and humid conditions are frequent. See Threlkeld and Jordan (1958) for recommended values. Typical values range from 0.95 to 1.05 and are usually never more than 1.2. Default is set to 1.0.
  • timestep – An optional integer to set the number of time steps per hour. Default is 1 for one value per hour.
  • is_leap_year – A boolean to indicate if values are representing a leap year. Default is False.
classmethod from_ashrae_revised_clear_sky(location, monthly_tau_beam, monthly_tau_diffuse, timestep=1, is_leap_year=False)[source]

Create a wea object representing an ASHRAE Revised Clear Sky (“Tau Model”)

ASHRAE Revised Clear Skies are intended to determine peak solar load and sizing parmeters for HVAC systems. The revised clear sky is currently the default recommended sky model used to autosize HVAC systems in EnergyPlus. For more information on the ASHRAE Revised Clear Sky model, see the EnergyPlus Engineering Reference: https://bigladdersoftware.com/epx/docs/8-9/engineering-reference/climate-calculations.html

Parameters:
  • location – Ladybug location object.
  • monthly_tau_beam – A list of 12 float values indicating the beam optical depth of the sky at each month of the year.
  • monthly_tau_diffuse – A list of 12 float values indicating the diffuse optical depth of the sky at each month of the year.
  • timestep – An optional integer to set the number of time steps per hour. Default is 1 for one value per hour.
  • is_leap_year – A boolean to indicate if values are representing a leap year. Default is False.
classmethod from_epw_file(epwfile, timestep=1)[source]

Create a wea object using the solar radiation values in an epw file.

Parameters:
  • epwfile – Full path to epw weather file.
  • timestep – An optional integer to set the number of time steps per hour. Default is 1 for one value per hour. Note that this input will only do a linear interpolation over the data in the EPW file. While such linear interpolations are suitable for most thermal simulations, where thermal lag “smooths over” the effect of momentary increases in solar energy, it is not recommended for daylight simulations, where momentary increases in solar energy can mean the difference between glare and visual comfort.
classmethod from_json(data)[source]

Create Wea from json file { “location”: {} , // ladybug location schema “direct_normal_radiation”: [], // List of hourly direct normal

radiation data points
“diffuse_horizontal_radiation”: [], // List of hourly diffuse
horizontal radiation data points

“timestep”: float //timestep between measurements, default is 1 }

classmethod from_stat_file(statfile, timestep=1, is_leap_year=False)[source]

Create an ASHRAE Revised Clear Sky wea object from the monthly sky optical depths in a .stat file.

Parameters:
  • statfile – Full path to the .stat file.
  • timestep – An optional integer to set the number of time steps per hour. Default is 1 for one value per hour.
  • is_leap_year – A boolean to indicate if values are representing a leap year. Default is False.
classmethod from_values(location, direct_normal_radiation, diffuse_horizontal_radiation, timestep=1, is_leap_year=False)[source]

Create wea from a list of radiation values.

This method converts input lists to DataCollection.

classmethod from_zhang_huang_solar_model(location, cloud_cover, relative_humidity, dry_bulb_temperature, wind_speed, timestep=1, is_leap_year=False)[source]

Create a wea object from climate data using the Zhang-Huang model.

The Zhang-Huang solar model was developed to estimate solar radiation for weather stations that lack such values, which are typically colleted with a pyranometer. Using total cloud cover, dry-bulb temperature, relative humidity, and wind speed as inputs the Zhang-Huang estimates global horizontal radiation by means of a regression model across these variables. For more information on the Zhang-Huang model, see the EnergyPlus Engineering Reference: https://bigladdersoftware.com/epx/docs/8-7/engineering-reference/climate-calculations.html#zhang-huang-solar-model

Parameters:
  • location – Ladybug location object.
  • cloud_cover – A list of annual float values between 0 and 1 that represent the fraction of the sky dome covered in clouds (0 = clear; 1 = completely overcast)
  • cloud_cover – A list of annual float values between 0 and 1 that represent the fraction of the sky dome covered in clouds (0 = clear; 1 = completely overcast)
  • relative_humidity – A list of annual float values between 0 and 100 that represent the relative humidity in percent.
  • dry_bulb_temperature – A list of annual float values that represent the dry bulb temperature in degrees Celcius.
  • wind_speed – A list of annual float values that represent the wind speed in meters per second.
  • timestep – An optional integer to set the number of time steps per hour. Default is 1 for one value per hour.
  • is_leap_year – A boolean to indicate if values are representing a leap year. Default is False.
get_radiation_values(month, day, hour)[source]

Get direct and diffuse radiation values for a point in time.

get_radiation_values_for_hoy(hoy)[source]

Get direct and diffuse radiation values for an hoy.

global_horizontal_radiation

Returns the global horizontal radiation at each timestep.

header

Wea header.

hoys

Hours of the year in wea file.

isWea

Return True.

is_leap_year

Return the timestep.

timestep

Return the timestep.

to_json()[source]

Write Wea to json file { “location”: {} , // ladybug location schema “direct_normal_radiation”: (), // Tuple of hourly direct normal

radiation
“diffuse_horizontal_radiation”: (), // Tuple of hourly diffuse
horizontal radiation

“timestep”: float //timestep between measurements, default is 1 }

write(file_path, hoys=None, write_hours=False)[source]

Write the wea file.

WEA carries radiation values from epw and is what gendaymtx uses to generate the sky.

Module contents