repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
fhs/pyhdf
pyhdf/VS.py
VS.create
def create(self, name, fields): """Create a new vdata, setting its name and allocating its fields. Args:: name Name to assign to the vdata fields Sequence of field definitions. Each field definition is a sequence with the following elements in order...
python
def create(self, name, fields): """Create a new vdata, setting its name and allocating its fields. Args:: name Name to assign to the vdata fields Sequence of field definitions. Each field definition is a sequence with the following elements in order...
[ "def", "create", "(", "self", ",", "name", ",", "fields", ")", ":", "try", ":", "# Create new vdata (-1), open in write mode (1)", "vd", "=", "self", ".", "attach", "(", "-", "1", ",", "1", ")", "# Set vdata name", "vd", ".", "_name", "=", "name", "# Defin...
Create a new vdata, setting its name and allocating its fields. Args:: name Name to assign to the vdata fields Sequence of field definitions. Each field definition is a sequence with the following elements in order: - field name ...
[ "Create", "a", "new", "vdata", "setting", "its", "name", "and", "allocating", "its", "fields", "." ]
train
https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/VS.py#L913-L959
fhs/pyhdf
pyhdf/VS.py
VS.find
def find(self, vName): """Get the reference number of a vdata given its name. The vdata can then be opened (attached) by passing this reference number to the attach() method. Args:: vName Name of the vdata for which the reference number is needed. vdatas...
python
def find(self, vName): """Get the reference number of a vdata given its name. The vdata can then be opened (attached) by passing this reference number to the attach() method. Args:: vName Name of the vdata for which the reference number is needed. vdatas...
[ "def", "find", "(", "self", ",", "vName", ")", ":", "refNum", "=", "_C", ".", "VSfind", "(", "self", ".", "_hdf_inst", ".", "_id", ",", "vName", ")", "_checkErr", "(", "\"find\"", ",", "refNum", ",", "\"cannot find vdata %s\"", "%", "vName", ")", "retu...
Get the reference number of a vdata given its name. The vdata can then be opened (attached) by passing this reference number to the attach() method. Args:: vName Name of the vdata for which the reference number is needed. vdatas names are not guaranteed to be ...
[ "Get", "the", "reference", "number", "of", "a", "vdata", "given", "its", "name", ".", "The", "vdata", "can", "then", "be", "opened", "(", "attached", ")", "by", "passing", "this", "reference", "number", "to", "the", "attach", "()", "method", "." ]
train
https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/VS.py#L961-L982
fhs/pyhdf
pyhdf/VS.py
VS.next
def next(self, vRef): """Get the reference number of the vdata following a given vdata. Args:: vRef Reference number of the vdata preceding the one we require. Set to -1 to get the first vdata in the HDF file. Knowing its reference number, ...
python
def next(self, vRef): """Get the reference number of the vdata following a given vdata. Args:: vRef Reference number of the vdata preceding the one we require. Set to -1 to get the first vdata in the HDF file. Knowing its reference number, ...
[ "def", "next", "(", "self", ",", "vRef", ")", ":", "num", "=", "_C", ".", "VSgetid", "(", "self", ".", "_hdf_inst", ".", "_id", ",", "vRef", ")", "_checkErr", "(", "'next'", ",", "num", ",", "'cannot get next vdata'", ")", "return", "num" ]
Get the reference number of the vdata following a given vdata. Args:: vRef Reference number of the vdata preceding the one we require. Set to -1 to get the first vdata in the HDF file. Knowing its reference number, the vdata can then be op...
[ "Get", "the", "reference", "number", "of", "the", "vdata", "following", "a", "given", "vdata", "." ]
train
https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/VS.py#L984-L1008
fhs/pyhdf
pyhdf/VS.py
VS.vdatainfo
def vdatainfo(self, listAttr=0): """Return info about all the file vdatas. Args:: listAttr Set to 0 to ignore vdatas used to store attribute values, 1 to list them (see the VD._isattr readonly attribute) Returns:: List of vdata ...
python
def vdatainfo(self, listAttr=0): """Return info about all the file vdatas. Args:: listAttr Set to 0 to ignore vdatas used to store attribute values, 1 to list them (see the VD._isattr readonly attribute) Returns:: List of vdata ...
[ "def", "vdatainfo", "(", "self", ",", "listAttr", "=", "0", ")", ":", "lst", "=", "[", "]", "ref", "=", "-", "1", "# start at beginning", "while", "True", ":", "try", ":", "nxtRef", "=", "self", ".", "next", "(", "ref", ")", "except", "HDF4Error", ...
Return info about all the file vdatas. Args:: listAttr Set to 0 to ignore vdatas used to store attribute values, 1 to list them (see the VD._isattr readonly attribute) Returns:: List of vdata descriptions. Each vdata is described as ...
[ "Return", "info", "about", "all", "the", "file", "vdatas", "." ]
train
https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/VS.py#L1010-L1060
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", ")", ":", "# See if the field is multi-valued.", "nrecs", "=", "len", "(", "values", ")", "if", "type", "(", "values", "[", "0", "]", ")", "i...
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", "." ]
train
https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/VS.py#L1062-L1159
fhs/pyhdf
pyhdf/VS.py
VD.fdefine
def fdefine(self, name, type, order): """Define a field. To initialize a newly created vdata with fields created with fdefine(), assign a tuple of field names to the _fields attribute or call the setfields() method. Args:: name field name type field data typ...
python
def fdefine(self, name, type, order): """Define a field. To initialize a newly created vdata with fields created with fdefine(), assign a tuple of field names to the _fields attribute or call the setfields() method. Args:: name field name type field data typ...
[ "def", "fdefine", "(", "self", ",", "name", ",", "type", ",", "order", ")", ":", "_checkErr", "(", "'fdefine'", ",", "_C", ".", "VSfdefine", "(", "self", ".", "_id", ",", "name", ",", "type", ",", "order", ")", ",", "'cannot define field'", ")" ]
Define a field. To initialize a newly created vdata with fields created with fdefine(), assign a tuple of field names to the _fields attribute or call the setfields() method. Args:: name field name type field data type (one of HC.xxx) order field order ...
[ "Define", "a", "field", ".", "To", "initialize", "a", "newly", "created", "vdata", "with", "fields", "created", "with", "fdefine", "()", "assign", "a", "tuple", "of", "field", "names", "to", "the", "_fields", "attribute", "or", "call", "the", "setfields", ...
train
https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/VS.py#L1417-L1436
fhs/pyhdf
pyhdf/VS.py
VD.setfields
def setfields(self, *fldNames): """Define the name and order of the fields to access with the read() and write() methods. Args:: fldNames variable length argument specifying one or more vdata field names Returns:: None C library equiv...
python
def setfields(self, *fldNames): """Define the name and order of the fields to access with the read() and write() methods. Args:: fldNames variable length argument specifying one or more vdata field names Returns:: None C library equiv...
[ "def", "setfields", "(", "self", ",", "*", "fldNames", ")", ":", "_checkErr", "(", "'setfields'", ",", "_C", ".", "VSsetfields", "(", "self", ".", "_id", ",", "','", ".", "join", "(", "fldNames", ")", ")", ",", "'cannot execute'", ")", "self", ".", "...
Define the name and order of the fields to access with the read() and write() methods. Args:: fldNames variable length argument specifying one or more vdata field names Returns:: None C library equivalent : VSsetfields setfields() in...
[ "Define", "the", "name", "and", "order", "of", "the", "fields", "to", "access", "with", "the", "read", "()", "and", "write", "()", "methods", "." ]
train
https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/VS.py#L1439-L1477
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", ")", ":", "# Transform a name to an index number", "if", "isinstance", "(", "name_index", ",", "str", ")", ":", "status", ",", "index", "=", "_C", ".", "VSfindex", "(", "self", ".", "_id", ",", "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
[ "Get", "a", "VDField", "instance", "representing", "a", "field", "of", "the", "vdata", "." ]
train
https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/VS.py#L1480-L1504
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", "." ]
train
https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/VS.py#L1507-L1544
fhs/pyhdf
pyhdf/VS.py
VD.seekend
def seekend(self): """Set the current record position past the last vdata record. Subsequent write() calls will append records to the vdata. Args:: no argument Returns:: index of the last record plus 1 C library equivalent : no equivalent ...
python
def seekend(self): """Set the current record position past the last vdata record. Subsequent write() calls will append records to the vdata. Args:: no argument Returns:: index of the last record plus 1 C library equivalent : no equivalent ...
[ "def", "seekend", "(", "self", ")", ":", "try", ":", "# Seek to the next-to-last record position", "n", "=", "self", ".", "seek", "(", "self", ".", "_nrecs", "-", "1", ")", "# updates _offset", "# Read last record, ignoring values", "self", ".", "read", "(", "1"...
Set the current record position past the last vdata record. Subsequent write() calls will append records to the vdata. Args:: no argument Returns:: index of the last record plus 1 C library equivalent : no equivalent
[ "Set", "the", "current", "record", "position", "past", "the", "last", "vdata", "record", ".", "Subsequent", "write", "()", "calls", "will", "append", "records", "to", "the", "vdata", "." ]
train
https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/VS.py#L1546-L1568
fhs/pyhdf
pyhdf/VS.py
VD.read
def read(self, nRec=1): """Retrieve the values of a number of records, starting at the current record position. The current record position is advanced by the number of records read. Current position is 0 after "opening" the vdata with the attach() method. Args:: nRec...
python
def read(self, nRec=1): """Retrieve the values of a number of records, starting at the current record position. The current record position is advanced by the number of records read. Current position is 0 after "opening" the vdata with the attach() method. Args:: nRec...
[ "def", "read", "(", "self", ",", "nRec", "=", "1", ")", ":", "# Validate number of records to read vs the current offset.", "# Return \"end of vdata\" exception if already at end of vdata", "# otherwise \"clip\" the number of records if it exceeds the", "# number of remaining records in th...
Retrieve the values of a number of records, starting at the current record position. The current record position is advanced by the number of records read. Current position is 0 after "opening" the vdata with the attach() method. Args:: nRec number of records to read ...
[ "Retrieve", "the", "values", "of", "a", "number", "of", "records", "starting", "at", "the", "current", "record", "position", ".", "The", "current", "record", "position", "is", "advanced", "by", "the", "number", "of", "records", "read", ".", "Current", "posit...
train
https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/VS.py#L1586-L1722
fhs/pyhdf
pyhdf/VS.py
VD.write
def write(self, values): """Write records to the vdata. Writing starts at the current record position, which is advanced by the number of records written. Args:: values: 2-level sequence. First level is a sequence of records. A second level gives the sequenc...
python
def write(self, values): """Write records to the vdata. Writing starts at the current record position, which is advanced by the number of records written. Args:: values: 2-level sequence. First level is a sequence of records. A second level gives the sequenc...
[ "def", "write", "(", "self", ",", "values", ")", ":", "nFields", "=", "self", ".", "_nfields", "# Fields give the order the record values, as defined in the", "# last call to setfields()", "fields", "=", "self", ".", "_setfields", "or", "self", ".", "_fields", "# We m...
Write records to the vdata. Writing starts at the current record position, which is advanced by the number of records written. Args:: values: 2-level sequence. First level is a sequence of records. A second level gives the sequence of record values. ...
[ "Write", "records", "to", "the", "vdata", ".", "Writing", "starts", "at", "the", "current", "record", "position", "which", "is", "advanced", "by", "the", "number", "of", "records", "written", "." ]
train
https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/VS.py#L1725-L1859
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", "." ]
train
https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/VS.py#L1861-L1883
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", "." ]
train
https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/VS.py#L1886-L1921
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", "." ]
train
https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/VS.py#L1923-L1943
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", "." ]
train
https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/VS.py#L1945-L1969
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", "." ]
train
https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/VS.py#L2236-L2257
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", "." ]
train
https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/VS.py#L2406-L2493
fhs/pyhdf
pyhdf/VS.py
VDAttr.info
def info(self): """Retrieve info about the attribute. Args:: no argument Returns:: 4-element tuple with the following components: -attribute name -attribute data type (one of HC.xxx constants) -attribute order (number of values) ...
python
def info(self): """Retrieve info about the attribute. Args:: no argument Returns:: 4-element tuple with the following components: -attribute name -attribute data type (one of HC.xxx constants) -attribute order (number of values) ...
[ "def", "info", "(", "self", ")", ":", "# Make sure the attribute exists.", "if", "self", ".", "_index", "is", "None", ":", "raise", "HDF4Error", "(", "\"non existent attribute\"", ")", "status", ",", "name", ",", "type", ",", "order", ",", "size", "=", "_C",...
Retrieve info about the attribute. Args:: no argument Returns:: 4-element tuple with the following components: -attribute name -attribute data type (one of HC.xxx constants) -attribute order (number of values) -attribute size in byt...
[ "Retrieve", "info", "about", "the", "attribute", "." ]
train
https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/VS.py#L2495-L2520
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", "." ]
train
https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/HDF.py#L99-L116
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", "." ]
train
https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/HDF.py#L244-L261
fhs/pyhdf
examples/txttohdf/txttohdf.py
txtToHDF
def txtToHDF(txtFile, hdfFile, varName, attr): """Inputs: txtFile = name of .txt file (passed as string) hdfFile = name of .hdf file (passed as string) varName = name of dataset to be added (passed as string) attr = dataset attributes (passed as dictionary) txtFile indicates a da...
python
def txtToHDF(txtFile, hdfFile, varName, attr): """Inputs: txtFile = name of .txt file (passed as string) hdfFile = name of .hdf file (passed as string) varName = name of dataset to be added (passed as string) attr = dataset attributes (passed as dictionary) txtFile indicates a da...
[ "def", "txtToHDF", "(", "txtFile", ",", "hdfFile", ",", "varName", ",", "attr", ")", ":", "try", ":", "# Catch pyhdf errors", "# Open HDF file in update mode, creating it if non existent.", "d", "=", "SD", "(", "hdfFile", ",", "SDC", ".", "WRITE", "|", "SDC", "....
Inputs: txtFile = name of .txt file (passed as string) hdfFile = name of .hdf file (passed as string) varName = name of dataset to be added (passed as string) attr = dataset attributes (passed as dictionary) txtFile indicates a dataset, and varName and attr give information about...
[ "Inputs", ":", "txtFile", "=", "name", "of", ".", "txt", "file", "(", "passed", "as", "string", ")", "hdfFile", "=", "name", "of", ".", "hdf", "file", "(", "passed", "as", "string", ")", "varName", "=", "name", "of", "dataset", "to", "be", "added", ...
train
https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/examples/txttohdf/txttohdf.py#L11-L58
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" ]
train
https://github.com/mattmakai/underwear/blob/7c484c7937d2df86dc569d411249ba366ed43ead/underwear/run_underwear.py#L24-L29
zapier/django-drip
drip/utils.py
get_fields
def get_fields(Model, parent_field="", model_stack=None, stack_limit=2, excludes=['permissions', 'comment', 'content_type']): """ Given a Model, return a list of lists of strings with important stuff: ... ['test_user__user__customuser', 'custo...
python
def get_fields(Model, parent_field="", model_stack=None, stack_limit=2, excludes=['permissions', 'comment', 'content_type']): """ Given a Model, return a list of lists of strings with important stuff: ... ['test_user__user__customuser', 'custo...
[ "def", "get_fields", "(", "Model", ",", "parent_field", "=", "\"\"", ",", "model_stack", "=", "None", ",", "stack_limit", "=", "2", ",", "excludes", "=", "[", "'permissions'", ",", "'comment'", ",", "'content_type'", "]", ")", ":", "out_fields", "=", "[", ...
Given a Model, return a list of lists of strings with important stuff: ... ['test_user__user__customuser', 'customuser', 'User', 'RelatedObject'] ['test_user__unique_id', 'unique_id', 'TestUser', 'CharField'] ['test_user__confirmed', 'confirmed', 'TestUser', 'BooleanField'] ...
[ "Given", "a", "Model", "return", "a", "list", "of", "lists", "of", "strings", "with", "important", "stuff", ":", "...", "[", "test_user__user__customuser", "customuser", "User", "RelatedObject", "]", "[", "test_user__unique_id", "unique_id", "TestUser", "CharField",...
train
https://github.com/zapier/django-drip/blob/ffbef6927a1a20f4c353ecb108c1b484502d2b29/drip/utils.py#L20-L95
zapier/django-drip
drip/utils.py
give_model_field
def give_model_field(full_field, Model): """ Given a field_name and Model: "test_user__unique_id", <AchievedGoal> Returns "test_user__unique_id", "id", <Model>, <ModelField> """ field_data = get_fields(Model, '', []) for full_key, name, _Model, _ModelField in field_data: if full_k...
python
def give_model_field(full_field, Model): """ Given a field_name and Model: "test_user__unique_id", <AchievedGoal> Returns "test_user__unique_id", "id", <Model>, <ModelField> """ field_data = get_fields(Model, '', []) for full_key, name, _Model, _ModelField in field_data: if full_k...
[ "def", "give_model_field", "(", "full_field", ",", "Model", ")", ":", "field_data", "=", "get_fields", "(", "Model", ",", "''", ",", "[", "]", ")", "for", "full_key", ",", "name", ",", "_Model", ",", "_ModelField", "in", "field_data", ":", "if", "full_ke...
Given a field_name and Model: "test_user__unique_id", <AchievedGoal> Returns "test_user__unique_id", "id", <Model>, <ModelField>
[ "Given", "a", "field_name", "and", "Model", ":" ]
train
https://github.com/zapier/django-drip/blob/ffbef6927a1a20f4c353ecb108c1b484502d2b29/drip/utils.py#L97-L111
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", "." ]
train
https://github.com/zapier/django-drip/blob/ffbef6927a1a20f4c353ecb108c1b484502d2b29/drip/admin.py#L33-L51
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", "." ]
train
https://github.com/zapier/django-drip/blob/ffbef6927a1a20f4c353ecb108c1b484502d2b29/drip/drips.py#L146-L156
zapier/django-drip
drip/drips.py
DripBase.apply_queryset_rules
def apply_queryset_rules(self, qs): """ First collect all filter/exclude kwargs and apply any annotations. Then apply all filters at once, and all excludes at once. """ clauses = { 'filter': [], 'exclude': []} for rule in self.drip_model.queryset_...
python
def apply_queryset_rules(self, qs): """ First collect all filter/exclude kwargs and apply any annotations. Then apply all filters at once, and all excludes at once. """ clauses = { 'filter': [], 'exclude': []} for rule in self.drip_model.queryset_...
[ "def", "apply_queryset_rules", "(", "self", ",", "qs", ")", ":", "clauses", "=", "{", "'filter'", ":", "[", "]", ",", "'exclude'", ":", "[", "]", "}", "for", "rule", "in", "self", ".", "drip_model", ".", "queryset_rules", ".", "all", "(", ")", ":", ...
First collect all filter/exclude kwargs and apply any annotations. Then apply all filters at once, and all excludes at once.
[ "First", "collect", "all", "filter", "/", "exclude", "kwargs", "and", "apply", "any", "annotations", ".", "Then", "apply", "all", "filters", "at", "once", "and", "all", "excludes", "at", "once", "." ]
train
https://github.com/zapier/django-drip/blob/ffbef6927a1a20f4c353ecb108c1b484502d2b29/drip/drips.py#L158-L180
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", "." ]
train
https://github.com/zapier/django-drip/blob/ffbef6927a1a20f4c353ecb108c1b484502d2b29/drip/drips.py#L194-L204
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", "." ]
train
https://github.com/zapier/django-drip/blob/ffbef6927a1a20f4c353ecb108c1b484502d2b29/drip/drips.py#L206-L215
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", "." ]
train
https://github.com/zapier/django-drip/blob/ffbef6927a1a20f4c353ecb108c1b484502d2b29/drip/drips.py#L217-L248
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" ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/euclid.py#L298-L300
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" ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/euclid.py#L302-L305
ladybug-tools/ladybug
ladybug/euclid.py
Vector3.flip
def flip(self): """Flip vector""" # added by Mostapha Sadeghipour self.x = -self.x self.y = -self.y self.z = -self.z return self
python
def flip(self): """Flip vector""" # added by Mostapha Sadeghipour self.x = -self.x self.y = -self.y self.z = -self.z return self
[ "def", "flip", "(", "self", ")", ":", "# added by Mostapha Sadeghipour", "self", ".", "x", "=", "-", "self", ".", "x", "self", ".", "y", "=", "-", "self", ".", "y", "self", ".", "z", "=", "-", "self", ".", "z", "return", "self" ]
Flip vector
[ "Flip", "vector" ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/euclid.py#L553-L559
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", ")", ":", "# Adapted from equations published by Glenn Murray.", "# http://inside.mines.edu/~gmurray/ArbitraryAxisRotation/ArbitraryAxisRotation.html", "x", ",", "y", ",", "z", "=", "self", ".", "x", ",", "se...
Return the vector rotated around axis through angle theta. Right hand rule applies.
[ "Return", "the", "vector", "rotated", "around", "axis", "through", "angle", "theta", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/euclid.py#L588-L607
ladybug-tools/ladybug
ladybug/datatype/uvalue.py
UValue.to_ip
def to_ip(self, values, from_unit): """Return values in IP and the units to which the values have been converted.""" if from_unit == 'Btu/h-ft2-F': return values, from_unit else: return self.to_unit(values, 'Btu/h-ft2-F', from_unit), 'Btu/h-ft2-F'
python
def to_ip(self, values, from_unit): """Return values in IP and the units to which the values have been converted.""" if from_unit == 'Btu/h-ft2-F': return values, from_unit else: return self.to_unit(values, 'Btu/h-ft2-F', from_unit), 'Btu/h-ft2-F'
[ "def", "to_ip", "(", "self", ",", "values", ",", "from_unit", ")", ":", "if", "from_unit", "==", "'Btu/h-ft2-F'", ":", "return", "values", ",", "from_unit", "else", ":", "return", "self", ".", "to_unit", "(", "values", ",", "'Btu/h-ft2-F'", ",", "from_unit...
Return values in IP and the units to which the values have been converted.
[ "Return", "values", "in", "IP", "and", "the", "units", "to", "which", "the", "values", "have", "been", "converted", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datatype/uvalue.py#L26-L31
ladybug-tools/ladybug
ladybug/datatype/uvalue.py
UValue.to_si
def to_si(self, values, from_unit): """Return values in SI and the units to which the values have been converted.""" if from_unit == 'W/m2-K': return values, from_unit else: return self.to_unit(values, 'W/m2-K', from_unit), 'W/m2-K'
python
def to_si(self, values, from_unit): """Return values in SI and the units to which the values have been converted.""" if from_unit == 'W/m2-K': return values, from_unit else: return self.to_unit(values, 'W/m2-K', from_unit), 'W/m2-K'
[ "def", "to_si", "(", "self", ",", "values", ",", "from_unit", ")", ":", "if", "from_unit", "==", "'W/m2-K'", ":", "return", "values", ",", "from_unit", "else", ":", "return", "self", ".", "to_unit", "(", "values", ",", "'W/m2-K'", ",", "from_unit", ")", ...
Return values in SI and the units to which the values have been converted.
[ "Return", "values", "in", "SI", "and", "the", "units", "to", "which", "the", "values", "have", "been", "converted", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datatype/uvalue.py#L33-L38
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", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/futil.py#L20-L36
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", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/futil.py#L39-L69
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", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/futil.py#L72-L96
ladybug-tools/ladybug
ladybug/futil.py
write_to_file
def write_to_file(file_path, data, mkdir=False): """Write a string of data to file. Args: file_path: Full path for a valid file path (e.g. c:/ladybug/testPts.pts) data: Any data as string mkdir: Set to True to create the directory if doesn't exist (Default: False) """ folder, fn...
python
def write_to_file(file_path, data, mkdir=False): """Write a string of data to file. Args: file_path: Full path for a valid file path (e.g. c:/ladybug/testPts.pts) data: Any data as string mkdir: Set to True to create the directory if doesn't exist (Default: False) """ folder, fn...
[ "def", "write_to_file", "(", "file_path", ",", "data", ",", "mkdir", "=", "False", ")", ":", "folder", ",", "fname", "=", "os", ".", "path", ".", "split", "(", "file_path", ")", "return", "write_to_file_by_name", "(", "folder", ",", "fname", ",", "data",...
Write a string of data to file. Args: file_path: Full path for a valid file path (e.g. c:/ladybug/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", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/futil.py#L99-L108
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", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/futil.py#L111-L143
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", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/futil.py#L146-L171
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", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/futil.py#L174-L185
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", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/futil.py#L188-L199
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", ")", ":", "# headers to \"spoof\" the download as coming from a browser (needed for E+ site)", "__hdr__", "=", "{", "'User-Agent'", ":", "'Mozilla/5.0 (X11; Linux x...
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", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/futil.py#L202-L234
ladybug-tools/ladybug
ladybug/futil.py
download_file
def download_file(url, file_path, mkdir=False): """Write a string of data to file. Args: url: A string to a valid URL. file_path: Full path to intended download location (e.g. c:/ladybug/testPts.pts) mkdir: Set to True to create the directory if doesn't exist (Default: False) """ ...
python
def download_file(url, file_path, mkdir=False): """Write a string of data to file. Args: url: A string to a valid URL. file_path: Full path to intended download location (e.g. c:/ladybug/testPts.pts) mkdir: Set to True to create the directory if doesn't exist (Default: False) """ ...
[ "def", "download_file", "(", "url", ",", "file_path", ",", "mkdir", "=", "False", ")", ":", "folder", ",", "fname", "=", "os", ".", "path", ".", "split", "(", "file_path", ")", "return", "download_file_by_name", "(", "url", ",", "folder", ",", "fname", ...
Write a string of data to file. Args: url: A string to a valid URL. file_path: Full path to intended download location (e.g. c:/ladybug/testPts.pts) mkdir: Set to True to create the directory if doesn't exist (Default: False)
[ "Write", "a", "string", "of", "data", "to", "file", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/futil.py#L237-L246
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", ")", ":", "# set default dest_dir and create it if need be.", "if", "dest_dir", "is", "None", ":", "dest_dir", ",", "fname", "=", "os", ".", "path", ".", "split"...
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", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/futil.py#L249-L279
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", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/futil.py#L282-L292
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", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/futil.py#L295-L305
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", ")", ":", "# Initialize the class with all data missing", "stat_ob", "=", "cls", "(", "None", ")", "# Check required and optional keys", "option_keys_none", "=", "(", "'ashrae_climate_zone'", ",", "'koppen_climate_zone'", ",", ...
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", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/stat.py#L87-L175
ladybug-tools/ladybug
ladybug/stat.py
STAT._import_data
def _import_data(self): """Import data from a stat file. """ # set default state to ironpython for very old ironpython (2.7.0) iron_python = True try: iron_python = True if platform.python_implementation() == 'IronPython' \ else False except Va...
python
def _import_data(self): """Import data from a stat file. """ # set default state to ironpython for very old ironpython (2.7.0) iron_python = True try: iron_python = True if platform.python_implementation() == 'IronPython' \ else False except Va...
[ "def", "_import_data", "(", "self", ")", ":", "# set default state to ironpython for very old ironpython (2.7.0)", "iron_python", "=", "True", "try", ":", "iron_python", "=", "True", "if", "platform", ".", "python_implementation", "(", ")", "==", "'IronPython'", "else",...
Import data from a stat file.
[ "Import", "data", "from", "a", "stat", "file", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/stat.py#L182-L300
ladybug-tools/ladybug
ladybug/stat.py
STAT.annual_heating_design_day_996
def annual_heating_design_day_996(self): """A design day object representing the annual 99.6% heating design day.""" if bool(self._winter_des_day_dict) is True: return DesignDay.from_ashrae_dict_heating( self._winter_des_day_dict, self.location, False, self._s...
python
def annual_heating_design_day_996(self): """A design day object representing the annual 99.6% heating design day.""" if bool(self._winter_des_day_dict) is True: return DesignDay.from_ashrae_dict_heating( self._winter_des_day_dict, self.location, False, self._s...
[ "def", "annual_heating_design_day_996", "(", "self", ")", ":", "if", "bool", "(", "self", ".", "_winter_des_day_dict", ")", "is", "True", ":", "return", "DesignDay", ".", "from_ashrae_dict_heating", "(", "self", ".", "_winter_des_day_dict", ",", "self", ".", "lo...
A design day object representing the annual 99.6% heating design day.
[ "A", "design", "day", "object", "representing", "the", "annual", "99", ".", "6%", "heating", "design", "day", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/stat.py#L443-L450
ladybug-tools/ladybug
ladybug/stat.py
STAT.annual_heating_design_day_990
def annual_heating_design_day_990(self): """A design day object representing the annual 99.0% heating design day.""" if bool(self._winter_des_day_dict) is True: return DesignDay.from_ashrae_dict_heating( self._winter_des_day_dict, self.location, True, self._st...
python
def annual_heating_design_day_990(self): """A design day object representing the annual 99.0% heating design day.""" if bool(self._winter_des_day_dict) is True: return DesignDay.from_ashrae_dict_heating( self._winter_des_day_dict, self.location, True, self._st...
[ "def", "annual_heating_design_day_990", "(", "self", ")", ":", "if", "bool", "(", "self", ".", "_winter_des_day_dict", ")", "is", "True", ":", "return", "DesignDay", ".", "from_ashrae_dict_heating", "(", "self", ".", "_winter_des_day_dict", ",", "self", ".", "lo...
A design day object representing the annual 99.0% heating design day.
[ "A", "design", "day", "object", "representing", "the", "annual", "99", ".", "0%", "heating", "design", "day", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/stat.py#L453-L460
ladybug-tools/ladybug
ladybug/stat.py
STAT.annual_cooling_design_day_004
def annual_cooling_design_day_004(self): """A design day object representing the annual 0.4% cooling design day.""" if bool(self._summer_des_day_dict) is True: tau = None month_num = int(self._summer_des_day_dict['Month']) if self._monthly_tau_beam != [] and self._mon...
python
def annual_cooling_design_day_004(self): """A design day object representing the annual 0.4% cooling design day.""" if bool(self._summer_des_day_dict) is True: tau = None month_num = int(self._summer_des_day_dict['Month']) if self._monthly_tau_beam != [] and self._mon...
[ "def", "annual_cooling_design_day_004", "(", "self", ")", ":", "if", "bool", "(", "self", ".", "_summer_des_day_dict", ")", "is", "True", ":", "tau", "=", "None", "month_num", "=", "int", "(", "self", ".", "_summer_des_day_dict", "[", "'Month'", "]", ")", ...
A design day object representing the annual 0.4% cooling design day.
[ "A", "design", "day", "object", "representing", "the", "annual", "0", ".", "4%", "cooling", "design", "day", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/stat.py#L463-L477
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", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/stat.py#L497-L513
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", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/stat.py#L516-L532
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", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/stat.py#L535-L551
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", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/stat.py#L554-L570
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", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/stat.py#L598-L601
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", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/stat.py#L609-L612
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", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/stat.py#L615-L620
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", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/stat.py#L642-L678
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", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datatype/base.py#L70-L100
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", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datatype/base.py#L102-L119
ladybug-tools/ladybug
ladybug/datatype/base.py
DataTypeBase.is_in_range
def is_in_range(self, values, unit=None, raise_exception=True): """Check if a list of values is within physically/mathematically possible range. Args: values: A list of values. unit: The unit of the values. If not specified, the default metric unit will be assum...
python
def is_in_range(self, values, unit=None, raise_exception=True): """Check if a list of values is within physically/mathematically possible range. Args: values: A list of values. unit: The unit of the values. If not specified, the default metric unit will be assum...
[ "def", "is_in_range", "(", "self", ",", "values", ",", "unit", "=", "None", ",", "raise_exception", "=", "True", ")", ":", "self", ".", "_is_numeric", "(", "values", ")", "if", "unit", "is", "None", "or", "unit", "==", "self", ".", "units", "[", "0",...
Check if a list of values is within physically/mathematically possible range. Args: values: A list of values. unit: The unit of the values. If not specified, the default metric unit will be assumed. raise_exception: Set to True to raise an exception if not i...
[ "Check", "if", "a", "list", "of", "values", "is", "within", "physically", "/", "mathematically", "possible", "range", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datatype/base.py#L139-L172
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", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datatype/base.py#L188-L194
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", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datatype/base.py#L196-L211
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", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datatype/base.py#L222-L227
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", ")", ":", "# assign default values", "assert", "'data_type'", "in", "data", ",", "'Required keyword \"data_type\" is missing!'", "keys", "=", "(", "'data_type'", ",", "'unit'", ",", "'analysis_period'", ",", "'metadata'", ...
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", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/header.py#L58-L78
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", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/header.py#L105-L109
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", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/header.py#L111-L118
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", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/header.py#L124-L130
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", ")", ":", "# apparent solar irradiation at air mass m = 0", "MONTHLY_A", "=", "[", "1202", ",", "1187", ",", "1164", ",", "1130", ",", "1106", ",", "1092", ",", "1093", ...
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" ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/skymodel.py#L11-L57
ladybug-tools/ladybug
ladybug/skymodel.py
ashrae_revised_clear_sky
def ashrae_revised_clear_sky(altitudes, tb, td, use_2017_model=False): """Calculate solar flux for an ASHRAE Revised Clear Sky ("Tau Model"). By default, this function returns clear sky values following the methods originally published in the ASHRAE 2009 HOF. Args: altitudes: A list of solar al...
python
def ashrae_revised_clear_sky(altitudes, tb, td, use_2017_model=False): """Calculate solar flux for an ASHRAE Revised Clear Sky ("Tau Model"). By default, this function returns clear sky values following the methods originally published in the ASHRAE 2009 HOF. Args: altitudes: A list of solar al...
[ "def", "ashrae_revised_clear_sky", "(", "altitudes", ",", "tb", ",", "td", ",", "use_2017_model", "=", "False", ")", ":", "dir_norm_rad", "=", "[", "]", "dif_horiz_rad", "=", "[", "]", "if", "use_2017_model", "is", "True", ":", "ab", "=", "1.454", "-", "...
Calculate solar flux for an ASHRAE Revised Clear Sky ("Tau Model"). By default, this function returns clear sky values following the methods originally published in the ASHRAE 2009 HOF. Args: altitudes: A list of solar altitudes in degrees. tb: A value indicating the beam optical depth of t...
[ "Calculate", "solar", "flux", "for", "an", "ASHRAE", "Revised", "Clear", "Sky", "(", "Tau", "Model", ")", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/skymodel.py#L63-L106
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", ")", ":", "# zhang-huang solar model regression constants", "C0", ",", "C1", ",", "C2...
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", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/skymodel.py#L112-L161
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", ")", ":", "# Calculate global horizon...
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", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/skymodel.py#L164-L224
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", ")", ":", "# stefan-boltzmann constant", "SIGMA", "=", "5.6697e-8", "# convert to kelvin", "db_k", "=", "dry_bulb", "+", "273.15", "dp_k", "=", "dew_point", "+", "273.15", "# cal...
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", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/skymodel.py#L230-L267
ladybug-tools/ladybug
ladybug/skymodel.py
dirint
def dirint(ghi, altitudes, doys, pressures, use_delta_kt_prime=True, temp_dew=None, min_sin_altitude=0.065, min_altitude=3): """ Determine DNI from GHI using the DIRINT modification of the DISC model. Implements the modified DISC model known as "DIRINT" introduced in [1]. DIRINT predicts...
python
def dirint(ghi, altitudes, doys, pressures, use_delta_kt_prime=True, temp_dew=None, min_sin_altitude=0.065, min_altitude=3): """ Determine DNI from GHI using the DIRINT modification of the DISC model. Implements the modified DISC model known as "DIRINT" introduced in [1]. DIRINT predicts...
[ "def", "dirint", "(", "ghi", ",", "altitudes", ",", "doys", ",", "pressures", ",", "use_delta_kt_prime", "=", "True", ",", "temp_dew", "=", "None", ",", "min_sin_altitude", "=", "0.065", ",", "min_altitude", "=", "3", ")", ":", "# calculate kt_prime values", ...
Determine DNI from GHI using the DIRINT modification of the DISC model. Implements the modified DISC model known as "DIRINT" introduced in [1]. DIRINT predicts direct normal irradiance (DNI) from measured global horizontal irradiance (GHI). DIRINT improves upon the DISC model by using time-series G...
[ "Determine", "DNI", "from", "GHI", "using", "the", "DIRINT", "modification", "of", "the", "DISC", "model", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/skymodel.py#L305-L408
ladybug-tools/ladybug
ladybug/skymodel.py
_dirint_bins
def _dirint_bins(ktp, alt, w, dktp): """ Determine the bins for the DIRINT coefficients. Args: ktp : Altitude-independent clearness index alt : Solar altitude angle w : precipitable water estimated from surface dew-point temperature dktp : stability index Returns: ...
python
def _dirint_bins(ktp, alt, w, dktp): """ Determine the bins for the DIRINT coefficients. Args: ktp : Altitude-independent clearness index alt : Solar altitude angle w : precipitable water estimated from surface dew-point temperature dktp : stability index Returns: ...
[ "def", "_dirint_bins", "(", "ktp", ",", "alt", ",", "w", ",", "dktp", ")", ":", "it", "=", "range", "(", "len", "(", "ktp", ")", ")", "# Create kt_prime bins", "ktp_bin", "=", "[", "-", "1", "]", "*", "len", "(", "ktp", ")", "ktp_bin", "=", "[", ...
Determine the bins for the DIRINT coefficients. Args: ktp : Altitude-independent clearness index alt : Solar altitude angle w : precipitable water estimated from surface dew-point temperature dktp : stability index Returns: tuple of ktp_bin, alt_bin, w_bin, dktp_bin
[ "Determine", "the", "bins", "for", "the", "DIRINT", "coefficients", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/skymodel.py#L411-L462
ladybug-tools/ladybug
ladybug/skymodel.py
disc
def disc(ghi, altitude, doy, pressure=101325, min_sin_altitude=0.065, min_altitude=3, max_airmass=12): """ Estimate Direct Normal Irradiance from Global Horizontal Irradiance using the DISC model. The DISC algorithm converts global horizontal irradiance to direct normal irradiance through ...
python
def disc(ghi, altitude, doy, pressure=101325, min_sin_altitude=0.065, min_altitude=3, max_airmass=12): """ Estimate Direct Normal Irradiance from Global Horizontal Irradiance using the DISC model. The DISC algorithm converts global horizontal irradiance to direct normal irradiance through ...
[ "def", "disc", "(", "ghi", ",", "altitude", ",", "doy", ",", "pressure", "=", "101325", ",", "min_sin_altitude", "=", "0.065", ",", "min_altitude", "=", "3", ",", "max_airmass", "=", "12", ")", ":", "if", "altitude", ">", "min_altitude", "and", "ghi", ...
Estimate Direct Normal Irradiance from Global Horizontal Irradiance using the DISC model. The DISC algorithm converts global horizontal irradiance to direct normal irradiance through empirical relationships between the global and direct clearness indices. This implementation limits the clearness i...
[ "Estimate", "Direct", "Normal", "Irradiance", "from", "Global", "Horizontal", "Irradiance", "using", "the", "DISC", "model", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/skymodel.py#L465-L540
ladybug-tools/ladybug
ladybug/skymodel.py
_disc_kn
def _disc_kn(clearness_index, airmass, max_airmass=12): """ Calculate Kn for `disc` Args: clearness_index : numeric airmass : numeric max_airmass : float airmass > max_airmass is set to max_airmass before being used in calculating Kn. Returns: Kn...
python
def _disc_kn(clearness_index, airmass, max_airmass=12): """ Calculate Kn for `disc` Args: clearness_index : numeric airmass : numeric max_airmass : float airmass > max_airmass is set to max_airmass before being used in calculating Kn. Returns: Kn...
[ "def", "_disc_kn", "(", "clearness_index", ",", "airmass", ",", "max_airmass", "=", "12", ")", ":", "# short names for equations", "kt", "=", "clearness_index", "am", "=", "airmass", "am", "=", "min", "(", "am", ",", "max_airmass", ")", "# GH 450", "# powers o...
Calculate Kn for `disc` Args: clearness_index : numeric airmass : numeric max_airmass : float airmass > max_airmass is set to max_airmass before being used in calculating Kn. Returns: Kn : numeric am : numeric airmass used in the calc...
[ "Calculate", "Kn", "for", "disc" ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/skymodel.py#L543-L582
ladybug-tools/ladybug
ladybug/skymodel.py
get_extra_radiation
def get_extra_radiation(doy, solar_constant=1366.1): """ Determine extraterrestrial radiation from day of year (using the spencer method). Note: [1] M. Reno, C. Hansen, and J. Stein, "Global Horizontal Irradiance Clear Sky Models: Implementation and Analysis", Sandia National Labora...
python
def get_extra_radiation(doy, solar_constant=1366.1): """ Determine extraterrestrial radiation from day of year (using the spencer method). Note: [1] M. Reno, C. Hansen, and J. Stein, "Global Horizontal Irradiance Clear Sky Models: Implementation and Analysis", Sandia National Labora...
[ "def", "get_extra_radiation", "(", "doy", ",", "solar_constant", "=", "1366.1", ")", ":", "# Calculates the day angle for the Earth's orbit around the Sun.", "B", "=", "(", "2.", "*", "math", ".", "pi", "/", "365.", ")", "*", "(", "doy", "-", "1", ")", "# Calc...
Determine extraterrestrial radiation from day of year (using the spencer method). Note: [1] M. Reno, C. Hansen, and J. Stein, "Global Horizontal Irradiance Clear Sky Models: Implementation and Analysis", Sandia National Laboratories, SAND2012-2389, 2012. [2] <http://solardat.uorego...
[ "Determine", "extraterrestrial", "radiation", "from", "day", "of", "year", "(", "using", "the", "spencer", "method", ")", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/skymodel.py#L585-L617
ladybug-tools/ladybug
ladybug/skymodel.py
clearness_index
def clearness_index(ghi, altitude, extra_radiation, min_sin_altitude=0.065, max_clearness_index=2.0): """ Calculate the clearness index. The clearness index is the ratio of global to extraterrestrial irradiance on a horizontal plane. Note: [1] Maxwell, E. L., "A Quasi-P...
python
def clearness_index(ghi, altitude, extra_radiation, min_sin_altitude=0.065, max_clearness_index=2.0): """ Calculate the clearness index. The clearness index is the ratio of global to extraterrestrial irradiance on a horizontal plane. Note: [1] Maxwell, E. L., "A Quasi-P...
[ "def", "clearness_index", "(", "ghi", ",", "altitude", ",", "extra_radiation", ",", "min_sin_altitude", "=", "0.065", ",", "max_clearness_index", "=", "2.0", ")", ":", "sin_altitude", "=", "math", ".", "sin", "(", "math", ".", "radians", "(", "altitude", ")"...
Calculate the clearness index. The clearness index is the ratio of global to extraterrestrial irradiance on a horizontal plane. Note: [1] Maxwell, E. L., "A Quasi-Physical Model for Converting Hourly Global Horizontal to Direct Normal Insolation", Technical Report No. SERI/TR-215-3...
[ "Calculate", "the", "clearness", "index", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/skymodel.py#L620-L659
ladybug-tools/ladybug
ladybug/skymodel.py
clearness_index_zenith_independent
def clearness_index_zenith_independent(clearness_index, airmass, max_clearness_index=2.0): """ Calculate the zenith angle independent clearness index. Note: [1] Perez, R., P. Ineichen, E. Maxwell, R. Seals and A. Zelenka, (1992). "Dynamic Global-to-Dir...
python
def clearness_index_zenith_independent(clearness_index, airmass, max_clearness_index=2.0): """ Calculate the zenith angle independent clearness index. Note: [1] Perez, R., P. Ineichen, E. Maxwell, R. Seals and A. Zelenka, (1992). "Dynamic Global-to-Dir...
[ "def", "clearness_index_zenith_independent", "(", "clearness_index", ",", "airmass", ",", "max_clearness_index", "=", "2.0", ")", ":", "if", "airmass", "is", "not", "None", ":", "# Perez eqn 1", "kt_prime", "=", "clearness_index", "/", "(", "1.031", "*", "math", ...
Calculate the zenith angle independent clearness index. Note: [1] Perez, R., P. Ineichen, E. Maxwell, R. Seals and A. Zelenka, (1992). "Dynamic Global-to-Direct Irradiance Conversion Models". ASHRAE Transactions-Research Series, pp. 354-369 Args: clearness_index: numeric ...
[ "Calculate", "the", "zenith", "angle", "independent", "clearness", "index", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/skymodel.py#L662-L695
ladybug-tools/ladybug
ladybug/skymodel.py
get_relative_airmass
def get_relative_airmass(altitude, model='kastenyoung1989'): """ Gives the relative (not pressure-corrected) airmass. Gives the airmass at sea-level when given a sun altitude angle (in degrees). The ``model`` variable allows selection of different airmass models (described below). If ``model`` is n...
python
def get_relative_airmass(altitude, model='kastenyoung1989'): """ Gives the relative (not pressure-corrected) airmass. Gives the airmass at sea-level when given a sun altitude angle (in degrees). The ``model`` variable allows selection of different airmass models (described below). If ``model`` is n...
[ "def", "get_relative_airmass", "(", "altitude", ",", "model", "=", "'kastenyoung1989'", ")", ":", "if", "altitude", "<", "0", ":", "return", "None", "else", ":", "alt_rad", "=", "math", ".", "radians", "(", "altitude", ")", "model", "=", "model", ".", "l...
Gives the relative (not pressure-corrected) airmass. Gives the airmass at sea-level when given a sun altitude angle (in degrees). The ``model`` variable allows selection of different airmass models (described below). If ``model`` is not included or is not valid, the default model is 'kastenyoung1989'. ...
[ "Gives", "the", "relative", "(", "not", "pressure", "-", "corrected", ")", "airmass", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/skymodel.py#L732-L820
ladybug-tools/ladybug
ladybug/skymodel.py
_get_dirint_coeffs
def _get_dirint_coeffs(): """ Here be a large multi-dimensional matrix of dirint coefficients. Returns: Array with shape ``(6, 6, 7, 5)``. Ordering is ``[kt_prime_bin, zenith_bin, delta_kt_prime_bin, w_bin]`` """ coeffs = [[0 for i in range(6)] for j in range(6)] coeffs[0][0] =...
python
def _get_dirint_coeffs(): """ Here be a large multi-dimensional matrix of dirint coefficients. Returns: Array with shape ``(6, 6, 7, 5)``. Ordering is ``[kt_prime_bin, zenith_bin, delta_kt_prime_bin, w_bin]`` """ coeffs = [[0 for i in range(6)] for j in range(6)] coeffs[0][0] =...
[ "def", "_get_dirint_coeffs", "(", ")", ":", "coeffs", "=", "[", "[", "0", "for", "i", "in", "range", "(", "6", ")", "]", "for", "j", "in", "range", "(", "6", ")", "]", "coeffs", "[", "0", "]", "[", "0", "]", "=", "[", "[", "0.385230", ",", ...
Here be a large multi-dimensional matrix of dirint coefficients. Returns: Array with shape ``(6, 6, 7, 5)``. Ordering is ``[kt_prime_bin, zenith_bin, delta_kt_prime_bin, w_bin]``
[ "Here", "be", "a", "large", "multi", "-", "dimensional", "matrix", "of", "dirint", "coefficients", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/skymodel.py#L823-L1157
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", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/legendparameters.py#L80-L84
ladybug-tools/ladybug
ladybug/legendparameters.py
LegendParameters.calculate_colors
def calculate_colors(self, values): """Return a list (or list of lists) of colors based on input values.""" # set domain if it is not set _flattenedList = list(flatten(values)) if not self.is_domain_set: self.set_domain(_flattenedList) _flattenedColors = range(len(_f...
python
def calculate_colors(self, values): """Return a list (or list of lists) of colors based on input values.""" # set domain if it is not set _flattenedList = list(flatten(values)) if not self.is_domain_set: self.set_domain(_flattenedList) _flattenedColors = range(len(_f...
[ "def", "calculate_colors", "(", "self", ",", "values", ")", ":", "# set domain if it is not set", "_flattenedList", "=", "list", "(", "flatten", "(", "values", ")", ")", "if", "not", "self", ".", "is_domain_set", ":", "self", ".", "set_domain", "(", "_flattene...
Return a list (or list of lists) of colors based on input values.
[ "Return", "a", "list", "(", "or", "list", "of", "lists", ")", "of", "colors", "based", "on", "input", "values", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/legendparameters.py#L86-L97
ladybug-tools/ladybug
ladybug/datacollection.py
HourlyDiscontinuousCollection.from_json
def from_json(cls, data): """Create a Data Collection from a dictionary. Args: { "header": A Ladybug Header, "values": An array of values, "datetimes": An array of datetimes, "validated_a_period": Boolean for whether header ana...
python
def from_json(cls, data): """Create a Data Collection from a dictionary. Args: { "header": A Ladybug Header, "values": An array of values, "datetimes": An array of datetimes, "validated_a_period": Boolean for whether header ana...
[ "def", "from_json", "(", "cls", ",", "data", ")", ":", "assert", "'header'", "in", "data", ",", "'Required keyword \"header\" is missing!'", "assert", "'values'", "in", "data", ",", "'Required keyword \"values\" is missing!'", "assert", "'datetimes'", "in", "data", ",...
Create a Data Collection from a dictionary. Args: { "header": A Ladybug Header, "values": An array of values, "datetimes": An array of datetimes, "validated_a_period": Boolean for whether header analysis_period is valid }
[ "Create", "a", "Data", "Collection", "from", "a", "dictionary", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L75-L93
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", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L96-L101
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", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L104-L112
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", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L114-L127
ladybug-tools/ladybug
ladybug/datacollection.py
HourlyDiscontinuousCollection.filter_by_hoys
def filter_by_hoys(self, hoys): """Filter the Data Collection based on an analysis period. Args: hoys: A List of hours of the year 0..8759 Return: A new Data Collection with filtered data """ _moys = tuple(int(hour * 60) for hour in hoys) return s...
python
def filter_by_hoys(self, hoys): """Filter the Data Collection based on an analysis period. Args: hoys: A List of hours of the year 0..8759 Return: A new Data Collection with filtered data """ _moys = tuple(int(hour * 60) for hour in hoys) return s...
[ "def", "filter_by_hoys", "(", "self", ",", "hoys", ")", ":", "_moys", "=", "tuple", "(", "int", "(", "hour", "*", "60", ")", "for", "hour", "in", "hoys", ")", "return", "self", ".", "filter_by_moys", "(", "_moys", ")" ]
Filter the Data Collection based on an analysis period. Args: hoys: A List of hours of the year 0..8759 Return: A new Data Collection with filtered data
[ "Filter", "the", "Data", "Collection", "based", "on", "an", "analysis", "period", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L129-L139
ladybug-tools/ladybug
ladybug/datacollection.py
HourlyDiscontinuousCollection.filter_by_moys
def filter_by_moys(self, moys): """Filter the Data Collection based on a list of minutes of the year. Args: moys: A List of minutes of the year [0..8759 * 60] Return: A new Data Collection with filtered data """ _filt_values, _filt_datetimes = self._filte...
python
def filter_by_moys(self, moys): """Filter the Data Collection based on a list of minutes of the year. Args: moys: A List of minutes of the year [0..8759 * 60] Return: A new Data Collection with filtered data """ _filt_values, _filt_datetimes = self._filte...
[ "def", "filter_by_moys", "(", "self", ",", "moys", ")", ":", "_filt_values", ",", "_filt_datetimes", "=", "self", ".", "_filter_by_moys_slow", "(", "moys", ")", "collection", "=", "HourlyDiscontinuousCollection", "(", "self", ".", "header", ".", "duplicate", "("...
Filter the Data Collection based on a list of minutes of the year. Args: moys: A List of minutes of the year [0..8759 * 60] Return: A new Data Collection with filtered data
[ "Filter", "the", "Data", "Collection", "based", "on", "a", "list", "of", "minutes", "of", "the", "year", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L141-L154
ladybug-tools/ladybug
ladybug/datacollection.py
HourlyDiscontinuousCollection.group_by_day
def group_by_day(self): """Return a dictionary of this collection's values grouped by each day of year. Key values are between 1-365. """ data_by_day = OrderedDict() for d in xrange(1, 366): data_by_day[d] = [] for v, dt in zip(self._values, self.datetimes): ...
python
def group_by_day(self): """Return a dictionary of this collection's values grouped by each day of year. Key values are between 1-365. """ data_by_day = OrderedDict() for d in xrange(1, 366): data_by_day[d] = [] for v, dt in zip(self._values, self.datetimes): ...
[ "def", "group_by_day", "(", "self", ")", ":", "data_by_day", "=", "OrderedDict", "(", ")", "for", "d", "in", "xrange", "(", "1", ",", "366", ")", ":", "data_by_day", "[", "d", "]", "=", "[", "]", "for", "v", ",", "dt", "in", "zip", "(", "self", ...
Return a dictionary of this collection's values grouped by each day of year. Key values are between 1-365.
[ "Return", "a", "dictionary", "of", "this", "collection", "s", "values", "grouped", "by", "each", "day", "of", "year", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L156-L166
ladybug-tools/ladybug
ladybug/datacollection.py
HourlyDiscontinuousCollection.group_by_month
def group_by_month(self): """Return a dictionary of this collection's values grouped by each month. Key values are between 1-12. """ data_by_month = OrderedDict() for d in xrange(1, 13): data_by_month[d] = [] for v, dt in zip(self._values, self.datetimes): ...
python
def group_by_month(self): """Return a dictionary of this collection's values grouped by each month. Key values are between 1-12. """ data_by_month = OrderedDict() for d in xrange(1, 13): data_by_month[d] = [] for v, dt in zip(self._values, self.datetimes): ...
[ "def", "group_by_month", "(", "self", ")", ":", "data_by_month", "=", "OrderedDict", "(", ")", "for", "d", "in", "xrange", "(", "1", ",", "13", ")", ":", "data_by_month", "[", "d", "]", "=", "[", "]", "for", "v", ",", "dt", "in", "zip", "(", "sel...
Return a dictionary of this collection's values grouped by each month. Key values are between 1-12.
[ "Return", "a", "dictionary", "of", "this", "collection", "s", "values", "grouped", "by", "each", "month", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L185-L195
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", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L214-L228
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", ")", ":", "# validate analysis_period and use the resulting period to generate datetimes", "assert", "self", ".", "validated_a_period", "is", "True", ",", "'validated_a_period property must be'", "' True to use interpolate_holes(). Run validate_...
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", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L247-L287
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", "." ]
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L289-L301