def type(self, name, new_type=None):
"""Find or change the CDF type of a zEntry in this zVar
@param name: name of the zAttr to check or change
@type name: str
@param new_type: type to change it to, see :py:mod:`pycdf.const`
@type new_type: ctypes.c_long
@return: CDF variable type, see :py:mod:`pycdf.const`
@rtype: int
@note: If changing types, old and new must be equivalent, see CDF
User's Guide section 2.5.5 pg. 57
"""
attrib = super(zAttrList, self).__getitem__(name)
zvar_num = self._zvar._num()
if not attrib.has_entry(zvar_num):
raise KeyError(name + ': no such attribute for variable ' +
self._zvar.name())
return attrib.type(zvar_num, new_type)
评论列表
文章目录