Class UserType
object --+
|
UserType
A UserType
instance is used to describe some of the new data types supported in
netCDF 4. Currently, 'vlen'
and 'compound'
data
types can be described by instances of the UserType class.
Constructor: UserType(group, base_datatype, usertype,
usertype_name)
UserType
instances should be created using the createUserType method
of a Dataset or Group
instance, not using this class directly.
Parameters:
group
- Group instance to associate with user-defined
datatype.
base_datatype
- Base data type (data type that
user-defined data type is composed of). For usertype='vlen'
,
can be one of 'f4'
(32-bit floating point),
'f8'
(64-bit floating point), 'i4'
(32-bit
signed integer), 'i2'
(16-bit signed integer),
'i8'
(64-bit singed integer), 'i1'
(8-bit
signed integer), 'u1'
(8-bit unsigned integer),
'u2'
(16-bit unsigned integer), 'u4'
(32-bit
unsigned integer), 'u8'
(64-bit unsigned integer), or
'S1'
(single-character string). For
usertype='compound'
, the base_datatype argument must be a
list of 3-element tuples describing the type of each member of the
compound type. Each 3-tuple must contain a string giving the name of the
member, a string describing the primitive data-type of the member
('i4','f8',
etc. - 'S'
not allowed) and
a tuple describing the member's shape. The same format can be used to
create a dtype descriptor for a numpy record array.
usertype
- The type of user-defined data type
(such as 'vlen'
, 'compound'
,
'opaque'
or 'enum'
). Currently, only
'vlen'
and 'compound'
are supported. In netCDF
4 it is possible to have nested user-defined data types (e.g. compound
types composed of vlens), but this is not yet supported. All user-defined
data types must consist of collections of fixed-size primitive data types
(as specified by the base_datatype
argument).
usertype_name
- a Python string containing a
description of the user-defined data type.
Returns:
a UserType
instance, which can be passed to the createVariable
method
of a Dataset or Group instance.
The instance variables usertype, usertype_name
and
base_datatype
are read-only (and should not be modified by
the user).
|
__init__(...)
x.__init__(...) initializes x; see x.__class__.__doc__ for
signature
|
|
__new__(T,
S,
...)
|
Inherited from object :
__delattr__ ,
__getattribute__ ,
__hash__ ,
__reduce__ ,
__reduce_ex__ ,
__repr__ ,
__setattr__ ,
__str__
|
|
_base_type_offsets = <member '_base_type_offsets' of 'netCDF4.UserType' o...
|
|
_base_type_size = <member '_base_type_size' of 'netCDF4.UserType' obje...
|
|
_base_type_sizes = <member '_base_type_sizes' of 'netCDF4.UserType' obj...
|
|
_grpid = <member '_grpid' of 'netCDF4.UserType' objects>
|
|
_nc_type = <member '_nc_type' of 'netCDF4.UserType' objects>
|
|
_nfields = <member '_nfields' of 'netCDF4.UserType' objects>
|
|
base_datatype = <member 'base_datatype' of 'netCDF4.UserType' objects>
Describes the data type of which the user-defined data type is
composed - given by the base_datatype argument to the UserType
constructor.
|
|
usertype = <member 'usertype' of 'netCDF4.UserType' objects>
Describes the user-defined data type (either 'vlen'
or 'compound' ) - given by the usertype
argument to the UserType constructor..
|
|
usertype_name = <member 'usertype_name' of 'netCDF4.UserType' objects>
User-specified name (python string) for the user-defined data type
- given by the usertype_name argument to the UserType
constructor.
|
Inherited from object :
__class__
|
__init__(...)
(Constructor)
| |
x.__init__(...) initializes x; see x.__class__.__doc__ for
signature
-
- Overrides:
object.__init__
|
-
- Returns:
a new object with type S, a subtype of T
- Overrides:
object.__new__
|
_base_type_offsets
None
-
- Value:
<member '_base_type_offsets' of 'netCDF4.UserType' objects>
|
|
_base_type_size
None
-
- Value:
<member '_base_type_size' of 'netCDF4.UserType' objects>
|
|
_base_type_sizes
None
-
- Value:
<member '_base_type_sizes' of 'netCDF4.UserType' objects>
|
|
_grpid
None
-
- Value:
<member '_grpid' of 'netCDF4.UserType' objects>
|
|
_nc_type
None
-
- Value:
<member '_nc_type' of 'netCDF4.UserType' objects>
|
|
_nfields
None
-
- Value:
<member '_nfields' of 'netCDF4.UserType' objects>
|
|
base_datatype
Describes the data type of which the user-defined data type is
composed - given by the base_datatype argument to the UserType
constructor.
-
- Value:
<member 'base_datatype' of 'netCDF4.UserType' objects>
|
|
usertype
Describes the user-defined data type (either 'vlen' or
'compound' ) - given by the usertype argument to
the UserType
constructor..
-
- Value:
<member 'usertype' of 'netCDF4.UserType' objects>
|
|
usertype_name
User-specified name (python string) for the user-defined data type -
given by the usertype_name argument to the UserType
constructor.
-
- Value:
<member 'usertype_name' of 'netCDF4.UserType' objects>
|
|