cfdm.GatheredArray


class cfdm.GatheredArray(compressed_array=None, shape=None, size=None, ndim=None, compressed_dimension=None, compressed_dimensions=None, list_variable=None, source=None, copy=True)[source]

Bases: cfdm.data.abstract.compressedarray.CompressedArray

An underlying gathered array.

Compression by gathering combines axes of a multidimensional array into a new, discrete axis whilst omitting the missing values and thus reducing the number of values that need to be stored.

The information needed to uncompress the data is stored in a “list variable” that gives the indices of the required points.

See CF section 8.2 “Lossless Compression by Gathering”.

New in version (cfdm): 1.7.0

Initialisation

Parameters
compressed_array: array_like

The compressed array.

shape: tuple

The shape of the uncompressed array.

compressed_dimensions: dict

Mapping of compressed to uncompressed dimensions.

A dictionary key is a position of a dimension in the compressed data, with a value of the positions of the corresponding dimensions in the uncompressed data. Compressed array dimensions that are not compressed must be omitted from the mapping.

Parameter example:

{2: (2, 3)}

New in version (cfdm): 1.10.0.0

list_variable: List

The “list variable” required to uncompress the data, identical to the data of a CF-netCDF list variable.

compressed_dimension: deprecated at version 1.10.0.0

Use the compressed_dimensions parameter instead.

source: optional

Convert source, which can be any type of object, to a GatheredArray instance.

All other parameters, apart from copy, are ignored and their values are instead inferred from source by assuming that it has the GatheredArray 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 a GatheredArray instance then cfdm.GatheredArray(source=x) is equivalent to x.copy().

New in version (cfdm): 1.10.0.0

copy: bool, optional

If True (the default) then deep copy the input parameters prior to initialisation. By default the parameters are not deep copied.

New in version (cfdm): 1.10.0.0

size: int

Deprecated at version 1.10.0.0. Ignored if set.

Number of elements in the uncompressed array.

ndim: int

Deprecated at version 1.10.0.0. Ignored if set.

The number of uncompressed array dimensions

Inspection

Methods

compressed_dimensions

Mapping of compressed to uncompressed dimensions.

get_compressed_axes

Return axes that are compressed in the underlying array.

get_compressed_dimension

Returns the compressed dimension’s position in the array.

get_compression_type

Returns the array’s compression type.

get_list

Return the list variable for a compressed array.

Attributes

array

Returns a numpy array containing the uncompressed data.

compressed_array

Returns an independent numpy array with the compressed data.

dtype

The data-type of the uncompressed data.

ndim

Number of array dimensions.

shape

Shape of the uncompressed data.

size

Number of elements in the array.

Units

Methods

get_calendar

The calendar of the array.

get_units

The units of the array.

Miscellaneous

Methods

copy

Return a deep copy of the array.

get_subspace

Return a subspace, defined by indices, of a numpy array.

source

Return the underlying array object.

to_memory

Bring data on disk into memory.

subarray_shapes

Create the subarray shapes along each uncompressed dimension.

subarray_parameters

Non-data parameters required by the Subarray class.

subarrays

Return descriptors for every subarray.

get_Subarray

Return the Subarray class.

conformed_data

The compressed data and list variable.

cfdm.GatheredArray.get_filename

get_filenames

Return the names of any files containing the compressed data.

Special

Methods

__array__

The numpy array interface.

__deepcopy__

Called by the copy.deepcopy function.

__getitem__

Return a subspace of the uncompressed data.

__repr__

Called by the repr built-in function.

__str__

Called by the str built-in function.

Docstring substitutions

Methods

_docstring_special_substitutions

Return the special docstring substitutions.

_docstring_substitutions

Returns the substitutions that apply to methods of the class.

_docstring_package_depth

Returns the class {{package}} substitutions package depth.

_docstring_method_exclusions

Returns method names excluded in the class substitutions.