枚举 NpyDataType
- java.lang.Object
-
- java.lang.Enum<NpyDataType>
-
- org.meteoinfo.ndarray.io.npy.NpyDataType
-
- 所有已实现的接口:
Serializable,Comparable<NpyDataType>
public enum NpyDataType extends Enum<NpyDataType>
An enumeration of supported NumPy data types.
-
-
枚举常量概要
枚举常量 枚举常量 说明 boolBooleansf216 bit floating point numbersf432 bit floating point numbersf864 bit floating point numbersi18-bit signed integersi216 bit signed integersi432 bit signed integersi864 bit signed integersSUu18-bit unsigned integersu216 bit unsigned integersu432 bit unsigned integersu864 bit unsigned integers
-
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 static NpyByteOrderbyteOrderOf(String dtype)Get the byte order of the given data type description.static NpyDataTypeof(String dtype)Tries to find the data type for the given symbol.intsize()For fixed sized data types, returns the number of bytes that are required to store a value of this type.Stringsymbol()Get the NPY symbol of the data type.StringtoString()static NpyDataTypevalueOf(String name)返回带有指定名称的该类型的枚举常量。static NpyDataType[]values()按照声明该枚举类型的常量的顺序, 返回 包含这些常量的数组。
-
-
-
枚举常量详细资料
-
bool
public static final NpyDataType bool
Booleans
-
f2
public static final NpyDataType f2
16 bit floating point numbers
-
f4
public static final NpyDataType f4
32 bit floating point numbers
-
f8
public static final NpyDataType f8
64 bit floating point numbers
-
i1
public static final NpyDataType i1
8-bit signed integers
-
i2
public static final NpyDataType i2
16 bit signed integers
-
i4
public static final NpyDataType i4
32 bit signed integers
-
i8
public static final NpyDataType i8
64 bit signed integers
-
u1
public static final NpyDataType u1
8-bit unsigned integers
-
u2
public static final NpyDataType u2
16 bit unsigned integers
-
u4
public static final NpyDataType u4
32 bit unsigned integers
-
u8
public static final NpyDataType u8
64 bit unsigned integers
-
S
public static final NpyDataType S
-
U
public static final NpyDataType U
-
-
方法详细资料
-
values
public static NpyDataType[] values()
按照声明该枚举类型的常量的顺序, 返回 包含这些常量的数组。该方法可用于迭代 常量, 如下所示:for (NpyDataType c : NpyDataType.values()) System.out.println(c);
- 返回:
- 按照声明该枚举类型的常量的顺序返回的包含这些常量的数组
-
valueOf
public static NpyDataType valueOf(String name)
返回带有指定名称的该类型的枚举常量。 字符串必须与用于声明该类型的枚举常量的 标识符完全匹配。(不允许有多余 的空格字符。)- 参数:
name- 要返回的枚举常量的名称。- 返回:
- 返回带有指定名称的枚举常量
- 抛出:
IllegalArgumentException- 如果该枚举类型没有带有指定名称的常量NullPointerException- 如果参数为空值
-
toString
public String toString()
- 覆盖:
toString在类中Enum<NpyDataType>
-
symbol
public String symbol()
Get the NPY symbol of the data type.- 返回:
- the NPY symbol of the data type, e.g.
i4.
-
size
public int size()
For fixed sized data types, returns the number of bytes that are required to store a value of this type. Returns0for variable sized types (the string typesSandU). This method is similar to the NumPy methodnumpy.dtype.itemsize.>>> import numpy as np >>> np.dtype('i4').itemsize 4 >>> np.dtype('U').itemsize 0- 返回:
- for fixed sized types the number of bytes to store a single value,
for variable sized types like strings
0.
-
of
public static NpyDataType of(String dtype)
Tries to find the data type for the given symbol. The behavior is a bit likenumpy.dtype('[the type name or symbol]'). The given symbol can have a prefix that indicates the byte order.- 参数:
dtype- the data type symbol (e.g.i4, int32, <i4)- 返回:
- the data type or
nullif there is no matching type defined.
-
byteOrderOf
public static NpyByteOrder byteOrderOf(String dtype)
Get the byte order of the given data type description. It tries to identify it from the first character of that type description:=hardware native<little-endian>big-endian|not applicable
- 参数:
dtype- the data type description (e.g.<i4)- 返回:
- the identified byte-order or
NpyByteOrder.NOT_APPLICABLEif it is not specified in the given type string - 另请参阅:
- https://numpy.org/doc/stable/reference/generated/numpy.dtype.byteorder.html
-
-