repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
fhs/pyhdf | pyhdf/VS.py | VS.storedata | def storedata(self, fieldName, values, data_type, vName, vClass):
"""Create and initialize a single field vdata, returning
the vdata reference number.
Args::
fieldName Name of the single field in the vadata to create
values Sequence of values to store in the field;. ... | python | def storedata(self, fieldName, values, data_type, vName, vClass):
"""Create and initialize a single field vdata, returning
the vdata reference number.
Args::
fieldName Name of the single field in the vadata to create
values Sequence of values to store in the field;. ... | [
"def",
"storedata",
"(",
"self",
",",
"fieldName",
",",
"values",
",",
"data_type",
",",
"vName",
",",
"vClass",
")",
":",
"nrecs",
"=",
"len",
"(",
"values",
")",
"if",
"type",
"(",
"values",
"[",
"0",
"]",
")",
"in",
"[",
"list",
",",
"tuple",
... | Create and initialize a single field vdata, returning
the vdata reference number.
Args::
fieldName Name of the single field in the vadata to create
values Sequence of values to store in the field;. Each value can
itself be a sequence, in which case the ... | [
"Create",
"and",
"initialize",
"a",
"single",
"field",
"vdata",
"returning",
"the",
"vdata",
"reference",
"number",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/VS.py#L1062-L1159 | train |
fhs/pyhdf | pyhdf/VS.py | VD.field | def field(self, name_index):
"""Get a VDField instance representing a field of the vdata.
Args::
name_index name or index number of the field
Returns::
VDfield instance representing the field
C library equivalent : no equivalent
... | python | def field(self, name_index):
"""Get a VDField instance representing a field of the vdata.
Args::
name_index name or index number of the field
Returns::
VDfield instance representing the field
C library equivalent : no equivalent
... | [
"def",
"field",
"(",
"self",
",",
"name_index",
")",
":",
"if",
"isinstance",
"(",
"name_index",
",",
"str",
")",
":",
"status",
",",
"index",
"=",
"_C",
".",
"VSfindex",
"(",
"self",
".",
"_id",
",",
"name_index",
")",
"_checkErr",
"(",
"'field'",
"... | Get a VDField instance representing a field of the vdata.
Args::
name_index name or index number of the field
Returns::
VDfield instance representing the field
C library equivalent : no equivalent | [
"Get",
"a",
"VDField",
"instance",
"representing",
"a",
"field",
"of",
"the",
"vdata",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/VS.py#L1480-L1504 | train |
fhs/pyhdf | pyhdf/VS.py | VD.seek | def seek(self, recIndex):
"""Seek to the beginning of the record identified by its
record index. A succeeding read will load this record in
memory.
Args::
recIndex index of the record in the vdata; numbering
starts at 0. Legal values range from 0
... | python | def seek(self, recIndex):
"""Seek to the beginning of the record identified by its
record index. A succeeding read will load this record in
memory.
Args::
recIndex index of the record in the vdata; numbering
starts at 0. Legal values range from 0
... | [
"def",
"seek",
"(",
"self",
",",
"recIndex",
")",
":",
"if",
"recIndex",
">",
"self",
".",
"_nrecs",
"-",
"1",
":",
"if",
"recIndex",
"==",
"self",
".",
"_nrecs",
":",
"return",
"self",
".",
"seekend",
"(",
")",
"else",
":",
"raise",
"HDF4Error",
"... | Seek to the beginning of the record identified by its
record index. A succeeding read will load this record in
memory.
Args::
recIndex index of the record in the vdata; numbering
starts at 0. Legal values range from 0
(start of vdata) to the c... | [
"Seek",
"to",
"the",
"beginning",
"of",
"the",
"record",
"identified",
"by",
"its",
"record",
"index",
".",
"A",
"succeeding",
"read",
"will",
"load",
"this",
"record",
"in",
"memory",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/VS.py#L1507-L1544 | train |
fhs/pyhdf | pyhdf/VS.py | VD.inquire | def inquire(self):
"""Retrieve info about the vdata.
Args::
no argument
Returns::
5-element tuple with the following elements:
-number of records in the vdata
-interlace mode
-list of vdata field names
-size in bytes of the ... | python | def inquire(self):
"""Retrieve info about the vdata.
Args::
no argument
Returns::
5-element tuple with the following elements:
-number of records in the vdata
-interlace mode
-list of vdata field names
-size in bytes of the ... | [
"def",
"inquire",
"(",
"self",
")",
":",
"status",
",",
"nRecs",
",",
"interlace",
",",
"fldNames",
",",
"size",
",",
"vName",
"=",
"_C",
".",
"VSinquire",
"(",
"self",
".",
"_id",
")",
"_checkErr",
"(",
"'inquire'",
",",
"status",
",",
"\"cannot query... | Retrieve info about the vdata.
Args::
no argument
Returns::
5-element tuple with the following elements:
-number of records in the vdata
-interlace mode
-list of vdata field names
-size in bytes of the vdata record
-name... | [
"Retrieve",
"info",
"about",
"the",
"vdata",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/VS.py#L1861-L1883 | train |
fhs/pyhdf | pyhdf/VS.py | VD.fieldinfo | def fieldinfo(self):
"""Retrieve info about all vdata fields.
Args::
no argument
Returns::
list where each element describes a field of the vdata;
each field is described by an 7-element tuple containing
the following elements:
- field name
... | python | def fieldinfo(self):
"""Retrieve info about all vdata fields.
Args::
no argument
Returns::
list where each element describes a field of the vdata;
each field is described by an 7-element tuple containing
the following elements:
- field name
... | [
"def",
"fieldinfo",
"(",
"self",
")",
":",
"lst",
"=",
"[",
"]",
"for",
"n",
"in",
"range",
"(",
"self",
".",
"_nfields",
")",
":",
"fld",
"=",
"self",
".",
"field",
"(",
"n",
")",
"lst",
".",
"append",
"(",
"(",
"fld",
".",
"_name",
",",
"fl... | Retrieve info about all vdata fields.
Args::
no argument
Returns::
list where each element describes a field of the vdata;
each field is described by an 7-element tuple containing
the following elements:
- field name
- field data type (one... | [
"Retrieve",
"info",
"about",
"all",
"vdata",
"fields",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/VS.py#L1886-L1921 | train |
fhs/pyhdf | pyhdf/VS.py | VD.sizeof | def sizeof(self, fields):
"""Retrieve the size in bytes of the given fields.
Args::
fields sequence of field names to query
Returns::
total size of the fields in bytes
C library equivalent : VSsizeof
"""
... | python | def sizeof(self, fields):
"""Retrieve the size in bytes of the given fields.
Args::
fields sequence of field names to query
Returns::
total size of the fields in bytes
C library equivalent : VSsizeof
"""
... | [
"def",
"sizeof",
"(",
"self",
",",
"fields",
")",
":",
"if",
"type",
"(",
"fields",
")",
"in",
"[",
"tuple",
",",
"list",
"]",
":",
"str",
"=",
"','",
".",
"join",
"(",
"fields",
")",
"else",
":",
"str",
"=",
"fields",
"n",
"=",
"_C",
".",
"V... | Retrieve the size in bytes of the given fields.
Args::
fields sequence of field names to query
Returns::
total size of the fields in bytes
C library equivalent : VSsizeof | [
"Retrieve",
"the",
"size",
"in",
"bytes",
"of",
"the",
"given",
"fields",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/VS.py#L1923-L1943 | train |
fhs/pyhdf | pyhdf/VS.py | VD.fexist | def fexist(self, fields):
"""Check if a vdata contains a given set of fields.
Args::
fields sequence of field names whose presence in the
vdata must be checked
Returns::
true (1) if the given fields are present
false (0) otherwise
... | python | def fexist(self, fields):
"""Check if a vdata contains a given set of fields.
Args::
fields sequence of field names whose presence in the
vdata must be checked
Returns::
true (1) if the given fields are present
false (0) otherwise
... | [
"def",
"fexist",
"(",
"self",
",",
"fields",
")",
":",
"if",
"type",
"(",
"fields",
")",
"in",
"[",
"tuple",
",",
"list",
"]",
":",
"str",
"=",
"','",
".",
"join",
"(",
"fields",
")",
"else",
":",
"str",
"=",
"fields",
"ret",
"=",
"_C",
".",
... | Check if a vdata contains a given set of fields.
Args::
fields sequence of field names whose presence in the
vdata must be checked
Returns::
true (1) if the given fields are present
false (0) otherwise
C library equivalent : VSfexist | [
"Check",
"if",
"a",
"vdata",
"contains",
"a",
"given",
"set",
"of",
"fields",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/VS.py#L1945-L1969 | train |
fhs/pyhdf | pyhdf/VS.py | VDField.find | def find(self, name):
"""Search the field for a given attribute.
Args::
name attribute name
Returns::
if found, VDAttr instance describing the attribute
None otherwise
C library equivalent : VSfindattr
... | python | def find(self, name):
"""Search the field for a given attribute.
Args::
name attribute name
Returns::
if found, VDAttr instance describing the attribute
None otherwise
C library equivalent : VSfindattr
... | [
"def",
"find",
"(",
"self",
",",
"name",
")",
":",
"try",
":",
"att",
"=",
"self",
".",
"attr",
"(",
"name",
")",
"if",
"att",
".",
"_index",
"is",
"None",
":",
"att",
"=",
"None",
"except",
"HDF4Error",
":",
"att",
"=",
"None",
"return",
"att"
] | Search the field for a given attribute.
Args::
name attribute name
Returns::
if found, VDAttr instance describing the attribute
None otherwise
C library equivalent : VSfindattr | [
"Search",
"the",
"field",
"for",
"a",
"given",
"attribute",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/VS.py#L2236-L2257 | train |
fhs/pyhdf | pyhdf/VS.py | VDAttr.set | def set(self, data_type, values):
"""Set the attribute value.
Args::
data_type : attribute data type (see constants HC.xxx)
values : attribute value(s); specify a list to create
a multi-valued attribute; a string valued
att... | python | def set(self, data_type, values):
"""Set the attribute value.
Args::
data_type : attribute data type (see constants HC.xxx)
values : attribute value(s); specify a list to create
a multi-valued attribute; a string valued
att... | [
"def",
"set",
"(",
"self",
",",
"data_type",
",",
"values",
")",
":",
"try",
":",
"n_values",
"=",
"len",
"(",
"values",
")",
"except",
":",
"values",
"=",
"[",
"values",
"]",
"n_values",
"=",
"1",
"if",
"data_type",
"==",
"HC",
".",
"CHAR8",
":",
... | Set the attribute value.
Args::
data_type : attribute data type (see constants HC.xxx)
values : attribute value(s); specify a list to create
a multi-valued attribute; a string valued
attribute can be created by setting 'data_type'
... | [
"Set",
"the",
"attribute",
"value",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/VS.py#L2406-L2493 | train |
fhs/pyhdf | pyhdf/HDF.py | getlibversion | def getlibversion():
"""Get the library version info.
Args:
no argument
Returns:
4-element tuple with the following components:
-major version number (int)
-minor version number (int)
-complete library version number (int)
-additional information (string)
C ... | python | def getlibversion():
"""Get the library version info.
Args:
no argument
Returns:
4-element tuple with the following components:
-major version number (int)
-minor version number (int)
-complete library version number (int)
-additional information (string)
C ... | [
"def",
"getlibversion",
"(",
")",
":",
"status",
",",
"major_v",
",",
"minor_v",
",",
"release",
",",
"info",
"=",
"_C",
".",
"Hgetlibversion",
"(",
")",
"_checkErr",
"(",
"'getlibversion'",
",",
"status",
",",
"\"cannot get lib version\"",
")",
"return",
"m... | Get the library version info.
Args:
no argument
Returns:
4-element tuple with the following components:
-major version number (int)
-minor version number (int)
-complete library version number (int)
-additional information (string)
C library equivalent : Hgetlib... | [
"Get",
"the",
"library",
"version",
"info",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/HDF.py#L99-L116 | train |
fhs/pyhdf | pyhdf/HDF.py | HDF.getfileversion | def getfileversion(self):
"""Get file version info.
Args:
no argument
Returns:
4-element tuple with the following components:
-major version number (int)
-minor version number (int)
-complete library version number (int)
-addit... | python | def getfileversion(self):
"""Get file version info.
Args:
no argument
Returns:
4-element tuple with the following components:
-major version number (int)
-minor version number (int)
-complete library version number (int)
-addit... | [
"def",
"getfileversion",
"(",
"self",
")",
":",
"status",
",",
"major_v",
",",
"minor_v",
",",
"release",
",",
"info",
"=",
"_C",
".",
"Hgetfileversion",
"(",
"self",
".",
"_id",
")",
"_checkErr",
"(",
"'getfileversion'",
",",
"status",
",",
"\"cannot get ... | Get file version info.
Args:
no argument
Returns:
4-element tuple with the following components:
-major version number (int)
-minor version number (int)
-complete library version number (int)
-additional information (string)
C... | [
"Get",
"file",
"version",
"info",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/HDF.py#L244-L261 | train |
mattmakai/underwear | underwear/run_underwear.py | colorize | def colorize(lead, num, color):
""" Print 'lead' = 'num' in 'color' """
if num != 0 and ANSIBLE_COLOR and color is not None:
return "%s%s%-15s" % (stringc(lead, color), stringc("=", color), stringc(str(num), color))
else:
return "%s=%-4s" % (lead, str(num)) | python | def colorize(lead, num, color):
""" Print 'lead' = 'num' in 'color' """
if num != 0 and ANSIBLE_COLOR and color is not None:
return "%s%s%-15s" % (stringc(lead, color), stringc("=", color), stringc(str(num), color))
else:
return "%s=%-4s" % (lead, str(num)) | [
"def",
"colorize",
"(",
"lead",
",",
"num",
",",
"color",
")",
":",
"if",
"num",
"!=",
"0",
"and",
"ANSIBLE_COLOR",
"and",
"color",
"is",
"not",
"None",
":",
"return",
"\"%s%s%-15s\"",
"%",
"(",
"stringc",
"(",
"lead",
",",
"color",
")",
",",
"string... | Print 'lead' = 'num' in 'color' | [
"Print",
"lead",
"=",
"num",
"in",
"color"
] | 7c484c7937d2df86dc569d411249ba366ed43ead | https://github.com/mattmakai/underwear/blob/7c484c7937d2df86dc569d411249ba366ed43ead/underwear/run_underwear.py#L24-L29 | train |
zapier/django-drip | drip/admin.py | DripAdmin.timeline | def timeline(self, request, drip_id, into_past, into_future):
"""
Return a list of people who should get emails.
"""
from django.shortcuts import render, get_object_or_404
drip = get_object_or_404(Drip, id=drip_id)
shifted_drips = []
seen_users = set()
f... | python | def timeline(self, request, drip_id, into_past, into_future):
"""
Return a list of people who should get emails.
"""
from django.shortcuts import render, get_object_or_404
drip = get_object_or_404(Drip, id=drip_id)
shifted_drips = []
seen_users = set()
f... | [
"def",
"timeline",
"(",
"self",
",",
"request",
",",
"drip_id",
",",
"into_past",
",",
"into_future",
")",
":",
"from",
"django",
".",
"shortcuts",
"import",
"render",
",",
"get_object_or_404",
"drip",
"=",
"get_object_or_404",
"(",
"Drip",
",",
"id",
"=",
... | Return a list of people who should get emails. | [
"Return",
"a",
"list",
"of",
"people",
"who",
"should",
"get",
"emails",
"."
] | ffbef6927a1a20f4c353ecb108c1b484502d2b29 | https://github.com/zapier/django-drip/blob/ffbef6927a1a20f4c353ecb108c1b484502d2b29/drip/admin.py#L33-L51 | train |
zapier/django-drip | drip/drips.py | DripBase.walk | def walk(self, into_past=0, into_future=0):
"""
Walk over a date range and create new instances of self with new ranges.
"""
walked_range = []
for shift in range(-into_past, into_future):
kwargs = dict(drip_model=self.drip_model,
name=self.na... | python | def walk(self, into_past=0, into_future=0):
"""
Walk over a date range and create new instances of self with new ranges.
"""
walked_range = []
for shift in range(-into_past, into_future):
kwargs = dict(drip_model=self.drip_model,
name=self.na... | [
"def",
"walk",
"(",
"self",
",",
"into_past",
"=",
"0",
",",
"into_future",
"=",
"0",
")",
":",
"walked_range",
"=",
"[",
"]",
"for",
"shift",
"in",
"range",
"(",
"-",
"into_past",
",",
"into_future",
")",
":",
"kwargs",
"=",
"dict",
"(",
"drip_model... | Walk over a date range and create new instances of self with new ranges. | [
"Walk",
"over",
"a",
"date",
"range",
"and",
"create",
"new",
"instances",
"of",
"self",
"with",
"new",
"ranges",
"."
] | ffbef6927a1a20f4c353ecb108c1b484502d2b29 | https://github.com/zapier/django-drip/blob/ffbef6927a1a20f4c353ecb108c1b484502d2b29/drip/drips.py#L146-L156 | train |
zapier/django-drip | drip/drips.py | DripBase.run | def run(self):
"""
Get the queryset, prune sent people, and send it.
"""
if not self.drip_model.enabled:
return None
self.prune()
count = self.send()
return count | python | def run(self):
"""
Get the queryset, prune sent people, and send it.
"""
if not self.drip_model.enabled:
return None
self.prune()
count = self.send()
return count | [
"def",
"run",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"drip_model",
".",
"enabled",
":",
"return",
"None",
"self",
".",
"prune",
"(",
")",
"count",
"=",
"self",
".",
"send",
"(",
")",
"return",
"count"
] | Get the queryset, prune sent people, and send it. | [
"Get",
"the",
"queryset",
"prune",
"sent",
"people",
"and",
"send",
"it",
"."
] | ffbef6927a1a20f4c353ecb108c1b484502d2b29 | https://github.com/zapier/django-drip/blob/ffbef6927a1a20f4c353ecb108c1b484502d2b29/drip/drips.py#L194-L204 | train |
zapier/django-drip | drip/drips.py | DripBase.prune | def prune(self):
"""
Do an exclude for all Users who have a SentDrip already.
"""
target_user_ids = self.get_queryset().values_list('id', flat=True)
exclude_user_ids = SentDrip.objects.filter(date__lt=conditional_now(),
drip=self... | python | def prune(self):
"""
Do an exclude for all Users who have a SentDrip already.
"""
target_user_ids = self.get_queryset().values_list('id', flat=True)
exclude_user_ids = SentDrip.objects.filter(date__lt=conditional_now(),
drip=self... | [
"def",
"prune",
"(",
"self",
")",
":",
"target_user_ids",
"=",
"self",
".",
"get_queryset",
"(",
")",
".",
"values_list",
"(",
"'id'",
",",
"flat",
"=",
"True",
")",
"exclude_user_ids",
"=",
"SentDrip",
".",
"objects",
".",
"filter",
"(",
"date__lt",
"="... | Do an exclude for all Users who have a SentDrip already. | [
"Do",
"an",
"exclude",
"for",
"all",
"Users",
"who",
"have",
"a",
"SentDrip",
"already",
"."
] | ffbef6927a1a20f4c353ecb108c1b484502d2b29 | https://github.com/zapier/django-drip/blob/ffbef6927a1a20f4c353ecb108c1b484502d2b29/drip/drips.py#L206-L215 | train |
zapier/django-drip | drip/drips.py | DripBase.send | def send(self):
"""
Send the message to each user on the queryset.
Create SentDrip for each user that gets a message.
Returns count of created SentDrips.
"""
if not self.from_email:
self.from_email = getattr(settings, 'DRIP_FROM_EMAIL', settings.DEFAULT_FRO... | python | def send(self):
"""
Send the message to each user on the queryset.
Create SentDrip for each user that gets a message.
Returns count of created SentDrips.
"""
if not self.from_email:
self.from_email = getattr(settings, 'DRIP_FROM_EMAIL', settings.DEFAULT_FRO... | [
"def",
"send",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"from_email",
":",
"self",
".",
"from_email",
"=",
"getattr",
"(",
"settings",
",",
"'DRIP_FROM_EMAIL'",
",",
"settings",
".",
"DEFAULT_FROM_EMAIL",
")",
"MessageClass",
"=",
"message_class_for",
... | Send the message to each user on the queryset.
Create SentDrip for each user that gets a message.
Returns count of created SentDrips. | [
"Send",
"the",
"message",
"to",
"each",
"user",
"on",
"the",
"queryset",
"."
] | ffbef6927a1a20f4c353ecb108c1b484502d2b29 | https://github.com/zapier/django-drip/blob/ffbef6927a1a20f4c353ecb108c1b484502d2b29/drip/drips.py#L217-L248 | train |
ladybug-tools/ladybug | ladybug/euclid.py | Vector2.angle | def angle(self, other):
"""Return the angle to the vector other"""
return math.acos(self.dot(other) / (self.magnitude() * other.magnitude())) | python | def angle(self, other):
"""Return the angle to the vector other"""
return math.acos(self.dot(other) / (self.magnitude() * other.magnitude())) | [
"def",
"angle",
"(",
"self",
",",
"other",
")",
":",
"return",
"math",
".",
"acos",
"(",
"self",
".",
"dot",
"(",
"other",
")",
"/",
"(",
"self",
".",
"magnitude",
"(",
")",
"*",
"other",
".",
"magnitude",
"(",
")",
")",
")"
] | Return the angle to the vector other | [
"Return",
"the",
"angle",
"to",
"the",
"vector",
"other"
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/euclid.py#L298-L300 | train |
ladybug-tools/ladybug | ladybug/euclid.py | Vector2.project | def project(self, other):
"""Return one vector projected on the vector other"""
n = other.normalized()
return self.dot(n) * n | python | def project(self, other):
"""Return one vector projected on the vector other"""
n = other.normalized()
return self.dot(n) * n | [
"def",
"project",
"(",
"self",
",",
"other",
")",
":",
"n",
"=",
"other",
".",
"normalized",
"(",
")",
"return",
"self",
".",
"dot",
"(",
"n",
")",
"*",
"n"
] | Return one vector projected on the vector other | [
"Return",
"one",
"vector",
"projected",
"on",
"the",
"vector",
"other"
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/euclid.py#L302-L305 | train |
ladybug-tools/ladybug | ladybug/euclid.py | Vector3.rotate_around | def rotate_around(self, axis, theta):
"""Return the vector rotated around axis through angle theta.
Right hand rule applies.
"""
# Adapted from equations published by Glenn Murray.
# http://inside.mines.edu/~gmurray/ArbitraryAxisRotation/ArbitraryAxisRotation.html
x, y,... | python | def rotate_around(self, axis, theta):
"""Return the vector rotated around axis through angle theta.
Right hand rule applies.
"""
# Adapted from equations published by Glenn Murray.
# http://inside.mines.edu/~gmurray/ArbitraryAxisRotation/ArbitraryAxisRotation.html
x, y,... | [
"def",
"rotate_around",
"(",
"self",
",",
"axis",
",",
"theta",
")",
":",
"x",
",",
"y",
",",
"z",
"=",
"self",
".",
"x",
",",
"self",
".",
"y",
",",
"self",
".",
"z",
"u",
",",
"v",
",",
"w",
"=",
"axis",
".",
"x",
",",
"axis",
".",
"y",... | Return the vector rotated around axis through angle theta.
Right hand rule applies. | [
"Return",
"the",
"vector",
"rotated",
"around",
"axis",
"through",
"angle",
"theta",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/euclid.py#L588-L607 | train |
ladybug-tools/ladybug | ladybug/futil.py | preparedir | def preparedir(target_dir, remove_content=True):
"""Prepare a folder for analysis.
This method creates the folder if it is not created, and removes the file in
the folder if the folder already existed.
"""
if os.path.isdir(target_dir):
if remove_content:
nukedir(target_dir, Fals... | python | def preparedir(target_dir, remove_content=True):
"""Prepare a folder for analysis.
This method creates the folder if it is not created, and removes the file in
the folder if the folder already existed.
"""
if os.path.isdir(target_dir):
if remove_content:
nukedir(target_dir, Fals... | [
"def",
"preparedir",
"(",
"target_dir",
",",
"remove_content",
"=",
"True",
")",
":",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"target_dir",
")",
":",
"if",
"remove_content",
":",
"nukedir",
"(",
"target_dir",
",",
"False",
")",
"return",
"True",
"els... | Prepare a folder for analysis.
This method creates the folder if it is not created, and removes the file in
the folder if the folder already existed. | [
"Prepare",
"a",
"folder",
"for",
"analysis",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/futil.py#L20-L36 | train |
ladybug-tools/ladybug | ladybug/futil.py | nukedir | def nukedir(target_dir, rmdir=False):
"""Delete all the files inside target_dir.
Usage:
nukedir("c:/ladybug/libs", True)
"""
d = os.path.normpath(target_dir)
if not os.path.isdir(d):
return
files = os.listdir(d)
for f in files:
if f == '.' or f == '..':
... | python | def nukedir(target_dir, rmdir=False):
"""Delete all the files inside target_dir.
Usage:
nukedir("c:/ladybug/libs", True)
"""
d = os.path.normpath(target_dir)
if not os.path.isdir(d):
return
files = os.listdir(d)
for f in files:
if f == '.' or f == '..':
... | [
"def",
"nukedir",
"(",
"target_dir",
",",
"rmdir",
"=",
"False",
")",
":",
"d",
"=",
"os",
".",
"path",
".",
"normpath",
"(",
"target_dir",
")",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"d",
")",
":",
"return",
"files",
"=",
"os",
".",
... | Delete all the files inside target_dir.
Usage:
nukedir("c:/ladybug/libs", True) | [
"Delete",
"all",
"the",
"files",
"inside",
"target_dir",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/futil.py#L39-L69 | train |
ladybug-tools/ladybug | ladybug/futil.py | write_to_file_by_name | def write_to_file_by_name(folder, fname, data, mkdir=False):
"""Write a string of data to file by filename and folder.
Args:
folder: Target folder (e.g. c:/ladybug).
fname: File name (e.g. testPts.pts).
data: Any data as string.
mkdir: Set to True to create the directory if does... | python | def write_to_file_by_name(folder, fname, data, mkdir=False):
"""Write a string of data to file by filename and folder.
Args:
folder: Target folder (e.g. c:/ladybug).
fname: File name (e.g. testPts.pts).
data: Any data as string.
mkdir: Set to True to create the directory if does... | [
"def",
"write_to_file_by_name",
"(",
"folder",
",",
"fname",
",",
"data",
",",
"mkdir",
"=",
"False",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"folder",
")",
":",
"if",
"mkdir",
":",
"preparedir",
"(",
"folder",
")",
"else",
":",
... | Write a string of data to file by filename and folder.
Args:
folder: Target folder (e.g. c:/ladybug).
fname: File name (e.g. testPts.pts).
data: Any data as string.
mkdir: Set to True to create the directory if doesn't exist (Default: False). | [
"Write",
"a",
"string",
"of",
"data",
"to",
"file",
"by",
"filename",
"and",
"folder",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/futil.py#L72-L96 | train |
ladybug-tools/ladybug | ladybug/futil.py | copy_files_to_folder | def copy_files_to_folder(files, target_folder, overwrite=True):
"""Copy a list of files to a new target folder.
Returns:
A list of fullpath of the new files.
"""
if not files:
return []
for f in files:
target = os.path.join(target_folder, os.path.split(f)[-1])
if t... | python | def copy_files_to_folder(files, target_folder, overwrite=True):
"""Copy a list of files to a new target folder.
Returns:
A list of fullpath of the new files.
"""
if not files:
return []
for f in files:
target = os.path.join(target_folder, os.path.split(f)[-1])
if t... | [
"def",
"copy_files_to_folder",
"(",
"files",
",",
"target_folder",
",",
"overwrite",
"=",
"True",
")",
":",
"if",
"not",
"files",
":",
"return",
"[",
"]",
"for",
"f",
"in",
"files",
":",
"target",
"=",
"os",
".",
"path",
".",
"join",
"(",
"target_folde... | Copy a list of files to a new target folder.
Returns:
A list of fullpath of the new files. | [
"Copy",
"a",
"list",
"of",
"files",
"to",
"a",
"new",
"target",
"folder",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/futil.py#L111-L143 | train |
ladybug-tools/ladybug | ladybug/futil.py | bat_to_sh | def bat_to_sh(file_path):
"""Convert honeybee .bat file to .sh file.
WARNING: This is a very simple function and doesn't handle any edge cases.
"""
sh_file = file_path[:-4] + '.sh'
with open(file_path, 'rb') as inf, open(sh_file, 'wb') as outf:
outf.write('#!/usr/bin/env bash\n\n')
... | python | def bat_to_sh(file_path):
"""Convert honeybee .bat file to .sh file.
WARNING: This is a very simple function and doesn't handle any edge cases.
"""
sh_file = file_path[:-4] + '.sh'
with open(file_path, 'rb') as inf, open(sh_file, 'wb') as outf:
outf.write('#!/usr/bin/env bash\n\n')
... | [
"def",
"bat_to_sh",
"(",
"file_path",
")",
":",
"sh_file",
"=",
"file_path",
"[",
":",
"-",
"4",
"]",
"+",
"'.sh'",
"with",
"open",
"(",
"file_path",
",",
"'rb'",
")",
"as",
"inf",
",",
"open",
"(",
"sh_file",
",",
"'wb'",
")",
"as",
"outf",
":",
... | Convert honeybee .bat file to .sh file.
WARNING: This is a very simple function and doesn't handle any edge cases. | [
"Convert",
"honeybee",
".",
"bat",
"file",
"to",
".",
"sh",
"file",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/futil.py#L146-L171 | train |
ladybug-tools/ladybug | ladybug/futil.py | _download_py2 | def _download_py2(link, path, __hdr__):
"""Download a file from a link in Python 2."""
try:
req = urllib2.Request(link, headers=__hdr__)
u = urllib2.urlopen(req)
except Exception as e:
raise Exception(' Download failed with the error:\n{}'.format(e))
with open(path, 'wb') as out... | python | def _download_py2(link, path, __hdr__):
"""Download a file from a link in Python 2."""
try:
req = urllib2.Request(link, headers=__hdr__)
u = urllib2.urlopen(req)
except Exception as e:
raise Exception(' Download failed with the error:\n{}'.format(e))
with open(path, 'wb') as out... | [
"def",
"_download_py2",
"(",
"link",
",",
"path",
",",
"__hdr__",
")",
":",
"try",
":",
"req",
"=",
"urllib2",
".",
"Request",
"(",
"link",
",",
"headers",
"=",
"__hdr__",
")",
"u",
"=",
"urllib2",
".",
"urlopen",
"(",
"req",
")",
"except",
"Exceptio... | Download a file from a link in Python 2. | [
"Download",
"a",
"file",
"from",
"a",
"link",
"in",
"Python",
"2",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/futil.py#L174-L185 | train |
ladybug-tools/ladybug | ladybug/futil.py | _download_py3 | def _download_py3(link, path, __hdr__):
"""Download a file from a link in Python 3."""
try:
req = urllib.request.Request(link, headers=__hdr__)
u = urllib.request.urlopen(req)
except Exception as e:
raise Exception(' Download failed with the error:\n{}'.format(e))
with open(path... | python | def _download_py3(link, path, __hdr__):
"""Download a file from a link in Python 3."""
try:
req = urllib.request.Request(link, headers=__hdr__)
u = urllib.request.urlopen(req)
except Exception as e:
raise Exception(' Download failed with the error:\n{}'.format(e))
with open(path... | [
"def",
"_download_py3",
"(",
"link",
",",
"path",
",",
"__hdr__",
")",
":",
"try",
":",
"req",
"=",
"urllib",
".",
"request",
".",
"Request",
"(",
"link",
",",
"headers",
"=",
"__hdr__",
")",
"u",
"=",
"urllib",
".",
"request",
".",
"urlopen",
"(",
... | Download a file from a link in Python 3. | [
"Download",
"a",
"file",
"from",
"a",
"link",
"in",
"Python",
"3",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/futil.py#L188-L199 | train |
ladybug-tools/ladybug | ladybug/futil.py | download_file_by_name | def download_file_by_name(url, target_folder, file_name, mkdir=False):
"""Download a file to a directory.
Args:
url: A string to a valid URL.
target_folder: Target folder for download (e.g. c:/ladybug)
file_name: File name (e.g. testPts.zip).
mkdir: Set to True to create the dir... | python | def download_file_by_name(url, target_folder, file_name, mkdir=False):
"""Download a file to a directory.
Args:
url: A string to a valid URL.
target_folder: Target folder for download (e.g. c:/ladybug)
file_name: File name (e.g. testPts.zip).
mkdir: Set to True to create the dir... | [
"def",
"download_file_by_name",
"(",
"url",
",",
"target_folder",
",",
"file_name",
",",
"mkdir",
"=",
"False",
")",
":",
"__hdr__",
"=",
"{",
"'User-Agent'",
":",
"'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 '",
"'(KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11... | Download a file to a directory.
Args:
url: A string to a valid URL.
target_folder: Target folder for download (e.g. c:/ladybug)
file_name: File name (e.g. testPts.zip).
mkdir: Set to True to create the directory if doesn't exist (Default: False) | [
"Download",
"a",
"file",
"to",
"a",
"directory",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/futil.py#L202-L234 | train |
ladybug-tools/ladybug | ladybug/futil.py | unzip_file | def unzip_file(source_file, dest_dir=None, mkdir=False):
"""Unzip a compressed file.
Args:
source_file: Full path to a valid compressed file (e.g. c:/ladybug/testPts.zip)
dest_dir: Target folder to extract to (e.g. c:/ladybug).
Default is set to the same directory as the source file... | python | def unzip_file(source_file, dest_dir=None, mkdir=False):
"""Unzip a compressed file.
Args:
source_file: Full path to a valid compressed file (e.g. c:/ladybug/testPts.zip)
dest_dir: Target folder to extract to (e.g. c:/ladybug).
Default is set to the same directory as the source file... | [
"def",
"unzip_file",
"(",
"source_file",
",",
"dest_dir",
"=",
"None",
",",
"mkdir",
"=",
"False",
")",
":",
"if",
"dest_dir",
"is",
"None",
":",
"dest_dir",
",",
"fname",
"=",
"os",
".",
"path",
".",
"split",
"(",
"source_file",
")",
"elif",
"not",
... | Unzip a compressed file.
Args:
source_file: Full path to a valid compressed file (e.g. c:/ladybug/testPts.zip)
dest_dir: Target folder to extract to (e.g. c:/ladybug).
Default is set to the same directory as the source file.
mkdir: Set to True to create the directory if doesn't ... | [
"Unzip",
"a",
"compressed",
"file",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/futil.py#L249-L279 | train |
ladybug-tools/ladybug | ladybug/futil.py | csv_to_matrix | def csv_to_matrix(csv_file_path):
"""Load a CSV file into a Python matrix of strings.
Args:
csv_file_path: Full path to a valid CSV file (e.g. c:/ladybug/test.csv)
"""
mtx = []
with open(csv_file_path) as csv_data_file:
for row in csv_data_file:
mtx.append(row.split(',')... | python | def csv_to_matrix(csv_file_path):
"""Load a CSV file into a Python matrix of strings.
Args:
csv_file_path: Full path to a valid CSV file (e.g. c:/ladybug/test.csv)
"""
mtx = []
with open(csv_file_path) as csv_data_file:
for row in csv_data_file:
mtx.append(row.split(',')... | [
"def",
"csv_to_matrix",
"(",
"csv_file_path",
")",
":",
"mtx",
"=",
"[",
"]",
"with",
"open",
"(",
"csv_file_path",
")",
"as",
"csv_data_file",
":",
"for",
"row",
"in",
"csv_data_file",
":",
"mtx",
".",
"append",
"(",
"row",
".",
"split",
"(",
"','",
"... | Load a CSV file into a Python matrix of strings.
Args:
csv_file_path: Full path to a valid CSV file (e.g. c:/ladybug/test.csv) | [
"Load",
"a",
"CSV",
"file",
"into",
"a",
"Python",
"matrix",
"of",
"strings",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/futil.py#L282-L292 | train |
ladybug-tools/ladybug | ladybug/futil.py | csv_to_num_matrix | def csv_to_num_matrix(csv_file_path):
"""Load a CSV file consisting only of numbers into a Python matrix of floats.
Args:
csv_file_path: Full path to a valid CSV file (e.g. c:/ladybug/test.csv)
"""
mtx = []
with open(csv_file_path) as csv_data_file:
for row in csv_data_file:
... | python | def csv_to_num_matrix(csv_file_path):
"""Load a CSV file consisting only of numbers into a Python matrix of floats.
Args:
csv_file_path: Full path to a valid CSV file (e.g. c:/ladybug/test.csv)
"""
mtx = []
with open(csv_file_path) as csv_data_file:
for row in csv_data_file:
... | [
"def",
"csv_to_num_matrix",
"(",
"csv_file_path",
")",
":",
"mtx",
"=",
"[",
"]",
"with",
"open",
"(",
"csv_file_path",
")",
"as",
"csv_data_file",
":",
"for",
"row",
"in",
"csv_data_file",
":",
"mtx",
".",
"append",
"(",
"[",
"float",
"(",
"val",
")",
... | Load a CSV file consisting only of numbers into a Python matrix of floats.
Args:
csv_file_path: Full path to a valid CSV file (e.g. c:/ladybug/test.csv) | [
"Load",
"a",
"CSV",
"file",
"consisting",
"only",
"of",
"numbers",
"into",
"a",
"Python",
"matrix",
"of",
"floats",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/futil.py#L295-L305 | train |
ladybug-tools/ladybug | ladybug/stat.py | STAT.from_json | def from_json(cls, data):
""" Create STAT from json dictionary.
Args:
data: {
'location': {} , // ladybug location schema
'ashrae_climate_zone': str,
'koppen_climate_zone': str,
'extreme_cold_week': {}, // ladybug analy... | python | def from_json(cls, data):
""" Create STAT from json dictionary.
Args:
data: {
'location': {} , // ladybug location schema
'ashrae_climate_zone': str,
'koppen_climate_zone': str,
'extreme_cold_week': {}, // ladybug analy... | [
"def",
"from_json",
"(",
"cls",
",",
"data",
")",
":",
"stat_ob",
"=",
"cls",
"(",
"None",
")",
"option_keys_none",
"=",
"(",
"'ashrae_climate_zone'",
",",
"'koppen_climate_zone'",
",",
"'extreme_cold_week'",
",",
"'extreme_hot_week'",
",",
"'standard_pressure_at_el... | Create STAT from json dictionary.
Args:
data: {
'location': {} , // ladybug location schema
'ashrae_climate_zone': str,
'koppen_climate_zone': str,
'extreme_cold_week': {}, // ladybug analysis period schema
'ext... | [
"Create",
"STAT",
"from",
"json",
"dictionary",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/stat.py#L87-L175 | train |
ladybug-tools/ladybug | ladybug/stat.py | STAT.monthly_cooling_design_days_050 | def monthly_cooling_design_days_050(self):
"""A list of 12 objects representing monthly 5.0% cooling design days."""
if self.monthly_found is False or self._monthly_db_50 == [] \
or self._monthly_wb_50 == []:
return []
else:
db_conds = [DryBulbCond... | python | def monthly_cooling_design_days_050(self):
"""A list of 12 objects representing monthly 5.0% cooling design days."""
if self.monthly_found is False or self._monthly_db_50 == [] \
or self._monthly_wb_50 == []:
return []
else:
db_conds = [DryBulbCond... | [
"def",
"monthly_cooling_design_days_050",
"(",
"self",
")",
":",
"if",
"self",
".",
"monthly_found",
"is",
"False",
"or",
"self",
".",
"_monthly_db_50",
"==",
"[",
"]",
"or",
"self",
".",
"_monthly_wb_50",
"==",
"[",
"]",
":",
"return",
"[",
"]",
"else",
... | A list of 12 objects representing monthly 5.0% cooling design days. | [
"A",
"list",
"of",
"12",
"objects",
"representing",
"monthly",
"5",
".",
"0%",
"cooling",
"design",
"days",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/stat.py#L497-L513 | train |
ladybug-tools/ladybug | ladybug/stat.py | STAT.monthly_cooling_design_days_100 | def monthly_cooling_design_days_100(self):
"""A list of 12 objects representing monthly 10.0% cooling design days."""
if self.monthly_found is False or self._monthly_db_100 == [] \
or self._monthly_wb_100 == []:
return []
else:
db_conds = [DryBulbC... | python | def monthly_cooling_design_days_100(self):
"""A list of 12 objects representing monthly 10.0% cooling design days."""
if self.monthly_found is False or self._monthly_db_100 == [] \
or self._monthly_wb_100 == []:
return []
else:
db_conds = [DryBulbC... | [
"def",
"monthly_cooling_design_days_100",
"(",
"self",
")",
":",
"if",
"self",
".",
"monthly_found",
"is",
"False",
"or",
"self",
".",
"_monthly_db_100",
"==",
"[",
"]",
"or",
"self",
".",
"_monthly_wb_100",
"==",
"[",
"]",
":",
"return",
"[",
"]",
"else",... | A list of 12 objects representing monthly 10.0% cooling design days. | [
"A",
"list",
"of",
"12",
"objects",
"representing",
"monthly",
"10",
".",
"0%",
"cooling",
"design",
"days",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/stat.py#L516-L532 | train |
ladybug-tools/ladybug | ladybug/stat.py | STAT.monthly_cooling_design_days_020 | def monthly_cooling_design_days_020(self):
"""A list of 12 objects representing monthly 2.0% cooling design days."""
if self.monthly_found is False or self._monthly_db_20 == [] \
or self._monthly_wb_20 == []:
return []
else:
db_conds = [DryBulbCond... | python | def monthly_cooling_design_days_020(self):
"""A list of 12 objects representing monthly 2.0% cooling design days."""
if self.monthly_found is False or self._monthly_db_20 == [] \
or self._monthly_wb_20 == []:
return []
else:
db_conds = [DryBulbCond... | [
"def",
"monthly_cooling_design_days_020",
"(",
"self",
")",
":",
"if",
"self",
".",
"monthly_found",
"is",
"False",
"or",
"self",
".",
"_monthly_db_20",
"==",
"[",
"]",
"or",
"self",
".",
"_monthly_wb_20",
"==",
"[",
"]",
":",
"return",
"[",
"]",
"else",
... | A list of 12 objects representing monthly 2.0% cooling design days. | [
"A",
"list",
"of",
"12",
"objects",
"representing",
"monthly",
"2",
".",
"0%",
"cooling",
"design",
"days",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/stat.py#L535-L551 | train |
ladybug-tools/ladybug | ladybug/stat.py | STAT.monthly_cooling_design_days_004 | def monthly_cooling_design_days_004(self):
"""A list of 12 objects representing monthly 0.4% cooling design days."""
if self.monthly_found is False or self._monthly_db_04 == [] \
or self._monthly_wb_04 == []:
return []
else:
db_conds = [DryBulbCond... | python | def monthly_cooling_design_days_004(self):
"""A list of 12 objects representing monthly 0.4% cooling design days."""
if self.monthly_found is False or self._monthly_db_04 == [] \
or self._monthly_wb_04 == []:
return []
else:
db_conds = [DryBulbCond... | [
"def",
"monthly_cooling_design_days_004",
"(",
"self",
")",
":",
"if",
"self",
".",
"monthly_found",
"is",
"False",
"or",
"self",
".",
"_monthly_db_04",
"==",
"[",
"]",
"or",
"self",
".",
"_monthly_wb_04",
"==",
"[",
"]",
":",
"return",
"[",
"]",
"else",
... | A list of 12 objects representing monthly 0.4% cooling design days. | [
"A",
"list",
"of",
"12",
"objects",
"representing",
"monthly",
"0",
".",
"4%",
"cooling",
"design",
"days",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/stat.py#L554-L570 | train |
ladybug-tools/ladybug | ladybug/stat.py | STAT.monthly_wind_conditions | def monthly_wind_conditions(self):
"""A list of 12 monthly wind conditions that are used on the design days."""
return [WindCondition(x, y) for x, y in zip(
self._monthly_wind, self.monthly_wind_dirs)] | python | def monthly_wind_conditions(self):
"""A list of 12 monthly wind conditions that are used on the design days."""
return [WindCondition(x, y) for x, y in zip(
self._monthly_wind, self.monthly_wind_dirs)] | [
"def",
"monthly_wind_conditions",
"(",
"self",
")",
":",
"return",
"[",
"WindCondition",
"(",
"x",
",",
"y",
")",
"for",
"x",
",",
"y",
"in",
"zip",
"(",
"self",
".",
"_monthly_wind",
",",
"self",
".",
"monthly_wind_dirs",
")",
"]"
] | A list of 12 monthly wind conditions that are used on the design days. | [
"A",
"list",
"of",
"12",
"monthly",
"wind",
"conditions",
"that",
"are",
"used",
"on",
"the",
"design",
"days",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/stat.py#L598-L601 | train |
ladybug-tools/ladybug | ladybug/stat.py | STAT.monthly_wind_dirs | def monthly_wind_dirs(self):
"""A list of prevailing wind directions for each month."""
mwd = zip(*self._monthly_wind_dirs)
return [self._wind_dirs[mon.index(max(mon))] for mon in mwd] | python | def monthly_wind_dirs(self):
"""A list of prevailing wind directions for each month."""
mwd = zip(*self._monthly_wind_dirs)
return [self._wind_dirs[mon.index(max(mon))] for mon in mwd] | [
"def",
"monthly_wind_dirs",
"(",
"self",
")",
":",
"mwd",
"=",
"zip",
"(",
"*",
"self",
".",
"_monthly_wind_dirs",
")",
"return",
"[",
"self",
".",
"_wind_dirs",
"[",
"mon",
".",
"index",
"(",
"max",
"(",
"mon",
")",
")",
"]",
"for",
"mon",
"in",
"... | A list of prevailing wind directions for each month. | [
"A",
"list",
"of",
"prevailing",
"wind",
"directions",
"for",
"each",
"month",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/stat.py#L609-L612 | train |
ladybug-tools/ladybug | ladybug/stat.py | STAT.monthly_clear_sky_conditions | def monthly_clear_sky_conditions(self):
"""A list of 12 monthly clear sky conditions that are used on the design days."""
if self._monthly_tau_diffuse is [] or self._monthly_tau_beam is []:
return [OriginalClearSkyCondition(i, 21) for i in xrange(1, 13)]
return [RevisedClearSkyCondit... | python | def monthly_clear_sky_conditions(self):
"""A list of 12 monthly clear sky conditions that are used on the design days."""
if self._monthly_tau_diffuse is [] or self._monthly_tau_beam is []:
return [OriginalClearSkyCondition(i, 21) for i in xrange(1, 13)]
return [RevisedClearSkyCondit... | [
"def",
"monthly_clear_sky_conditions",
"(",
"self",
")",
":",
"if",
"self",
".",
"_monthly_tau_diffuse",
"is",
"[",
"]",
"or",
"self",
".",
"_monthly_tau_beam",
"is",
"[",
"]",
":",
"return",
"[",
"OriginalClearSkyCondition",
"(",
"i",
",",
"21",
")",
"for",... | A list of 12 monthly clear sky conditions that are used on the design days. | [
"A",
"list",
"of",
"12",
"monthly",
"clear",
"sky",
"conditions",
"that",
"are",
"used",
"on",
"the",
"design",
"days",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/stat.py#L615-L620 | train |
ladybug-tools/ladybug | ladybug/stat.py | STAT.to_json | def to_json(self):
"""Convert the STAT object to a dictionary."""
def jsonify_dict(base_dict):
new_dict = {}
for key, val in base_dict.items():
if isinstance(val, list):
new_dict[key] = [v.to_json() for v in val]
else:
... | python | def to_json(self):
"""Convert the STAT object to a dictionary."""
def jsonify_dict(base_dict):
new_dict = {}
for key, val in base_dict.items():
if isinstance(val, list):
new_dict[key] = [v.to_json() for v in val]
else:
... | [
"def",
"to_json",
"(",
"self",
")",
":",
"def",
"jsonify_dict",
"(",
"base_dict",
")",
":",
"new_dict",
"=",
"{",
"}",
"for",
"key",
",",
"val",
"in",
"base_dict",
".",
"items",
"(",
")",
":",
"if",
"isinstance",
"(",
"val",
",",
"list",
")",
":",
... | Convert the STAT object to a dictionary. | [
"Convert",
"the",
"STAT",
"object",
"to",
"a",
"dictionary",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/stat.py#L642-L678 | train |
ladybug-tools/ladybug | ladybug/datatype/base.py | DataTypeBase.from_json | def from_json(cls, data):
"""Create a data type from a dictionary.
Args:
data: Data as a dictionary.
{
"name": data type name of the data type as a string
"data_type": the class name of the data type as a string
"ba... | python | def from_json(cls, data):
"""Create a data type from a dictionary.
Args:
data: Data as a dictionary.
{
"name": data type name of the data type as a string
"data_type": the class name of the data type as a string
"ba... | [
"def",
"from_json",
"(",
"cls",
",",
"data",
")",
":",
"assert",
"'name'",
"in",
"data",
",",
"'Required keyword \"name\" is missing!'",
"assert",
"'data_type'",
"in",
"data",
",",
"'Required keyword \"data_type\" is missing!'",
"if",
"cls",
".",
"_type_enumeration",
... | Create a data type from a dictionary.
Args:
data: Data as a dictionary.
{
"name": data type name of the data type as a string
"data_type": the class name of the data type as a string
"base_unit": the base unit of the data t... | [
"Create",
"a",
"data",
"type",
"from",
"a",
"dictionary",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datatype/base.py#L70-L100 | train |
ladybug-tools/ladybug | ladybug/datatype/base.py | DataTypeBase.is_unit_acceptable | def is_unit_acceptable(self, unit, raise_exception=True):
"""Check if a certain unit is acceptable for the data type.
Args:
unit: A text string representing the abbreviated unit.
raise_exception: Set to True to raise an exception if not acceptable.
"""
_is_accept... | python | def is_unit_acceptable(self, unit, raise_exception=True):
"""Check if a certain unit is acceptable for the data type.
Args:
unit: A text string representing the abbreviated unit.
raise_exception: Set to True to raise an exception if not acceptable.
"""
_is_accept... | [
"def",
"is_unit_acceptable",
"(",
"self",
",",
"unit",
",",
"raise_exception",
"=",
"True",
")",
":",
"_is_acceptable",
"=",
"unit",
"in",
"self",
".",
"units",
"if",
"_is_acceptable",
"or",
"raise_exception",
"is",
"False",
":",
"return",
"_is_acceptable",
"e... | Check if a certain unit is acceptable for the data type.
Args:
unit: A text string representing the abbreviated unit.
raise_exception: Set to True to raise an exception if not acceptable. | [
"Check",
"if",
"a",
"certain",
"unit",
"is",
"acceptable",
"for",
"the",
"data",
"type",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datatype/base.py#L102-L119 | train |
ladybug-tools/ladybug | ladybug/datatype/base.py | DataTypeBase._is_numeric | def _is_numeric(self, values):
"""Check to be sure values are numbers before doing numerical operations."""
if len(values) > 0:
assert isinstance(values[0], (float, int)), \
"values must be numbers to perform math operations. Got {}".format(
type(values[0]... | python | def _is_numeric(self, values):
"""Check to be sure values are numbers before doing numerical operations."""
if len(values) > 0:
assert isinstance(values[0], (float, int)), \
"values must be numbers to perform math operations. Got {}".format(
type(values[0]... | [
"def",
"_is_numeric",
"(",
"self",
",",
"values",
")",
":",
"if",
"len",
"(",
"values",
")",
">",
"0",
":",
"assert",
"isinstance",
"(",
"values",
"[",
"0",
"]",
",",
"(",
"float",
",",
"int",
")",
")",
",",
"\"values must be numbers to perform math oper... | Check to be sure values are numbers before doing numerical operations. | [
"Check",
"to",
"be",
"sure",
"values",
"are",
"numbers",
"before",
"doing",
"numerical",
"operations",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datatype/base.py#L188-L194 | train |
ladybug-tools/ladybug | ladybug/datatype/base.py | DataTypeBase._to_unit_base | def _to_unit_base(self, base_unit, values, unit, from_unit):
"""Return values in a given unit given the input from_unit."""
self._is_numeric(values)
namespace = {'self': self, 'values': values}
if not from_unit == base_unit:
self.is_unit_acceptable(from_unit, True)
... | python | def _to_unit_base(self, base_unit, values, unit, from_unit):
"""Return values in a given unit given the input from_unit."""
self._is_numeric(values)
namespace = {'self': self, 'values': values}
if not from_unit == base_unit:
self.is_unit_acceptable(from_unit, True)
... | [
"def",
"_to_unit_base",
"(",
"self",
",",
"base_unit",
",",
"values",
",",
"unit",
",",
"from_unit",
")",
":",
"self",
".",
"_is_numeric",
"(",
"values",
")",
"namespace",
"=",
"{",
"'self'",
":",
"self",
",",
"'values'",
":",
"values",
"}",
"if",
"not... | Return values in a given unit given the input from_unit. | [
"Return",
"values",
"in",
"a",
"given",
"unit",
"given",
"the",
"input",
"from_unit",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datatype/base.py#L196-L211 | train |
ladybug-tools/ladybug | ladybug/datatype/base.py | DataTypeBase.name | def name(self):
"""The data type name."""
if self._name is None:
return re.sub(r"(?<=\w)([A-Z])", r" \1", self.__class__.__name__)
else:
return self._name | python | def name(self):
"""The data type name."""
if self._name is None:
return re.sub(r"(?<=\w)([A-Z])", r" \1", self.__class__.__name__)
else:
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"if",
"self",
".",
"_name",
"is",
"None",
":",
"return",
"re",
".",
"sub",
"(",
"r\"(?<=\\w)([A-Z])\"",
",",
"r\" \\1\"",
",",
"self",
".",
"__class__",
".",
"__name__",
")",
"else",
":",
"return",
"self",
".",
"... | The data type name. | [
"The",
"data",
"type",
"name",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datatype/base.py#L222-L227 | train |
ladybug-tools/ladybug | ladybug/header.py | Header.from_json | def from_json(cls, data):
"""Create a header from a dictionary.
Args:
data: {
"data_type": {}, //Type of data (e.g. Temperature)
"unit": string,
"analysis_period": {} // A Ladybug AnalysisPeriod
"metadata": {}, // A dictionary ... | python | def from_json(cls, data):
"""Create a header from a dictionary.
Args:
data: {
"data_type": {}, //Type of data (e.g. Temperature)
"unit": string,
"analysis_period": {} // A Ladybug AnalysisPeriod
"metadata": {}, // A dictionary ... | [
"def",
"from_json",
"(",
"cls",
",",
"data",
")",
":",
"assert",
"'data_type'",
"in",
"data",
",",
"'Required keyword \"data_type\" is missing!'",
"keys",
"=",
"(",
"'data_type'",
",",
"'unit'",
",",
"'analysis_period'",
",",
"'metadata'",
")",
"for",
"key",
"in... | Create a header from a dictionary.
Args:
data: {
"data_type": {}, //Type of data (e.g. Temperature)
"unit": string,
"analysis_period": {} // A Ladybug AnalysisPeriod
"metadata": {}, // A dictionary of metadata
} | [
"Create",
"a",
"header",
"from",
"a",
"dictionary",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/header.py#L58-L78 | train |
ladybug-tools/ladybug | ladybug/header.py | Header.duplicate | def duplicate(self):
"""Return a copy of the header."""
a_per = self.analysis_period.duplicate() if self.analysis_period else None
return self.__class__(self.data_type, self.unit,
a_per, deepcopy(self.metadata)) | python | def duplicate(self):
"""Return a copy of the header."""
a_per = self.analysis_period.duplicate() if self.analysis_period else None
return self.__class__(self.data_type, self.unit,
a_per, deepcopy(self.metadata)) | [
"def",
"duplicate",
"(",
"self",
")",
":",
"a_per",
"=",
"self",
".",
"analysis_period",
".",
"duplicate",
"(",
")",
"if",
"self",
".",
"analysis_period",
"else",
"None",
"return",
"self",
".",
"__class__",
"(",
"self",
".",
"data_type",
",",
"self",
"."... | Return a copy of the header. | [
"Return",
"a",
"copy",
"of",
"the",
"header",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/header.py#L105-L109 | train |
ladybug-tools/ladybug | ladybug/header.py | Header.to_tuple | def to_tuple(self):
"""Return Ladybug header as a list."""
return (
self.data_type,
self.unit,
self.analysis_period,
self.metadata
) | python | def to_tuple(self):
"""Return Ladybug header as a list."""
return (
self.data_type,
self.unit,
self.analysis_period,
self.metadata
) | [
"def",
"to_tuple",
"(",
"self",
")",
":",
"return",
"(",
"self",
".",
"data_type",
",",
"self",
".",
"unit",
",",
"self",
".",
"analysis_period",
",",
"self",
".",
"metadata",
")"
] | Return Ladybug header as a list. | [
"Return",
"Ladybug",
"header",
"as",
"a",
"list",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/header.py#L111-L118 | train |
ladybug-tools/ladybug | ladybug/header.py | Header.to_json | def to_json(self):
"""Return a header as a dictionary."""
a_per = self.analysis_period.to_json() if self.analysis_period else None
return {'data_type': self.data_type.to_json(),
'unit': self.unit,
'analysis_period': a_per,
'metadata': self.metadata... | python | def to_json(self):
"""Return a header as a dictionary."""
a_per = self.analysis_period.to_json() if self.analysis_period else None
return {'data_type': self.data_type.to_json(),
'unit': self.unit,
'analysis_period': a_per,
'metadata': self.metadata... | [
"def",
"to_json",
"(",
"self",
")",
":",
"a_per",
"=",
"self",
".",
"analysis_period",
".",
"to_json",
"(",
")",
"if",
"self",
".",
"analysis_period",
"else",
"None",
"return",
"{",
"'data_type'",
":",
"self",
".",
"data_type",
".",
"to_json",
"(",
")",
... | Return a header as a dictionary. | [
"Return",
"a",
"header",
"as",
"a",
"dictionary",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/header.py#L124-L130 | train |
ladybug-tools/ladybug | ladybug/skymodel.py | ashrae_clear_sky | def ashrae_clear_sky(altitudes, month, sky_clearness=1):
"""Calculate solar flux for an original ASHRAE Clear Sky
Args:
altitudes: A list of solar altitudes in degrees
month: An integer (1-12) indicating the month the altitudes belong to
sky_clearness: A factor that will be multiplied b... | python | def ashrae_clear_sky(altitudes, month, sky_clearness=1):
"""Calculate solar flux for an original ASHRAE Clear Sky
Args:
altitudes: A list of solar altitudes in degrees
month: An integer (1-12) indicating the month the altitudes belong to
sky_clearness: A factor that will be multiplied b... | [
"def",
"ashrae_clear_sky",
"(",
"altitudes",
",",
"month",
",",
"sky_clearness",
"=",
"1",
")",
":",
"MONTHLY_A",
"=",
"[",
"1202",
",",
"1187",
",",
"1164",
",",
"1130",
",",
"1106",
",",
"1092",
",",
"1093",
",",
"1107",
",",
"1136",
",",
"1166",
... | Calculate solar flux for an original ASHRAE Clear Sky
Args:
altitudes: A list of solar altitudes in degrees
month: An integer (1-12) indicating the month the altitudes belong to
sky_clearness: A factor that will be multiplied by the output of
the model. This is to help account f... | [
"Calculate",
"solar",
"flux",
"for",
"an",
"original",
"ASHRAE",
"Clear",
"Sky"
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/skymodel.py#L11-L57 | train |
ladybug-tools/ladybug | ladybug/skymodel.py | zhang_huang_solar | def zhang_huang_solar(alt, cloud_cover, relative_humidity,
dry_bulb_present, dry_bulb_t3_hrs, wind_speed,
irr_0=1355):
"""Calculate global horizontal solar irradiance using the Zhang-Huang model.
Note:
[1] Zhang, Q.Y. and Huang, Y.J. 2002. "Development of typ... | python | def zhang_huang_solar(alt, cloud_cover, relative_humidity,
dry_bulb_present, dry_bulb_t3_hrs, wind_speed,
irr_0=1355):
"""Calculate global horizontal solar irradiance using the Zhang-Huang model.
Note:
[1] Zhang, Q.Y. and Huang, Y.J. 2002. "Development of typ... | [
"def",
"zhang_huang_solar",
"(",
"alt",
",",
"cloud_cover",
",",
"relative_humidity",
",",
"dry_bulb_present",
",",
"dry_bulb_t3_hrs",
",",
"wind_speed",
",",
"irr_0",
"=",
"1355",
")",
":",
"C0",
",",
"C1",
",",
"C2",
",",
"C3",
",",
"C4",
",",
"C5",
",... | Calculate global horizontal solar irradiance using the Zhang-Huang model.
Note:
[1] Zhang, Q.Y. and Huang, Y.J. 2002. "Development of typical year weather files
for Chinese locations", LBNL-51436, ASHRAE Transactions, Vol. 108, Part 2.
Args:
alt: A solar altitude in degrees.
cl... | [
"Calculate",
"global",
"horizontal",
"solar",
"irradiance",
"using",
"the",
"Zhang",
"-",
"Huang",
"model",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/skymodel.py#L112-L161 | train |
ladybug-tools/ladybug | ladybug/skymodel.py | zhang_huang_solar_split | def zhang_huang_solar_split(altitudes, doys, cloud_cover, relative_humidity,
dry_bulb_present, dry_bulb_t3_hrs, wind_speed,
atm_pressure, use_disc=False):
"""Calculate direct and diffuse solar irradiance using the Zhang-Huang model.
By default, this funct... | python | def zhang_huang_solar_split(altitudes, doys, cloud_cover, relative_humidity,
dry_bulb_present, dry_bulb_t3_hrs, wind_speed,
atm_pressure, use_disc=False):
"""Calculate direct and diffuse solar irradiance using the Zhang-Huang model.
By default, this funct... | [
"def",
"zhang_huang_solar_split",
"(",
"altitudes",
",",
"doys",
",",
"cloud_cover",
",",
"relative_humidity",
",",
"dry_bulb_present",
",",
"dry_bulb_t3_hrs",
",",
"wind_speed",
",",
"atm_pressure",
",",
"use_disc",
"=",
"False",
")",
":",
"glob_ir",
"=",
"[",
... | Calculate direct and diffuse solar irradiance using the Zhang-Huang model.
By default, this function uses the DIRINT method (aka. Perez split) to split global
irradiance into direct and diffuse. This is the same method used by EnergyPlus.
Args:
altitudes: A list of solar altitudes in degrees.
... | [
"Calculate",
"direct",
"and",
"diffuse",
"solar",
"irradiance",
"using",
"the",
"Zhang",
"-",
"Huang",
"model",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/skymodel.py#L164-L224 | train |
ladybug-tools/ladybug | ladybug/skymodel.py | calc_horizontal_infrared | def calc_horizontal_infrared(sky_cover, dry_bulb, dew_point):
"""Calculate horizontal infrared radiation intensity.
See EnergyPlus Enrineering Reference for more information:
https://bigladdersoftware.com/epx/docs/8-9/engineering-reference/climate-calculations.html#sky-radiation-modeling
Note:
... | python | def calc_horizontal_infrared(sky_cover, dry_bulb, dew_point):
"""Calculate horizontal infrared radiation intensity.
See EnergyPlus Enrineering Reference for more information:
https://bigladdersoftware.com/epx/docs/8-9/engineering-reference/climate-calculations.html#sky-radiation-modeling
Note:
... | [
"def",
"calc_horizontal_infrared",
"(",
"sky_cover",
",",
"dry_bulb",
",",
"dew_point",
")",
":",
"SIGMA",
"=",
"5.6697e-8",
"db_k",
"=",
"dry_bulb",
"+",
"273.15",
"dp_k",
"=",
"dew_point",
"+",
"273.15",
"sky_emiss",
"=",
"(",
"0.787",
"+",
"(",
"0.764",
... | Calculate horizontal infrared radiation intensity.
See EnergyPlus Enrineering Reference for more information:
https://bigladdersoftware.com/epx/docs/8-9/engineering-reference/climate-calculations.html#sky-radiation-modeling
Note:
[1] Walton, G. N. 1983. Thermal Analysis Research Program Reference ... | [
"Calculate",
"horizontal",
"infrared",
"radiation",
"intensity",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/skymodel.py#L230-L267 | train |
ladybug-tools/ladybug | ladybug/legendparameters.py | LegendParameters.set_domain | def set_domain(self, values):
"""Set domain of the colors based on min and max of a list of values."""
_flattenedList = sorted(flatten(values))
self.domain = tuple(_flattenedList[0] if d == 'min' else d for d in self.domain)
self.domain = tuple(_flattenedList[-1] if d == 'max' else d for... | python | def set_domain(self, values):
"""Set domain of the colors based on min and max of a list of values."""
_flattenedList = sorted(flatten(values))
self.domain = tuple(_flattenedList[0] if d == 'min' else d for d in self.domain)
self.domain = tuple(_flattenedList[-1] if d == 'max' else d for... | [
"def",
"set_domain",
"(",
"self",
",",
"values",
")",
":",
"_flattenedList",
"=",
"sorted",
"(",
"flatten",
"(",
"values",
")",
")",
"self",
".",
"domain",
"=",
"tuple",
"(",
"_flattenedList",
"[",
"0",
"]",
"if",
"d",
"==",
"'min'",
"else",
"d",
"fo... | Set domain of the colors based on min and max of a list of values. | [
"Set",
"domain",
"of",
"the",
"colors",
"based",
"on",
"min",
"and",
"max",
"of",
"a",
"list",
"of",
"values",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/legendparameters.py#L80-L84 | train |
ladybug-tools/ladybug | ladybug/datacollection.py | HourlyDiscontinuousCollection.timestep_text | def timestep_text(self):
"""Return a text string representing the timestep of the collection."""
if self.header.analysis_period.timestep == 1:
return 'Hourly'
else:
return '{} Minute'.format(int(60 / self.header.analysis_period.timestep)) | python | def timestep_text(self):
"""Return a text string representing the timestep of the collection."""
if self.header.analysis_period.timestep == 1:
return 'Hourly'
else:
return '{} Minute'.format(int(60 / self.header.analysis_period.timestep)) | [
"def",
"timestep_text",
"(",
"self",
")",
":",
"if",
"self",
".",
"header",
".",
"analysis_period",
".",
"timestep",
"==",
"1",
":",
"return",
"'Hourly'",
"else",
":",
"return",
"'{} Minute'",
".",
"format",
"(",
"int",
"(",
"60",
"/",
"self",
".",
"he... | Return a text string representing the timestep of the collection. | [
"Return",
"a",
"text",
"string",
"representing",
"the",
"timestep",
"of",
"the",
"collection",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L96-L101 | train |
ladybug-tools/ladybug | ladybug/datacollection.py | HourlyDiscontinuousCollection.moys_dict | def moys_dict(self):
"""Return a dictionary of this collection's values where the keys are the moys.
This is useful for aligning the values with another list of datetimes.
"""
moy_dict = {}
for val, dt in zip(self.values, self.datetimes):
moy_dict[dt.moy] = val
... | python | def moys_dict(self):
"""Return a dictionary of this collection's values where the keys are the moys.
This is useful for aligning the values with another list of datetimes.
"""
moy_dict = {}
for val, dt in zip(self.values, self.datetimes):
moy_dict[dt.moy] = val
... | [
"def",
"moys_dict",
"(",
"self",
")",
":",
"moy_dict",
"=",
"{",
"}",
"for",
"val",
",",
"dt",
"in",
"zip",
"(",
"self",
".",
"values",
",",
"self",
".",
"datetimes",
")",
":",
"moy_dict",
"[",
"dt",
".",
"moy",
"]",
"=",
"val",
"return",
"moy_di... | Return a dictionary of this collection's values where the keys are the moys.
This is useful for aligning the values with another list of datetimes. | [
"Return",
"a",
"dictionary",
"of",
"this",
"collection",
"s",
"values",
"where",
"the",
"keys",
"are",
"the",
"moys",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L104-L112 | train |
ladybug-tools/ladybug | ladybug/datacollection.py | HourlyDiscontinuousCollection.filter_by_analysis_period | def filter_by_analysis_period(self, analysis_period):
"""
Filter a 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(analy... | python | def filter_by_analysis_period(self, analysis_period):
"""
Filter a 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(analy... | [
"def",
"filter_by_analysis_period",
"(",
"self",
",",
"analysis_period",
")",
":",
"self",
".",
"_check_analysis_period",
"(",
"analysis_period",
")",
"_filtered_data",
"=",
"self",
".",
"filter_by_moys",
"(",
"analysis_period",
".",
"moys",
")",
"_filtered_data",
"... | Filter a Data Collection based on an analysis period.
Args:
analysis period: A Ladybug analysis period
Return:
A new Data Collection with filtered data | [
"Filter",
"a",
"Data",
"Collection",
"based",
"on",
"an",
"analysis",
"period",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L114-L127 | train |
ladybug-tools/ladybug | ladybug/datacollection.py | HourlyDiscontinuousCollection.group_by_month_per_hour | def group_by_month_per_hour(self):
"""Return a dictionary of this collection's values grouped by each month per hour.
Key values are tuples of 2 integers:
The first represents the month of the year between 1-12.
The first represents the hour of the day between 0-24.
(eg. (12, 23... | python | def group_by_month_per_hour(self):
"""Return a dictionary of this collection's values grouped by each month per hour.
Key values are tuples of 2 integers:
The first represents the month of the year between 1-12.
The first represents the hour of the day between 0-24.
(eg. (12, 23... | [
"def",
"group_by_month_per_hour",
"(",
"self",
")",
":",
"data_by_month_per_hour",
"=",
"OrderedDict",
"(",
")",
"for",
"m",
"in",
"xrange",
"(",
"1",
",",
"13",
")",
":",
"for",
"h",
"in",
"xrange",
"(",
"0",
",",
"24",
")",
":",
"data_by_month_per_hour... | Return a dictionary of this collection's values grouped by each month per hour.
Key values are tuples of 2 integers:
The first represents the month of the year between 1-12.
The first represents the hour of the day between 0-24.
(eg. (12, 23) for December at 11 PM) | [
"Return",
"a",
"dictionary",
"of",
"this",
"collection",
"s",
"values",
"grouped",
"by",
"each",
"month",
"per",
"hour",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L214-L228 | train |
ladybug-tools/ladybug | ladybug/datacollection.py | HourlyDiscontinuousCollection.interpolate_holes | def interpolate_holes(self):
"""Linearly interpolate over holes in this collection to make it continuous.
Returns:
continuous_collection: A HourlyContinuousCollection with the same data
as this collection but with missing data filled by means of a
linear inte... | python | def interpolate_holes(self):
"""Linearly interpolate over holes in this collection to make it continuous.
Returns:
continuous_collection: A HourlyContinuousCollection with the same data
as this collection but with missing data filled by means of a
linear inte... | [
"def",
"interpolate_holes",
"(",
"self",
")",
":",
"assert",
"self",
".",
"validated_a_period",
"is",
"True",
",",
"'validated_a_period property must be'",
"' True to use interpolate_holes(). Run validate_analysis_period().'",
"mins_per_step",
"=",
"int",
"(",
"60",
"/",
"s... | Linearly interpolate over holes in this collection to make it continuous.
Returns:
continuous_collection: A HourlyContinuousCollection with the same data
as this collection but with missing data filled by means of a
linear interpolation. | [
"Linearly",
"interpolate",
"over",
"holes",
"in",
"this",
"collection",
"to",
"make",
"it",
"continuous",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L247-L287 | train |
ladybug-tools/ladybug | ladybug/datacollection.py | HourlyDiscontinuousCollection.cull_to_timestep | def cull_to_timestep(self, timestep=1):
"""Get a collection with only 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, valid_s)
new_ap, new... | python | def cull_to_timestep(self, timestep=1):
"""Get a collection with only 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, valid_s)
new_ap, new... | [
"def",
"cull_to_timestep",
"(",
"self",
",",
"timestep",
"=",
"1",
")",
":",
"valid_s",
"=",
"self",
".",
"header",
".",
"analysis_period",
".",
"VALIDTIMESTEPS",
".",
"keys",
"(",
")",
"assert",
"timestep",
"in",
"valid_s",
",",
"'timestep {} is not valid. Ch... | Get a collection with only datetimes that fit a timestep. | [
"Get",
"a",
"collection",
"with",
"only",
"datetimes",
"that",
"fit",
"a",
"timestep",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L289-L301 | train |
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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L303-L312 | train |
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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L409-L412 | train |
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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L414-L422 | train |
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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L424-L437 | train |
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",
")",
":",
"if",
"operation",
"==",
"'average'",
":",
"funct",
"=",
"self",
".",
"_average",
"elif",
"operation",
"==",
"'total'",
":",
"funct",
... | 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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L449-L495 | train |
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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L554-L558 | train |
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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L567-L616 | train |
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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L683-L695 | train |
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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L782-L787 | train |
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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L854-L859 | train |
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"
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L875-L901 | train |
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",
")",
":",
"if",
"operation",
"==",
"'average'",
":",
"funct",
"=",
"self",
".",
"_average",
"elif",
"operation",
"==",
"'total'",
":",
"funct",
"=",
"self",
".",
"_t... | Get a MonthlyCollection given a certain operation. | [
"Get",
"a",
"MonthlyCollection",
"given",
"a",
"certain",
"operation",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L1095-L1124 | train |
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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datatype/temperaturetime.py#L33-L35 | train |
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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/rootfind.py#L56-L98 | train |
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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/location.py#L40-L59 | train |
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'",
")",
":",
"return",
"location",
"elif",
"hasattr",
"(",
"location",... | 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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/location.py#L62-L104 | train |
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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/location.py#L158-L162 | train |
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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/location.py#L165-L172 | train |
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",
")",
":",
"epw_obj",
"=",
"cls",
"(",
"None",
")",
"epw_obj",
".",
"_is_leap_year",
"=",
"is_leap_year",
"epw_obj",
".",
"_location",
"=",
"Location",
"(",
")",
"analysis_period",
"... | 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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/epw.py#L105-L178 | train |
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",
")",
":",
"epw_obj",
"=",
"cls",
"(",
"None",
")",
"epw_obj",
".",
"_is_header_loaded",
"=",
"True",
"epw_obj",
".",
"_is_data_loaded",
"=",
"True",
"required_keys",
"=",
"(",
"'location'",
",",
"'data_collections... | 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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/epw.py#L181-L274 | train |
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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/epw.py#L364-L373 | train |
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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/epw.py#L482-L490 | train |
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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/epw.py#L709-L712 | train |
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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/epw.py#L714-L721 | train |
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",
")",
":",
"if",
"not",
"self",
".",
"is_data_loaded",
":",
"self",
".",
"_import_data",
"(",
")",
"originally_ip",
"=",
"False",
"if",
"self",
".",
"is_ip",
"is",
"True",
":",
"self",
".",
"convert_to_si",
... | 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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/epw.py#L723-L773 | train |
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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/epw.py#L775-L785 | train |
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",
"(",
")",
"if",
"not",
"0",
"<=",
"field_number",
"<",
"self",
".",
"_num_of_fields",
":",
"raise",
"Valu... | 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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/epw.py#L800-L820 | train |
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",
")",
":",
"sky_temp_header",
"=",
"Header",
"(",
"data_type",
"=",
"temperature",
".",
"SkyTemperature",
"(",
")",
",",
"unit",
"=",
"'C'",
",",
"analysis_period",
"=",
"AnalysisPeriod",
"(",
")",
",",
"metadata",
"=",
... | 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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/epw.py#L1275-L1292 | train |
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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/epw.py#L1302-L1341 | train |
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",
")",
":",
"if",
"not",
"self",
".",
"is_data_loaded",
":",
"self",
".",
"_import_data",
"(",
")",
"def",
"jsonify_dict",
"(",
"base_dict",
")",
":",
"new_dict",
"=",
"{",
"}",
"for",
"key",
",",
"val",
"in",
"base_dict",
... | Convert the EPW to a dictionary. | [
"Convert",
"the",
"EPW",
"to",
"a",
"dictionary",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/epw.py#L1343-L1375 | train |
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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/analysisperiod.py#L161-L177 | train |
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",
")",
":",
"is_leap_year",
"=",
"True",
"if",
"analysis_period_string",
".",
"strip",
"(",
")",
"[",
"-",
"1",
"]",
"==",
"'*'",
"else",
"False",
"ap",
"=",
"analysis_period_string",
".",
"lower... | 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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/analysisperiod.py#L180-L200 | train |
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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/analysisperiod.py#L258-L263 | train |
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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/analysisperiod.py#L273-L277 | train |
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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/analysisperiod.py#L280-L284 | train |
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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/analysisperiod.py#L287-L294 | train |
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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/analysisperiod.py#L297-L304 | train |
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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/analysisperiod.py#L307-L313 | train |
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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/analysisperiod.py#L321-L327 | train |
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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/analysisperiod.py#L347-L355 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.