repository_name stringlengths 7 55 | func_path_in_repository stringlengths 4 223 | func_name stringlengths 1 134 | whole_func_string stringlengths 75 104k | language stringclasses 1
value | func_code_string stringlengths 75 104k | func_code_tokens listlengths 19 28.4k | func_documentation_string stringlengths 1 46.9k | func_documentation_tokens listlengths 1 1.97k | split_name stringclasses 1
value | func_code_url stringlengths 87 315 |
|---|---|---|---|---|---|---|---|---|---|---|
ladybug-tools/ladybug | ladybug/datacollection.py | HourlyDiscontinuousCollection.convert_to_culled_timestep | def convert_to_culled_timestep(self, timestep=1):
"""Convert this collection to one that only has datetimes that fit a timestep."""
valid_s = self.header.analysis_period.VALIDTIMESTEPS.keys()
assert timestep in valid_s, \
'timestep {} is not valid. Choose from: {}'.format(timestep, v... | python | def convert_to_culled_timestep(self, timestep=1):
"""Convert this collection to one that only has datetimes that fit a timestep."""
valid_s = self.header.analysis_period.VALIDTIMESTEPS.keys()
assert timestep in valid_s, \
'timestep {} is not valid. Choose from: {}'.format(timestep, v... | [
"def",
"convert_to_culled_timestep",
"(",
"self",
",",
"timestep",
"=",
"1",
")",
":",
"valid_s",
"=",
"self",
".",
"header",
".",
"analysis_period",
".",
"VALIDTIMESTEPS",
".",
"keys",
"(",
")",
"assert",
"timestep",
"in",
"valid_s",
",",
"'timestep {} is not... | Convert this collection to one that only has datetimes that fit a timestep. | [
"Convert",
"this",
"collection",
"to",
"one",
"that",
"only",
"has",
"datetimes",
"that",
"fit",
"a",
"timestep",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L303-L312 |
ladybug-tools/ladybug | ladybug/datacollection.py | HourlyDiscontinuousCollection.validate_analysis_period | def validate_analysis_period(self):
"""Get a collection where the header analysis_period aligns with datetimes.
This means that checks for five criteria will be performed:
1) All datetimes in the data collection are in chronological orderstarting
from the analysis_period start hour ... | python | def validate_analysis_period(self):
"""Get a collection where the header analysis_period aligns with datetimes.
This means that checks for five criteria will be performed:
1) All datetimes in the data collection are in chronological orderstarting
from the analysis_period start hour ... | [
"def",
"validate_analysis_period",
"(",
"self",
")",
":",
"a_per",
"=",
"self",
".",
"header",
".",
"analysis_period",
"n_ap",
"=",
"[",
"a_per",
".",
"st_month",
",",
"a_per",
".",
"st_day",
",",
"a_per",
".",
"st_hour",
",",
"a_per",
".",
"end_month",
... | Get a collection where the header analysis_period aligns with datetimes.
This means that checks for five criteria will be performed:
1) All datetimes in the data collection are in chronological orderstarting
from the analysis_period start hour to the end hour.
2) No duplicate dateti... | [
"Get",
"a",
"collection",
"where",
"the",
"header",
"analysis_period",
"aligns",
"with",
"datetimes",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L314-L398 |
ladybug-tools/ladybug | ladybug/datacollection.py | HourlyDiscontinuousCollection._xxrange | def _xxrange(self, start, end, step_count):
"""Generate n values between start and end."""
_step = (end - start) / float(step_count)
return (start + (i * _step) for i in xrange(int(step_count))) | python | def _xxrange(self, start, end, step_count):
"""Generate n values between start and end."""
_step = (end - start) / float(step_count)
return (start + (i * _step) for i in xrange(int(step_count))) | [
"def",
"_xxrange",
"(",
"self",
",",
"start",
",",
"end",
",",
"step_count",
")",
":",
"_step",
"=",
"(",
"end",
"-",
"start",
")",
"/",
"float",
"(",
"step_count",
")",
"return",
"(",
"start",
"+",
"(",
"i",
"*",
"_step",
")",
"for",
"i",
"in",
... | Generate n values between start and end. | [
"Generate",
"n",
"values",
"between",
"start",
"and",
"end",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L409-L412 |
ladybug-tools/ladybug | ladybug/datacollection.py | HourlyDiscontinuousCollection._filter_by_moys_slow | def _filter_by_moys_slow(self, moys):
"""Filter the Data Collection with a slow method that always works."""
_filt_values = []
_filt_datetimes = []
for i, d in enumerate(self.datetimes):
if d.moy in moys:
_filt_datetimes.append(d)
_filt_values.... | python | def _filter_by_moys_slow(self, moys):
"""Filter the Data Collection with a slow method that always works."""
_filt_values = []
_filt_datetimes = []
for i, d in enumerate(self.datetimes):
if d.moy in moys:
_filt_datetimes.append(d)
_filt_values.... | [
"def",
"_filter_by_moys_slow",
"(",
"self",
",",
"moys",
")",
":",
"_filt_values",
"=",
"[",
"]",
"_filt_datetimes",
"=",
"[",
"]",
"for",
"i",
",",
"d",
"in",
"enumerate",
"(",
"self",
".",
"datetimes",
")",
":",
"if",
"d",
".",
"moy",
"in",
"moys",... | Filter the Data Collection with a slow method that always works. | [
"Filter",
"the",
"Data",
"Collection",
"with",
"a",
"slow",
"method",
"that",
"always",
"works",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L414-L422 |
ladybug-tools/ladybug | ladybug/datacollection.py | HourlyDiscontinuousCollection._timestep_cull | def _timestep_cull(self, timestep):
"""Cull out values that do not fit a timestep."""
new_values = []
new_datetimes = []
mins_per_step = int(60 / timestep)
for i, date_t in enumerate(self.datetimes):
if date_t.moy % mins_per_step == 0:
new_datetimes.ap... | python | def _timestep_cull(self, timestep):
"""Cull out values that do not fit a timestep."""
new_values = []
new_datetimes = []
mins_per_step = int(60 / timestep)
for i, date_t in enumerate(self.datetimes):
if date_t.moy % mins_per_step == 0:
new_datetimes.ap... | [
"def",
"_timestep_cull",
"(",
"self",
",",
"timestep",
")",
":",
"new_values",
"=",
"[",
"]",
"new_datetimes",
"=",
"[",
"]",
"mins_per_step",
"=",
"int",
"(",
"60",
"/",
"timestep",
")",
"for",
"i",
",",
"date_t",
"in",
"enumerate",
"(",
"self",
".",
... | Cull out values that do not fit a timestep. | [
"Cull",
"out",
"values",
"that",
"do",
"not",
"fit",
"a",
"timestep",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L424-L437 |
ladybug-tools/ladybug | ladybug/datacollection.py | HourlyDiscontinuousCollection._time_interval_operation | def _time_interval_operation(self, interval, operation, percentile=0):
"""Get a collection of a certain time interval with a given math operation."""
# retrive the function that correctly describes the operation
if operation == 'average':
funct = self._average
elif operation ... | python | def _time_interval_operation(self, interval, operation, percentile=0):
"""Get a collection of a certain time interval with a given math operation."""
# retrive the function that correctly describes the operation
if operation == 'average':
funct = self._average
elif operation ... | [
"def",
"_time_interval_operation",
"(",
"self",
",",
"interval",
",",
"operation",
",",
"percentile",
"=",
"0",
")",
":",
"# retrive the function that correctly describes the operation",
"if",
"operation",
"==",
"'average'",
":",
"funct",
"=",
"self",
".",
"_average",... | Get a collection of a certain time interval with a given math operation. | [
"Get",
"a",
"collection",
"of",
"a",
"certain",
"time",
"interval",
"with",
"a",
"given",
"math",
"operation",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L449-L495 |
ladybug-tools/ladybug | ladybug/datacollection.py | HourlyContinuousCollection.from_json | def from_json(cls, data):
"""Create a Data Collection from a dictionary.
Args:
{
"header": A Ladybug Header,
"values": An array of values,
}
"""
assert 'header' in data, 'Required keyword "header" is missing!'
assert 'value... | python | def from_json(cls, data):
"""Create a Data Collection from a dictionary.
Args:
{
"header": A Ladybug Header,
"values": An array of values,
}
"""
assert 'header' in data, 'Required keyword "header" is missing!'
assert 'value... | [
"def",
"from_json",
"(",
"cls",
",",
"data",
")",
":",
"assert",
"'header'",
"in",
"data",
",",
"'Required keyword \"header\" is missing!'",
"assert",
"'values'",
"in",
"data",
",",
"'Required keyword \"values\" is missing!'",
"return",
"cls",
"(",
"Header",
".",
"f... | Create a Data Collection from a dictionary.
Args:
{
"header": A Ladybug Header,
"values": An array of values,
} | [
"Create",
"a",
"Data",
"Collection",
"from",
"a",
"dictionary",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L540-L551 |
ladybug-tools/ladybug | ladybug/datacollection.py | HourlyContinuousCollection.datetimes | def datetimes(self):
"""Return datetimes for this collection as a tuple."""
if self._datetimes is None:
self._datetimes = tuple(self.header.analysis_period.datetimes)
return self._datetimes | python | def datetimes(self):
"""Return datetimes for this collection as a tuple."""
if self._datetimes is None:
self._datetimes = tuple(self.header.analysis_period.datetimes)
return self._datetimes | [
"def",
"datetimes",
"(",
"self",
")",
":",
"if",
"self",
".",
"_datetimes",
"is",
"None",
":",
"self",
".",
"_datetimes",
"=",
"tuple",
"(",
"self",
".",
"header",
".",
"analysis_period",
".",
"datetimes",
")",
"return",
"self",
".",
"_datetimes"
] | Return datetimes for this collection as a tuple. | [
"Return",
"datetimes",
"for",
"this",
"collection",
"as",
"a",
"tuple",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L554-L558 |
ladybug-tools/ladybug | ladybug/datacollection.py | HourlyContinuousCollection.interpolate_to_timestep | def interpolate_to_timestep(self, timestep, cumulative=None):
"""Interpolate data for a finer timestep using a linear interpolation.
Args:
timestep: Target timestep as an integer. Target timestep must be
divisable by current timestep.
cumulative: A boolean that s... | python | def interpolate_to_timestep(self, timestep, cumulative=None):
"""Interpolate data for a finer timestep using a linear interpolation.
Args:
timestep: Target timestep as an integer. Target timestep must be
divisable by current timestep.
cumulative: A boolean that s... | [
"def",
"interpolate_to_timestep",
"(",
"self",
",",
"timestep",
",",
"cumulative",
"=",
"None",
")",
":",
"assert",
"timestep",
"%",
"self",
".",
"header",
".",
"analysis_period",
".",
"timestep",
"==",
"0",
",",
"'Target timestep({}) must be divisable by current ti... | Interpolate data for a finer timestep using a linear interpolation.
Args:
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 colec... | [
"Interpolate",
"data",
"for",
"a",
"finer",
"timestep",
"using",
"a",
"linear",
"interpolation",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L567-L616 |
ladybug-tools/ladybug | ladybug/datacollection.py | HourlyContinuousCollection.filter_by_conditional_statement | def filter_by_conditional_statement(self, statement):
"""Filter the Data Collection based on a conditional statement.
Args:
statement: A conditional statement as a string (e.g. a > 25 and a%5 == 0).
The variable should always be named as 'a' (without quotations).
Re... | python | def filter_by_conditional_statement(self, statement):
"""Filter the Data Collection based on a conditional statement.
Args:
statement: A conditional statement as a string (e.g. a > 25 and a%5 == 0).
The variable should always be named as 'a' (without quotations).
Re... | [
"def",
"filter_by_conditional_statement",
"(",
"self",
",",
"statement",
")",
":",
"_filt_values",
",",
"_filt_datetimes",
"=",
"self",
".",
"_filter_by_statement",
"(",
"statement",
")",
"collection",
"=",
"HourlyDiscontinuousCollection",
"(",
"self",
".",
"header",
... | Filter the Data Collection based on a conditional statement.
Args:
statement: A conditional statement as a string (e.g. a > 25 and a%5 == 0).
The variable should always be named as 'a' (without quotations).
Return:
A new Data Collection containing only the filte... | [
"Filter",
"the",
"Data",
"Collection",
"based",
"on",
"a",
"conditional",
"statement",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L618-L632 |
ladybug-tools/ladybug | ladybug/datacollection.py | HourlyContinuousCollection.filter_by_pattern | def filter_by_pattern(self, pattern):
"""Filter the Data Collection based on a list of booleans.
Args:
pattern: A list of True/False values. Typically, this is a list
with a length matching the length of the Data Collections values
but it can also be a patte... | python | def filter_by_pattern(self, pattern):
"""Filter the Data Collection based on a list of booleans.
Args:
pattern: A list of True/False values. Typically, this is a list
with a length matching the length of the Data Collections values
but it can also be a patte... | [
"def",
"filter_by_pattern",
"(",
"self",
",",
"pattern",
")",
":",
"_filt_values",
",",
"_filt_datetimes",
"=",
"self",
".",
"_filter_by_pattern",
"(",
"pattern",
")",
"collection",
"=",
"HourlyDiscontinuousCollection",
"(",
"self",
".",
"header",
".",
"duplicate"... | Filter the Data Collection based on a list of booleans.
Args:
pattern: A list of True/False values. Typically, this is a list
with a length matching the length of the Data Collections values
but it can also be a pattern to be repeated over the Data Collection.
... | [
"Filter",
"the",
"Data",
"Collection",
"based",
"on",
"a",
"list",
"of",
"booleans",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L634-L649 |
ladybug-tools/ladybug | ladybug/datacollection.py | HourlyContinuousCollection.filter_by_analysis_period | def filter_by_analysis_period(self, analysis_period):
"""Filter the Data Collection based on an analysis period.
Args:
analysis period: A Ladybug analysis period
Return:
A new Data Collection with filtered data
"""
self._check_analysis_period(analysis_per... | python | def filter_by_analysis_period(self, analysis_period):
"""Filter the Data Collection based on an analysis period.
Args:
analysis period: A Ladybug analysis period
Return:
A new Data Collection with filtered data
"""
self._check_analysis_period(analysis_per... | [
"def",
"filter_by_analysis_period",
"(",
"self",
",",
"analysis_period",
")",
":",
"self",
".",
"_check_analysis_period",
"(",
"analysis_period",
")",
"analysis_period",
"=",
"self",
".",
"_get_analysis_period_subset",
"(",
"analysis_period",
")",
"if",
"analysis_period... | Filter the Data Collection based on an analysis period.
Args:
analysis period: A Ladybug analysis period
Return:
A new Data Collection with filtered data | [
"Filter",
"the",
"Data",
"Collection",
"based",
"on",
"an",
"analysis",
"period",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L651-L681 |
ladybug-tools/ladybug | ladybug/datacollection.py | HourlyContinuousCollection.filter_by_hoys | def filter_by_hoys(self, hoys):
"""Filter the Data Collection based onva list of hoys.
Args:
hoys: A List of hours of the year 0..8759
Return:
A new Data Collection with filtered data
"""
existing_hoys = self.header.analysis_period.hoys
hoys = [h ... | python | def filter_by_hoys(self, hoys):
"""Filter the Data Collection based onva list of hoys.
Args:
hoys: A List of hours of the year 0..8759
Return:
A new Data Collection with filtered data
"""
existing_hoys = self.header.analysis_period.hoys
hoys = [h ... | [
"def",
"filter_by_hoys",
"(",
"self",
",",
"hoys",
")",
":",
"existing_hoys",
"=",
"self",
".",
"header",
".",
"analysis_period",
".",
"hoys",
"hoys",
"=",
"[",
"h",
"for",
"h",
"in",
"hoys",
"if",
"h",
"in",
"existing_hoys",
"]",
"_moys",
"=",
"tuple"... | Filter the Data Collection based onva list of hoys.
Args:
hoys: A List of hours of the year 0..8759
Return:
A new Data Collection with filtered data | [
"Filter",
"the",
"Data",
"Collection",
"based",
"onva",
"list",
"of",
"hoys",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L683-L695 |
ladybug-tools/ladybug | ladybug/datacollection.py | HourlyContinuousCollection.filter_by_moys | def filter_by_moys(self, moys):
"""Filter the Data Collection based on a list of minutes of the year.
Args:
moys: A List of minutes of the year [0..8759 * 60]
Return:
A new Data Collection with filtered data
"""
t_s = 60 / self.header.analysis_period.time... | python | def filter_by_moys(self, moys):
"""Filter the Data Collection based on a list of minutes of the year.
Args:
moys: A List of minutes of the year [0..8759 * 60]
Return:
A new Data Collection with filtered data
"""
t_s = 60 / self.header.analysis_period.time... | [
"def",
"filter_by_moys",
"(",
"self",
",",
"moys",
")",
":",
"t_s",
"=",
"60",
"/",
"self",
".",
"header",
".",
"analysis_period",
".",
"timestep",
"st_ind",
"=",
"self",
".",
"header",
".",
"analysis_period",
".",
"st_time",
".",
"moy",
"/",
"t_s",
"i... | Filter the Data Collection based on a list of minutes of the year.
Args:
moys: A List of minutes of the year [0..8759 * 60]
Return:
A new Data Collection with filtered data | [
"Filter",
"the",
"Data",
"Collection",
"based",
"on",
"a",
"list",
"of",
"minutes",
"of",
"the",
"year",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L697-L728 |
ladybug-tools/ladybug | ladybug/datacollection.py | HourlyContinuousCollection.group_by_day | def group_by_day(self):
"""Return a dictionary of this collection's values grouped by each day of year.
Key values are between 1-365.
"""
hourly_data_by_day = OrderedDict()
for d in xrange(1, 366):
hourly_data_by_day[d] = []
a_per = self.header.analysis_perio... | python | def group_by_day(self):
"""Return a dictionary of this collection's values grouped by each day of year.
Key values are between 1-365.
"""
hourly_data_by_day = OrderedDict()
for d in xrange(1, 366):
hourly_data_by_day[d] = []
a_per = self.header.analysis_perio... | [
"def",
"group_by_day",
"(",
"self",
")",
":",
"hourly_data_by_day",
"=",
"OrderedDict",
"(",
")",
"for",
"d",
"in",
"xrange",
"(",
"1",
",",
"366",
")",
":",
"hourly_data_by_day",
"[",
"d",
"]",
"=",
"[",
"]",
"a_per",
"=",
"self",
".",
"header",
"."... | Return a dictionary of this collection's values grouped by each day of year.
Key values are between 1-365. | [
"Return",
"a",
"dictionary",
"of",
"this",
"collection",
"s",
"values",
"grouped",
"by",
"each",
"day",
"of",
"year",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L730-L755 |
ladybug-tools/ladybug | ladybug/datacollection.py | HourlyContinuousCollection.group_by_month | def group_by_month(self):
"""Return a dictionary of this collection's values grouped by each month.
Key values are between 1-12.
"""
hourly_data_by_month = OrderedDict()
for d in xrange(1, 13):
hourly_data_by_month[d] = []
a_per = self.header.analysis_period... | python | def group_by_month(self):
"""Return a dictionary of this collection's values grouped by each month.
Key values are between 1-12.
"""
hourly_data_by_month = OrderedDict()
for d in xrange(1, 13):
hourly_data_by_month[d] = []
a_per = self.header.analysis_period... | [
"def",
"group_by_month",
"(",
"self",
")",
":",
"hourly_data_by_month",
"=",
"OrderedDict",
"(",
")",
"for",
"d",
"in",
"xrange",
"(",
"1",
",",
"13",
")",
":",
"hourly_data_by_month",
"[",
"d",
"]",
"=",
"[",
"]",
"a_per",
"=",
"self",
".",
"header",
... | Return a dictionary of this collection's values grouped by each month.
Key values are between 1-12. | [
"Return",
"a",
"dictionary",
"of",
"this",
"collection",
"s",
"values",
"grouped",
"by",
"each",
"month",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L757-L780 |
ladybug-tools/ladybug | ladybug/datacollection.py | HourlyContinuousCollection.to_immutable | def to_immutable(self):
"""Get an immutable version of this collection."""
if self._enumeration is None:
self._get_mutable_enumeration()
col_obj = self._enumeration['immutable'][self._collection_type]
return col_obj(self.header, self.values) | python | def to_immutable(self):
"""Get an immutable version of this collection."""
if self._enumeration is None:
self._get_mutable_enumeration()
col_obj = self._enumeration['immutable'][self._collection_type]
return col_obj(self.header, self.values) | [
"def",
"to_immutable",
"(",
"self",
")",
":",
"if",
"self",
".",
"_enumeration",
"is",
"None",
":",
"self",
".",
"_get_mutable_enumeration",
"(",
")",
"col_obj",
"=",
"self",
".",
"_enumeration",
"[",
"'immutable'",
"]",
"[",
"self",
".",
"_collection_type",... | Get an immutable version of this collection. | [
"Get",
"an",
"immutable",
"version",
"of",
"this",
"collection",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L782-L787 |
ladybug-tools/ladybug | ladybug/datacollection.py | HourlyContinuousCollection.is_collection_aligned | def is_collection_aligned(self, data_collection):
"""Check if this Data Collection is aligned with another.
Aligned Data Collections are of the same Data Collection class,
have the same number of values and have matching datetimes.
Args:
data_collection: The Data Collection... | python | def is_collection_aligned(self, data_collection):
"""Check if this Data Collection is aligned with another.
Aligned Data Collections are of the same Data Collection class,
have the same number of values and have matching datetimes.
Args:
data_collection: The Data Collection... | [
"def",
"is_collection_aligned",
"(",
"self",
",",
"data_collection",
")",
":",
"if",
"self",
".",
"_collection_type",
"!=",
"data_collection",
".",
"_collection_type",
":",
"return",
"False",
"elif",
"len",
"(",
"self",
".",
"values",
")",
"!=",
"len",
"(",
... | Check if this Data Collection is aligned with another.
Aligned Data Collections are of the same Data Collection class,
have the same number of values and have matching datetimes.
Args:
data_collection: The Data Collection which you want to test if this
collection is... | [
"Check",
"if",
"this",
"Data",
"Collection",
"is",
"aligned",
"with",
"another",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L833-L852 |
ladybug-tools/ladybug | ladybug/datacollection.py | HourlyContinuousCollection.to_discontinuous | def to_discontinuous(self):
"""Return a discontinuous version of the current collection."""
collection = HourlyDiscontinuousCollection(self.header.duplicate(),
self.values, self.datetimes)
collection._validated_a_period = True
return col... | python | def to_discontinuous(self):
"""Return a discontinuous version of the current collection."""
collection = HourlyDiscontinuousCollection(self.header.duplicate(),
self.values, self.datetimes)
collection._validated_a_period = True
return col... | [
"def",
"to_discontinuous",
"(",
"self",
")",
":",
"collection",
"=",
"HourlyDiscontinuousCollection",
"(",
"self",
".",
"header",
".",
"duplicate",
"(",
")",
",",
"self",
".",
"values",
",",
"self",
".",
"datetimes",
")",
"collection",
".",
"_validated_a_perio... | Return a discontinuous version of the current collection. | [
"Return",
"a",
"discontinuous",
"version",
"of",
"the",
"current",
"collection",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L854-L859 |
ladybug-tools/ladybug | ladybug/datacollection.py | HourlyContinuousCollection._get_analysis_period_subset | def _get_analysis_period_subset(self, a_per):
"""Return an analysis_period is always a subset of the Data Collection"""
if self.header.analysis_period.is_annual:
return a_per
new_needed = False
n_ap = [a_per.st_month, a_per.st_day, a_per.st_hour,
a_per.end_mo... | python | def _get_analysis_period_subset(self, a_per):
"""Return an analysis_period is always a subset of the Data Collection"""
if self.header.analysis_period.is_annual:
return a_per
new_needed = False
n_ap = [a_per.st_month, a_per.st_day, a_per.st_hour,
a_per.end_mo... | [
"def",
"_get_analysis_period_subset",
"(",
"self",
",",
"a_per",
")",
":",
"if",
"self",
".",
"header",
".",
"analysis_period",
".",
"is_annual",
":",
"return",
"a_per",
"new_needed",
"=",
"False",
"n_ap",
"=",
"[",
"a_per",
".",
"st_month",
",",
"a_per",
... | Return an analysis_period is always a subset of the Data Collection | [
"Return",
"an",
"analysis_period",
"is",
"always",
"a",
"subset",
"of",
"the",
"Data",
"Collection"
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L875-L901 |
ladybug-tools/ladybug | ladybug/datacollection.py | HourlyContinuousCollection._check_values | def _check_values(self, values):
"""Check values whenever they come through the values setter."""
assert isinstance(values, Iterable) and not isinstance(
values, (str, dict, bytes, bytearray)), \
'values should be a list or tuple. Got {}'.format(type(values))
if self.head... | python | def _check_values(self, values):
"""Check values whenever they come through the values setter."""
assert isinstance(values, Iterable) and not isinstance(
values, (str, dict, bytes, bytearray)), \
'values should be a list or tuple. Got {}'.format(type(values))
if self.head... | [
"def",
"_check_values",
"(",
"self",
",",
"values",
")",
":",
"assert",
"isinstance",
"(",
"values",
",",
"Iterable",
")",
"and",
"not",
"isinstance",
"(",
"values",
",",
"(",
"str",
",",
"dict",
",",
"bytes",
",",
"bytearray",
")",
")",
",",
"'values ... | Check values whenever they come through the values setter. | [
"Check",
"values",
"whenever",
"they",
"come",
"through",
"the",
"values",
"setter",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L903-L916 |
ladybug-tools/ladybug | ladybug/datacollection.py | DailyCollection.filter_by_analysis_period | def filter_by_analysis_period(self, analysis_period):
"""Filter the Data Collection based on an analysis period.
Args:
analysis period: A Ladybug analysis period
Return:
A new Data Collection with filtered data
"""
self._check_analysis_period(analysis_per... | python | def filter_by_analysis_period(self, analysis_period):
"""Filter the Data Collection based on an analysis period.
Args:
analysis period: A Ladybug analysis period
Return:
A new Data Collection with filtered data
"""
self._check_analysis_period(analysis_per... | [
"def",
"filter_by_analysis_period",
"(",
"self",
",",
"analysis_period",
")",
":",
"self",
".",
"_check_analysis_period",
"(",
"analysis_period",
")",
"_filtered_data",
"=",
"self",
".",
"filter_by_doys",
"(",
"analysis_period",
".",
"doys_int",
")",
"_filtered_data",... | Filter the Data Collection based on an analysis period.
Args:
analysis period: A Ladybug analysis period
Return:
A new Data Collection with filtered data | [
"Filter",
"the",
"Data",
"Collection",
"based",
"on",
"an",
"analysis",
"period",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L963-L975 |
ladybug-tools/ladybug | ladybug/datacollection.py | DailyCollection.filter_by_doys | def filter_by_doys(self, doys):
"""Filter the Data Collection based on a list of days of the year (as integers).
Args:
doys: A List of days of the year [1..365]
Return:
A new Data Collection with filtered data
"""
_filt_values = []
_filt_datetimes... | python | def filter_by_doys(self, doys):
"""Filter the Data Collection based on a list of days of the year (as integers).
Args:
doys: A List of days of the year [1..365]
Return:
A new Data Collection with filtered data
"""
_filt_values = []
_filt_datetimes... | [
"def",
"filter_by_doys",
"(",
"self",
",",
"doys",
")",
":",
"_filt_values",
"=",
"[",
"]",
"_filt_datetimes",
"=",
"[",
"]",
"for",
"i",
",",
"d",
"in",
"enumerate",
"(",
"self",
".",
"datetimes",
")",
":",
"if",
"d",
"in",
"doys",
":",
"_filt_datet... | Filter the Data Collection based on a list of days of the year (as integers).
Args:
doys: A List of days of the year [1..365]
Return:
A new Data Collection with filtered data | [
"Filter",
"the",
"Data",
"Collection",
"based",
"on",
"a",
"list",
"of",
"days",
"of",
"the",
"year",
"(",
"as",
"integers",
")",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L977-L993 |
ladybug-tools/ladybug | ladybug/datacollection.py | DailyCollection.validate_analysis_period | def validate_analysis_period(self):
"""Get a collection where the header analysis_period aligns with datetimes.
This means that checks for four criteria will be performed:
1) All days in the data collection are chronological starting from the
analysis_period start day to the end day... | python | def validate_analysis_period(self):
"""Get a collection where the header analysis_period aligns with datetimes.
This means that checks for four criteria will be performed:
1) All days in the data collection are chronological starting from the
analysis_period start day to the end day... | [
"def",
"validate_analysis_period",
"(",
"self",
")",
":",
"a_per",
"=",
"self",
".",
"header",
".",
"analysis_period",
"n_ap",
"=",
"[",
"a_per",
".",
"st_month",
",",
"a_per",
".",
"st_day",
",",
"a_per",
".",
"st_hour",
",",
"a_per",
".",
"end_month",
... | Get a collection where the header analysis_period aligns with datetimes.
This means that checks for four criteria will be performed:
1) All days in the data collection are chronological starting from the
analysis_period start day to the end day.
2) No duplicate days exist in the dat... | [
"Get",
"a",
"collection",
"where",
"the",
"header",
"analysis_period",
"aligns",
"with",
"datetimes",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L1025-L1087 |
ladybug-tools/ladybug | ladybug/datacollection.py | DailyCollection._monthly_operation | def _monthly_operation(self, operation, percentile=0):
"""Get a MonthlyCollection given a certain operation."""
# Retrive the correct operation.
if operation == 'average':
funct = self._average
elif operation == 'total':
funct = self._total
else:
... | python | def _monthly_operation(self, operation, percentile=0):
"""Get a MonthlyCollection given a certain operation."""
# Retrive the correct operation.
if operation == 'average':
funct = self._average
elif operation == 'total':
funct = self._total
else:
... | [
"def",
"_monthly_operation",
"(",
"self",
",",
"operation",
",",
"percentile",
"=",
"0",
")",
":",
"# Retrive the correct operation.",
"if",
"operation",
"==",
"'average'",
":",
"funct",
"=",
"self",
".",
"_average",
"elif",
"operation",
"==",
"'total'",
":",
... | Get a MonthlyCollection given a certain operation. | [
"Get",
"a",
"MonthlyCollection",
"given",
"a",
"certain",
"operation",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L1095-L1124 |
ladybug-tools/ladybug | ladybug/datacollection.py | MonthlyCollection.filter_by_analysis_period | def filter_by_analysis_period(self, analysis_period):
"""Filter the Data Collection based on an analysis period.
Args:
analysis period: A Ladybug analysis period
Return:
A new Data Collection with filtered data
"""
_filtered_data = self.filter_by_months(a... | python | def filter_by_analysis_period(self, analysis_period):
"""Filter the Data Collection based on an analysis period.
Args:
analysis period: A Ladybug analysis period
Return:
A new Data Collection with filtered data
"""
_filtered_data = self.filter_by_months(a... | [
"def",
"filter_by_analysis_period",
"(",
"self",
",",
"analysis_period",
")",
":",
"_filtered_data",
"=",
"self",
".",
"filter_by_months",
"(",
"analysis_period",
".",
"months_int",
")",
"_filtered_data",
".",
"header",
".",
"_analysis_period",
"=",
"analysis_period",... | Filter the Data Collection based on an analysis period.
Args:
analysis period: A Ladybug analysis period
Return:
A new Data Collection with filtered data | [
"Filter",
"the",
"Data",
"Collection",
"based",
"on",
"an",
"analysis",
"period",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L1176-L1187 |
ladybug-tools/ladybug | ladybug/datacollection.py | MonthlyCollection.filter_by_months | def filter_by_months(self, months):
"""Filter the Data Collection based on a list of months of the year (as integers).
Args:
months: A List of months of the year [1..12]
Return:
A new Data Collection with filtered data
"""
_filt_values = []
_filt_... | python | def filter_by_months(self, months):
"""Filter the Data Collection based on a list of months of the year (as integers).
Args:
months: A List of months of the year [1..12]
Return:
A new Data Collection with filtered data
"""
_filt_values = []
_filt_... | [
"def",
"filter_by_months",
"(",
"self",
",",
"months",
")",
":",
"_filt_values",
"=",
"[",
"]",
"_filt_datetimes",
"=",
"[",
"]",
"for",
"i",
",",
"d",
"in",
"enumerate",
"(",
"self",
".",
"datetimes",
")",
":",
"if",
"d",
"in",
"months",
":",
"_filt... | Filter the Data Collection based on a list of months of the year (as integers).
Args:
months: A List of months of the year [1..12]
Return:
A new Data Collection with filtered data | [
"Filter",
"the",
"Data",
"Collection",
"based",
"on",
"a",
"list",
"of",
"months",
"of",
"the",
"year",
"(",
"as",
"integers",
")",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L1189-L1205 |
ladybug-tools/ladybug | ladybug/datacollection.py | MonthlyCollection.validate_analysis_period | def validate_analysis_period(self):
"""Get a collection where the header analysis_period aligns with datetimes.
This means that checks for three criteria will be performed:
1) All months in the data collection are chronological starting from the
analysis_period start month to the en... | python | def validate_analysis_period(self):
"""Get a collection where the header analysis_period aligns with datetimes.
This means that checks for three criteria will be performed:
1) All months in the data collection are chronological starting from the
analysis_period start month to the en... | [
"def",
"validate_analysis_period",
"(",
"self",
")",
":",
"a_per",
"=",
"self",
".",
"header",
".",
"analysis_period",
"n_ap",
"=",
"[",
"a_per",
".",
"st_month",
",",
"a_per",
".",
"end_month",
"]",
"# make sure that months are in chronological order.",
"sort_datet... | Get a collection where the header analysis_period aligns with datetimes.
This means that checks for three criteria will be performed:
1) All months in the data collection are chronological starting from the
analysis_period start month to the end month.
2) No duplicate months exist i... | [
"Get",
"a",
"collection",
"where",
"the",
"header",
"analysis_period",
"aligns",
"with",
"datetimes",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L1207-L1256 |
ladybug-tools/ladybug | ladybug/datacollection.py | MonthlyCollection.is_continuous | def is_continuous(self):
"""Boolean denoting whether the data collection is continuous."""
if self._validated_a_period is True and \
len(self.values) == len(self.header.analysis_period.months_int):
return True
else:
return False | python | def is_continuous(self):
"""Boolean denoting whether the data collection is continuous."""
if self._validated_a_period is True and \
len(self.values) == len(self.header.analysis_period.months_int):
return True
else:
return False | [
"def",
"is_continuous",
"(",
"self",
")",
":",
"if",
"self",
".",
"_validated_a_period",
"is",
"True",
"and",
"len",
"(",
"self",
".",
"values",
")",
"==",
"len",
"(",
"self",
".",
"header",
".",
"analysis_period",
".",
"months_int",
")",
":",
"return",
... | Boolean denoting whether the data collection is continuous. | [
"Boolean",
"denoting",
"whether",
"the",
"data",
"collection",
"is",
"continuous",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L1259-L1265 |
ladybug-tools/ladybug | ladybug/datacollection.py | MonthlyPerHourCollection.filter_by_analysis_period | def filter_by_analysis_period(self, analysis_period):
"""Filter the Data Collection based on an analysis period.
Args:
analysis period: A Ladybug analysis period
Return:
A new Data Collection with filtered data
"""
_filtered_data = self.filter_by_months_p... | python | def filter_by_analysis_period(self, analysis_period):
"""Filter the Data Collection based on an analysis period.
Args:
analysis period: A Ladybug analysis period
Return:
A new Data Collection with filtered data
"""
_filtered_data = self.filter_by_months_p... | [
"def",
"filter_by_analysis_period",
"(",
"self",
",",
"analysis_period",
")",
":",
"_filtered_data",
"=",
"self",
".",
"filter_by_months_per_hour",
"(",
"analysis_period",
".",
"months_per_hour",
")",
"_filtered_data",
".",
"header",
".",
"_analysis_period",
"=",
"ana... | Filter the Data Collection based on an analysis period.
Args:
analysis period: A Ladybug analysis period
Return:
A new Data Collection with filtered data | [
"Filter",
"the",
"Data",
"Collection",
"based",
"on",
"an",
"analysis",
"period",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L1308-L1320 |
ladybug-tools/ladybug | ladybug/datacollection.py | MonthlyPerHourCollection.filter_by_months_per_hour | def filter_by_months_per_hour(self, months_per_hour):
"""Filter the Data Collection based on a list of months per hour (as strings).
Args:
months_per_hour: A list of tuples representing months per hour.
Each tuple should possess two values: the first is the month
... | python | def filter_by_months_per_hour(self, months_per_hour):
"""Filter the Data Collection based on a list of months per hour (as strings).
Args:
months_per_hour: A list of tuples representing months per hour.
Each tuple should possess two values: the first is the month
... | [
"def",
"filter_by_months_per_hour",
"(",
"self",
",",
"months_per_hour",
")",
":",
"_filt_values",
"=",
"[",
"]",
"_filt_datetimes",
"=",
"[",
"]",
"for",
"i",
",",
"d",
"in",
"enumerate",
"(",
"self",
".",
"datetimes",
")",
":",
"if",
"d",
"in",
"months... | Filter the Data Collection based on a list of months per hour (as strings).
Args:
months_per_hour: A list of tuples representing months per hour.
Each tuple should possess two values: the first is the month
and the second is the hour. (eg. (12, 23) = December at 11 PM)
... | [
"Filter",
"the",
"Data",
"Collection",
"based",
"on",
"a",
"list",
"of",
"months",
"per",
"hour",
"(",
"as",
"strings",
")",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L1322-L1340 |
ladybug-tools/ladybug | ladybug/datacollection.py | MonthlyPerHourCollection.is_continuous | def is_continuous(self):
"""Boolean denoting whether the data collection is continuous."""
a_per = self.header.analysis_period
if self._validated_a_period is True and a_per.st_hour == 0 and a_per.end_hour \
== 23 and len(self.values) == len(a_per.months_per_hour):
ret... | python | def is_continuous(self):
"""Boolean denoting whether the data collection is continuous."""
a_per = self.header.analysis_period
if self._validated_a_period is True and a_per.st_hour == 0 and a_per.end_hour \
== 23 and len(self.values) == len(a_per.months_per_hour):
ret... | [
"def",
"is_continuous",
"(",
"self",
")",
":",
"a_per",
"=",
"self",
".",
"header",
".",
"analysis_period",
"if",
"self",
".",
"_validated_a_period",
"is",
"True",
"and",
"a_per",
".",
"st_hour",
"==",
"0",
"and",
"a_per",
".",
"end_hour",
"==",
"23",
"a... | Boolean denoting whether the data collection is continuous. | [
"Boolean",
"denoting",
"whether",
"the",
"data",
"collection",
"is",
"continuous",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L1405-L1412 |
ladybug-tools/ladybug | ladybug/datatype/temperaturetime.py | TemperatureTime.to_unit | def to_unit(self, values, unit, from_unit):
"""Return values converted to the unit given the input from_unit."""
return self._to_unit_base('degC-days', values, unit, from_unit) | python | def to_unit(self, values, unit, from_unit):
"""Return values converted to the unit given the input from_unit."""
return self._to_unit_base('degC-days', values, unit, from_unit) | [
"def",
"to_unit",
"(",
"self",
",",
"values",
",",
"unit",
",",
"from_unit",
")",
":",
"return",
"self",
".",
"_to_unit_base",
"(",
"'degC-days'",
",",
"values",
",",
"unit",
",",
"from_unit",
")"
] | Return values converted to the unit given the input from_unit. | [
"Return",
"values",
"converted",
"to",
"the",
"unit",
"given",
"the",
"input",
"from_unit",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datatype/temperaturetime.py#L33-L35 |
ladybug-tools/ladybug | ladybug/datatype/temperaturetime.py | TemperatureTime.to_ip | def to_ip(self, values, from_unit):
"""Return values in IP and the units to which the values have been converted."""
if from_unit in self._ip_units:
return values, from_unit
elif from_unit == 'degC-hours':
return self.to_unit(values, 'degF-hours', from_unit), 'degF-hours'... | python | def to_ip(self, values, from_unit):
"""Return values in IP and the units to which the values have been converted."""
if from_unit in self._ip_units:
return values, from_unit
elif from_unit == 'degC-hours':
return self.to_unit(values, 'degF-hours', from_unit), 'degF-hours'... | [
"def",
"to_ip",
"(",
"self",
",",
"values",
",",
"from_unit",
")",
":",
"if",
"from_unit",
"in",
"self",
".",
"_ip_units",
":",
"return",
"values",
",",
"from_unit",
"elif",
"from_unit",
"==",
"'degC-hours'",
":",
"return",
"self",
".",
"to_unit",
"(",
"... | Return values in IP and the units to which the values have been converted. | [
"Return",
"values",
"in",
"IP",
"and",
"the",
"units",
"to",
"which",
"the",
"values",
"have",
"been",
"converted",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datatype/temperaturetime.py#L37-L44 |
ladybug-tools/ladybug | ladybug/datatype/temperaturetime.py | TemperatureTime.to_si | def to_si(self, values, from_unit):
"""Return values in SI and the units to which the values have been converted."""
if from_unit in self._si_units:
return values, from_unit
elif from_unit == 'degF-hours':
return self.to_unit(values, 'degC-hours', from_unit), 'degC-hours'... | python | def to_si(self, values, from_unit):
"""Return values in SI and the units to which the values have been converted."""
if from_unit in self._si_units:
return values, from_unit
elif from_unit == 'degF-hours':
return self.to_unit(values, 'degC-hours', from_unit), 'degC-hours'... | [
"def",
"to_si",
"(",
"self",
",",
"values",
",",
"from_unit",
")",
":",
"if",
"from_unit",
"in",
"self",
".",
"_si_units",
":",
"return",
"values",
",",
"from_unit",
"elif",
"from_unit",
"==",
"'degF-hours'",
":",
"return",
"self",
".",
"to_unit",
"(",
"... | Return values in SI and the units to which the values have been converted. | [
"Return",
"values",
"in",
"SI",
"and",
"the",
"units",
"to",
"which",
"the",
"values",
"have",
"been",
"converted",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datatype/temperaturetime.py#L46-L53 |
ladybug-tools/ladybug | ladybug/rootfind.py | secant | def secant(a, b, fn, epsilon):
"""
One of the fasest root-finding algorithms.
The method calculates the slope of the function fn and this enables it to converge
to a solution very fast. However, if started too far away from a root, the method
may not converge (returning a None). For this reason,... | python | def secant(a, b, fn, epsilon):
"""
One of the fasest root-finding algorithms.
The method calculates the slope of the function fn and this enables it to converge
to a solution very fast. However, if started too far away from a root, the method
may not converge (returning a None). For this reason,... | [
"def",
"secant",
"(",
"a",
",",
"b",
",",
"fn",
",",
"epsilon",
")",
":",
"f1",
"=",
"fn",
"(",
"a",
")",
"if",
"abs",
"(",
"f1",
")",
"<=",
"epsilon",
":",
"return",
"a",
"f2",
"=",
"fn",
"(",
"b",
")",
"if",
"abs",
"(",
"f2",
")",
"<=",... | One of the fasest root-finding algorithms.
The method calculates the slope of the function fn and this enables it to converge
to a solution very fast. However, if started too far away from a root, the method
may not converge (returning a None). For this reason, it is recommended that this
function b... | [
"One",
"of",
"the",
"fasest",
"root",
"-",
"finding",
"algorithms",
".",
"The",
"method",
"calculates",
"the",
"slope",
"of",
"the",
"function",
"fn",
"and",
"this",
"enables",
"it",
"to",
"converge",
"to",
"a",
"solution",
"very",
"fast",
".",
"However",
... | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/rootfind.py#L6-L53 |
ladybug-tools/ladybug | ladybug/rootfind.py | bisect | def bisect(a, b, fn, epsilon, target):
"""
The simplest root-finding algorithm.
It is extremely reliable. However, it converges slowly for this reason,
it is recommended that this only be used after the secant() method has
returned None.
Args:
a: A lower guess of the value you are tyin... | python | def bisect(a, b, fn, epsilon, target):
"""
The simplest root-finding algorithm.
It is extremely reliable. However, it converges slowly for this reason,
it is recommended that this only be used after the secant() method has
returned None.
Args:
a: A lower guess of the value you are tyin... | [
"def",
"bisect",
"(",
"a",
",",
"b",
",",
"fn",
",",
"epsilon",
",",
"target",
")",
":",
"while",
"(",
"abs",
"(",
"b",
"-",
"a",
")",
">",
"2",
"*",
"epsilon",
")",
":",
"midpoint",
"=",
"(",
"b",
"+",
"a",
")",
"/",
"2",
"a_t",
"=",
"fn... | The simplest root-finding algorithm.
It is extremely reliable. However, it converges slowly for this reason,
it is recommended that this only be used after the secant() method has
returned None.
Args:
a: A lower guess of the value you are tying to find.
b: A higher guess of the value y... | [
"The",
"simplest",
"root",
"-",
"finding",
"algorithm",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/rootfind.py#L56-L98 |
ladybug-tools/ladybug | ladybug/location.py | Location.from_json | def from_json(cls, data):
"""Create a location from a dictionary.
Args:
data: {
"city": "-",
"latitude": 0,
"longitude": 0,
"time_zone": 0,
"elevation": 0}
"""
optional_keys = ('city', 'state', 'country', 'latitude'... | python | def from_json(cls, data):
"""Create a location from a dictionary.
Args:
data: {
"city": "-",
"latitude": 0,
"longitude": 0,
"time_zone": 0,
"elevation": 0}
"""
optional_keys = ('city', 'state', 'country', 'latitude'... | [
"def",
"from_json",
"(",
"cls",
",",
"data",
")",
":",
"optional_keys",
"=",
"(",
"'city'",
",",
"'state'",
",",
"'country'",
",",
"'latitude'",
",",
"'longitude'",
",",
"'time_zone'",
",",
"'elevation'",
",",
"'station_id'",
",",
"'source'",
")",
"for",
"... | Create a location from a dictionary.
Args:
data: {
"city": "-",
"latitude": 0,
"longitude": 0,
"time_zone": 0,
"elevation": 0} | [
"Create",
"a",
"location",
"from",
"a",
"dictionary",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/location.py#L40-L59 |
ladybug-tools/ladybug | ladybug/location.py | Location.from_location | def from_location(cls, location):
"""Try to create a Ladybug location from a location string.
Args:
locationString: Location string
Usage:
l = Location.from_location(locationString)
"""
if not location:
return cls()
try:
... | python | def from_location(cls, location):
"""Try to create a Ladybug location from a location string.
Args:
locationString: Location string
Usage:
l = Location.from_location(locationString)
"""
if not location:
return cls()
try:
... | [
"def",
"from_location",
"(",
"cls",
",",
"location",
")",
":",
"if",
"not",
"location",
":",
"return",
"cls",
"(",
")",
"try",
":",
"if",
"hasattr",
"(",
"location",
",",
"'isLocation'",
")",
":",
"# Ladybug location",
"return",
"location",
"elif",
"hasatt... | Try to create a Ladybug location from a location string.
Args:
locationString: Location string
Usage:
l = Location.from_location(locationString) | [
"Try",
"to",
"create",
"a",
"Ladybug",
"location",
"from",
"a",
"location",
"string",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/location.py#L62-L104 |
ladybug-tools/ladybug | ladybug/location.py | Location.duplicate | def duplicate(self):
"""Duplicate location."""
return Location(self.city, self.state, self.country,
self.latitude, self.longitude, self.time_zone, self.elevation,
self.station_id, self.source) | python | def duplicate(self):
"""Duplicate location."""
return Location(self.city, self.state, self.country,
self.latitude, self.longitude, self.time_zone, self.elevation,
self.station_id, self.source) | [
"def",
"duplicate",
"(",
"self",
")",
":",
"return",
"Location",
"(",
"self",
".",
"city",
",",
"self",
".",
"state",
",",
"self",
".",
"country",
",",
"self",
".",
"latitude",
",",
"self",
".",
"longitude",
",",
"self",
".",
"time_zone",
",",
"self"... | Duplicate location. | [
"Duplicate",
"location",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/location.py#L158-L162 |
ladybug-tools/ladybug | ladybug/location.py | Location.ep_style_location_string | def ep_style_location_string(self):
"""Return EnergyPlus's location string."""
return "Site:Location,\n " + \
self.city + ',\n ' + \
str(self.latitude) + ', !Latitude\n ' + \
str(self.longitude) + ', !Longitude\n ' + \
str(self.time_zone) + ',... | python | def ep_style_location_string(self):
"""Return EnergyPlus's location string."""
return "Site:Location,\n " + \
self.city + ',\n ' + \
str(self.latitude) + ', !Latitude\n ' + \
str(self.longitude) + ', !Longitude\n ' + \
str(self.time_zone) + ',... | [
"def",
"ep_style_location_string",
"(",
"self",
")",
":",
"return",
"\"Site:Location,\\n \"",
"+",
"self",
".",
"city",
"+",
"',\\n '",
"+",
"str",
"(",
"self",
".",
"latitude",
")",
"+",
"', !Latitude\\n '",
"+",
"str",
"(",
"self",
".",
"longitude",
... | Return EnergyPlus's location string. | [
"Return",
"EnergyPlus",
"s",
"location",
"string",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/location.py#L165-L172 |
ladybug-tools/ladybug | ladybug/location.py | Location.to_json | def to_json(self):
"""Create a location from json.
{
"city": "-",
"latitude": 0,
"longitude": 0,
"time_zone": 0,
"elevation": 0
}
"""
return {
"city": self.city,
"state": self.st... | python | def to_json(self):
"""Create a location from json.
{
"city": "-",
"latitude": 0,
"longitude": 0,
"time_zone": 0,
"elevation": 0
}
"""
return {
"city": self.city,
"state": self.st... | [
"def",
"to_json",
"(",
"self",
")",
":",
"return",
"{",
"\"city\"",
":",
"self",
".",
"city",
",",
"\"state\"",
":",
"self",
".",
"state",
",",
"\"country\"",
":",
"self",
".",
"country",
",",
"\"latitude\"",
":",
"self",
".",
"latitude",
",",
"\"longi... | Create a location from json.
{
"city": "-",
"latitude": 0,
"longitude": 0,
"time_zone": 0,
"elevation": 0
} | [
"Create",
"a",
"location",
"from",
"json",
".",
"{",
"city",
":",
"-",
"latitude",
":",
"0",
"longitude",
":",
"0",
"time_zone",
":",
"0",
"elevation",
":",
"0",
"}"
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/location.py#L182-L202 |
ladybug-tools/ladybug | ladybug/epw.py | EPW.from_missing_values | def from_missing_values(cls, is_leap_year=False):
"""Initalize an EPW object with all data missing or empty.
Note that this classmethod is intended for workflows where one plans
to set all of the data within the EPW object. The EPW file written
out from the use of this method is not si... | python | def from_missing_values(cls, is_leap_year=False):
"""Initalize an EPW object with all data missing or empty.
Note that this classmethod is intended for workflows where one plans
to set all of the data within the EPW object. The EPW file written
out from the use of this method is not si... | [
"def",
"from_missing_values",
"(",
"cls",
",",
"is_leap_year",
"=",
"False",
")",
":",
"# Initialize the class with all data missing",
"epw_obj",
"=",
"cls",
"(",
"None",
")",
"epw_obj",
".",
"_is_leap_year",
"=",
"is_leap_year",
"epw_obj",
".",
"_location",
"=",
... | Initalize an EPW object with all data missing or empty.
Note that this classmethod is intended for workflows where one plans
to set all of the data within the EPW object. The EPW file written
out from the use of this method is not simulate-abe or useful since
all hourly data slots just... | [
"Initalize",
"an",
"EPW",
"object",
"with",
"all",
"data",
"missing",
"or",
"empty",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/epw.py#L105-L178 |
ladybug-tools/ladybug | ladybug/epw.py | EPW.from_json | def from_json(cls, data):
""" Create EPW from json dictionary.
Args:
data: {
"location": {} , // ladybug location schema
"data_collections": [], // list of hourly annual hourly data collection
schemas for each of the 35 fields with... | python | def from_json(cls, data):
""" Create EPW from json dictionary.
Args:
data: {
"location": {} , // ladybug location schema
"data_collections": [], // list of hourly annual hourly data collection
schemas for each of the 35 fields with... | [
"def",
"from_json",
"(",
"cls",
",",
"data",
")",
":",
"# Initialize the class with all data missing",
"epw_obj",
"=",
"cls",
"(",
"None",
")",
"epw_obj",
".",
"_is_header_loaded",
"=",
"True",
"epw_obj",
".",
"_is_data_loaded",
"=",
"True",
"# Check required and op... | Create EPW from json dictionary.
Args:
data: {
"location": {} , // ladybug location schema
"data_collections": [], // list of hourly annual hourly data collection
schemas for each of the 35 fields within the EPW file.
"meta... | [
"Create",
"EPW",
"from",
"json",
"dictionary",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/epw.py#L181-L274 |
ladybug-tools/ladybug | ladybug/epw.py | EPW.annual_heating_design_day_996 | def annual_heating_design_day_996(self):
"""A design day object representing the annual 99.6% heating design day."""
self._load_header_check()
if bool(self._heating_dict) is True:
avg_press = self.atmospheric_station_pressure.average
avg_press = None if avg_press == 99999... | python | def annual_heating_design_day_996(self):
"""A design day object representing the annual 99.6% heating design day."""
self._load_header_check()
if bool(self._heating_dict) is True:
avg_press = self.atmospheric_station_pressure.average
avg_press = None if avg_press == 99999... | [
"def",
"annual_heating_design_day_996",
"(",
"self",
")",
":",
"self",
".",
"_load_header_check",
"(",
")",
"if",
"bool",
"(",
"self",
".",
"_heating_dict",
")",
"is",
"True",
":",
"avg_press",
"=",
"self",
".",
"atmospheric_station_pressure",
".",
"average",
... | A design day object representing the annual 99.6% heating design day. | [
"A",
"design",
"day",
"object",
"representing",
"the",
"annual",
"99",
".",
"6%",
"heating",
"design",
"day",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/epw.py#L328-L337 |
ladybug-tools/ladybug | ladybug/epw.py | EPW.annual_heating_design_day_990 | def annual_heating_design_day_990(self):
"""A design day object representing the annual 99.0% heating design day."""
self._load_header_check()
if bool(self._heating_dict) is True:
avg_press = self.atmospheric_station_pressure.average
avg_press = None if avg_press == 99999... | python | def annual_heating_design_day_990(self):
"""A design day object representing the annual 99.0% heating design day."""
self._load_header_check()
if bool(self._heating_dict) is True:
avg_press = self.atmospheric_station_pressure.average
avg_press = None if avg_press == 99999... | [
"def",
"annual_heating_design_day_990",
"(",
"self",
")",
":",
"self",
".",
"_load_header_check",
"(",
")",
"if",
"bool",
"(",
"self",
".",
"_heating_dict",
")",
"is",
"True",
":",
"avg_press",
"=",
"self",
".",
"atmospheric_station_pressure",
".",
"average",
... | A design day object representing the annual 99.0% heating design day. | [
"A",
"design",
"day",
"object",
"representing",
"the",
"annual",
"99",
".",
"0%",
"heating",
"design",
"day",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/epw.py#L340-L349 |
ladybug-tools/ladybug | ladybug/epw.py | EPW.annual_cooling_design_day_004 | def annual_cooling_design_day_004(self):
"""A design day object representing the annual 0.4% cooling design day."""
self._load_header_check()
if bool(self._cooling_dict) is True:
avg_press = self.atmospheric_station_pressure.average
avg_press = None if avg_press == 999999... | python | def annual_cooling_design_day_004(self):
"""A design day object representing the annual 0.4% cooling design day."""
self._load_header_check()
if bool(self._cooling_dict) is True:
avg_press = self.atmospheric_station_pressure.average
avg_press = None if avg_press == 999999... | [
"def",
"annual_cooling_design_day_004",
"(",
"self",
")",
":",
"self",
".",
"_load_header_check",
"(",
")",
"if",
"bool",
"(",
"self",
".",
"_cooling_dict",
")",
"is",
"True",
":",
"avg_press",
"=",
"self",
".",
"atmospheric_station_pressure",
".",
"average",
... | A design day object representing the annual 0.4% cooling design day. | [
"A",
"design",
"day",
"object",
"representing",
"the",
"annual",
"0",
".",
"4%",
"cooling",
"design",
"day",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/epw.py#L352-L361 |
ladybug-tools/ladybug | ladybug/epw.py | EPW.annual_cooling_design_day_010 | def annual_cooling_design_day_010(self):
"""A design day object representing the annual 1.0% cooling design day."""
self._load_header_check()
if bool(self._cooling_dict) is True:
avg_press = self.atmospheric_station_pressure.average
avg_press = None if avg_press == 999999... | python | def annual_cooling_design_day_010(self):
"""A design day object representing the annual 1.0% cooling design day."""
self._load_header_check()
if bool(self._cooling_dict) is True:
avg_press = self.atmospheric_station_pressure.average
avg_press = None if avg_press == 999999... | [
"def",
"annual_cooling_design_day_010",
"(",
"self",
")",
":",
"self",
".",
"_load_header_check",
"(",
")",
"if",
"bool",
"(",
"self",
".",
"_cooling_dict",
")",
"is",
"True",
":",
"avg_press",
"=",
"self",
".",
"atmospheric_station_pressure",
".",
"average",
... | A design day object representing the annual 1.0% cooling design day. | [
"A",
"design",
"day",
"object",
"representing",
"the",
"annual",
"1",
".",
"0%",
"cooling",
"design",
"day",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/epw.py#L364-L373 |
ladybug-tools/ladybug | ladybug/epw.py | EPW._des_dict_check | def _des_dict_check(self, des_dict, req_keys, cond_name):
"""Check if an input design condition dictionary is acceptable."""
assert isinstance(des_dict, dict), '{}' \
' must be a dictionary. Got {}.'.format(cond_name, type(des_dict))
if bool(des_dict) is True:
input_keys ... | python | def _des_dict_check(self, des_dict, req_keys, cond_name):
"""Check if an input design condition dictionary is acceptable."""
assert isinstance(des_dict, dict), '{}' \
' must be a dictionary. Got {}.'.format(cond_name, type(des_dict))
if bool(des_dict) is True:
input_keys ... | [
"def",
"_des_dict_check",
"(",
"self",
",",
"des_dict",
",",
"req_keys",
",",
"cond_name",
")",
":",
"assert",
"isinstance",
"(",
"des_dict",
",",
"dict",
")",
",",
"'{}'",
"' must be a dictionary. Got {}.'",
".",
"format",
"(",
"cond_name",
",",
"type",
"(",
... | Check if an input design condition dictionary is acceptable. | [
"Check",
"if",
"an",
"input",
"design",
"condition",
"dictionary",
"is",
"acceptable",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/epw.py#L482-L490 |
ladybug-tools/ladybug | ladybug/epw.py | EPW._weeks_check | def _weeks_check(self, data, week_type):
"""Check if input for the typical/extreme weeks of the header is correct."""
assert isinstance(data, dict), '{}' \
' must be an OrderedDict. Got {}.'.format(week_type, type(data))
if bool(data) is True:
for val in data.values():
... | python | def _weeks_check(self, data, week_type):
"""Check if input for the typical/extreme weeks of the header is correct."""
assert isinstance(data, dict), '{}' \
' must be an OrderedDict. Got {}.'.format(week_type, type(data))
if bool(data) is True:
for val in data.values():
... | [
"def",
"_weeks_check",
"(",
"self",
",",
"data",
",",
"week_type",
")",
":",
"assert",
"isinstance",
"(",
"data",
",",
"dict",
")",
",",
"'{}'",
"' must be an OrderedDict. Got {}.'",
".",
"format",
"(",
"week_type",
",",
"type",
"(",
"data",
")",
")",
"if"... | Check if input for the typical/extreme weeks of the header is correct. | [
"Check",
"if",
"input",
"for",
"the",
"typical",
"/",
"extreme",
"weeks",
"of",
"the",
"header",
"is",
"correct",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/epw.py#L492-L502 |
ladybug-tools/ladybug | ladybug/epw.py | EPW._import_data | def _import_data(self, import_header_only=False):
"""Import data from an epw file.
Hourly data will be saved in self.data and the various header data
will be saved in the properties above.
"""
# perform checks on the file before opening it.
assert os.path.isfile(self._fi... | python | def _import_data(self, import_header_only=False):
"""Import data from an epw file.
Hourly data will be saved in self.data and the various header data
will be saved in the properties above.
"""
# perform checks on the file before opening it.
assert os.path.isfile(self._fi... | [
"def",
"_import_data",
"(",
"self",
",",
"import_header_only",
"=",
"False",
")",
":",
"# perform checks on the file before opening it.",
"assert",
"os",
".",
"path",
".",
"isfile",
"(",
"self",
".",
"_file_path",
")",
",",
"'Cannot find an epw file at {}'",
".",
"f... | Import data from an epw file.
Hourly data will be saved in self.data and the various header data
will be saved in the properties above. | [
"Import",
"data",
"from",
"an",
"epw",
"file",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/epw.py#L504-L663 |
ladybug-tools/ladybug | ladybug/epw.py | EPW.header | def header(self):
"""A list of text representing the full header (the first 8 lines) of the EPW."""
self._load_header_check()
loc = self.location
loc_str = 'LOCATION,{},{},{},{},{},{},{},{},{}\n'.format(
loc.city, loc.state, loc.country, loc.source, loc.station_id, loc.latitu... | python | def header(self):
"""A list of text representing the full header (the first 8 lines) of the EPW."""
self._load_header_check()
loc = self.location
loc_str = 'LOCATION,{},{},{},{},{},{},{},{},{}\n'.format(
loc.city, loc.state, loc.country, loc.source, loc.station_id, loc.latitu... | [
"def",
"header",
"(",
"self",
")",
":",
"self",
".",
"_load_header_check",
"(",
")",
"loc",
"=",
"self",
".",
"location",
"loc_str",
"=",
"'LOCATION,{},{},{},{},{},{},{},{},{}\\n'",
".",
"format",
"(",
"loc",
".",
"city",
",",
"loc",
".",
"state",
",",
"lo... | A list of text representing the full header (the first 8 lines) of the EPW. | [
"A",
"list",
"of",
"text",
"representing",
"the",
"full",
"header",
"(",
"the",
"first",
"8",
"lines",
")",
"of",
"the",
"EPW",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/epw.py#L666-L707 |
ladybug-tools/ladybug | ladybug/epw.py | EPW._format_week | def _format_week(self, name, type, a_per):
"""Format an AnalysisPeriod into string for the EPW header."""
return '{},{},{}/{},{}/{}'.format(name, type, a_per.st_month, a_per.st_day,
a_per.end_month, a_per.end_day) | python | def _format_week(self, name, type, a_per):
"""Format an AnalysisPeriod into string for the EPW header."""
return '{},{},{}/{},{}/{}'.format(name, type, a_per.st_month, a_per.st_day,
a_per.end_month, a_per.end_day) | [
"def",
"_format_week",
"(",
"self",
",",
"name",
",",
"type",
",",
"a_per",
")",
":",
"return",
"'{},{},{}/{},{}/{}'",
".",
"format",
"(",
"name",
",",
"type",
",",
"a_per",
".",
"st_month",
",",
"a_per",
".",
"st_day",
",",
"a_per",
".",
"end_month",
... | Format an AnalysisPeriod into string for the EPW header. | [
"Format",
"an",
"AnalysisPeriod",
"into",
"string",
"for",
"the",
"EPW",
"header",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/epw.py#L709-L712 |
ladybug-tools/ladybug | ladybug/epw.py | EPW._format_grndt | def _format_grndt(self, data_c):
"""Format monthly ground data collection into string for the EPW header."""
monthly_str = '{},{},{},{}'.format(
data_c.header.metadata['soil conductivity'],
data_c.header.metadata['soil density'],
data_c.header.metadata['soil specific ... | python | def _format_grndt(self, data_c):
"""Format monthly ground data collection into string for the EPW header."""
monthly_str = '{},{},{},{}'.format(
data_c.header.metadata['soil conductivity'],
data_c.header.metadata['soil density'],
data_c.header.metadata['soil specific ... | [
"def",
"_format_grndt",
"(",
"self",
",",
"data_c",
")",
":",
"monthly_str",
"=",
"'{},{},{},{}'",
".",
"format",
"(",
"data_c",
".",
"header",
".",
"metadata",
"[",
"'soil conductivity'",
"]",
",",
"data_c",
".",
"header",
".",
"metadata",
"[",
"'soil densi... | Format monthly ground data collection into string for the EPW header. | [
"Format",
"monthly",
"ground",
"data",
"collection",
"into",
"string",
"for",
"the",
"EPW",
"header",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/epw.py#L714-L721 |
ladybug-tools/ladybug | ladybug/epw.py | EPW.save | def save(self, file_path):
"""Save epw object as an epw file.
args:
file_path: A string representing the path to write the epw file to.
"""
# load data if it's not loaded convert to SI if it is in IP
if not self.is_data_loaded:
self._import_data()
... | python | def save(self, file_path):
"""Save epw object as an epw file.
args:
file_path: A string representing the path to write the epw file to.
"""
# load data if it's not loaded convert to SI if it is in IP
if not self.is_data_loaded:
self._import_data()
... | [
"def",
"save",
"(",
"self",
",",
"file_path",
")",
":",
"# load data if it's not loaded convert to SI if it is in IP",
"if",
"not",
"self",
".",
"is_data_loaded",
":",
"self",
".",
"_import_data",
"(",
")",
"originally_ip",
"=",
"False",
"if",
"self",
".",
"is_ip... | Save epw object as an epw file.
args:
file_path: A string representing the path to write the epw file to. | [
"Save",
"epw",
"object",
"as",
"an",
"epw",
"file",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/epw.py#L723-L773 |
ladybug-tools/ladybug | ladybug/epw.py | EPW.convert_to_ip | def convert_to_ip(self):
"""Convert all Data Collections of this EPW object to IP units.
This is useful when one knows that all graphics produced from this
EPW should be in Imperial units."""
if not self.is_data_loaded:
self._import_data()
if self.is_ip is False:
... | python | def convert_to_ip(self):
"""Convert all Data Collections of this EPW object to IP units.
This is useful when one knows that all graphics produced from this
EPW should be in Imperial units."""
if not self.is_data_loaded:
self._import_data()
if self.is_ip is False:
... | [
"def",
"convert_to_ip",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"is_data_loaded",
":",
"self",
".",
"_import_data",
"(",
")",
"if",
"self",
".",
"is_ip",
"is",
"False",
":",
"for",
"coll",
"in",
"self",
".",
"_data",
":",
"coll",
".",
"conve... | Convert all Data Collections of this EPW object to IP units.
This is useful when one knows that all graphics produced from this
EPW should be in Imperial units. | [
"Convert",
"all",
"Data",
"Collections",
"of",
"this",
"EPW",
"object",
"to",
"IP",
"units",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/epw.py#L775-L785 |
ladybug-tools/ladybug | ladybug/epw.py | EPW._get_data_by_field | def _get_data_by_field(self, field_number):
"""Return a data field by field number.
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
Args:
field_number: a va... | python | def _get_data_by_field(self, field_number):
"""Return a data field by field number.
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
Args:
field_number: a va... | [
"def",
"_get_data_by_field",
"(",
"self",
",",
"field_number",
")",
":",
"if",
"not",
"self",
".",
"is_data_loaded",
":",
"self",
".",
"_import_data",
"(",
")",
"# check input data",
"if",
"not",
"0",
"<=",
"field_number",
"<",
"self",
".",
"_num_of_fields",
... | Return a data field by field number.
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
Args:
field_number: a value between 0 to 34 for different available epw fields.... | [
"Return",
"a",
"data",
"field",
"by",
"field",
"number",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/epw.py#L800-L820 |
ladybug-tools/ladybug | ladybug/epw.py | EPW.sky_temperature | def sky_temperature(self):
"""Return annual Sky Temperature as a Ladybug Data Collection.
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://bigladde... | python | def sky_temperature(self):
"""Return annual Sky Temperature as a Ladybug Data Collection.
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://bigladde... | [
"def",
"sky_temperature",
"(",
"self",
")",
":",
"# create sky temperature header",
"sky_temp_header",
"=",
"Header",
"(",
"data_type",
"=",
"temperature",
".",
"SkyTemperature",
"(",
")",
",",
"unit",
"=",
"'C'",
",",
"analysis_period",
"=",
"AnalysisPeriod",
"("... | Return annual Sky Temperature as a Ladybug Data Collection.
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... | [
"Return",
"annual",
"Sky",
"Temperature",
"as",
"a",
"Ladybug",
"Data",
"Collection",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/epw.py#L1275-L1292 |
ladybug-tools/ladybug | ladybug/epw.py | EPW.to_wea | def to_wea(self, file_path, hoys=None):
"""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.
args:
file_path: Full file path for output file.
... | python | def to_wea(self, file_path, hoys=None):
"""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.
args:
file_path: Full file path for output file.
... | [
"def",
"to_wea",
"(",
"self",
",",
"file_path",
",",
"hoys",
"=",
"None",
")",
":",
"hoys",
"=",
"hoys",
"or",
"xrange",
"(",
"len",
"(",
"self",
".",
"direct_normal_radiation",
".",
"datetimes",
")",
")",
"if",
"not",
"file_path",
".",
"lower",
"(",
... | 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.
args:
file_path: Full file path for output file.
hoys: List of hours of the year. Defaul... | [
"Write",
"an",
"wea",
"file",
"from",
"the",
"epw",
"file",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/epw.py#L1302-L1341 |
ladybug-tools/ladybug | ladybug/epw.py | EPW.to_json | def to_json(self):
"""Convert the EPW to a dictionary."""
# load data if it's not loaded
if not self.is_data_loaded:
self._import_data()
def jsonify_dict(base_dict):
new_dict = {}
for key, val in base_dict.items():
new_dict[key] = val.... | python | def to_json(self):
"""Convert the EPW to a dictionary."""
# load data if it's not loaded
if not self.is_data_loaded:
self._import_data()
def jsonify_dict(base_dict):
new_dict = {}
for key, val in base_dict.items():
new_dict[key] = val.... | [
"def",
"to_json",
"(",
"self",
")",
":",
"# load data if it's not loaded",
"if",
"not",
"self",
".",
"is_data_loaded",
":",
"self",
".",
"_import_data",
"(",
")",
"def",
"jsonify_dict",
"(",
"base_dict",
")",
":",
"new_dict",
"=",
"{",
"}",
"for",
"key",
"... | Convert the EPW to a dictionary. | [
"Convert",
"the",
"EPW",
"to",
"a",
"dictionary",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/epw.py#L1343-L1375 |
ladybug-tools/ladybug | ladybug/analysisperiod.py | AnalysisPeriod.from_json | def from_json(cls, data):
"""Create an analysis period from a dictionary.
Args:
data: {
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 sho... | python | def from_json(cls, data):
"""Create an analysis period from a dictionary.
Args:
data: {
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 sho... | [
"def",
"from_json",
"(",
"cls",
",",
"data",
")",
":",
"keys",
"=",
"(",
"'st_month'",
",",
"'st_day'",
",",
"'st_hour'",
",",
"'end_month'",
",",
"'end_day'",
",",
"'end_hour'",
",",
"'timestep'",
",",
"'is_leap_year'",
")",
"for",
"key",
"in",
"keys",
... | Create an analysis period from a dictionary.
Args:
data: {
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_hou... | [
"Create",
"an",
"analysis",
"period",
"from",
"a",
"dictionary",
".",
"Args",
":",
"data",
":",
"{",
"st_month",
":",
"An",
"integer",
"between",
"1",
"-",
"12",
"for",
"starting",
"month",
"(",
"default",
"=",
"1",
")",
"st_day",
":",
"An",
"integer",... | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/analysisperiod.py#L134-L158 |
ladybug-tools/ladybug | ladybug/analysisperiod.py | AnalysisPeriod.from_analysis_period | def from_analysis_period(cls, analysis_period=None):
"""Create and AnalysisPeriod from an analysis period.
This method is useful to be called from inside Grasshopper or Dynamo
"""
if not analysis_period:
return cls()
elif hasattr(analysis_period, 'isAnalysisPeriod'):... | python | def from_analysis_period(cls, analysis_period=None):
"""Create and AnalysisPeriod from an analysis period.
This method is useful to be called from inside Grasshopper or Dynamo
"""
if not analysis_period:
return cls()
elif hasattr(analysis_period, 'isAnalysisPeriod'):... | [
"def",
"from_analysis_period",
"(",
"cls",
",",
"analysis_period",
"=",
"None",
")",
":",
"if",
"not",
"analysis_period",
":",
"return",
"cls",
"(",
")",
"elif",
"hasattr",
"(",
"analysis_period",
",",
"'isAnalysisPeriod'",
")",
":",
"return",
"analysis_period",... | Create and AnalysisPeriod from an analysis period.
This method is useful to be called from inside Grasshopper or Dynamo | [
"Create",
"and",
"AnalysisPeriod",
"from",
"an",
"analysis",
"period",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/analysisperiod.py#L161-L177 |
ladybug-tools/ladybug | ladybug/analysisperiod.py | AnalysisPeriod.from_string | def from_string(cls, analysis_period_string):
"""Create an Analysis Period object from an analysis period string.
%s/%s to %s/%s between %s and %s @%s
"""
# %s/%s to %s/%s between %s to %s @%s*
is_leap_year = True if analysis_period_string.strip()[-1] == '*' else False
... | python | def from_string(cls, analysis_period_string):
"""Create an Analysis Period object from an analysis period string.
%s/%s to %s/%s between %s and %s @%s
"""
# %s/%s to %s/%s between %s to %s @%s*
is_leap_year = True if analysis_period_string.strip()[-1] == '*' else False
... | [
"def",
"from_string",
"(",
"cls",
",",
"analysis_period_string",
")",
":",
"# %s/%s to %s/%s between %s to %s @%s*",
"is_leap_year",
"=",
"True",
"if",
"analysis_period_string",
".",
"strip",
"(",
")",
"[",
"-",
"1",
"]",
"==",
"'*'",
"else",
"False",
"ap",
"=",... | Create an Analysis Period object from an analysis period string.
%s/%s to %s/%s between %s and %s @%s | [
"Create",
"an",
"Analysis",
"Period",
"object",
"from",
"an",
"analysis",
"period",
"string",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/analysisperiod.py#L180-L200 |
ladybug-tools/ladybug | ladybug/analysisperiod.py | AnalysisPeriod.datetimes | def datetimes(self):
"""A sorted list of datetimes in this analysis period."""
if self._timestamps_data is None:
self._calculate_timestamps()
return tuple(DateTime.from_moy(moy, self.is_leap_year)
for moy in self._timestamps_data) | python | def datetimes(self):
"""A sorted list of datetimes in this analysis period."""
if self._timestamps_data is None:
self._calculate_timestamps()
return tuple(DateTime.from_moy(moy, self.is_leap_year)
for moy in self._timestamps_data) | [
"def",
"datetimes",
"(",
"self",
")",
":",
"if",
"self",
".",
"_timestamps_data",
"is",
"None",
":",
"self",
".",
"_calculate_timestamps",
"(",
")",
"return",
"tuple",
"(",
"DateTime",
".",
"from_moy",
"(",
"moy",
",",
"self",
".",
"is_leap_year",
")",
"... | A sorted list of datetimes in this analysis period. | [
"A",
"sorted",
"list",
"of",
"datetimes",
"in",
"this",
"analysis",
"period",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/analysisperiod.py#L258-L263 |
ladybug-tools/ladybug | ladybug/analysisperiod.py | AnalysisPeriod.hoys | def hoys(self):
"""A sorted list of hours of year in this analysis period."""
if self._timestamps_data is None:
self._calculate_timestamps()
return tuple(moy / 60.0 for moy in self._timestamps_data) | python | def hoys(self):
"""A sorted list of hours of year in this analysis period."""
if self._timestamps_data is None:
self._calculate_timestamps()
return tuple(moy / 60.0 for moy in self._timestamps_data) | [
"def",
"hoys",
"(",
"self",
")",
":",
"if",
"self",
".",
"_timestamps_data",
"is",
"None",
":",
"self",
".",
"_calculate_timestamps",
"(",
")",
"return",
"tuple",
"(",
"moy",
"/",
"60.0",
"for",
"moy",
"in",
"self",
".",
"_timestamps_data",
")"
] | A sorted list of hours of year in this analysis period. | [
"A",
"sorted",
"list",
"of",
"hours",
"of",
"year",
"in",
"this",
"analysis",
"period",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/analysisperiod.py#L273-L277 |
ladybug-tools/ladybug | ladybug/analysisperiod.py | AnalysisPeriod.hoys_int | def hoys_int(self):
"""A sorted list of hours of year in this analysis period as integers."""
if self._timestamps_data is None:
self._calculate_timestamps()
return tuple(int(moy / 60.0) for moy in self._timestamps_data) | python | def hoys_int(self):
"""A sorted list of hours of year in this analysis period as integers."""
if self._timestamps_data is None:
self._calculate_timestamps()
return tuple(int(moy / 60.0) for moy in self._timestamps_data) | [
"def",
"hoys_int",
"(",
"self",
")",
":",
"if",
"self",
".",
"_timestamps_data",
"is",
"None",
":",
"self",
".",
"_calculate_timestamps",
"(",
")",
"return",
"tuple",
"(",
"int",
"(",
"moy",
"/",
"60.0",
")",
"for",
"moy",
"in",
"self",
".",
"_timestam... | A sorted list of hours of year in this analysis period as integers. | [
"A",
"sorted",
"list",
"of",
"hours",
"of",
"year",
"in",
"this",
"analysis",
"period",
"as",
"integers",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/analysisperiod.py#L280-L284 |
ladybug-tools/ladybug | ladybug/analysisperiod.py | AnalysisPeriod.doys_int | def doys_int(self):
"""A sorted list of days of the year in this analysis period as integers."""
if not self._is_reversed:
return self._calc_daystamps(self.st_time, self.end_time)
else:
doys_st = self._calc_daystamps(self.st_time, DateTime.from_hoy(8759))
doys... | python | def doys_int(self):
"""A sorted list of days of the year in this analysis period as integers."""
if not self._is_reversed:
return self._calc_daystamps(self.st_time, self.end_time)
else:
doys_st = self._calc_daystamps(self.st_time, DateTime.from_hoy(8759))
doys... | [
"def",
"doys_int",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_is_reversed",
":",
"return",
"self",
".",
"_calc_daystamps",
"(",
"self",
".",
"st_time",
",",
"self",
".",
"end_time",
")",
"else",
":",
"doys_st",
"=",
"self",
".",
"_calc_daystamps"... | A sorted list of days of the year in this analysis period as integers. | [
"A",
"sorted",
"list",
"of",
"days",
"of",
"the",
"year",
"in",
"this",
"analysis",
"period",
"as",
"integers",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/analysisperiod.py#L287-L294 |
ladybug-tools/ladybug | ladybug/analysisperiod.py | AnalysisPeriod.months_int | def months_int(self):
"""A sorted list of months of the year in this analysis period as integers."""
if not self._is_reversed:
return list(xrange(self.st_time.month, self.end_time.month + 1))
else:
months_st = list(xrange(self.st_time.month, 13))
months_end = ... | python | def months_int(self):
"""A sorted list of months of the year in this analysis period as integers."""
if not self._is_reversed:
return list(xrange(self.st_time.month, self.end_time.month + 1))
else:
months_st = list(xrange(self.st_time.month, 13))
months_end = ... | [
"def",
"months_int",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_is_reversed",
":",
"return",
"list",
"(",
"xrange",
"(",
"self",
".",
"st_time",
".",
"month",
",",
"self",
".",
"end_time",
".",
"month",
"+",
"1",
")",
")",
"else",
":",
"mon... | A sorted list of months of the year in this analysis period as integers. | [
"A",
"sorted",
"list",
"of",
"months",
"of",
"the",
"year",
"in",
"this",
"analysis",
"period",
"as",
"integers",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/analysisperiod.py#L297-L304 |
ladybug-tools/ladybug | ladybug/analysisperiod.py | AnalysisPeriod.months_per_hour | def months_per_hour(self):
"""A list of tuples representing months per hour in this analysis period."""
month_hour = []
hour_range = xrange(self.st_hour, self.end_hour + 1)
for month in self.months_int:
month_hour.extend([(month, hr) for hr in hour_range])
return mont... | python | def months_per_hour(self):
"""A list of tuples representing months per hour in this analysis period."""
month_hour = []
hour_range = xrange(self.st_hour, self.end_hour + 1)
for month in self.months_int:
month_hour.extend([(month, hr) for hr in hour_range])
return mont... | [
"def",
"months_per_hour",
"(",
"self",
")",
":",
"month_hour",
"=",
"[",
"]",
"hour_range",
"=",
"xrange",
"(",
"self",
".",
"st_hour",
",",
"self",
".",
"end_hour",
"+",
"1",
")",
"for",
"month",
"in",
"self",
".",
"months_int",
":",
"month_hour",
"."... | A list of tuples representing months per hour in this analysis period. | [
"A",
"list",
"of",
"tuples",
"representing",
"months",
"per",
"hour",
"in",
"this",
"analysis",
"period",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/analysisperiod.py#L307-L313 |
ladybug-tools/ladybug | ladybug/analysisperiod.py | AnalysisPeriod.is_annual | def is_annual(self):
"""Check if an analysis period is annual."""
if (self.st_month, self.st_day, self.st_hour, self.end_month,
self.end_day, self.end_hour) == (1, 1, 0, 12, 31, 23):
return True
else:
return False | python | def is_annual(self):
"""Check if an analysis period is annual."""
if (self.st_month, self.st_day, self.st_hour, self.end_month,
self.end_day, self.end_hour) == (1, 1, 0, 12, 31, 23):
return True
else:
return False | [
"def",
"is_annual",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"st_month",
",",
"self",
".",
"st_day",
",",
"self",
".",
"st_hour",
",",
"self",
".",
"end_month",
",",
"self",
".",
"end_day",
",",
"self",
".",
"end_hour",
")",
"==",
"(",
"1",
... | Check if an analysis period is annual. | [
"Check",
"if",
"an",
"analysis",
"period",
"is",
"annual",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/analysisperiod.py#L321-L327 |
ladybug-tools/ladybug | ladybug/analysisperiod.py | AnalysisPeriod.is_possible_hour | def is_possible_hour(self, hour):
"""Check if a float hour is a possible hour for this analysis period."""
if hour > 23 and self.is_possible_hour(0):
hour = int(hour)
if not self._is_overnight:
return self.st_time.hour <= hour <= self.end_time.hour
else:
... | python | def is_possible_hour(self, hour):
"""Check if a float hour is a possible hour for this analysis period."""
if hour > 23 and self.is_possible_hour(0):
hour = int(hour)
if not self._is_overnight:
return self.st_time.hour <= hour <= self.end_time.hour
else:
... | [
"def",
"is_possible_hour",
"(",
"self",
",",
"hour",
")",
":",
"if",
"hour",
">",
"23",
"and",
"self",
".",
"is_possible_hour",
"(",
"0",
")",
":",
"hour",
"=",
"int",
"(",
"hour",
")",
"if",
"not",
"self",
".",
"_is_overnight",
":",
"return",
"self"... | Check if a float hour is a possible hour for this analysis period. | [
"Check",
"if",
"a",
"float",
"hour",
"is",
"a",
"possible",
"hour",
"for",
"this",
"analysis",
"period",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/analysisperiod.py#L347-L355 |
ladybug-tools/ladybug | ladybug/analysisperiod.py | AnalysisPeriod.is_time_included | def is_time_included(self, time):
"""Check if time is included in analysis period.
Return True if time is inside this analysis period,
otherwise return False
Args:
time: A DateTime to be tested
Returns:
A boolean. True if time is included in analysis pe... | python | def is_time_included(self, time):
"""Check if time is included in analysis period.
Return True if time is inside this analysis period,
otherwise return False
Args:
time: A DateTime to be tested
Returns:
A boolean. True if time is included in analysis pe... | [
"def",
"is_time_included",
"(",
"self",
",",
"time",
")",
":",
"if",
"self",
".",
"_timestamps_data",
"is",
"None",
":",
"self",
".",
"_calculate_timestamps",
"(",
")",
"# time filtering in Ladybug Tools is slightly different than \"normal\"",
"# filtering since start hour ... | Check if time is included in analysis period.
Return True if time is inside this analysis period,
otherwise return False
Args:
time: A DateTime to be tested
Returns:
A boolean. True if time is included in analysis period | [
"Check",
"if",
"time",
"is",
"included",
"in",
"analysis",
"period",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/analysisperiod.py#L357-L375 |
ladybug-tools/ladybug | ladybug/analysisperiod.py | AnalysisPeriod.duplicate | def duplicate(self):
"""Return a copy of the analysis period."""
return AnalysisPeriod(self.st_month, self.st_day, self.st_hour,
self.end_month, self.end_day, self.end_hour,
self.timestep, self.is_leap_year) | python | def duplicate(self):
"""Return a copy of the analysis period."""
return AnalysisPeriod(self.st_month, self.st_day, self.st_hour,
self.end_month, self.end_day, self.end_hour,
self.timestep, self.is_leap_year) | [
"def",
"duplicate",
"(",
"self",
")",
":",
"return",
"AnalysisPeriod",
"(",
"self",
".",
"st_month",
",",
"self",
".",
"st_day",
",",
"self",
".",
"st_hour",
",",
"self",
".",
"end_month",
",",
"self",
".",
"end_day",
",",
"self",
".",
"end_hour",
",",... | Return a copy of the analysis period. | [
"Return",
"a",
"copy",
"of",
"the",
"analysis",
"period",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/analysisperiod.py#L377-L381 |
ladybug-tools/ladybug | ladybug/analysisperiod.py | AnalysisPeriod.to_json | def to_json(self):
"""Convert the analysis period to a dictionary."""
return {
'st_month': self.st_month,
'st_day': self.st_day,
'st_hour': self.st_hour,
'end_month': self.end_month,
'end_day': self.end_day,
'end_hour': self.end_hou... | python | def to_json(self):
"""Convert the analysis period to a dictionary."""
return {
'st_month': self.st_month,
'st_day': self.st_day,
'st_hour': self.st_hour,
'end_month': self.end_month,
'end_day': self.end_day,
'end_hour': self.end_hou... | [
"def",
"to_json",
"(",
"self",
")",
":",
"return",
"{",
"'st_month'",
":",
"self",
".",
"st_month",
",",
"'st_day'",
":",
"self",
".",
"st_day",
",",
"'st_hour'",
":",
"self",
".",
"st_hour",
",",
"'end_month'",
":",
"self",
".",
"end_month",
",",
"'en... | Convert the analysis period to a dictionary. | [
"Convert",
"the",
"analysis",
"period",
"to",
"a",
"dictionary",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/analysisperiod.py#L383-L394 |
ladybug-tools/ladybug | ladybug/analysisperiod.py | AnalysisPeriod._calc_timestamps | def _calc_timestamps(self, st_time, end_time):
"""Calculate timesteps between start time and end time.
Use this method only when start time month is before end time month.
"""
# calculate based on minutes
# I have to convert the object to DateTime because of how Dynamo
#... | python | def _calc_timestamps(self, st_time, end_time):
"""Calculate timesteps between start time and end time.
Use this method only when start time month is before end time month.
"""
# calculate based on minutes
# I have to convert the object to DateTime because of how Dynamo
#... | [
"def",
"_calc_timestamps",
"(",
"self",
",",
"st_time",
",",
"end_time",
")",
":",
"# calculate based on minutes",
"# I have to convert the object to DateTime because of how Dynamo",
"# works: https://github.com/DynamoDS/Dynamo/issues/6683",
"# Do not modify this line to datetime",
"curr... | Calculate timesteps between start time and end time.
Use this method only when start time month is before end time month. | [
"Calculate",
"timesteps",
"between",
"start",
"time",
"and",
"end",
"time",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/analysisperiod.py#L396-L425 |
ladybug-tools/ladybug | ladybug/analysisperiod.py | AnalysisPeriod._calculate_timestamps | def _calculate_timestamps(self):
"""Return a list of Ladybug DateTime in this analysis period."""
self._timestamps_data = []
if not self._is_reversed:
self._calc_timestamps(self.st_time, self.end_time)
else:
self._calc_timestamps(self.st_time, DateTime.from_hoy(87... | python | def _calculate_timestamps(self):
"""Return a list of Ladybug DateTime in this analysis period."""
self._timestamps_data = []
if not self._is_reversed:
self._calc_timestamps(self.st_time, self.end_time)
else:
self._calc_timestamps(self.st_time, DateTime.from_hoy(87... | [
"def",
"_calculate_timestamps",
"(",
"self",
")",
":",
"self",
".",
"_timestamps_data",
"=",
"[",
"]",
"if",
"not",
"self",
".",
"_is_reversed",
":",
"self",
".",
"_calc_timestamps",
"(",
"self",
".",
"st_time",
",",
"self",
".",
"end_time",
")",
"else",
... | Return a list of Ladybug DateTime in this analysis period. | [
"Return",
"a",
"list",
"of",
"Ladybug",
"DateTime",
"in",
"this",
"analysis",
"period",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/analysisperiod.py#L427-L434 |
ladybug-tools/ladybug | ladybug/analysisperiod.py | AnalysisPeriod._calc_daystamps | def _calc_daystamps(self, st_time, end_time):
"""Calculate days of the year between start time and end time.
Use this method only when start time month is before end time month.
"""
start_doy = sum(self._num_of_days_each_month[:st_time.month-1]) + st_time.day
end_doy = sum(self.... | python | def _calc_daystamps(self, st_time, end_time):
"""Calculate days of the year between start time and end time.
Use this method only when start time month is before end time month.
"""
start_doy = sum(self._num_of_days_each_month[:st_time.month-1]) + st_time.day
end_doy = sum(self.... | [
"def",
"_calc_daystamps",
"(",
"self",
",",
"st_time",
",",
"end_time",
")",
":",
"start_doy",
"=",
"sum",
"(",
"self",
".",
"_num_of_days_each_month",
"[",
":",
"st_time",
".",
"month",
"-",
"1",
"]",
")",
"+",
"st_time",
".",
"day",
"end_doy",
"=",
"... | Calculate days of the year between start time and end time.
Use this method only when start time month is before end time month. | [
"Calculate",
"days",
"of",
"the",
"year",
"between",
"start",
"time",
"and",
"end",
"time",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/analysisperiod.py#L436-L443 |
ladybug-tools/ladybug | ladybug/wea.py | Wea.from_values | def from_values(cls, location, direct_normal_irradiance,
diffuse_horizontal_irradiance, timestep=1, is_leap_year=False):
"""Create wea from a list of irradiance values.
This method converts input lists to data collection.
"""
err_message = 'For timestep %d, %d number... | python | def from_values(cls, location, direct_normal_irradiance,
diffuse_horizontal_irradiance, timestep=1, is_leap_year=False):
"""Create wea from a list of irradiance values.
This method converts input lists to data collection.
"""
err_message = 'For timestep %d, %d number... | [
"def",
"from_values",
"(",
"cls",
",",
"location",
",",
"direct_normal_irradiance",
",",
"diffuse_horizontal_irradiance",
",",
"timestep",
"=",
"1",
",",
"is_leap_year",
"=",
"False",
")",
":",
"err_message",
"=",
"'For timestep %d, %d number of data for %s is expected. '... | Create wea from a list of irradiance values.
This method converts input lists to data collection. | [
"Create",
"wea",
"from",
"a",
"list",
"of",
"irradiance",
"values",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/wea.py#L69-L99 |
ladybug-tools/ladybug | ladybug/wea.py | Wea.from_json | def from_json(cls, data):
""" Create Wea from json file
{
"location": {} , // ladybug location schema
"direct_normal_irradiance": [], // List of hourly direct normal
irradiance data points
"diffuse_horizontal_irradiance": [], // List of hourly diff... | python | def from_json(cls, data):
""" Create Wea from json file
{
"location": {} , // ladybug location schema
"direct_normal_irradiance": [], // List of hourly direct normal
irradiance data points
"diffuse_horizontal_irradiance": [], // List of hourly diff... | [
"def",
"from_json",
"(",
"cls",
",",
"data",
")",
":",
"required_keys",
"=",
"(",
"'location'",
",",
"'direct_normal_irradiance'",
",",
"'diffuse_horizontal_irradiance'",
")",
"optional_keys",
"=",
"(",
"'timestep'",
",",
"'is_leap_year'",
")",
"for",
"key",
"in",... | Create Wea from json file
{
"location": {} , // ladybug location schema
"direct_normal_irradiance": [], // List of hourly direct normal
irradiance data points
"diffuse_horizontal_irradiance": [], // List of hourly diffuse
horizontal irradia... | [
"Create",
"Wea",
"from",
"json",
"file",
"{",
"location",
":",
"{}",
"//",
"ladybug",
"location",
"schema",
"direct_normal_irradiance",
":",
"[]",
"//",
"List",
"of",
"hourly",
"direct",
"normal",
"irradiance",
"data",
"points",
"diffuse_horizontal_irradiance",
":... | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/wea.py#L102-L133 |
ladybug-tools/ladybug | ladybug/wea.py | Wea.from_file | def from_file(cls, weafile, timestep=1, is_leap_year=False):
"""Create wea object from a wea file.
Args:
weafile:Full path to wea file.
timestep: An optional integer to set the number of time steps per hour.
Default is 1 for one value per hour. If the wea file ha... | python | def from_file(cls, weafile, timestep=1, is_leap_year=False):
"""Create wea object from a wea file.
Args:
weafile:Full path to wea file.
timestep: An optional integer to set the number of time steps per hour.
Default is 1 for one value per hour. If the wea file ha... | [
"def",
"from_file",
"(",
"cls",
",",
"weafile",
",",
"timestep",
"=",
"1",
",",
"is_leap_year",
"=",
"False",
")",
":",
"assert",
"os",
".",
"path",
".",
"isfile",
"(",
"weafile",
")",
",",
"'Failed to find {}'",
".",
"format",
"(",
"weafile",
")",
"lo... | Create wea object from a wea file.
Args:
weafile:Full path to wea file.
timestep: An optional integer to set the number of time steps per hour.
Default is 1 for one value per hour. If the wea file has a time step
smaller than an hour adjust this input acc... | [
"Create",
"wea",
"object",
"from",
"a",
"wea",
"file",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/wea.py#L139-L174 |
ladybug-tools/ladybug | ladybug/wea.py | Wea.from_epw_file | def from_epw_file(cls, epwfile, timestep=1):
"""Create a wea object using the solar irradiance values in an epw file.
Args:
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 ... | python | def from_epw_file(cls, epwfile, timestep=1):
"""Create a wea object using the solar irradiance values in an epw file.
Args:
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 ... | [
"def",
"from_epw_file",
"(",
"cls",
",",
"epwfile",
",",
"timestep",
"=",
"1",
")",
":",
"is_leap_year",
"=",
"False",
"# epw file is always for 8760 hours",
"epw",
"=",
"EPW",
"(",
"epwfile",
")",
"direct_normal",
",",
"diffuse_horizontal",
"=",
"cls",
".",
"... | Create a wea object using the solar irradiance values in an epw file.
Args:
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... | [
"Create",
"a",
"wea",
"object",
"using",
"the",
"solar",
"irradiance",
"values",
"in",
"an",
"epw",
"file",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/wea.py#L177-L216 |
ladybug-tools/ladybug | ladybug/wea.py | Wea.from_stat_file | def from_stat_file(cls, statfile, timestep=1, is_leap_year=False):
"""Create an ASHRAE Revised Clear Sky wea object from the monthly sky
optical depths in a .stat file.
Args:
statfile: Full path to the .stat file.
timestep: An optional integer to set the number of time s... | python | def from_stat_file(cls, statfile, timestep=1, is_leap_year=False):
"""Create an ASHRAE Revised Clear Sky wea object from the monthly sky
optical depths in a .stat file.
Args:
statfile: Full path to the .stat file.
timestep: An optional integer to set the number of time s... | [
"def",
"from_stat_file",
"(",
"cls",
",",
"statfile",
",",
"timestep",
"=",
"1",
",",
"is_leap_year",
"=",
"False",
")",
":",
"stat",
"=",
"STAT",
"(",
"statfile",
")",
"# check to be sure the stat file does not have missing tau values",
"def",
"check_missing",
"(",... | Create an ASHRAE Revised Clear Sky wea object from the monthly sky
optical depths in a .stat file.
Args:
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.
... | [
"Create",
"an",
"ASHRAE",
"Revised",
"Clear",
"Sky",
"wea",
"object",
"from",
"the",
"monthly",
"sky",
"optical",
"depths",
"in",
"a",
".",
"stat",
"file",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/wea.py#L219-L247 |
ladybug-tools/ladybug | ladybug/wea.py | Wea.from_ashrae_revised_clear_sky | def from_ashrae_revised_clear_sky(cls, location, monthly_tau_beam,
monthly_tau_diffuse, timestep=1,
is_leap_year=False):
"""Create a wea object representing an ASHRAE Revised Clear Sky ("Tau Model")
ASHRAE Revised Clear Skies a... | python | def from_ashrae_revised_clear_sky(cls, location, monthly_tau_beam,
monthly_tau_diffuse, timestep=1,
is_leap_year=False):
"""Create a wea object representing an ASHRAE Revised Clear Sky ("Tau Model")
ASHRAE Revised Clear Skies a... | [
"def",
"from_ashrae_revised_clear_sky",
"(",
"cls",
",",
"location",
",",
"monthly_tau_beam",
",",
"monthly_tau_diffuse",
",",
"timestep",
"=",
"1",
",",
"is_leap_year",
"=",
"False",
")",
":",
"# extract metadata",
"metadata",
"=",
"{",
"'source'",
":",
"location... | 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 E... | [
"Create",
"a",
"wea",
"object",
"representing",
"an",
"ASHRAE",
"Revised",
"Clear",
"Sky",
"(",
"Tau",
"Model",
")"
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/wea.py#L250-L298 |
ladybug-tools/ladybug | ladybug/wea.py | Wea.from_zhang_huang_solar | def from_zhang_huang_solar(cls, location, cloud_cover,
relative_humidity, dry_bulb_temperature,
wind_speed, atmospheric_pressure=None,
timestep=1, is_leap_year=False, use_disc=False):
"""Create a wea object from climate... | python | def from_zhang_huang_solar(cls, location, cloud_cover,
relative_humidity, dry_bulb_temperature,
wind_speed, atmospheric_pressure=None,
timestep=1, is_leap_year=False, use_disc=False):
"""Create a wea object from climate... | [
"def",
"from_zhang_huang_solar",
"(",
"cls",
",",
"location",
",",
"cloud_cover",
",",
"relative_humidity",
",",
"dry_bulb_temperature",
",",
"wind_speed",
",",
"atmospheric_pressure",
"=",
"None",
",",
"timestep",
"=",
"1",
",",
"is_leap_year",
"=",
"False",
",",... | Create a wea object from climate data using the Zhang-Huang model.
The Zhang-Huang solar model was developed to estimate solar
irradiance for weather stations that lack such values, which are
typically colleted with a pyranometer. Using total cloud cover,
dry-bulb temperature, relative ... | [
"Create",
"a",
"wea",
"object",
"from",
"climate",
"data",
"using",
"the",
"Zhang",
"-",
"Huang",
"model",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/wea.py#L357-L437 |
ladybug-tools/ladybug | ladybug/wea.py | Wea.datetimes | def datetimes(self):
"""Datetimes in wea file."""
if self.timestep == 1:
return tuple(dt.add_minute(30) for dt in
self.direct_normal_irradiance.datetimes)
else:
return self.direct_normal_irradiance.datetimes | python | def datetimes(self):
"""Datetimes in wea file."""
if self.timestep == 1:
return tuple(dt.add_minute(30) for dt in
self.direct_normal_irradiance.datetimes)
else:
return self.direct_normal_irradiance.datetimes | [
"def",
"datetimes",
"(",
"self",
")",
":",
"if",
"self",
".",
"timestep",
"==",
"1",
":",
"return",
"tuple",
"(",
"dt",
".",
"add_minute",
"(",
"30",
")",
"for",
"dt",
"in",
"self",
".",
"direct_normal_irradiance",
".",
"datetimes",
")",
"else",
":",
... | Datetimes in wea file. | [
"Datetimes",
"in",
"wea",
"file",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/wea.py#L450-L456 |
ladybug-tools/ladybug | ladybug/wea.py | Wea.global_horizontal_irradiance | def global_horizontal_irradiance(self):
"""Returns the global horizontal irradiance at each timestep."""
analysis_period = AnalysisPeriod(timestep=self.timestep,
is_leap_year=self.is_leap_year)
header_ghr = Header(data_type=GlobalHorizontalIrradiance(),
... | python | def global_horizontal_irradiance(self):
"""Returns the global horizontal irradiance at each timestep."""
analysis_period = AnalysisPeriod(timestep=self.timestep,
is_leap_year=self.is_leap_year)
header_ghr = Header(data_type=GlobalHorizontalIrradiance(),
... | [
"def",
"global_horizontal_irradiance",
"(",
"self",
")",
":",
"analysis_period",
"=",
"AnalysisPeriod",
"(",
"timestep",
"=",
"self",
".",
"timestep",
",",
"is_leap_year",
"=",
"self",
".",
"is_leap_year",
")",
"header_ghr",
"=",
"Header",
"(",
"data_type",
"=",... | Returns the global horizontal irradiance at each timestep. | [
"Returns",
"the",
"global",
"horizontal",
"irradiance",
"at",
"each",
"timestep",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/wea.py#L498-L513 |
ladybug-tools/ladybug | ladybug/wea.py | Wea.direct_horizontal_irradiance | def direct_horizontal_irradiance(self):
"""Returns the direct irradiance on a horizontal surface at each timestep.
Note that this is different from the direct_normal_irradiance needed
to construct a Wea, which is NORMAL and not HORIZONTAL."""
analysis_period = AnalysisPeriod(timestep=se... | python | def direct_horizontal_irradiance(self):
"""Returns the direct irradiance on a horizontal surface at each timestep.
Note that this is different from the direct_normal_irradiance needed
to construct a Wea, which is NORMAL and not HORIZONTAL."""
analysis_period = AnalysisPeriod(timestep=se... | [
"def",
"direct_horizontal_irradiance",
"(",
"self",
")",
":",
"analysis_period",
"=",
"AnalysisPeriod",
"(",
"timestep",
"=",
"self",
".",
"timestep",
",",
"is_leap_year",
"=",
"self",
".",
"is_leap_year",
")",
"header_dhr",
"=",
"Header",
"(",
"data_type",
"=",... | Returns the direct irradiance on a horizontal surface at each timestep.
Note that this is different from the direct_normal_irradiance needed
to construct a Wea, which is NORMAL and not HORIZONTAL. | [
"Returns",
"the",
"direct",
"irradiance",
"on",
"a",
"horizontal",
"surface",
"at",
"each",
"timestep",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/wea.py#L516-L533 |
ladybug-tools/ladybug | ladybug/wea.py | Wea._get_datetimes | def _get_datetimes(timestep, is_leap_year):
"""List of datetimes based on timestep.
This method should only be used for classmethods. For datetimes use datetiems or
hoys methods.
"""
hour_count = 8760 + 24 if is_leap_year else 8760
adjust_time = 30 if timestep == 1 else ... | python | def _get_datetimes(timestep, is_leap_year):
"""List of datetimes based on timestep.
This method should only be used for classmethods. For datetimes use datetiems or
hoys methods.
"""
hour_count = 8760 + 24 if is_leap_year else 8760
adjust_time = 30 if timestep == 1 else ... | [
"def",
"_get_datetimes",
"(",
"timestep",
",",
"is_leap_year",
")",
":",
"hour_count",
"=",
"8760",
"+",
"24",
"if",
"is_leap_year",
"else",
"8760",
"adjust_time",
"=",
"30",
"if",
"timestep",
"==",
"1",
"else",
"0",
"return",
"tuple",
"(",
"DateTime",
"."... | List of datetimes based on timestep.
This method should only be used for classmethods. For datetimes use datetiems or
hoys methods. | [
"List",
"of",
"datetimes",
"based",
"on",
"timestep",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/wea.py#L550-L561 |
ladybug-tools/ladybug | ladybug/wea.py | Wea._get_data_collections | def _get_data_collections(dnr_values, dhr_values, metadata, timestep, is_leap_year):
"""Return two data collections for Direct Normal , Diffuse Horizontal
"""
analysis_period = AnalysisPeriod(timestep=timestep, is_leap_year=is_leap_year)
dnr_header = Header(data_type=DirectNormalIrradian... | python | def _get_data_collections(dnr_values, dhr_values, metadata, timestep, is_leap_year):
"""Return two data collections for Direct Normal , Diffuse Horizontal
"""
analysis_period = AnalysisPeriod(timestep=timestep, is_leap_year=is_leap_year)
dnr_header = Header(data_type=DirectNormalIrradian... | [
"def",
"_get_data_collections",
"(",
"dnr_values",
",",
"dhr_values",
",",
"metadata",
",",
"timestep",
",",
"is_leap_year",
")",
":",
"analysis_period",
"=",
"AnalysisPeriod",
"(",
"timestep",
"=",
"timestep",
",",
"is_leap_year",
"=",
"is_leap_year",
")",
"dnr_h... | Return two data collections for Direct Normal , Diffuse Horizontal | [
"Return",
"two",
"data",
"collections",
"for",
"Direct",
"Normal",
"Diffuse",
"Horizontal"
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/wea.py#L564-L579 |
ladybug-tools/ladybug | ladybug/wea.py | Wea.get_irradiance_value | def get_irradiance_value(self, month, day, hour):
"""Get direct and diffuse irradiance values for a point in time."""
dt = DateTime(month, day, hour, leap_year=self.is_leap_year)
count = int(dt.hoy * self.timestep)
return self.direct_normal_irradiance[count], \
self.diffuse_h... | python | def get_irradiance_value(self, month, day, hour):
"""Get direct and diffuse irradiance values for a point in time."""
dt = DateTime(month, day, hour, leap_year=self.is_leap_year)
count = int(dt.hoy * self.timestep)
return self.direct_normal_irradiance[count], \
self.diffuse_h... | [
"def",
"get_irradiance_value",
"(",
"self",
",",
"month",
",",
"day",
",",
"hour",
")",
":",
"dt",
"=",
"DateTime",
"(",
"month",
",",
"day",
",",
"hour",
",",
"leap_year",
"=",
"self",
".",
"is_leap_year",
")",
"count",
"=",
"int",
"(",
"dt",
".",
... | Get direct and diffuse irradiance values for a point in time. | [
"Get",
"direct",
"and",
"diffuse",
"irradiance",
"values",
"for",
"a",
"point",
"in",
"time",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/wea.py#L581-L586 |
ladybug-tools/ladybug | ladybug/wea.py | Wea.get_irradiance_value_for_hoy | def get_irradiance_value_for_hoy(self, hoy):
"""Get direct and diffuse irradiance values for an hoy."""
count = int(hoy * self.timestep)
return self.direct_normal_irradiance[count], \
self.diffuse_horizontal_irradiance[count] | python | def get_irradiance_value_for_hoy(self, hoy):
"""Get direct and diffuse irradiance values for an hoy."""
count = int(hoy * self.timestep)
return self.direct_normal_irradiance[count], \
self.diffuse_horizontal_irradiance[count] | [
"def",
"get_irradiance_value_for_hoy",
"(",
"self",
",",
"hoy",
")",
":",
"count",
"=",
"int",
"(",
"hoy",
"*",
"self",
".",
"timestep",
")",
"return",
"self",
".",
"direct_normal_irradiance",
"[",
"count",
"]",
",",
"self",
".",
"diffuse_horizontal_irradiance... | Get direct and diffuse irradiance values for an hoy. | [
"Get",
"direct",
"and",
"diffuse",
"irradiance",
"values",
"for",
"an",
"hoy",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/wea.py#L588-L592 |
ladybug-tools/ladybug | ladybug/wea.py | Wea.directional_irradiance | def directional_irradiance(self, altitude=90, azimuth=180,
ground_reflectance=0.2, isotrophic=True):
"""Returns the irradiance components facing a given altitude and azimuth.
This method computes unobstructed solar flux facing a given
altitude and azimuth. The def... | python | def directional_irradiance(self, altitude=90, azimuth=180,
ground_reflectance=0.2, isotrophic=True):
"""Returns the irradiance components facing a given altitude and azimuth.
This method computes unobstructed solar flux facing a given
altitude and azimuth. The def... | [
"def",
"directional_irradiance",
"(",
"self",
",",
"altitude",
"=",
"90",
",",
"azimuth",
"=",
"180",
",",
"ground_reflectance",
"=",
"0.2",
",",
"isotrophic",
"=",
"True",
")",
":",
"# function to convert polar coordinates to xyz.",
"def",
"pol2cart",
"(",
"phi",... | Returns the irradiance 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
irradiance, assuming an altitude facing straight up (90 degrees).
Args:
... | [
"Returns",
"the",
"irradiance",
"components",
"facing",
"a",
"given",
"altitude",
"and",
"azimuth",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/wea.py#L594-L692 |
ladybug-tools/ladybug | ladybug/wea.py | Wea.header | def header(self):
"""Wea header."""
return "place %s\n" % self.location.city + \
"latitude %.2f\n" % self.location.latitude + \
"longitude %.2f\n" % -self.location.longitude + \
"time_zone %d\n" % (-self.location.time_zone * 15) + \
"site_elevation %.1f\n"... | python | def header(self):
"""Wea header."""
return "place %s\n" % self.location.city + \
"latitude %.2f\n" % self.location.latitude + \
"longitude %.2f\n" % -self.location.longitude + \
"time_zone %d\n" % (-self.location.time_zone * 15) + \
"site_elevation %.1f\n"... | [
"def",
"header",
"(",
"self",
")",
":",
"return",
"\"place %s\\n\"",
"%",
"self",
".",
"location",
".",
"city",
"+",
"\"latitude %.2f\\n\"",
"%",
"self",
".",
"location",
".",
"latitude",
"+",
"\"longitude %.2f\\n\"",
"%",
"-",
"self",
".",
"location",
".",
... | Wea header. | [
"Wea",
"header",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/wea.py#L695-L702 |
ladybug-tools/ladybug | ladybug/wea.py | Wea.to_json | def to_json(self):
"""Write Wea to json file
{
"location": {} , // ladybug location schema
"direct_normal_irradiance": (), // Tuple of hourly direct normal
irradiance
"diffuse_horizontal_irradiance": (), // Tuple of hourly diffuse
h... | python | def to_json(self):
"""Write Wea to json file
{
"location": {} , // ladybug location schema
"direct_normal_irradiance": (), // Tuple of hourly direct normal
irradiance
"diffuse_horizontal_irradiance": (), // Tuple of hourly diffuse
h... | [
"def",
"to_json",
"(",
"self",
")",
":",
"return",
"{",
"'location'",
":",
"self",
".",
"location",
".",
"to_json",
"(",
")",
",",
"'direct_normal_irradiance'",
":",
"self",
".",
"direct_normal_irradiance",
".",
"to_json",
"(",
")",
",",
"'diffuse_horizontal_i... | Write Wea to json file
{
"location": {} , // ladybug location schema
"direct_normal_irradiance": (), // Tuple of hourly direct normal
irradiance
"diffuse_horizontal_irradiance": (), // Tuple of hourly diffuse
horizontal irradiance
... | [
"Write",
"Wea",
"to",
"json",
"file",
"{",
"location",
":",
"{}",
"//",
"ladybug",
"location",
"schema",
"direct_normal_irradiance",
":",
"()",
"//",
"Tuple",
"of",
"hourly",
"direct",
"normal",
"irradiance",
"diffuse_horizontal_irradiance",
":",
"()",
"//",
"Tu... | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/wea.py#L704-L723 |
ladybug-tools/ladybug | ladybug/wea.py | Wea.write | def write(self, file_path, hoys=None, write_hours=False):
"""Write the wea file.
WEA carries irradiance values from epw and is what gendaymtx uses to
generate the sky.
"""
if not file_path.lower().endswith('.wea'):
file_path += '.wea'
# generate hoys in wea ... | python | def write(self, file_path, hoys=None, write_hours=False):
"""Write the wea file.
WEA carries irradiance values from epw and is what gendaymtx uses to
generate the sky.
"""
if not file_path.lower().endswith('.wea'):
file_path += '.wea'
# generate hoys in wea ... | [
"def",
"write",
"(",
"self",
",",
"file_path",
",",
"hoys",
"=",
"None",
",",
"write_hours",
"=",
"False",
")",
":",
"if",
"not",
"file_path",
".",
"lower",
"(",
")",
".",
"endswith",
"(",
"'.wea'",
")",
":",
"file_path",
"+=",
"'.wea'",
"# generate ho... | Write the wea file.
WEA carries irradiance values from epw and is what gendaymtx uses to
generate the sky. | [
"Write",
"the",
"wea",
"file",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/wea.py#L725-L773 |
ladybug-tools/ladybug | ladybug/listoperations.py | flatten | def flatten(input_list):
"""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']
"""
for el in input_list:
if isinstance(el, collections.Iterable) \
... | python | def flatten(input_list):
"""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']
"""
for el in input_list:
if isinstance(el, collections.Iterable) \
... | [
"def",
"flatten",
"(",
"input_list",
")",
":",
"for",
"el",
"in",
"input_list",
":",
"if",
"isinstance",
"(",
"el",
",",
"collections",
".",
"Iterable",
")",
"and",
"not",
"isinstance",
"(",
"el",
",",
"basestring",
")",
":",
"for",
"sub",
"in",
"flatt... | 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'] | [
"Return",
"a",
"flattened",
"genertor",
"from",
"an",
"input",
"list",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/listoperations.py#L8-L23 |
ladybug-tools/ladybug | ladybug/listoperations.py | unflatten | def unflatten(guide, falttened_input):
"""Unflatten a falttened generator.
Args:
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]
unf... | python | def unflatten(guide, falttened_input):
"""Unflatten a falttened generator.
Args:
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]
unf... | [
"def",
"unflatten",
"(",
"guide",
",",
"falttened_input",
")",
":",
"return",
"[",
"unflatten",
"(",
"sub_list",
",",
"falttened_input",
")",
"if",
"isinstance",
"(",
"sub_list",
",",
"list",
")",
"else",
"next",
"(",
"falttened_input",
")",
"for",
"sub_list... | Unflatten a falttened generator.
Args:
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... | [
"Unflatten",
"a",
"falttened",
"generator",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/listoperations.py#L26-L41 |
ladybug-tools/ladybug | ladybug/color.py | ColorRange.color | def color(self, value):
"""Return color for an input value."""
assert self._is_domain_set, \
"Domain is not set. Use self.domain to set the domain."
if self._ctype == 2:
# if ordinal map the value and color
try:
return self._colors[self._domai... | python | def color(self, value):
"""Return color for an input value."""
assert self._is_domain_set, \
"Domain is not set. Use self.domain to set the domain."
if self._ctype == 2:
# if ordinal map the value and color
try:
return self._colors[self._domai... | [
"def",
"color",
"(",
"self",
",",
"value",
")",
":",
"assert",
"self",
".",
"_is_domain_set",
",",
"\"Domain is not set. Use self.domain to set the domain.\"",
"if",
"self",
".",
"_ctype",
"==",
"2",
":",
"# if ordinal map the value and color",
"try",
":",
"return",
... | Return color for an input value. | [
"Return",
"color",
"for",
"an",
"input",
"value",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/color.py#L436-L462 |
ladybug-tools/ladybug | ladybug/color.py | ColorRange._cal_color | def _cal_color(self, value, color_index):
"""Blend between two colors based on input value."""
range_min_p = self._domain[color_index]
range_p = self._domain[color_index + 1] - range_min_p
try:
factor = (value - range_min_p) / range_p
except ZeroDivisionError:
... | python | def _cal_color(self, value, color_index):
"""Blend between two colors based on input value."""
range_min_p = self._domain[color_index]
range_p = self._domain[color_index + 1] - range_min_p
try:
factor = (value - range_min_p) / range_p
except ZeroDivisionError:
... | [
"def",
"_cal_color",
"(",
"self",
",",
"value",
",",
"color_index",
")",
":",
"range_min_p",
"=",
"self",
".",
"_domain",
"[",
"color_index",
"]",
"range_p",
"=",
"self",
".",
"_domain",
"[",
"color_index",
"+",
"1",
"]",
"-",
"range_min_p",
"try",
":",
... | Blend between two colors based on input value. | [
"Blend",
"between",
"two",
"colors",
"based",
"on",
"input",
"value",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/color.py#L464-L479 |
ladybug-tools/ladybug | ladybug/sunpath.py | Sunpath.from_location | def from_location(cls, location, north_angle=0, daylight_saving_period=None):
"""Create a sun path from a LBlocation."""
location = Location.from_location(location)
return cls(location.latitude, location.longitude,
location.time_zone, north_angle, daylight_saving_period) | python | def from_location(cls, location, north_angle=0, daylight_saving_period=None):
"""Create a sun path from a LBlocation."""
location = Location.from_location(location)
return cls(location.latitude, location.longitude,
location.time_zone, north_angle, daylight_saving_period) | [
"def",
"from_location",
"(",
"cls",
",",
"location",
",",
"north_angle",
"=",
"0",
",",
"daylight_saving_period",
"=",
"None",
")",
":",
"location",
"=",
"Location",
".",
"from_location",
"(",
"location",
")",
"return",
"cls",
"(",
"location",
".",
"latitude... | Create a sun path from a LBlocation. | [
"Create",
"a",
"sun",
"path",
"from",
"a",
"LBlocation",
"."
] | train | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/sunpath.py#L84-L88 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.