id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
4,500 | fhs/pyhdf | pyhdf/V.py | VG.tagrefs | def tagrefs(self):
"""Get the tags and reference numbers of all the vgroup
members.
Args::
no argument
Returns::
list of (tag,ref) tuples, one for each vgroup member
C library equivalent : Vgettagrefs
... | python | def tagrefs(self):
"""Get the tags and reference numbers of all the vgroup
members.
Args::
no argument
Returns::
list of (tag,ref) tuples, one for each vgroup member
C library equivalent : Vgettagrefs
... | [
"def",
"tagrefs",
"(",
"self",
")",
":",
"n",
"=",
"self",
".",
"_nmembers",
"ret",
"=",
"[",
"]",
"if",
"n",
":",
"tags",
"=",
"_C",
".",
"array_int32",
"(",
"n",
")",
"refs",
"=",
"_C",
".",
"array_int32",
"(",
"n",
")",
"k",
"=",
"_C",
"."... | Get the tags and reference numbers of all the vgroup
members.
Args::
no argument
Returns::
list of (tag,ref) tuples, one for each vgroup member
C library equivalent : Vgettagrefs | [
"Get",
"the",
"tags",
"and",
"reference",
"numbers",
"of",
"all",
"the",
"vgroup",
"members",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/V.py#L1100-L1124 |
4,501 | fhs/pyhdf | pyhdf/V.py | VG.inqtagref | def inqtagref(self, tag, ref):
"""Determines if an object identified by its tag and reference
number belongs to the vgroup.
Args::
tag tag of the object to check
ref reference number of the object to check
Returns::
False (0) if the object does... | python | def inqtagref(self, tag, ref):
"""Determines if an object identified by its tag and reference
number belongs to the vgroup.
Args::
tag tag of the object to check
ref reference number of the object to check
Returns::
False (0) if the object does... | [
"def",
"inqtagref",
"(",
"self",
",",
"tag",
",",
"ref",
")",
":",
"return",
"_C",
".",
"Vinqtagref",
"(",
"self",
".",
"_id",
",",
"tag",
",",
"ref",
")"
] | Determines if an object identified by its tag and reference
number belongs to the vgroup.
Args::
tag tag of the object to check
ref reference number of the object to check
Returns::
False (0) if the object does not belong to the vgroup,
True ... | [
"Determines",
"if",
"an",
"object",
"identified",
"by",
"its",
"tag",
"and",
"reference",
"number",
"belongs",
"to",
"the",
"vgroup",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/V.py#L1126-L1143 |
4,502 | fhs/pyhdf | pyhdf/V.py | VG.nrefs | def nrefs(self, tag):
"""Determine the number of tags of a given type in a vgroup.
Args::
tag tag type to look for in the vgroup
Returns::
number of members identified by this tag type
C library equivalent : Vnrefs
... | python | def nrefs(self, tag):
"""Determine the number of tags of a given type in a vgroup.
Args::
tag tag type to look for in the vgroup
Returns::
number of members identified by this tag type
C library equivalent : Vnrefs
... | [
"def",
"nrefs",
"(",
"self",
",",
"tag",
")",
":",
"n",
"=",
"_C",
".",
"Vnrefs",
"(",
"self",
".",
"_id",
",",
"tag",
")",
"_checkErr",
"(",
"'nrefs'",
",",
"n",
",",
"\"bad arguments\"",
")",
"return",
"n"
] | Determine the number of tags of a given type in a vgroup.
Args::
tag tag type to look for in the vgroup
Returns::
number of members identified by this tag type
C library equivalent : Vnrefs | [
"Determine",
"the",
"number",
"of",
"tags",
"of",
"a",
"given",
"type",
"in",
"a",
"vgroup",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/V.py#L1145-L1161 |
4,503 | fhs/pyhdf | pyhdf/V.py | VG.attrinfo | def attrinfo(self):
"""Return info about all the vgroup attributes.
Args::
no argument
Returns::
dictionnary describing each vgroup attribute; for each attribute,
a (name,data) pair is added to the dictionary, where 'data' is
a tuple holding:
... | python | def attrinfo(self):
"""Return info about all the vgroup attributes.
Args::
no argument
Returns::
dictionnary describing each vgroup attribute; for each attribute,
a (name,data) pair is added to the dictionary, where 'data' is
a tuple holding:
... | [
"def",
"attrinfo",
"(",
"self",
")",
":",
"dic",
"=",
"{",
"}",
"for",
"n",
"in",
"range",
"(",
"self",
".",
"_nattrs",
")",
":",
"att",
"=",
"self",
".",
"attr",
"(",
"n",
")",
"name",
",",
"type",
",",
"order",
",",
"size",
"=",
"att",
".",... | Return info about all the vgroup attributes.
Args::
no argument
Returns::
dictionnary describing each vgroup attribute; for each attribute,
a (name,data) pair is added to the dictionary, where 'data' is
a tuple holding:
- attribute data type (one of... | [
"Return",
"info",
"about",
"all",
"the",
"vgroup",
"attributes",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/V.py#L1218-L1245 |
4,504 | fhs/pyhdf | pyhdf/V.py | VG.findattr | def findattr(self, name):
"""Search the vgroup for a given attribute.
Args::
name attribute name
Returns::
if found, VGAttr instance describing the attribute
None otherwise
C library equivalent : Vfindattr
... | python | def findattr(self, name):
"""Search the vgroup for a given attribute.
Args::
name attribute name
Returns::
if found, VGAttr instance describing the attribute
None otherwise
C library equivalent : Vfindattr
... | [
"def",
"findattr",
"(",
"self",
",",
"name",
")",
":",
"try",
":",
"att",
"=",
"self",
".",
"attr",
"(",
"name",
")",
"if",
"att",
".",
"_index",
"is",
"None",
":",
"att",
"=",
"None",
"except",
"HDF4Error",
":",
"att",
"=",
"None",
"return",
"at... | Search the vgroup for a given attribute.
Args::
name attribute name
Returns::
if found, VGAttr instance describing the attribute
None otherwise
C library equivalent : Vfindattr | [
"Search",
"the",
"vgroup",
"for",
"a",
"given",
"attribute",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/V.py#L1248-L1269 |
4,505 | fhs/pyhdf | pyhdf/SD.py | SDAttr.index | def index(self):
"""Retrieve the attribute index number.
Args::
no argument
Returns::
attribute index number (starting at 0)
C library equivalent : SDfindattr
"""
self._index = _C.SDfindattr(self._obj._id, sel... | python | def index(self):
"""Retrieve the attribute index number.
Args::
no argument
Returns::
attribute index number (starting at 0)
C library equivalent : SDfindattr
"""
self._index = _C.SDfindattr(self._obj._id, sel... | [
"def",
"index",
"(",
"self",
")",
":",
"self",
".",
"_index",
"=",
"_C",
".",
"SDfindattr",
"(",
"self",
".",
"_obj",
".",
"_id",
",",
"self",
".",
"_name",
")",
"_checkErr",
"(",
"'find'",
",",
"self",
".",
"_index",
",",
"'illegal attribute name'",
... | Retrieve the attribute index number.
Args::
no argument
Returns::
attribute index number (starting at 0)
C library equivalent : SDfindattr | [
"Retrieve",
"the",
"attribute",
"index",
"number",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/SD.py#L1178-L1194 |
4,506 | fhs/pyhdf | pyhdf/SD.py | SD.end | def end(self):
"""End access to the SD interface and close the HDF file.
Args::
no argument
Returns::
None
The instance should not be used afterwards.
The 'end()' method is implicitly called when the
SD instance is deleted.
C library ... | python | def end(self):
"""End access to the SD interface and close the HDF file.
Args::
no argument
Returns::
None
The instance should not be used afterwards.
The 'end()' method is implicitly called when the
SD instance is deleted.
C library ... | [
"def",
"end",
"(",
"self",
")",
":",
"status",
"=",
"_C",
".",
"SDend",
"(",
"self",
".",
"_id",
")",
"_checkErr",
"(",
"'end'",
",",
"status",
",",
"\"cannot execute\"",
")",
"self",
".",
"_id",
"=",
"None"
] | End access to the SD interface and close the HDF file.
Args::
no argument
Returns::
None
The instance should not be used afterwards.
The 'end()' method is implicitly called when the
SD instance is deleted.
C library equivalent : SDend | [
"End",
"access",
"to",
"the",
"SD",
"interface",
"and",
"close",
"the",
"HDF",
"file",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/SD.py#L1457-L1477 |
4,507 | fhs/pyhdf | pyhdf/SD.py | SD.info | def info(self):
"""Retrieve information about the SD interface.
Args::
no argument
Returns::
2-element tuple holding:
number of datasets inside the file
number of file attributes
C library equivalent : SDfileinfo
... | python | def info(self):
"""Retrieve information about the SD interface.
Args::
no argument
Returns::
2-element tuple holding:
number of datasets inside the file
number of file attributes
C library equivalent : SDfileinfo
... | [
"def",
"info",
"(",
"self",
")",
":",
"status",
",",
"n_datasets",
",",
"n_file_attrs",
"=",
"_C",
".",
"SDfileinfo",
"(",
"self",
".",
"_id",
")",
"_checkErr",
"(",
"'info'",
",",
"status",
",",
"\"cannot execute\"",
")",
"return",
"n_datasets",
",",
"n... | Retrieve information about the SD interface.
Args::
no argument
Returns::
2-element tuple holding:
number of datasets inside the file
number of file attributes
C library equivalent : SDfileinfo | [
"Retrieve",
"information",
"about",
"the",
"SD",
"interface",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/SD.py#L1479-L1497 |
4,508 | fhs/pyhdf | pyhdf/SD.py | SD.nametoindex | def nametoindex(self, sds_name):
"""Return the index number of a dataset given the dataset name.
Args::
sds_name : dataset name
Returns::
index number of the dataset
C library equivalent : SDnametoindex
"""
... | python | def nametoindex(self, sds_name):
"""Return the index number of a dataset given the dataset name.
Args::
sds_name : dataset name
Returns::
index number of the dataset
C library equivalent : SDnametoindex
"""
... | [
"def",
"nametoindex",
"(",
"self",
",",
"sds_name",
")",
":",
"sds_idx",
"=",
"_C",
".",
"SDnametoindex",
"(",
"self",
".",
"_id",
",",
"sds_name",
")",
"_checkErr",
"(",
"'nametoindex'",
",",
"sds_idx",
",",
"'non existent SDS'",
")",
"return",
"sds_idx"
] | Return the index number of a dataset given the dataset name.
Args::
sds_name : dataset name
Returns::
index number of the dataset
C library equivalent : SDnametoindex | [
"Return",
"the",
"index",
"number",
"of",
"a",
"dataset",
"given",
"the",
"dataset",
"name",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/SD.py#L1499-L1515 |
4,509 | fhs/pyhdf | pyhdf/SD.py | SD.reftoindex | def reftoindex(self, sds_ref):
"""Returns the index number of a dataset given the dataset
reference number.
Args::
sds_ref : dataset reference number
Returns::
dataset index number
C library equivalent : SDreftoindex
... | python | def reftoindex(self, sds_ref):
"""Returns the index number of a dataset given the dataset
reference number.
Args::
sds_ref : dataset reference number
Returns::
dataset index number
C library equivalent : SDreftoindex
... | [
"def",
"reftoindex",
"(",
"self",
",",
"sds_ref",
")",
":",
"sds_idx",
"=",
"_C",
".",
"SDreftoindex",
"(",
"self",
".",
"_id",
",",
"sds_ref",
")",
"_checkErr",
"(",
"'reftoindex'",
",",
"sds_idx",
",",
"'illegal SDS ref number'",
")",
"return",
"sds_idx"
] | Returns the index number of a dataset given the dataset
reference number.
Args::
sds_ref : dataset reference number
Returns::
dataset index number
C library equivalent : SDreftoindex | [
"Returns",
"the",
"index",
"number",
"of",
"a",
"dataset",
"given",
"the",
"dataset",
"reference",
"number",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/SD.py#L1517-L1534 |
4,510 | fhs/pyhdf | pyhdf/SD.py | SD.setfillmode | def setfillmode(self, fill_mode):
"""Set the fill mode for all the datasets in the file.
Args::
fill_mode : fill mode; one of :
SDC.FILL write the fill value to all the datasets
of the file by default
SDC.NOF... | python | def setfillmode(self, fill_mode):
"""Set the fill mode for all the datasets in the file.
Args::
fill_mode : fill mode; one of :
SDC.FILL write the fill value to all the datasets
of the file by default
SDC.NOF... | [
"def",
"setfillmode",
"(",
"self",
",",
"fill_mode",
")",
":",
"if",
"not",
"fill_mode",
"in",
"[",
"SDC",
".",
"FILL",
",",
"SDC",
".",
"NOFILL",
"]",
":",
"raise",
"HDF4Error",
"(",
"\"bad fill mode\"",
")",
"old_mode",
"=",
"_C",
".",
"SDsetfillmode",... | Set the fill mode for all the datasets in the file.
Args::
fill_mode : fill mode; one of :
SDC.FILL write the fill value to all the datasets
of the file by default
SDC.NOFILL do not write fill values to all datasets
... | [
"Set",
"the",
"fill",
"mode",
"for",
"all",
"the",
"datasets",
"in",
"the",
"file",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/SD.py#L1536-L1558 |
4,511 | fhs/pyhdf | pyhdf/SD.py | SD.select | def select(self, name_or_index):
"""Locate a dataset.
Args::
name_or_index dataset name or index number
Returns::
SDS instance for the dataset
C library equivalent : SDselect
"""
if isi... | python | def select(self, name_or_index):
"""Locate a dataset.
Args::
name_or_index dataset name or index number
Returns::
SDS instance for the dataset
C library equivalent : SDselect
"""
if isi... | [
"def",
"select",
"(",
"self",
",",
"name_or_index",
")",
":",
"if",
"isinstance",
"(",
"name_or_index",
",",
"type",
"(",
"1",
")",
")",
":",
"idx",
"=",
"name_or_index",
"else",
":",
"try",
":",
"idx",
"=",
"self",
".",
"nametoindex",
"(",
"name_or_in... | Locate a dataset.
Args::
name_or_index dataset name or index number
Returns::
SDS instance for the dataset
C library equivalent : SDselect | [
"Locate",
"a",
"dataset",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/SD.py#L1603-L1626 |
4,512 | fhs/pyhdf | pyhdf/SD.py | SD.attributes | def attributes(self, full=0):
"""Return a dictionnary describing every global
attribute attached to the SD interface.
Args::
full true to get complete info about each attribute
false to report only each attribute value
Returns::
Empty dict... | python | def attributes(self, full=0):
"""Return a dictionnary describing every global
attribute attached to the SD interface.
Args::
full true to get complete info about each attribute
false to report only each attribute value
Returns::
Empty dict... | [
"def",
"attributes",
"(",
"self",
",",
"full",
"=",
"0",
")",
":",
"# Get the number of global attributes.",
"nsds",
",",
"natts",
"=",
"self",
".",
"info",
"(",
")",
"# Inquire each attribute",
"res",
"=",
"{",
"}",
"for",
"n",
"in",
"range",
"(",
"natts"... | Return a dictionnary describing every global
attribute attached to the SD interface.
Args::
full true to get complete info about each attribute
false to report only each attribute value
Returns::
Empty dictionnary if no global attribute defined
... | [
"Return",
"a",
"dictionnary",
"describing",
"every",
"global",
"attribute",
"attached",
"to",
"the",
"SD",
"interface",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/SD.py#L1651-L1689 |
4,513 | fhs/pyhdf | pyhdf/SD.py | SD.datasets | def datasets(self):
"""Return a dictionnary describing all the file datasets.
Args::
no argument
Returns::
Empty dictionnary if no dataset is defined.
Otherwise, dictionnary whose keys are the file dataset names,
and values are tuples describing the co... | python | def datasets(self):
"""Return a dictionnary describing all the file datasets.
Args::
no argument
Returns::
Empty dictionnary if no dataset is defined.
Otherwise, dictionnary whose keys are the file dataset names,
and values are tuples describing the co... | [
"def",
"datasets",
"(",
"self",
")",
":",
"# Get number of datasets",
"nDs",
"=",
"self",
".",
"info",
"(",
")",
"[",
"0",
"]",
"# Inquire each var",
"res",
"=",
"{",
"}",
"for",
"n",
"in",
"range",
"(",
"nDs",
")",
":",
"# Get dataset info.",
"v",
"="... | Return a dictionnary describing all the file datasets.
Args::
no argument
Returns::
Empty dictionnary if no dataset is defined.
Otherwise, dictionnary whose keys are the file dataset names,
and values are tuples describing the corresponding datasets.
... | [
"Return",
"a",
"dictionnary",
"describing",
"all",
"the",
"file",
"datasets",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/SD.py#L1691-L1736 |
4,514 | fhs/pyhdf | pyhdf/SD.py | SDS.endaccess | def endaccess(self):
"""Terminates access to the SDS.
Args::
no argument
Returns::
None.
The SDS instance should not be used afterwards.
The 'endaccess()' method is implicitly called when
the SDS instance is deleted.
C library equivalent ... | python | def endaccess(self):
"""Terminates access to the SDS.
Args::
no argument
Returns::
None.
The SDS instance should not be used afterwards.
The 'endaccess()' method is implicitly called when
the SDS instance is deleted.
C library equivalent ... | [
"def",
"endaccess",
"(",
"self",
")",
":",
"status",
"=",
"_C",
".",
"SDendaccess",
"(",
"self",
".",
"_id",
")",
"_checkErr",
"(",
"'endaccess'",
",",
"status",
",",
"\"cannot execute\"",
")",
"self",
".",
"_id",
"=",
"None"
] | Terminates access to the SDS.
Args::
no argument
Returns::
None.
The SDS instance should not be used afterwards.
The 'endaccess()' method is implicitly called when
the SDS instance is deleted.
C library equivalent : SDendaccess | [
"Terminates",
"access",
"to",
"the",
"SDS",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/SD.py#L1817-L1837 |
4,515 | fhs/pyhdf | pyhdf/SD.py | SDS.dim | def dim(self, dim_index):
"""Get an SDim instance given a dimension index number.
Args::
dim_index index number of the dimension (numbering starts at 0)
C library equivalent : SDgetdimid
"""
id = _C.SDgetdimid(self._id, dim... | python | def dim(self, dim_index):
"""Get an SDim instance given a dimension index number.
Args::
dim_index index number of the dimension (numbering starts at 0)
C library equivalent : SDgetdimid
"""
id = _C.SDgetdimid(self._id, dim... | [
"def",
"dim",
"(",
"self",
",",
"dim_index",
")",
":",
"id",
"=",
"_C",
".",
"SDgetdimid",
"(",
"self",
".",
"_id",
",",
"dim_index",
")",
"_checkErr",
"(",
"'dim'",
",",
"id",
",",
"'invalid SDS identifier or dimension index'",
")",
"return",
"SDim",
"(",... | Get an SDim instance given a dimension index number.
Args::
dim_index index number of the dimension (numbering starts at 0)
C library equivalent : SDgetdimid | [
"Get",
"an",
"SDim",
"instance",
"given",
"a",
"dimension",
"index",
"number",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/SD.py#L1840-L1851 |
4,516 | fhs/pyhdf | pyhdf/SD.py | SDS.get | def get(self, start=None, count=None, stride=None):
"""Read data from the dataset.
Args::
start : indices where to start reading in the data array;
default to 0 on all dimensions
count : number of values to read along each dimension;
defa... | python | def get(self, start=None, count=None, stride=None):
"""Read data from the dataset.
Args::
start : indices where to start reading in the data array;
default to 0 on all dimensions
count : number of values to read along each dimension;
defa... | [
"def",
"get",
"(",
"self",
",",
"start",
"=",
"None",
",",
"count",
"=",
"None",
",",
"stride",
"=",
"None",
")",
":",
"# Obtain SDS info.",
"try",
":",
"sds_name",
",",
"rank",
",",
"dim_sizes",
",",
"data_type",
",",
"n_attrs",
"=",
"self",
".",
"i... | Read data from the dataset.
Args::
start : indices where to start reading in the data array;
default to 0 on all dimensions
count : number of values to read along each dimension;
default to the current length of all dimensions
stride :... | [
"Read",
"data",
"from",
"the",
"dataset",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/SD.py#L1853-L1920 |
4,517 | fhs/pyhdf | pyhdf/SD.py | SDS.set | def set(self, data, start=None, count=None, stride=None):
"""Write data to the dataset.
Args::
data : array of data to write; can be given as a numpy
array, or as Python sequence (whose elements can be
imbricated sequences)
start : indic... | python | def set(self, data, start=None, count=None, stride=None):
"""Write data to the dataset.
Args::
data : array of data to write; can be given as a numpy
array, or as Python sequence (whose elements can be
imbricated sequences)
start : indic... | [
"def",
"set",
"(",
"self",
",",
"data",
",",
"start",
"=",
"None",
",",
"count",
"=",
"None",
",",
"stride",
"=",
"None",
")",
":",
"# Obtain SDS info.",
"try",
":",
"sds_name",
",",
"rank",
",",
"dim_sizes",
",",
"data_type",
",",
"n_attrs",
"=",
"s... | Write data to the dataset.
Args::
data : array of data to write; can be given as a numpy
array, or as Python sequence (whose elements can be
imbricated sequences)
start : indices where to start writing in the dataset;
default... | [
"Write",
"data",
"to",
"the",
"dataset",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/SD.py#L1922-L2001 |
4,518 | fhs/pyhdf | pyhdf/SD.py | SDS.info | def info(self):
"""Retrieves information about the dataset.
Args::
no argument
Returns::
5-element tuple holding:
- dataset name
- dataset rank (number of dimensions)
- dataset shape, that is a list giving the length of each
data... | python | def info(self):
"""Retrieves information about the dataset.
Args::
no argument
Returns::
5-element tuple holding:
- dataset name
- dataset rank (number of dimensions)
- dataset shape, that is a list giving the length of each
data... | [
"def",
"info",
"(",
"self",
")",
":",
"buf",
"=",
"_C",
".",
"array_int32",
"(",
"_C",
".",
"H4_MAX_VAR_DIMS",
")",
"status",
",",
"sds_name",
",",
"rank",
",",
"data_type",
",",
"n_attrs",
"=",
"_C",
".",
"SDgetinfo",
"(",
"self",
".",
"_id",
",",
... | Retrieves information about the dataset.
Args::
no argument
Returns::
5-element tuple holding:
- dataset name
- dataset rank (number of dimensions)
- dataset shape, that is a list giving the length of each
dataset dimension; if the first... | [
"Retrieves",
"information",
"about",
"the",
"dataset",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/SD.py#L2102-L2130 |
4,519 | fhs/pyhdf | pyhdf/SD.py | SDS.checkempty | def checkempty(self):
"""Determine whether the dataset is empty.
Args::
no argument
Returns::
True(1) if dataset is empty, False(0) if not
C library equivalent : SDcheckempty
"""
status, emptySDS = _C.SDch... | python | def checkempty(self):
"""Determine whether the dataset is empty.
Args::
no argument
Returns::
True(1) if dataset is empty, False(0) if not
C library equivalent : SDcheckempty
"""
status, emptySDS = _C.SDch... | [
"def",
"checkempty",
"(",
"self",
")",
":",
"status",
",",
"emptySDS",
"=",
"_C",
".",
"SDcheckempty",
"(",
"self",
".",
"_id",
")",
"_checkErr",
"(",
"'checkempty'",
",",
"status",
",",
"'invalid SDS identifier'",
")",
"return",
"emptySDS"
] | Determine whether the dataset is empty.
Args::
no argument
Returns::
True(1) if dataset is empty, False(0) if not
C library equivalent : SDcheckempty | [
"Determine",
"whether",
"the",
"dataset",
"is",
"empty",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/SD.py#L2132-L2148 |
4,520 | fhs/pyhdf | pyhdf/SD.py | SDS.ref | def ref(self):
"""Get the reference number of the dataset.
Args::
no argument
Returns::
dataset reference number
C library equivalent : SDidtoref
"""
sds_ref = _C.SDidtoref(self._id)
_checkErr('idtore... | python | def ref(self):
"""Get the reference number of the dataset.
Args::
no argument
Returns::
dataset reference number
C library equivalent : SDidtoref
"""
sds_ref = _C.SDidtoref(self._id)
_checkErr('idtore... | [
"def",
"ref",
"(",
"self",
")",
":",
"sds_ref",
"=",
"_C",
".",
"SDidtoref",
"(",
"self",
".",
"_id",
")",
"_checkErr",
"(",
"'idtoref'",
",",
"sds_ref",
",",
"'illegal SDS identifier'",
")",
"return",
"sds_ref"
] | Get the reference number of the dataset.
Args::
no argument
Returns::
dataset reference number
C library equivalent : SDidtoref | [
"Get",
"the",
"reference",
"number",
"of",
"the",
"dataset",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/SD.py#L2150-L2166 |
4,521 | fhs/pyhdf | pyhdf/SD.py | SDS.getcal | def getcal(self):
"""Retrieve the SDS calibration coefficients.
Args::
no argument
Returns::
5-element tuple holding:
- cal: calibration factor (attribute 'scale_factor')
- cal_error : calibration factor error
(attribute 'scale... | python | def getcal(self):
"""Retrieve the SDS calibration coefficients.
Args::
no argument
Returns::
5-element tuple holding:
- cal: calibration factor (attribute 'scale_factor')
- cal_error : calibration factor error
(attribute 'scale... | [
"def",
"getcal",
"(",
"self",
")",
":",
"status",
",",
"cal",
",",
"cal_error",
",",
"offset",
",",
"offset_err",
",",
"data_type",
"=",
"_C",
".",
"SDgetcal",
"(",
"self",
".",
"_id",
")",
"_checkErr",
"(",
"'getcal'",
",",
"status",
",",
"'no calibra... | Retrieve the SDS calibration coefficients.
Args::
no argument
Returns::
5-element tuple holding:
- cal: calibration factor (attribute 'scale_factor')
- cal_error : calibration factor error
(attribute 'scale_factor_err')
- off... | [
"Retrieve",
"the",
"SDS",
"calibration",
"coefficients",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/SD.py#L2206-L2246 |
4,522 | fhs/pyhdf | pyhdf/SD.py | SDS.getdatastrs | def getdatastrs(self):
"""Retrieve the dataset standard string attributes.
Args::
no argument
Returns::
4-element tuple holding:
- dataset label string (attribute 'long_name')
- dataset unit (attribute 'units')
- dataset output format (attri... | python | def getdatastrs(self):
"""Retrieve the dataset standard string attributes.
Args::
no argument
Returns::
4-element tuple holding:
- dataset label string (attribute 'long_name')
- dataset unit (attribute 'units')
- dataset output format (attri... | [
"def",
"getdatastrs",
"(",
"self",
")",
":",
"status",
",",
"label",
",",
"unit",
",",
"format",
",",
"coord_system",
"=",
"_C",
".",
"SDgetdatastrs",
"(",
"self",
".",
"_id",
",",
"128",
")",
"_checkErr",
"(",
"'getdatastrs'",
",",
"status",
",",
"'ca... | Retrieve the dataset standard string attributes.
Args::
no argument
Returns::
4-element tuple holding:
- dataset label string (attribute 'long_name')
- dataset unit (attribute 'units')
- dataset output format (attribute 'format')
- dataset... | [
"Retrieve",
"the",
"dataset",
"standard",
"string",
"attributes",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/SD.py#L2248-L2276 |
4,523 | fhs/pyhdf | pyhdf/SD.py | SDS.getrange | def getrange(self):
"""Retrieve the dataset min and max values.
Args::
no argument
Returns::
(min, max) tuple (attribute 'valid_range')
Note that those are the values as stored
by the 'setrange' method. 'getrange' does *NOT* compute the
min ... | python | def getrange(self):
"""Retrieve the dataset min and max values.
Args::
no argument
Returns::
(min, max) tuple (attribute 'valid_range')
Note that those are the values as stored
by the 'setrange' method. 'getrange' does *NOT* compute the
min ... | [
"def",
"getrange",
"(",
"self",
")",
":",
"# Obtain SDS data type.",
"try",
":",
"sds_name",
",",
"rank",
",",
"dim_sizes",
",",
"data_type",
",",
"n_attrs",
"=",
"self",
".",
"info",
"(",
")",
"except",
"HDF4Error",
":",
"raise",
"HDF4Error",
"(",
"'getra... | Retrieve the dataset min and max values.
Args::
no argument
Returns::
(min, max) tuple (attribute 'valid_range')
Note that those are the values as stored
by the 'setrange' method. 'getrange' does *NOT* compute the
min and max from the current datase... | [
"Retrieve",
"the",
"dataset",
"min",
"and",
"max",
"values",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/SD.py#L2344-L2426 |
4,524 | fhs/pyhdf | pyhdf/SD.py | SDS.setcal | def setcal(self, cal, cal_error, offset, offset_err, data_type):
"""Set the dataset calibration coefficients.
Args::
cal the calibraton factor (attribute 'scale_factor')
cal_error calibration factor error
(attribute 'scale_factor_err')
offs... | python | def setcal(self, cal, cal_error, offset, offset_err, data_type):
"""Set the dataset calibration coefficients.
Args::
cal the calibraton factor (attribute 'scale_factor')
cal_error calibration factor error
(attribute 'scale_factor_err')
offs... | [
"def",
"setcal",
"(",
"self",
",",
"cal",
",",
"cal_error",
",",
"offset",
",",
"offset_err",
",",
"data_type",
")",
":",
"status",
"=",
"_C",
".",
"SDsetcal",
"(",
"self",
".",
"_id",
",",
"cal",
",",
"cal_error",
",",
"offset",
",",
"offset_err",
"... | Set the dataset calibration coefficients.
Args::
cal the calibraton factor (attribute 'scale_factor')
cal_error calibration factor error
(attribute 'scale_factor_err')
offset offset value (attribute 'add_offset')
offset_err offset e... | [
"Set",
"the",
"dataset",
"calibration",
"coefficients",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/SD.py#L2428-L2463 |
4,525 | fhs/pyhdf | pyhdf/SD.py | SDS.setdatastrs | def setdatastrs(self, label, unit, format, coord_sys):
"""Set the dataset standard string type attributes.
Args::
label dataset label (attribute 'long_name')
unit dataset unit (attribute 'units')
format dataset format (attribute 'format')
... | python | def setdatastrs(self, label, unit, format, coord_sys):
"""Set the dataset standard string type attributes.
Args::
label dataset label (attribute 'long_name')
unit dataset unit (attribute 'units')
format dataset format (attribute 'format')
... | [
"def",
"setdatastrs",
"(",
"self",
",",
"label",
",",
"unit",
",",
"format",
",",
"coord_sys",
")",
":",
"status",
"=",
"_C",
".",
"SDsetdatastrs",
"(",
"self",
".",
"_id",
",",
"label",
",",
"unit",
",",
"format",
",",
"coord_sys",
")",
"_checkErr",
... | Set the dataset standard string type attributes.
Args::
label dataset label (attribute 'long_name')
unit dataset unit (attribute 'units')
format dataset format (attribute 'format')
coord_sys dataset coordinate system (attribute 'coordsys')
... | [
"Set",
"the",
"dataset",
"standard",
"string",
"type",
"attributes",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/SD.py#L2465-L2490 |
4,526 | fhs/pyhdf | pyhdf/SD.py | SDS.setfillvalue | def setfillvalue(self, fill_val):
"""Set the dataset fill value.
Args::
fill_val dataset fill value (attribute '_FillValue')
Returns::
None
The fill value is part of the so-called "standard" SDS
attributes. Calling 'setfillvalue' is equivalent to settin... | python | def setfillvalue(self, fill_val):
"""Set the dataset fill value.
Args::
fill_val dataset fill value (attribute '_FillValue')
Returns::
None
The fill value is part of the so-called "standard" SDS
attributes. Calling 'setfillvalue' is equivalent to settin... | [
"def",
"setfillvalue",
"(",
"self",
",",
"fill_val",
")",
":",
"# Obtain SDS data type.",
"try",
":",
"sds_name",
",",
"rank",
",",
"dim_sizes",
",",
"data_type",
",",
"n_attrs",
"=",
"self",
".",
"info",
"(",
")",
"except",
"HDF4Error",
":",
"raise",
"HDF... | Set the dataset fill value.
Args::
fill_val dataset fill value (attribute '_FillValue')
Returns::
None
The fill value is part of the so-called "standard" SDS
attributes. Calling 'setfillvalue' is equivalent to setting
the following attribute::
... | [
"Set",
"the",
"dataset",
"fill",
"value",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/SD.py#L2492-L2552 |
4,527 | fhs/pyhdf | pyhdf/SD.py | SDS.setrange | def setrange(self, min, max):
"""Set the dataset min and max values.
Args::
min dataset minimum value (attribute 'valid_range')
max dataset maximum value (attribute 'valid_range')
Returns::
None
The data range is part of the so-called "st... | python | def setrange(self, min, max):
"""Set the dataset min and max values.
Args::
min dataset minimum value (attribute 'valid_range')
max dataset maximum value (attribute 'valid_range')
Returns::
None
The data range is part of the so-called "st... | [
"def",
"setrange",
"(",
"self",
",",
"min",
",",
"max",
")",
":",
"# Obtain SDS data type.",
"try",
":",
"sds_name",
",",
"rank",
",",
"dim_sizes",
",",
"data_type",
",",
"n_attrs",
"=",
"self",
".",
"info",
"(",
")",
"except",
"HDF4Error",
":",
"raise",... | Set the dataset min and max values.
Args::
min dataset minimum value (attribute 'valid_range')
max dataset maximum value (attribute 'valid_range')
Returns::
None
The data range is part of the so-called "standard" SDS
attributes. Calling m... | [
"Set",
"the",
"dataset",
"min",
"and",
"max",
"values",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/SD.py#L2555-L2629 |
4,528 | fhs/pyhdf | pyhdf/SD.py | SDS.getcompress | def getcompress(self):
"""Retrieves info about dataset compression type and mode.
Args::
no argument
Returns::
tuple holding:
- compression type (one of the SDC.COMP_xxx constants)
- optional values, depending on the compression type
COM... | python | def getcompress(self):
"""Retrieves info about dataset compression type and mode.
Args::
no argument
Returns::
tuple holding:
- compression type (one of the SDC.COMP_xxx constants)
- optional values, depending on the compression type
COM... | [
"def",
"getcompress",
"(",
"self",
")",
":",
"status",
",",
"comp_type",
",",
"value",
",",
"v2",
",",
"v3",
",",
"v4",
",",
"v5",
"=",
"_C",
".",
"_SDgetcompress",
"(",
"self",
".",
"_id",
")",
"_checkErr",
"(",
"'getcompress'",
",",
"status",
",",
... | Retrieves info about dataset compression type and mode.
Args::
no argument
Returns::
tuple holding:
- compression type (one of the SDC.COMP_xxx constants)
- optional values, depending on the compression type
COMP_NONE 0 value no additio... | [
"Retrieves",
"info",
"about",
"dataset",
"compression",
"type",
"and",
"mode",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/SD.py#L2631-L2677 |
4,529 | fhs/pyhdf | pyhdf/SD.py | SDS.setcompress | def setcompress(self, comp_type, value=0, v2=0):
"""Compresses the dataset using a specified compression method.
Args::
comp_type compression type, identified by one of the
SDC.COMP_xxx constants
value,v2 auxiliary value(s) needed by some compression t... | python | def setcompress(self, comp_type, value=0, v2=0):
"""Compresses the dataset using a specified compression method.
Args::
comp_type compression type, identified by one of the
SDC.COMP_xxx constants
value,v2 auxiliary value(s) needed by some compression t... | [
"def",
"setcompress",
"(",
"self",
",",
"comp_type",
",",
"value",
"=",
"0",
",",
"v2",
"=",
"0",
")",
":",
"status",
"=",
"_C",
".",
"_SDsetcompress",
"(",
"self",
".",
"_id",
",",
"comp_type",
",",
"value",
",",
"v2",
")",
"_checkErr",
"(",
"'set... | Compresses the dataset using a specified compression method.
Args::
comp_type compression type, identified by one of the
SDC.COMP_xxx constants
value,v2 auxiliary value(s) needed by some compression types
SDC.COMP_SKPHUFF Skipping-Hu... | [
"Compresses",
"the",
"dataset",
"using",
"a",
"specified",
"compression",
"method",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/SD.py#L2679-L2718 |
4,530 | fhs/pyhdf | pyhdf/SD.py | SDS.setexternalfile | def setexternalfile(self, filename, offset=0):
"""Store the dataset data in an external file.
Args::
filename external file name
offset offset in bytes where to start writing in
the external file
Returns::
None
C library ... | python | def setexternalfile(self, filename, offset=0):
"""Store the dataset data in an external file.
Args::
filename external file name
offset offset in bytes where to start writing in
the external file
Returns::
None
C library ... | [
"def",
"setexternalfile",
"(",
"self",
",",
"filename",
",",
"offset",
"=",
"0",
")",
":",
"status",
"=",
"_C",
".",
"SDsetexternalfile",
"(",
"self",
".",
"_id",
",",
"filename",
",",
"offset",
")",
"_checkErr",
"(",
"'setexternalfile'",
",",
"status",
... | Store the dataset data in an external file.
Args::
filename external file name
offset offset in bytes where to start writing in
the external file
Returns::
None
C library equivalent : SDsetexternalfile | [
"Store",
"the",
"dataset",
"data",
"in",
"an",
"external",
"file",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/SD.py#L2721-L2738 |
4,531 | fhs/pyhdf | pyhdf/SD.py | SDS.dimensions | def dimensions(self, full=0):
"""Return a dictionnary describing every dataset dimension.
Args::
full true to get complete info about each dimension
false to report only each dimension length
Returns::
Dictionnary where each key is a dimension nam... | python | def dimensions(self, full=0):
"""Return a dictionnary describing every dataset dimension.
Args::
full true to get complete info about each dimension
false to report only each dimension length
Returns::
Dictionnary where each key is a dimension nam... | [
"def",
"dimensions",
"(",
"self",
",",
"full",
"=",
"0",
")",
":",
"# Get the number of dimensions and their lengths.",
"nDims",
",",
"dimLen",
"=",
"self",
".",
"info",
"(",
")",
"[",
"1",
":",
"3",
"]",
"if",
"isinstance",
"(",
"dimLen",
",",
"int",
")... | Return a dictionnary describing every dataset dimension.
Args::
full true to get complete info about each dimension
false to report only each dimension length
Returns::
Dictionnary where each key is a dimension name. If no name
has been given to... | [
"Return",
"a",
"dictionnary",
"describing",
"every",
"dataset",
"dimension",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/SD.py#L2800-L2849 |
4,532 | fhs/pyhdf | pyhdf/SD.py | SDim.info | def info(self):
"""Return info about the dimension instance.
Args::
no argument
Returns::
4-element tuple holding:
- dimension name; 'fakeDimx' is returned if the dimension
has not been named yet, where 'x' is the dimension
index number
... | python | def info(self):
"""Return info about the dimension instance.
Args::
no argument
Returns::
4-element tuple holding:
- dimension name; 'fakeDimx' is returned if the dimension
has not been named yet, where 'x' is the dimension
index number
... | [
"def",
"info",
"(",
"self",
")",
":",
"status",
",",
"dim_name",
",",
"dim_size",
",",
"data_type",
",",
"n_attrs",
"=",
"_C",
".",
"SDdiminfo",
"(",
"self",
".",
"_id",
")",
"_checkErr",
"(",
"'info'",
",",
"status",
",",
"'cannot execute'",
")",
"ret... | Return info about the dimension instance.
Args::
no argument
Returns::
4-element tuple holding:
- dimension name; 'fakeDimx' is returned if the dimension
has not been named yet, where 'x' is the dimension
index number
- dimension lengt... | [
"Return",
"info",
"about",
"the",
"dimension",
"instance",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/SD.py#L2892-L2918 |
4,533 | fhs/pyhdf | pyhdf/SD.py | SDim.setname | def setname(self, dim_name):
"""Set the dimension name.
Args::
dim_name dimension name; setting 2 dimensions to the same
name make the dimensions "shared"; in order to be
shared, the dimesions must be deined similarly.
Returns::
... | python | def setname(self, dim_name):
"""Set the dimension name.
Args::
dim_name dimension name; setting 2 dimensions to the same
name make the dimensions "shared"; in order to be
shared, the dimesions must be deined similarly.
Returns::
... | [
"def",
"setname",
"(",
"self",
",",
"dim_name",
")",
":",
"status",
"=",
"_C",
".",
"SDsetdimname",
"(",
"self",
".",
"_id",
",",
"dim_name",
")",
"_checkErr",
"(",
"'setname'",
",",
"status",
",",
"'cannot execute'",
")"
] | Set the dimension name.
Args::
dim_name dimension name; setting 2 dimensions to the same
name make the dimensions "shared"; in order to be
shared, the dimesions must be deined similarly.
Returns::
None
C library equivalent :... | [
"Set",
"the",
"dimension",
"name",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/SD.py#L2939-L2956 |
4,534 | fhs/pyhdf | pyhdf/SD.py | SDim.getscale | def getscale(self):
"""Obtain the scale values along a dimension.
Args::
no argument
Returns::
list with the scale values; the list length is equal to the
dimension length; the element type is equal to the dimension
data type, as set when the 'setdimsc... | python | def getscale(self):
"""Obtain the scale values along a dimension.
Args::
no argument
Returns::
list with the scale values; the list length is equal to the
dimension length; the element type is equal to the dimension
data type, as set when the 'setdimsc... | [
"def",
"getscale",
"(",
"self",
")",
":",
"# Get dimension info. If data_type is 0, no scale have been set",
"# on the dimension.",
"status",
",",
"dim_name",
",",
"dim_size",
",",
"data_type",
",",
"n_attrs",
"=",
"_C",
".",
"SDdiminfo",
"(",
"self",
".",
"_id",
")... | Obtain the scale values along a dimension.
Args::
no argument
Returns::
list with the scale values; the list length is equal to the
dimension length; the element type is equal to the dimension
data type, as set when the 'setdimscale()' method was called.
... | [
"Obtain",
"the",
"scale",
"values",
"along",
"a",
"dimension",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/SD.py#L2959-L3018 |
4,535 | fhs/pyhdf | pyhdf/SD.py | SDim.setscale | def setscale(self, data_type, scale):
"""Initialize the scale values along the dimension.
Args::
data_type data type code (one of the SDC.xxx constants)
scale sequence holding the scale values; the number of
values must match the current length of t... | python | def setscale(self, data_type, scale):
"""Initialize the scale values along the dimension.
Args::
data_type data type code (one of the SDC.xxx constants)
scale sequence holding the scale values; the number of
values must match the current length of t... | [
"def",
"setscale",
"(",
"self",
",",
"data_type",
",",
"scale",
")",
":",
"try",
":",
"n_values",
"=",
"len",
"(",
"scale",
")",
"except",
":",
"n_values",
"=",
"1",
"# Validate args",
"info",
"=",
"self",
".",
"_sds",
".",
"info",
"(",
")",
"if",
... | Initialize the scale values along the dimension.
Args::
data_type data type code (one of the SDC.xxx constants)
scale sequence holding the scale values; the number of
values must match the current length of the dataset
along that dime... | [
"Initialize",
"the",
"scale",
"values",
"along",
"the",
"dimension",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/SD.py#L3020-L3098 |
4,536 | fhs/pyhdf | pyhdf/SD.py | SDim.getstrs | def getstrs(self):
"""Retrieve the dimension standard string attributes.
Args::
no argument
Returns::
3-element tuple holding:
-dimension label (attribute 'long_name')
-dimension unit (attribute 'units')
-dimension format (attribute ... | python | def getstrs(self):
"""Retrieve the dimension standard string attributes.
Args::
no argument
Returns::
3-element tuple holding:
-dimension label (attribute 'long_name')
-dimension unit (attribute 'units')
-dimension format (attribute ... | [
"def",
"getstrs",
"(",
"self",
")",
":",
"status",
",",
"label",
",",
"unit",
",",
"format",
"=",
"_C",
".",
"SDgetdimstrs",
"(",
"self",
".",
"_id",
",",
"128",
")",
"_checkErr",
"(",
"'getstrs'",
",",
"status",
",",
"'cannot execute'",
")",
"return",... | Retrieve the dimension standard string attributes.
Args::
no argument
Returns::
3-element tuple holding:
-dimension label (attribute 'long_name')
-dimension unit (attribute 'units')
-dimension format (attribute 'format')
An exceptio... | [
"Retrieve",
"the",
"dimension",
"standard",
"string",
"attributes",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/SD.py#L3100-L3122 |
4,537 | fhs/pyhdf | pyhdf/SD.py | SDim.setstrs | def setstrs(self, label, unit, format):
"""Set the dimension standard string attributes.
Args::
label dimension label (attribute 'long_name')
unit dimension unit (attribute 'units')
format dimension format (attribute 'format')
Returns::
None
... | python | def setstrs(self, label, unit, format):
"""Set the dimension standard string attributes.
Args::
label dimension label (attribute 'long_name')
unit dimension unit (attribute 'units')
format dimension format (attribute 'format')
Returns::
None
... | [
"def",
"setstrs",
"(",
"self",
",",
"label",
",",
"unit",
",",
"format",
")",
":",
"status",
"=",
"_C",
".",
"SDsetdimstrs",
"(",
"self",
".",
"_id",
",",
"label",
",",
"unit",
",",
"format",
")",
"_checkErr",
"(",
"'setstrs'",
",",
"status",
",",
... | Set the dimension standard string attributes.
Args::
label dimension label (attribute 'long_name')
unit dimension unit (attribute 'units')
format dimension format (attribute 'format')
Returns::
None
C library equivalent: SDsetdimstrs | [
"Set",
"the",
"dimension",
"standard",
"string",
"attributes",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/SD.py#L3124-L3141 |
4,538 | fhs/pyhdf | pyhdf/VS.py | VS.attach | def attach(self, num_name, write=0):
"""Locate an existing vdata or create a new vdata in the HDF file,
returning a VD instance.
Args::
num_name Name or reference number of the vdata. An existing vdata
can be specified either through its reference number or
... | python | def attach(self, num_name, write=0):
"""Locate an existing vdata or create a new vdata in the HDF file,
returning a VD instance.
Args::
num_name Name or reference number of the vdata. An existing vdata
can be specified either through its reference number or
... | [
"def",
"attach",
"(",
"self",
",",
"num_name",
",",
"write",
"=",
"0",
")",
":",
"mode",
"=",
"write",
"and",
"'w'",
"or",
"'r'",
"if",
"isinstance",
"(",
"num_name",
",",
"str",
")",
":",
"num",
"=",
"self",
".",
"find",
"(",
"num_name",
")",
"e... | Locate an existing vdata or create a new vdata in the HDF file,
returning a VD instance.
Args::
num_name Name or reference number of the vdata. An existing vdata
can be specified either through its reference number or
its name. Use -1 to create a new ... | [
"Locate",
"an",
"existing",
"vdata",
"or",
"create",
"a",
"new",
"vdata",
"in",
"the",
"HDF",
"file",
"returning",
"a",
"VD",
"instance",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/VS.py#L872-L911 |
4,539 | 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",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/VS.py#L913-L959 |
4,540 | 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",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/VS.py#L984-L1008 |
4,541 | 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",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/VS.py#L1010-L1060 |
4,542 | 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",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/VS.py#L1062-L1159 |
4,543 | 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",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/VS.py#L1480-L1504 |
4,544 | fhs/pyhdf | pyhdf/VS.py | VD.seek | def seek(self, recIndex):
"""Seek to the beginning of the record identified by its
record index. A succeeding read will load this record in
memory.
Args::
recIndex index of the record in the vdata; numbering
starts at 0. Legal values range from 0
... | python | def seek(self, recIndex):
"""Seek to the beginning of the record identified by its
record index. A succeeding read will load this record in
memory.
Args::
recIndex index of the record in the vdata; numbering
starts at 0. Legal values range from 0
... | [
"def",
"seek",
"(",
"self",
",",
"recIndex",
")",
":",
"if",
"recIndex",
">",
"self",
".",
"_nrecs",
"-",
"1",
":",
"if",
"recIndex",
"==",
"self",
".",
"_nrecs",
":",
"return",
"self",
".",
"seekend",
"(",
")",
"else",
":",
"raise",
"HDF4Error",
"... | Seek to the beginning of the record identified by its
record index. A succeeding read will load this record in
memory.
Args::
recIndex index of the record in the vdata; numbering
starts at 0. Legal values range from 0
(start of vdata) to the c... | [
"Seek",
"to",
"the",
"beginning",
"of",
"the",
"record",
"identified",
"by",
"its",
"record",
"index",
".",
"A",
"succeeding",
"read",
"will",
"load",
"this",
"record",
"in",
"memory",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/VS.py#L1507-L1544 |
4,545 | fhs/pyhdf | pyhdf/VS.py | VD.inquire | def inquire(self):
"""Retrieve info about the vdata.
Args::
no argument
Returns::
5-element tuple with the following elements:
-number of records in the vdata
-interlace mode
-list of vdata field names
-size in bytes of the ... | python | def inquire(self):
"""Retrieve info about the vdata.
Args::
no argument
Returns::
5-element tuple with the following elements:
-number of records in the vdata
-interlace mode
-list of vdata field names
-size in bytes of the ... | [
"def",
"inquire",
"(",
"self",
")",
":",
"status",
",",
"nRecs",
",",
"interlace",
",",
"fldNames",
",",
"size",
",",
"vName",
"=",
"_C",
".",
"VSinquire",
"(",
"self",
".",
"_id",
")",
"_checkErr",
"(",
"'inquire'",
",",
"status",
",",
"\"cannot query... | Retrieve info about the vdata.
Args::
no argument
Returns::
5-element tuple with the following elements:
-number of records in the vdata
-interlace mode
-list of vdata field names
-size in bytes of the vdata record
-name... | [
"Retrieve",
"info",
"about",
"the",
"vdata",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/VS.py#L1861-L1883 |
4,546 | fhs/pyhdf | pyhdf/VS.py | VD.fieldinfo | def fieldinfo(self):
"""Retrieve info about all vdata fields.
Args::
no argument
Returns::
list where each element describes a field of the vdata;
each field is described by an 7-element tuple containing
the following elements:
- field name
... | python | def fieldinfo(self):
"""Retrieve info about all vdata fields.
Args::
no argument
Returns::
list where each element describes a field of the vdata;
each field is described by an 7-element tuple containing
the following elements:
- field name
... | [
"def",
"fieldinfo",
"(",
"self",
")",
":",
"lst",
"=",
"[",
"]",
"for",
"n",
"in",
"range",
"(",
"self",
".",
"_nfields",
")",
":",
"fld",
"=",
"self",
".",
"field",
"(",
"n",
")",
"lst",
".",
"append",
"(",
"(",
"fld",
".",
"_name",
",",
"fl... | Retrieve info about all vdata fields.
Args::
no argument
Returns::
list where each element describes a field of the vdata;
each field is described by an 7-element tuple containing
the following elements:
- field name
- field data type (one... | [
"Retrieve",
"info",
"about",
"all",
"vdata",
"fields",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/VS.py#L1886-L1921 |
4,547 | fhs/pyhdf | pyhdf/VS.py | VD.sizeof | def sizeof(self, fields):
"""Retrieve the size in bytes of the given fields.
Args::
fields sequence of field names to query
Returns::
total size of the fields in bytes
C library equivalent : VSsizeof
"""
... | python | def sizeof(self, fields):
"""Retrieve the size in bytes of the given fields.
Args::
fields sequence of field names to query
Returns::
total size of the fields in bytes
C library equivalent : VSsizeof
"""
... | [
"def",
"sizeof",
"(",
"self",
",",
"fields",
")",
":",
"if",
"type",
"(",
"fields",
")",
"in",
"[",
"tuple",
",",
"list",
"]",
":",
"str",
"=",
"','",
".",
"join",
"(",
"fields",
")",
"else",
":",
"str",
"=",
"fields",
"n",
"=",
"_C",
".",
"V... | Retrieve the size in bytes of the given fields.
Args::
fields sequence of field names to query
Returns::
total size of the fields in bytes
C library equivalent : VSsizeof | [
"Retrieve",
"the",
"size",
"in",
"bytes",
"of",
"the",
"given",
"fields",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/VS.py#L1923-L1943 |
4,548 | fhs/pyhdf | pyhdf/VS.py | VD.fexist | def fexist(self, fields):
"""Check if a vdata contains a given set of fields.
Args::
fields sequence of field names whose presence in the
vdata must be checked
Returns::
true (1) if the given fields are present
false (0) otherwise
... | python | def fexist(self, fields):
"""Check if a vdata contains a given set of fields.
Args::
fields sequence of field names whose presence in the
vdata must be checked
Returns::
true (1) if the given fields are present
false (0) otherwise
... | [
"def",
"fexist",
"(",
"self",
",",
"fields",
")",
":",
"if",
"type",
"(",
"fields",
")",
"in",
"[",
"tuple",
",",
"list",
"]",
":",
"str",
"=",
"','",
".",
"join",
"(",
"fields",
")",
"else",
":",
"str",
"=",
"fields",
"ret",
"=",
"_C",
".",
... | Check if a vdata contains a given set of fields.
Args::
fields sequence of field names whose presence in the
vdata must be checked
Returns::
true (1) if the given fields are present
false (0) otherwise
C library equivalent : VSfexist | [
"Check",
"if",
"a",
"vdata",
"contains",
"a",
"given",
"set",
"of",
"fields",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/VS.py#L1945-L1969 |
4,549 | fhs/pyhdf | pyhdf/VS.py | VDField.find | def find(self, name):
"""Search the field for a given attribute.
Args::
name attribute name
Returns::
if found, VDAttr instance describing the attribute
None otherwise
C library equivalent : VSfindattr
... | python | def find(self, name):
"""Search the field for a given attribute.
Args::
name attribute name
Returns::
if found, VDAttr instance describing the attribute
None otherwise
C library equivalent : VSfindattr
... | [
"def",
"find",
"(",
"self",
",",
"name",
")",
":",
"try",
":",
"att",
"=",
"self",
".",
"attr",
"(",
"name",
")",
"if",
"att",
".",
"_index",
"is",
"None",
":",
"att",
"=",
"None",
"except",
"HDF4Error",
":",
"att",
"=",
"None",
"return",
"att"
] | Search the field for a given attribute.
Args::
name attribute name
Returns::
if found, VDAttr instance describing the attribute
None otherwise
C library equivalent : VSfindattr | [
"Search",
"the",
"field",
"for",
"a",
"given",
"attribute",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/VS.py#L2236-L2257 |
4,550 | fhs/pyhdf | pyhdf/VS.py | VDAttr.set | def set(self, data_type, values):
"""Set the attribute value.
Args::
data_type : attribute data type (see constants HC.xxx)
values : attribute value(s); specify a list to create
a multi-valued attribute; a string valued
att... | python | def set(self, data_type, values):
"""Set the attribute value.
Args::
data_type : attribute data type (see constants HC.xxx)
values : attribute value(s); specify a list to create
a multi-valued attribute; a string valued
att... | [
"def",
"set",
"(",
"self",
",",
"data_type",
",",
"values",
")",
":",
"try",
":",
"n_values",
"=",
"len",
"(",
"values",
")",
"except",
":",
"values",
"=",
"[",
"values",
"]",
"n_values",
"=",
"1",
"if",
"data_type",
"==",
"HC",
".",
"CHAR8",
":",
... | Set the attribute value.
Args::
data_type : attribute data type (see constants HC.xxx)
values : attribute value(s); specify a list to create
a multi-valued attribute; a string valued
attribute can be created by setting 'data_type'
... | [
"Set",
"the",
"attribute",
"value",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/VS.py#L2406-L2493 |
4,551 | fhs/pyhdf | pyhdf/HDF.py | getlibversion | def getlibversion():
"""Get the library version info.
Args:
no argument
Returns:
4-element tuple with the following components:
-major version number (int)
-minor version number (int)
-complete library version number (int)
-additional information (string)
C ... | python | def getlibversion():
"""Get the library version info.
Args:
no argument
Returns:
4-element tuple with the following components:
-major version number (int)
-minor version number (int)
-complete library version number (int)
-additional information (string)
C ... | [
"def",
"getlibversion",
"(",
")",
":",
"status",
",",
"major_v",
",",
"minor_v",
",",
"release",
",",
"info",
"=",
"_C",
".",
"Hgetlibversion",
"(",
")",
"_checkErr",
"(",
"'getlibversion'",
",",
"status",
",",
"\"cannot get lib version\"",
")",
"return",
"m... | Get the library version info.
Args:
no argument
Returns:
4-element tuple with the following components:
-major version number (int)
-minor version number (int)
-complete library version number (int)
-additional information (string)
C library equivalent : Hgetlib... | [
"Get",
"the",
"library",
"version",
"info",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/HDF.py#L99-L116 |
4,552 | fhs/pyhdf | pyhdf/HDF.py | HDF.getfileversion | def getfileversion(self):
"""Get file version info.
Args:
no argument
Returns:
4-element tuple with the following components:
-major version number (int)
-minor version number (int)
-complete library version number (int)
-addit... | python | def getfileversion(self):
"""Get file version info.
Args:
no argument
Returns:
4-element tuple with the following components:
-major version number (int)
-minor version number (int)
-complete library version number (int)
-addit... | [
"def",
"getfileversion",
"(",
"self",
")",
":",
"status",
",",
"major_v",
",",
"minor_v",
",",
"release",
",",
"info",
"=",
"_C",
".",
"Hgetfileversion",
"(",
"self",
".",
"_id",
")",
"_checkErr",
"(",
"'getfileversion'",
",",
"status",
",",
"\"cannot get ... | Get file version info.
Args:
no argument
Returns:
4-element tuple with the following components:
-major version number (int)
-minor version number (int)
-complete library version number (int)
-additional information (string)
C... | [
"Get",
"file",
"version",
"info",
"."
] | dbdc1810a74a38df50dcad81fe903e239d2b388d | https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/HDF.py#L244-L261 |
4,553 | mattmakai/underwear | underwear/run_underwear.py | colorize | def colorize(lead, num, color):
""" Print 'lead' = 'num' in 'color' """
if num != 0 and ANSIBLE_COLOR and color is not None:
return "%s%s%-15s" % (stringc(lead, color), stringc("=", color), stringc(str(num), color))
else:
return "%s=%-4s" % (lead, str(num)) | python | def colorize(lead, num, color):
""" Print 'lead' = 'num' in 'color' """
if num != 0 and ANSIBLE_COLOR and color is not None:
return "%s%s%-15s" % (stringc(lead, color), stringc("=", color), stringc(str(num), color))
else:
return "%s=%-4s" % (lead, str(num)) | [
"def",
"colorize",
"(",
"lead",
",",
"num",
",",
"color",
")",
":",
"if",
"num",
"!=",
"0",
"and",
"ANSIBLE_COLOR",
"and",
"color",
"is",
"not",
"None",
":",
"return",
"\"%s%s%-15s\"",
"%",
"(",
"stringc",
"(",
"lead",
",",
"color",
")",
",",
"string... | Print 'lead' = 'num' in 'color' | [
"Print",
"lead",
"=",
"num",
"in",
"color"
] | 7c484c7937d2df86dc569d411249ba366ed43ead | https://github.com/mattmakai/underwear/blob/7c484c7937d2df86dc569d411249ba366ed43ead/underwear/run_underwear.py#L24-L29 |
4,554 | zapier/django-drip | drip/admin.py | DripAdmin.timeline | def timeline(self, request, drip_id, into_past, into_future):
"""
Return a list of people who should get emails.
"""
from django.shortcuts import render, get_object_or_404
drip = get_object_or_404(Drip, id=drip_id)
shifted_drips = []
seen_users = set()
f... | python | def timeline(self, request, drip_id, into_past, into_future):
"""
Return a list of people who should get emails.
"""
from django.shortcuts import render, get_object_or_404
drip = get_object_or_404(Drip, id=drip_id)
shifted_drips = []
seen_users = set()
f... | [
"def",
"timeline",
"(",
"self",
",",
"request",
",",
"drip_id",
",",
"into_past",
",",
"into_future",
")",
":",
"from",
"django",
".",
"shortcuts",
"import",
"render",
",",
"get_object_or_404",
"drip",
"=",
"get_object_or_404",
"(",
"Drip",
",",
"id",
"=",
... | Return a list of people who should get emails. | [
"Return",
"a",
"list",
"of",
"people",
"who",
"should",
"get",
"emails",
"."
] | ffbef6927a1a20f4c353ecb108c1b484502d2b29 | https://github.com/zapier/django-drip/blob/ffbef6927a1a20f4c353ecb108c1b484502d2b29/drip/admin.py#L33-L51 |
4,555 | zapier/django-drip | drip/drips.py | DripBase.walk | def walk(self, into_past=0, into_future=0):
"""
Walk over a date range and create new instances of self with new ranges.
"""
walked_range = []
for shift in range(-into_past, into_future):
kwargs = dict(drip_model=self.drip_model,
name=self.na... | python | def walk(self, into_past=0, into_future=0):
"""
Walk over a date range and create new instances of self with new ranges.
"""
walked_range = []
for shift in range(-into_past, into_future):
kwargs = dict(drip_model=self.drip_model,
name=self.na... | [
"def",
"walk",
"(",
"self",
",",
"into_past",
"=",
"0",
",",
"into_future",
"=",
"0",
")",
":",
"walked_range",
"=",
"[",
"]",
"for",
"shift",
"in",
"range",
"(",
"-",
"into_past",
",",
"into_future",
")",
":",
"kwargs",
"=",
"dict",
"(",
"drip_model... | Walk over a date range and create new instances of self with new ranges. | [
"Walk",
"over",
"a",
"date",
"range",
"and",
"create",
"new",
"instances",
"of",
"self",
"with",
"new",
"ranges",
"."
] | ffbef6927a1a20f4c353ecb108c1b484502d2b29 | https://github.com/zapier/django-drip/blob/ffbef6927a1a20f4c353ecb108c1b484502d2b29/drip/drips.py#L146-L156 |
4,556 | zapier/django-drip | drip/drips.py | DripBase.run | def run(self):
"""
Get the queryset, prune sent people, and send it.
"""
if not self.drip_model.enabled:
return None
self.prune()
count = self.send()
return count | python | def run(self):
"""
Get the queryset, prune sent people, and send it.
"""
if not self.drip_model.enabled:
return None
self.prune()
count = self.send()
return count | [
"def",
"run",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"drip_model",
".",
"enabled",
":",
"return",
"None",
"self",
".",
"prune",
"(",
")",
"count",
"=",
"self",
".",
"send",
"(",
")",
"return",
"count"
] | Get the queryset, prune sent people, and send it. | [
"Get",
"the",
"queryset",
"prune",
"sent",
"people",
"and",
"send",
"it",
"."
] | ffbef6927a1a20f4c353ecb108c1b484502d2b29 | https://github.com/zapier/django-drip/blob/ffbef6927a1a20f4c353ecb108c1b484502d2b29/drip/drips.py#L194-L204 |
4,557 | zapier/django-drip | drip/drips.py | DripBase.prune | def prune(self):
"""
Do an exclude for all Users who have a SentDrip already.
"""
target_user_ids = self.get_queryset().values_list('id', flat=True)
exclude_user_ids = SentDrip.objects.filter(date__lt=conditional_now(),
drip=self... | python | def prune(self):
"""
Do an exclude for all Users who have a SentDrip already.
"""
target_user_ids = self.get_queryset().values_list('id', flat=True)
exclude_user_ids = SentDrip.objects.filter(date__lt=conditional_now(),
drip=self... | [
"def",
"prune",
"(",
"self",
")",
":",
"target_user_ids",
"=",
"self",
".",
"get_queryset",
"(",
")",
".",
"values_list",
"(",
"'id'",
",",
"flat",
"=",
"True",
")",
"exclude_user_ids",
"=",
"SentDrip",
".",
"objects",
".",
"filter",
"(",
"date__lt",
"="... | Do an exclude for all Users who have a SentDrip already. | [
"Do",
"an",
"exclude",
"for",
"all",
"Users",
"who",
"have",
"a",
"SentDrip",
"already",
"."
] | ffbef6927a1a20f4c353ecb108c1b484502d2b29 | https://github.com/zapier/django-drip/blob/ffbef6927a1a20f4c353ecb108c1b484502d2b29/drip/drips.py#L206-L215 |
4,558 | zapier/django-drip | drip/drips.py | DripBase.send | def send(self):
"""
Send the message to each user on the queryset.
Create SentDrip for each user that gets a message.
Returns count of created SentDrips.
"""
if not self.from_email:
self.from_email = getattr(settings, 'DRIP_FROM_EMAIL', settings.DEFAULT_FRO... | python | def send(self):
"""
Send the message to each user on the queryset.
Create SentDrip for each user that gets a message.
Returns count of created SentDrips.
"""
if not self.from_email:
self.from_email = getattr(settings, 'DRIP_FROM_EMAIL', settings.DEFAULT_FRO... | [
"def",
"send",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"from_email",
":",
"self",
".",
"from_email",
"=",
"getattr",
"(",
"settings",
",",
"'DRIP_FROM_EMAIL'",
",",
"settings",
".",
"DEFAULT_FROM_EMAIL",
")",
"MessageClass",
"=",
"message_class_for",
... | Send the message to each user on the queryset.
Create SentDrip for each user that gets a message.
Returns count of created SentDrips. | [
"Send",
"the",
"message",
"to",
"each",
"user",
"on",
"the",
"queryset",
"."
] | ffbef6927a1a20f4c353ecb108c1b484502d2b29 | https://github.com/zapier/django-drip/blob/ffbef6927a1a20f4c353ecb108c1b484502d2b29/drip/drips.py#L217-L248 |
4,559 | ladybug-tools/ladybug | ladybug/euclid.py | Vector2.angle | def angle(self, other):
"""Return the angle to the vector other"""
return math.acos(self.dot(other) / (self.magnitude() * other.magnitude())) | python | def angle(self, other):
"""Return the angle to the vector other"""
return math.acos(self.dot(other) / (self.magnitude() * other.magnitude())) | [
"def",
"angle",
"(",
"self",
",",
"other",
")",
":",
"return",
"math",
".",
"acos",
"(",
"self",
".",
"dot",
"(",
"other",
")",
"/",
"(",
"self",
".",
"magnitude",
"(",
")",
"*",
"other",
".",
"magnitude",
"(",
")",
")",
")"
] | Return the angle to the vector other | [
"Return",
"the",
"angle",
"to",
"the",
"vector",
"other"
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/euclid.py#L298-L300 |
4,560 | ladybug-tools/ladybug | ladybug/euclid.py | Vector2.project | def project(self, other):
"""Return one vector projected on the vector other"""
n = other.normalized()
return self.dot(n) * n | python | def project(self, other):
"""Return one vector projected on the vector other"""
n = other.normalized()
return self.dot(n) * n | [
"def",
"project",
"(",
"self",
",",
"other",
")",
":",
"n",
"=",
"other",
".",
"normalized",
"(",
")",
"return",
"self",
".",
"dot",
"(",
"n",
")",
"*",
"n"
] | Return one vector projected on the vector other | [
"Return",
"one",
"vector",
"projected",
"on",
"the",
"vector",
"other"
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/euclid.py#L302-L305 |
4,561 | 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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/euclid.py#L588-L607 |
4,562 | ladybug-tools/ladybug | ladybug/futil.py | preparedir | def preparedir(target_dir, remove_content=True):
"""Prepare a folder for analysis.
This method creates the folder if it is not created, and removes the file in
the folder if the folder already existed.
"""
if os.path.isdir(target_dir):
if remove_content:
nukedir(target_dir, Fals... | python | def preparedir(target_dir, remove_content=True):
"""Prepare a folder for analysis.
This method creates the folder if it is not created, and removes the file in
the folder if the folder already existed.
"""
if os.path.isdir(target_dir):
if remove_content:
nukedir(target_dir, Fals... | [
"def",
"preparedir",
"(",
"target_dir",
",",
"remove_content",
"=",
"True",
")",
":",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"target_dir",
")",
":",
"if",
"remove_content",
":",
"nukedir",
"(",
"target_dir",
",",
"False",
")",
"return",
"True",
"els... | Prepare a folder for analysis.
This method creates the folder if it is not created, and removes the file in
the folder if the folder already existed. | [
"Prepare",
"a",
"folder",
"for",
"analysis",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/futil.py#L20-L36 |
4,563 | ladybug-tools/ladybug | ladybug/futil.py | nukedir | def nukedir(target_dir, rmdir=False):
"""Delete all the files inside target_dir.
Usage:
nukedir("c:/ladybug/libs", True)
"""
d = os.path.normpath(target_dir)
if not os.path.isdir(d):
return
files = os.listdir(d)
for f in files:
if f == '.' or f == '..':
... | python | def nukedir(target_dir, rmdir=False):
"""Delete all the files inside target_dir.
Usage:
nukedir("c:/ladybug/libs", True)
"""
d = os.path.normpath(target_dir)
if not os.path.isdir(d):
return
files = os.listdir(d)
for f in files:
if f == '.' or f == '..':
... | [
"def",
"nukedir",
"(",
"target_dir",
",",
"rmdir",
"=",
"False",
")",
":",
"d",
"=",
"os",
".",
"path",
".",
"normpath",
"(",
"target_dir",
")",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"d",
")",
":",
"return",
"files",
"=",
"os",
".",
... | Delete all the files inside target_dir.
Usage:
nukedir("c:/ladybug/libs", True) | [
"Delete",
"all",
"the",
"files",
"inside",
"target_dir",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/futil.py#L39-L69 |
4,564 | ladybug-tools/ladybug | ladybug/futil.py | write_to_file_by_name | def write_to_file_by_name(folder, fname, data, mkdir=False):
"""Write a string of data to file by filename and folder.
Args:
folder: Target folder (e.g. c:/ladybug).
fname: File name (e.g. testPts.pts).
data: Any data as string.
mkdir: Set to True to create the directory if does... | python | def write_to_file_by_name(folder, fname, data, mkdir=False):
"""Write a string of data to file by filename and folder.
Args:
folder: Target folder (e.g. c:/ladybug).
fname: File name (e.g. testPts.pts).
data: Any data as string.
mkdir: Set to True to create the directory if does... | [
"def",
"write_to_file_by_name",
"(",
"folder",
",",
"fname",
",",
"data",
",",
"mkdir",
"=",
"False",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"folder",
")",
":",
"if",
"mkdir",
":",
"preparedir",
"(",
"folder",
")",
"else",
":",
... | Write a string of data to file by filename and folder.
Args:
folder: Target folder (e.g. c:/ladybug).
fname: File name (e.g. testPts.pts).
data: Any data as string.
mkdir: Set to True to create the directory if doesn't exist (Default: False). | [
"Write",
"a",
"string",
"of",
"data",
"to",
"file",
"by",
"filename",
"and",
"folder",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/futil.py#L72-L96 |
4,565 | ladybug-tools/ladybug | ladybug/futil.py | copy_files_to_folder | def copy_files_to_folder(files, target_folder, overwrite=True):
"""Copy a list of files to a new target folder.
Returns:
A list of fullpath of the new files.
"""
if not files:
return []
for f in files:
target = os.path.join(target_folder, os.path.split(f)[-1])
if t... | python | def copy_files_to_folder(files, target_folder, overwrite=True):
"""Copy a list of files to a new target folder.
Returns:
A list of fullpath of the new files.
"""
if not files:
return []
for f in files:
target = os.path.join(target_folder, os.path.split(f)[-1])
if t... | [
"def",
"copy_files_to_folder",
"(",
"files",
",",
"target_folder",
",",
"overwrite",
"=",
"True",
")",
":",
"if",
"not",
"files",
":",
"return",
"[",
"]",
"for",
"f",
"in",
"files",
":",
"target",
"=",
"os",
".",
"path",
".",
"join",
"(",
"target_folde... | Copy a list of files to a new target folder.
Returns:
A list of fullpath of the new files. | [
"Copy",
"a",
"list",
"of",
"files",
"to",
"a",
"new",
"target",
"folder",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/futil.py#L111-L143 |
4,566 | ladybug-tools/ladybug | ladybug/futil.py | bat_to_sh | def bat_to_sh(file_path):
"""Convert honeybee .bat file to .sh file.
WARNING: This is a very simple function and doesn't handle any edge cases.
"""
sh_file = file_path[:-4] + '.sh'
with open(file_path, 'rb') as inf, open(sh_file, 'wb') as outf:
outf.write('#!/usr/bin/env bash\n\n')
... | python | def bat_to_sh(file_path):
"""Convert honeybee .bat file to .sh file.
WARNING: This is a very simple function and doesn't handle any edge cases.
"""
sh_file = file_path[:-4] + '.sh'
with open(file_path, 'rb') as inf, open(sh_file, 'wb') as outf:
outf.write('#!/usr/bin/env bash\n\n')
... | [
"def",
"bat_to_sh",
"(",
"file_path",
")",
":",
"sh_file",
"=",
"file_path",
"[",
":",
"-",
"4",
"]",
"+",
"'.sh'",
"with",
"open",
"(",
"file_path",
",",
"'rb'",
")",
"as",
"inf",
",",
"open",
"(",
"sh_file",
",",
"'wb'",
")",
"as",
"outf",
":",
... | Convert honeybee .bat file to .sh file.
WARNING: This is a very simple function and doesn't handle any edge cases. | [
"Convert",
"honeybee",
".",
"bat",
"file",
"to",
".",
"sh",
"file",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/futil.py#L146-L171 |
4,567 | ladybug-tools/ladybug | ladybug/futil.py | _download_py2 | def _download_py2(link, path, __hdr__):
"""Download a file from a link in Python 2."""
try:
req = urllib2.Request(link, headers=__hdr__)
u = urllib2.urlopen(req)
except Exception as e:
raise Exception(' Download failed with the error:\n{}'.format(e))
with open(path, 'wb') as out... | python | def _download_py2(link, path, __hdr__):
"""Download a file from a link in Python 2."""
try:
req = urllib2.Request(link, headers=__hdr__)
u = urllib2.urlopen(req)
except Exception as e:
raise Exception(' Download failed with the error:\n{}'.format(e))
with open(path, 'wb') as out... | [
"def",
"_download_py2",
"(",
"link",
",",
"path",
",",
"__hdr__",
")",
":",
"try",
":",
"req",
"=",
"urllib2",
".",
"Request",
"(",
"link",
",",
"headers",
"=",
"__hdr__",
")",
"u",
"=",
"urllib2",
".",
"urlopen",
"(",
"req",
")",
"except",
"Exceptio... | Download a file from a link in Python 2. | [
"Download",
"a",
"file",
"from",
"a",
"link",
"in",
"Python",
"2",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/futil.py#L174-L185 |
4,568 | ladybug-tools/ladybug | ladybug/futil.py | _download_py3 | def _download_py3(link, path, __hdr__):
"""Download a file from a link in Python 3."""
try:
req = urllib.request.Request(link, headers=__hdr__)
u = urllib.request.urlopen(req)
except Exception as e:
raise Exception(' Download failed with the error:\n{}'.format(e))
with open(path... | python | def _download_py3(link, path, __hdr__):
"""Download a file from a link in Python 3."""
try:
req = urllib.request.Request(link, headers=__hdr__)
u = urllib.request.urlopen(req)
except Exception as e:
raise Exception(' Download failed with the error:\n{}'.format(e))
with open(path... | [
"def",
"_download_py3",
"(",
"link",
",",
"path",
",",
"__hdr__",
")",
":",
"try",
":",
"req",
"=",
"urllib",
".",
"request",
".",
"Request",
"(",
"link",
",",
"headers",
"=",
"__hdr__",
")",
"u",
"=",
"urllib",
".",
"request",
".",
"urlopen",
"(",
... | Download a file from a link in Python 3. | [
"Download",
"a",
"file",
"from",
"a",
"link",
"in",
"Python",
"3",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/futil.py#L188-L199 |
4,569 | 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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/futil.py#L202-L234 |
4,570 | 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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/futil.py#L249-L279 |
4,571 | ladybug-tools/ladybug | ladybug/futil.py | csv_to_matrix | def csv_to_matrix(csv_file_path):
"""Load a CSV file into a Python matrix of strings.
Args:
csv_file_path: Full path to a valid CSV file (e.g. c:/ladybug/test.csv)
"""
mtx = []
with open(csv_file_path) as csv_data_file:
for row in csv_data_file:
mtx.append(row.split(',')... | python | def csv_to_matrix(csv_file_path):
"""Load a CSV file into a Python matrix of strings.
Args:
csv_file_path: Full path to a valid CSV file (e.g. c:/ladybug/test.csv)
"""
mtx = []
with open(csv_file_path) as csv_data_file:
for row in csv_data_file:
mtx.append(row.split(',')... | [
"def",
"csv_to_matrix",
"(",
"csv_file_path",
")",
":",
"mtx",
"=",
"[",
"]",
"with",
"open",
"(",
"csv_file_path",
")",
"as",
"csv_data_file",
":",
"for",
"row",
"in",
"csv_data_file",
":",
"mtx",
".",
"append",
"(",
"row",
".",
"split",
"(",
"','",
"... | Load a CSV file into a Python matrix of strings.
Args:
csv_file_path: Full path to a valid CSV file (e.g. c:/ladybug/test.csv) | [
"Load",
"a",
"CSV",
"file",
"into",
"a",
"Python",
"matrix",
"of",
"strings",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/futil.py#L282-L292 |
4,572 | ladybug-tools/ladybug | ladybug/futil.py | csv_to_num_matrix | def csv_to_num_matrix(csv_file_path):
"""Load a CSV file consisting only of numbers into a Python matrix of floats.
Args:
csv_file_path: Full path to a valid CSV file (e.g. c:/ladybug/test.csv)
"""
mtx = []
with open(csv_file_path) as csv_data_file:
for row in csv_data_file:
... | python | def csv_to_num_matrix(csv_file_path):
"""Load a CSV file consisting only of numbers into a Python matrix of floats.
Args:
csv_file_path: Full path to a valid CSV file (e.g. c:/ladybug/test.csv)
"""
mtx = []
with open(csv_file_path) as csv_data_file:
for row in csv_data_file:
... | [
"def",
"csv_to_num_matrix",
"(",
"csv_file_path",
")",
":",
"mtx",
"=",
"[",
"]",
"with",
"open",
"(",
"csv_file_path",
")",
"as",
"csv_data_file",
":",
"for",
"row",
"in",
"csv_data_file",
":",
"mtx",
".",
"append",
"(",
"[",
"float",
"(",
"val",
")",
... | Load a CSV file consisting only of numbers into a Python matrix of floats.
Args:
csv_file_path: Full path to a valid CSV file (e.g. c:/ladybug/test.csv) | [
"Load",
"a",
"CSV",
"file",
"consisting",
"only",
"of",
"numbers",
"into",
"a",
"Python",
"matrix",
"of",
"floats",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/futil.py#L295-L305 |
4,573 | 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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/stat.py#L87-L175 |
4,574 | ladybug-tools/ladybug | ladybug/stat.py | STAT.monthly_cooling_design_days_050 | def monthly_cooling_design_days_050(self):
"""A list of 12 objects representing monthly 5.0% cooling design days."""
if self.monthly_found is False or self._monthly_db_50 == [] \
or self._monthly_wb_50 == []:
return []
else:
db_conds = [DryBulbCond... | python | def monthly_cooling_design_days_050(self):
"""A list of 12 objects representing monthly 5.0% cooling design days."""
if self.monthly_found is False or self._monthly_db_50 == [] \
or self._monthly_wb_50 == []:
return []
else:
db_conds = [DryBulbCond... | [
"def",
"monthly_cooling_design_days_050",
"(",
"self",
")",
":",
"if",
"self",
".",
"monthly_found",
"is",
"False",
"or",
"self",
".",
"_monthly_db_50",
"==",
"[",
"]",
"or",
"self",
".",
"_monthly_wb_50",
"==",
"[",
"]",
":",
"return",
"[",
"]",
"else",
... | A list of 12 objects representing monthly 5.0% cooling design days. | [
"A",
"list",
"of",
"12",
"objects",
"representing",
"monthly",
"5",
".",
"0%",
"cooling",
"design",
"days",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/stat.py#L497-L513 |
4,575 | ladybug-tools/ladybug | ladybug/stat.py | STAT.monthly_cooling_design_days_100 | def monthly_cooling_design_days_100(self):
"""A list of 12 objects representing monthly 10.0% cooling design days."""
if self.monthly_found is False or self._monthly_db_100 == [] \
or self._monthly_wb_100 == []:
return []
else:
db_conds = [DryBulbC... | python | def monthly_cooling_design_days_100(self):
"""A list of 12 objects representing monthly 10.0% cooling design days."""
if self.monthly_found is False or self._monthly_db_100 == [] \
or self._monthly_wb_100 == []:
return []
else:
db_conds = [DryBulbC... | [
"def",
"monthly_cooling_design_days_100",
"(",
"self",
")",
":",
"if",
"self",
".",
"monthly_found",
"is",
"False",
"or",
"self",
".",
"_monthly_db_100",
"==",
"[",
"]",
"or",
"self",
".",
"_monthly_wb_100",
"==",
"[",
"]",
":",
"return",
"[",
"]",
"else",... | A list of 12 objects representing monthly 10.0% cooling design days. | [
"A",
"list",
"of",
"12",
"objects",
"representing",
"monthly",
"10",
".",
"0%",
"cooling",
"design",
"days",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/stat.py#L516-L532 |
4,576 | ladybug-tools/ladybug | ladybug/stat.py | STAT.monthly_cooling_design_days_020 | def monthly_cooling_design_days_020(self):
"""A list of 12 objects representing monthly 2.0% cooling design days."""
if self.monthly_found is False or self._monthly_db_20 == [] \
or self._monthly_wb_20 == []:
return []
else:
db_conds = [DryBulbCond... | python | def monthly_cooling_design_days_020(self):
"""A list of 12 objects representing monthly 2.0% cooling design days."""
if self.monthly_found is False or self._monthly_db_20 == [] \
or self._monthly_wb_20 == []:
return []
else:
db_conds = [DryBulbCond... | [
"def",
"monthly_cooling_design_days_020",
"(",
"self",
")",
":",
"if",
"self",
".",
"monthly_found",
"is",
"False",
"or",
"self",
".",
"_monthly_db_20",
"==",
"[",
"]",
"or",
"self",
".",
"_monthly_wb_20",
"==",
"[",
"]",
":",
"return",
"[",
"]",
"else",
... | A list of 12 objects representing monthly 2.0% cooling design days. | [
"A",
"list",
"of",
"12",
"objects",
"representing",
"monthly",
"2",
".",
"0%",
"cooling",
"design",
"days",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/stat.py#L535-L551 |
4,577 | ladybug-tools/ladybug | ladybug/stat.py | STAT.monthly_cooling_design_days_004 | def monthly_cooling_design_days_004(self):
"""A list of 12 objects representing monthly 0.4% cooling design days."""
if self.monthly_found is False or self._monthly_db_04 == [] \
or self._monthly_wb_04 == []:
return []
else:
db_conds = [DryBulbCond... | python | def monthly_cooling_design_days_004(self):
"""A list of 12 objects representing monthly 0.4% cooling design days."""
if self.monthly_found is False or self._monthly_db_04 == [] \
or self._monthly_wb_04 == []:
return []
else:
db_conds = [DryBulbCond... | [
"def",
"monthly_cooling_design_days_004",
"(",
"self",
")",
":",
"if",
"self",
".",
"monthly_found",
"is",
"False",
"or",
"self",
".",
"_monthly_db_04",
"==",
"[",
"]",
"or",
"self",
".",
"_monthly_wb_04",
"==",
"[",
"]",
":",
"return",
"[",
"]",
"else",
... | A list of 12 objects representing monthly 0.4% cooling design days. | [
"A",
"list",
"of",
"12",
"objects",
"representing",
"monthly",
"0",
".",
"4%",
"cooling",
"design",
"days",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/stat.py#L554-L570 |
4,578 | ladybug-tools/ladybug | ladybug/stat.py | STAT.monthly_wind_conditions | def monthly_wind_conditions(self):
"""A list of 12 monthly wind conditions that are used on the design days."""
return [WindCondition(x, y) for x, y in zip(
self._monthly_wind, self.monthly_wind_dirs)] | python | def monthly_wind_conditions(self):
"""A list of 12 monthly wind conditions that are used on the design days."""
return [WindCondition(x, y) for x, y in zip(
self._monthly_wind, self.monthly_wind_dirs)] | [
"def",
"monthly_wind_conditions",
"(",
"self",
")",
":",
"return",
"[",
"WindCondition",
"(",
"x",
",",
"y",
")",
"for",
"x",
",",
"y",
"in",
"zip",
"(",
"self",
".",
"_monthly_wind",
",",
"self",
".",
"monthly_wind_dirs",
")",
"]"
] | A list of 12 monthly wind conditions that are used on the design days. | [
"A",
"list",
"of",
"12",
"monthly",
"wind",
"conditions",
"that",
"are",
"used",
"on",
"the",
"design",
"days",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/stat.py#L598-L601 |
4,579 | ladybug-tools/ladybug | ladybug/stat.py | STAT.monthly_wind_dirs | def monthly_wind_dirs(self):
"""A list of prevailing wind directions for each month."""
mwd = zip(*self._monthly_wind_dirs)
return [self._wind_dirs[mon.index(max(mon))] for mon in mwd] | python | def monthly_wind_dirs(self):
"""A list of prevailing wind directions for each month."""
mwd = zip(*self._monthly_wind_dirs)
return [self._wind_dirs[mon.index(max(mon))] for mon in mwd] | [
"def",
"monthly_wind_dirs",
"(",
"self",
")",
":",
"mwd",
"=",
"zip",
"(",
"*",
"self",
".",
"_monthly_wind_dirs",
")",
"return",
"[",
"self",
".",
"_wind_dirs",
"[",
"mon",
".",
"index",
"(",
"max",
"(",
"mon",
")",
")",
"]",
"for",
"mon",
"in",
"... | A list of prevailing wind directions for each month. | [
"A",
"list",
"of",
"prevailing",
"wind",
"directions",
"for",
"each",
"month",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/stat.py#L609-L612 |
4,580 | ladybug-tools/ladybug | ladybug/stat.py | STAT.monthly_clear_sky_conditions | def monthly_clear_sky_conditions(self):
"""A list of 12 monthly clear sky conditions that are used on the design days."""
if self._monthly_tau_diffuse is [] or self._monthly_tau_beam is []:
return [OriginalClearSkyCondition(i, 21) for i in xrange(1, 13)]
return [RevisedClearSkyCondit... | python | def monthly_clear_sky_conditions(self):
"""A list of 12 monthly clear sky conditions that are used on the design days."""
if self._monthly_tau_diffuse is [] or self._monthly_tau_beam is []:
return [OriginalClearSkyCondition(i, 21) for i in xrange(1, 13)]
return [RevisedClearSkyCondit... | [
"def",
"monthly_clear_sky_conditions",
"(",
"self",
")",
":",
"if",
"self",
".",
"_monthly_tau_diffuse",
"is",
"[",
"]",
"or",
"self",
".",
"_monthly_tau_beam",
"is",
"[",
"]",
":",
"return",
"[",
"OriginalClearSkyCondition",
"(",
"i",
",",
"21",
")",
"for",... | A list of 12 monthly clear sky conditions that are used on the design days. | [
"A",
"list",
"of",
"12",
"monthly",
"clear",
"sky",
"conditions",
"that",
"are",
"used",
"on",
"the",
"design",
"days",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/stat.py#L615-L620 |
4,581 | ladybug-tools/ladybug | ladybug/stat.py | STAT.to_json | def to_json(self):
"""Convert the STAT object to a dictionary."""
def jsonify_dict(base_dict):
new_dict = {}
for key, val in base_dict.items():
if isinstance(val, list):
new_dict[key] = [v.to_json() for v in val]
else:
... | python | def to_json(self):
"""Convert the STAT object to a dictionary."""
def jsonify_dict(base_dict):
new_dict = {}
for key, val in base_dict.items():
if isinstance(val, list):
new_dict[key] = [v.to_json() for v in val]
else:
... | [
"def",
"to_json",
"(",
"self",
")",
":",
"def",
"jsonify_dict",
"(",
"base_dict",
")",
":",
"new_dict",
"=",
"{",
"}",
"for",
"key",
",",
"val",
"in",
"base_dict",
".",
"items",
"(",
")",
":",
"if",
"isinstance",
"(",
"val",
",",
"list",
")",
":",
... | Convert the STAT object to a dictionary. | [
"Convert",
"the",
"STAT",
"object",
"to",
"a",
"dictionary",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/stat.py#L642-L678 |
4,582 | ladybug-tools/ladybug | ladybug/datatype/base.py | DataTypeBase.from_json | def from_json(cls, data):
"""Create a data type from a dictionary.
Args:
data: Data as a dictionary.
{
"name": data type name of the data type as a string
"data_type": the class name of the data type as a string
"ba... | python | def from_json(cls, data):
"""Create a data type from a dictionary.
Args:
data: Data as a dictionary.
{
"name": data type name of the data type as a string
"data_type": the class name of the data type as a string
"ba... | [
"def",
"from_json",
"(",
"cls",
",",
"data",
")",
":",
"assert",
"'name'",
"in",
"data",
",",
"'Required keyword \"name\" is missing!'",
"assert",
"'data_type'",
"in",
"data",
",",
"'Required keyword \"data_type\" is missing!'",
"if",
"cls",
".",
"_type_enumeration",
... | Create a data type from a dictionary.
Args:
data: Data as a dictionary.
{
"name": data type name of the data type as a string
"data_type": the class name of the data type as a string
"base_unit": the base unit of the data t... | [
"Create",
"a",
"data",
"type",
"from",
"a",
"dictionary",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datatype/base.py#L70-L100 |
4,583 | ladybug-tools/ladybug | ladybug/datatype/base.py | DataTypeBase.is_unit_acceptable | def is_unit_acceptable(self, unit, raise_exception=True):
"""Check if a certain unit is acceptable for the data type.
Args:
unit: A text string representing the abbreviated unit.
raise_exception: Set to True to raise an exception if not acceptable.
"""
_is_accept... | python | def is_unit_acceptable(self, unit, raise_exception=True):
"""Check if a certain unit is acceptable for the data type.
Args:
unit: A text string representing the abbreviated unit.
raise_exception: Set to True to raise an exception if not acceptable.
"""
_is_accept... | [
"def",
"is_unit_acceptable",
"(",
"self",
",",
"unit",
",",
"raise_exception",
"=",
"True",
")",
":",
"_is_acceptable",
"=",
"unit",
"in",
"self",
".",
"units",
"if",
"_is_acceptable",
"or",
"raise_exception",
"is",
"False",
":",
"return",
"_is_acceptable",
"e... | Check if a certain unit is acceptable for the data type.
Args:
unit: A text string representing the abbreviated unit.
raise_exception: Set to True to raise an exception if not acceptable. | [
"Check",
"if",
"a",
"certain",
"unit",
"is",
"acceptable",
"for",
"the",
"data",
"type",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datatype/base.py#L102-L119 |
4,584 | ladybug-tools/ladybug | ladybug/datatype/base.py | DataTypeBase._is_numeric | def _is_numeric(self, values):
"""Check to be sure values are numbers before doing numerical operations."""
if len(values) > 0:
assert isinstance(values[0], (float, int)), \
"values must be numbers to perform math operations. Got {}".format(
type(values[0]... | python | def _is_numeric(self, values):
"""Check to be sure values are numbers before doing numerical operations."""
if len(values) > 0:
assert isinstance(values[0], (float, int)), \
"values must be numbers to perform math operations. Got {}".format(
type(values[0]... | [
"def",
"_is_numeric",
"(",
"self",
",",
"values",
")",
":",
"if",
"len",
"(",
"values",
")",
">",
"0",
":",
"assert",
"isinstance",
"(",
"values",
"[",
"0",
"]",
",",
"(",
"float",
",",
"int",
")",
")",
",",
"\"values must be numbers to perform math oper... | Check to be sure values are numbers before doing numerical operations. | [
"Check",
"to",
"be",
"sure",
"values",
"are",
"numbers",
"before",
"doing",
"numerical",
"operations",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datatype/base.py#L188-L194 |
4,585 | ladybug-tools/ladybug | ladybug/datatype/base.py | DataTypeBase._to_unit_base | def _to_unit_base(self, base_unit, values, unit, from_unit):
"""Return values in a given unit given the input from_unit."""
self._is_numeric(values)
namespace = {'self': self, 'values': values}
if not from_unit == base_unit:
self.is_unit_acceptable(from_unit, True)
... | python | def _to_unit_base(self, base_unit, values, unit, from_unit):
"""Return values in a given unit given the input from_unit."""
self._is_numeric(values)
namespace = {'self': self, 'values': values}
if not from_unit == base_unit:
self.is_unit_acceptable(from_unit, True)
... | [
"def",
"_to_unit_base",
"(",
"self",
",",
"base_unit",
",",
"values",
",",
"unit",
",",
"from_unit",
")",
":",
"self",
".",
"_is_numeric",
"(",
"values",
")",
"namespace",
"=",
"{",
"'self'",
":",
"self",
",",
"'values'",
":",
"values",
"}",
"if",
"not... | Return values in a given unit given the input from_unit. | [
"Return",
"values",
"in",
"a",
"given",
"unit",
"given",
"the",
"input",
"from_unit",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datatype/base.py#L196-L211 |
4,586 | ladybug-tools/ladybug | ladybug/datatype/base.py | DataTypeBase.name | def name(self):
"""The data type name."""
if self._name is None:
return re.sub(r"(?<=\w)([A-Z])", r" \1", self.__class__.__name__)
else:
return self._name | python | def name(self):
"""The data type name."""
if self._name is None:
return re.sub(r"(?<=\w)([A-Z])", r" \1", self.__class__.__name__)
else:
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"if",
"self",
".",
"_name",
"is",
"None",
":",
"return",
"re",
".",
"sub",
"(",
"r\"(?<=\\w)([A-Z])\"",
",",
"r\" \\1\"",
",",
"self",
".",
"__class__",
".",
"__name__",
")",
"else",
":",
"return",
"self",
".",
"... | The data type name. | [
"The",
"data",
"type",
"name",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datatype/base.py#L222-L227 |
4,587 | 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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/header.py#L58-L78 |
4,588 | ladybug-tools/ladybug | ladybug/header.py | Header.duplicate | def duplicate(self):
"""Return a copy of the header."""
a_per = self.analysis_period.duplicate() if self.analysis_period else None
return self.__class__(self.data_type, self.unit,
a_per, deepcopy(self.metadata)) | python | def duplicate(self):
"""Return a copy of the header."""
a_per = self.analysis_period.duplicate() if self.analysis_period else None
return self.__class__(self.data_type, self.unit,
a_per, deepcopy(self.metadata)) | [
"def",
"duplicate",
"(",
"self",
")",
":",
"a_per",
"=",
"self",
".",
"analysis_period",
".",
"duplicate",
"(",
")",
"if",
"self",
".",
"analysis_period",
"else",
"None",
"return",
"self",
".",
"__class__",
"(",
"self",
".",
"data_type",
",",
"self",
"."... | Return a copy of the header. | [
"Return",
"a",
"copy",
"of",
"the",
"header",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/header.py#L105-L109 |
4,589 | ladybug-tools/ladybug | ladybug/header.py | Header.to_tuple | def to_tuple(self):
"""Return Ladybug header as a list."""
return (
self.data_type,
self.unit,
self.analysis_period,
self.metadata
) | python | def to_tuple(self):
"""Return Ladybug header as a list."""
return (
self.data_type,
self.unit,
self.analysis_period,
self.metadata
) | [
"def",
"to_tuple",
"(",
"self",
")",
":",
"return",
"(",
"self",
".",
"data_type",
",",
"self",
".",
"unit",
",",
"self",
".",
"analysis_period",
",",
"self",
".",
"metadata",
")"
] | Return Ladybug header as a list. | [
"Return",
"Ladybug",
"header",
"as",
"a",
"list",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/header.py#L111-L118 |
4,590 | ladybug-tools/ladybug | ladybug/header.py | Header.to_json | def to_json(self):
"""Return a header as a dictionary."""
a_per = self.analysis_period.to_json() if self.analysis_period else None
return {'data_type': self.data_type.to_json(),
'unit': self.unit,
'analysis_period': a_per,
'metadata': self.metadata... | python | def to_json(self):
"""Return a header as a dictionary."""
a_per = self.analysis_period.to_json() if self.analysis_period else None
return {'data_type': self.data_type.to_json(),
'unit': self.unit,
'analysis_period': a_per,
'metadata': self.metadata... | [
"def",
"to_json",
"(",
"self",
")",
":",
"a_per",
"=",
"self",
".",
"analysis_period",
".",
"to_json",
"(",
")",
"if",
"self",
".",
"analysis_period",
"else",
"None",
"return",
"{",
"'data_type'",
":",
"self",
".",
"data_type",
".",
"to_json",
"(",
")",
... | Return a header as a dictionary. | [
"Return",
"a",
"header",
"as",
"a",
"dictionary",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/header.py#L124-L130 |
4,591 | 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"
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/skymodel.py#L11-L57 |
4,592 | 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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/skymodel.py#L112-L161 |
4,593 | 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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/skymodel.py#L164-L224 |
4,594 | 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",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/skymodel.py#L230-L267 |
4,595 | ladybug-tools/ladybug | ladybug/legendparameters.py | LegendParameters.set_domain | def set_domain(self, values):
"""Set domain of the colors based on min and max of a list of values."""
_flattenedList = sorted(flatten(values))
self.domain = tuple(_flattenedList[0] if d == 'min' else d for d in self.domain)
self.domain = tuple(_flattenedList[-1] if d == 'max' else d for... | python | def set_domain(self, values):
"""Set domain of the colors based on min and max of a list of values."""
_flattenedList = sorted(flatten(values))
self.domain = tuple(_flattenedList[0] if d == 'min' else d for d in self.domain)
self.domain = tuple(_flattenedList[-1] if d == 'max' else d for... | [
"def",
"set_domain",
"(",
"self",
",",
"values",
")",
":",
"_flattenedList",
"=",
"sorted",
"(",
"flatten",
"(",
"values",
")",
")",
"self",
".",
"domain",
"=",
"tuple",
"(",
"_flattenedList",
"[",
"0",
"]",
"if",
"d",
"==",
"'min'",
"else",
"d",
"fo... | Set domain of the colors based on min and max of a list of values. | [
"Set",
"domain",
"of",
"the",
"colors",
"based",
"on",
"min",
"and",
"max",
"of",
"a",
"list",
"of",
"values",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/legendparameters.py#L80-L84 |
4,596 | ladybug-tools/ladybug | ladybug/datacollection.py | HourlyDiscontinuousCollection.timestep_text | def timestep_text(self):
"""Return a text string representing the timestep of the collection."""
if self.header.analysis_period.timestep == 1:
return 'Hourly'
else:
return '{} Minute'.format(int(60 / self.header.analysis_period.timestep)) | python | def timestep_text(self):
"""Return a text string representing the timestep of the collection."""
if self.header.analysis_period.timestep == 1:
return 'Hourly'
else:
return '{} Minute'.format(int(60 / self.header.analysis_period.timestep)) | [
"def",
"timestep_text",
"(",
"self",
")",
":",
"if",
"self",
".",
"header",
".",
"analysis_period",
".",
"timestep",
"==",
"1",
":",
"return",
"'Hourly'",
"else",
":",
"return",
"'{} Minute'",
".",
"format",
"(",
"int",
"(",
"60",
"/",
"self",
".",
"he... | Return a text string representing the timestep of the collection. | [
"Return",
"a",
"text",
"string",
"representing",
"the",
"timestep",
"of",
"the",
"collection",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L96-L101 |
4,597 | ladybug-tools/ladybug | ladybug/datacollection.py | HourlyDiscontinuousCollection.moys_dict | def moys_dict(self):
"""Return a dictionary of this collection's values where the keys are the moys.
This is useful for aligning the values with another list of datetimes.
"""
moy_dict = {}
for val, dt in zip(self.values, self.datetimes):
moy_dict[dt.moy] = val
... | python | def moys_dict(self):
"""Return a dictionary of this collection's values where the keys are the moys.
This is useful for aligning the values with another list of datetimes.
"""
moy_dict = {}
for val, dt in zip(self.values, self.datetimes):
moy_dict[dt.moy] = val
... | [
"def",
"moys_dict",
"(",
"self",
")",
":",
"moy_dict",
"=",
"{",
"}",
"for",
"val",
",",
"dt",
"in",
"zip",
"(",
"self",
".",
"values",
",",
"self",
".",
"datetimes",
")",
":",
"moy_dict",
"[",
"dt",
".",
"moy",
"]",
"=",
"val",
"return",
"moy_di... | Return a dictionary of this collection's values where the keys are the moys.
This is useful for aligning the values with another list of datetimes. | [
"Return",
"a",
"dictionary",
"of",
"this",
"collection",
"s",
"values",
"where",
"the",
"keys",
"are",
"the",
"moys",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L104-L112 |
4,598 | ladybug-tools/ladybug | ladybug/datacollection.py | HourlyDiscontinuousCollection.filter_by_analysis_period | def filter_by_analysis_period(self, analysis_period):
"""
Filter a Data Collection based on an analysis period.
Args:
analysis period: A Ladybug analysis period
Return:
A new Data Collection with filtered data
"""
self._check_analysis_period(analy... | python | def filter_by_analysis_period(self, analysis_period):
"""
Filter a Data Collection based on an analysis period.
Args:
analysis period: A Ladybug analysis period
Return:
A new Data Collection with filtered data
"""
self._check_analysis_period(analy... | [
"def",
"filter_by_analysis_period",
"(",
"self",
",",
"analysis_period",
")",
":",
"self",
".",
"_check_analysis_period",
"(",
"analysis_period",
")",
"_filtered_data",
"=",
"self",
".",
"filter_by_moys",
"(",
"analysis_period",
".",
"moys",
")",
"_filtered_data",
"... | Filter a Data Collection based on an analysis period.
Args:
analysis period: A Ladybug analysis period
Return:
A new Data Collection with filtered data | [
"Filter",
"a",
"Data",
"Collection",
"based",
"on",
"an",
"analysis",
"period",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L114-L127 |
4,599 | ladybug-tools/ladybug | ladybug/datacollection.py | HourlyDiscontinuousCollection.group_by_month_per_hour | def group_by_month_per_hour(self):
"""Return a dictionary of this collection's values grouped by each month per hour.
Key values are tuples of 2 integers:
The first represents the month of the year between 1-12.
The first represents the hour of the day between 0-24.
(eg. (12, 23... | python | def group_by_month_per_hour(self):
"""Return a dictionary of this collection's values grouped by each month per hour.
Key values are tuples of 2 integers:
The first represents the month of the year between 1-12.
The first represents the hour of the day between 0-24.
(eg. (12, 23... | [
"def",
"group_by_month_per_hour",
"(",
"self",
")",
":",
"data_by_month_per_hour",
"=",
"OrderedDict",
"(",
")",
"for",
"m",
"in",
"xrange",
"(",
"1",
",",
"13",
")",
":",
"for",
"h",
"in",
"xrange",
"(",
"0",
",",
"24",
")",
":",
"data_by_month_per_hour... | Return a dictionary of this collection's values grouped by each month per hour.
Key values are tuples of 2 integers:
The first represents the month of the year between 1-12.
The first represents the hour of the day between 0-24.
(eg. (12, 23) for December at 11 PM) | [
"Return",
"a",
"dictionary",
"of",
"this",
"collection",
"s",
"values",
"grouped",
"by",
"each",
"month",
"per",
"hour",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L214-L228 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.