cf.UMArray¶
- class cf.UMArray(filename=None, address=None, dtype=None, shape=None, fmt=None, word_size=None, byte_ordering=None, mask=True, unpack=True, attributes=None, storage_options=None, source=None, copy=True)[source]¶
A sub-array stored in a PP or UM fields file.
Initialisation
- Parameters:
- filename: (sequence of)
str
, optional The file name(s).
- address: (sequence of)
int
, optional The start position in the file(s) of the header(s).
Added in version 3.15.0.
- dtype:
numpy.dtype
The data type of the data array on disk.
- shape:
tuple
The shape of the unpacked data array. Note that this is the shape as required by the object containing the
UMArray
object, and so may contain extra size one dimensions. When read, the data on disk is reshaped to shape.- fmt:
str
, optional 'PP'
or'FF'
- word_size:
int
, optional 4
or8
- byte_ordering:
str
, optional 'little_endian'
or'big_endian'
- attributes:
dict
orNone
, optional Provide netCDF attributes for the data as a dictionary of key/value pairs.
During the first
__getitem__
call, any of the_FillValue
,add_offset
,scale_factor
,units
, andcalendar
attributes which haven’t already been set will be inferred from the lookup header and cached for future use.Added in version 3.16.3.
- source: optional
Convert source, which can be any type of object, to a
UMArray
instance.All other parameters, apart from copy, are ignored and their values are instead inferred from source by assuming that it has the
UMArray
API. Any parameters that can not be retrieved from source in this way are assumed to have their default value.Note that if
x
is also aUMArray
instance thencf.UMArray(source=x)
is equivalent tox.copy()
.- copy:
bool
, optional If True (the default) then deep copy the input parameters prior to initialisation. By default the parameters are not deep copied.
- size:
int
Deprecated at version 3.14.0.
- ndim:
int
Deprecated at version 3.14.0.
- header_offset:
int
Deprecated at version 3.15.0. Use the address parameter instead.
- data_offset:
int
, optional Deprecated at version 3.15.0.
- disk_length:
int
, optional Deprecated at version 3.15.0.
- units:
str
orNone
, optional Deprecated at version 3.16.3. Use the attributes parameter instead.
- calendar:
str
orNone
, optional Deprecated at version 3.16.3. Use the attributes parameter instead.
- filename: (sequence of)
Inspection¶
Methods
Returns the array's compression type. |
|
The attributes of the array. |
|
The endianness of the data. |
|
The file format of the UM file containing the array. |
|
Word size in bytes. |
|
Whether or not to automatically mask the data. |
|
Whether or not to automatically unpack the data. |
|
True if the index represents a subspace of the data. |
|
The index to be applied when converting to a |
Attributes
Return an independent numpy array containing the data. |
|
Cast the data to a specified type. |
|
Data-type of the array. |
|
Number of array dimensions. |
|
Shape of the array. |
|
Number of elements in the array. |
|
The shape of the data in the file. |
|
The shape of the data in the file with added dimensions. |
Units¶
Methods
The calendar of the array. |
|
The units of the array. |
|
The |
File¶
Methods
The name of the file containing the array. |
|
Close the dataset containing the data. |
|
Returns an open dataset and the address of the data. |
|
The name of the file containing the array. |
|
The format of the files. |
|
Return |
Miscellaneous¶
Return a deep copy of the array. |
|
Bring data on disk into memory. |
|
The file directory. |
|
Replace the file directory. |
|
Replace the file location. |
Special¶
Return a value fully representative of the object. |
|
Returns a subspace of the data as a new |
Docstring substitutions¶
Methods
Return the special docstring substitutions. |
|
Returns the substitutions that apply to methods of the class. |
|
Returns the class {{package}} substitutions package depth. |
|
Returns method names excluded in the class substitutions. |
Deprecated¶
Methods
The missing values of the data. |
|
The endianness of the data. |
|
The start position in the file of the data array. |
|
The file name and address. |
|
The file format of the UM file containing the array. |
|
The number of words on disk for the data array. |
|
The start position in the file of the header. |
|
Word size in bytes. |