cfdm.BiLinearSubarray


class cfdm.BiLinearSubarray(data=None, indices=None, shape=None, compressed_dimensions=None, subarea_indices=None, first=None, parameters=None, dependent_tie_points=None, interpolation_description=None, source=None, copy=True, context_manager=None)[source]

Bases: BiLinearInterpolation, SubsampledSubarray

A subarray of an array compressed by subsampling.

A subarray describes a unique part of the uncompressed array.

The compressed data is reconstituted by bi-linear interpolation.

See CF appendix J “Coordinate Interpolation Methods”.

Added in version (cfdm): 1.10.0.0

Initialisation

Parameters:
data: array_like

The full compressed tie points array spanning all subarrays, from which the elements for this subarray are defined by the indices.

indices: tuple

The indices of data that define this subarray.

shape: tuple of int

The shape of the uncompressed subarray.

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:

{1: (1,)}

Parameter example:

{0: (0,), 2: (2,)}

first: tuple of bool

For each dimension of the tie points array, True if the interpolation subarea is the first along that dimension of the continuous area, otherwise False.

subarea_indices: tuple of slice

For each dimension of the tie points array, the index that defines the location of the interpolation subarea in interpolation-subarea-space. An index corresponding to a non-interpolated dimension must be slice(None).

parameters: dict, optional

If the interpolation method requires interpolation parameters then these are provided as array_like values, each keyed by its parameter term name. A parameter array must provide values for all interpolation subareas, from which the applicable elements are defined by the subarea_indices and indices indices.

Each dimension of a parameter array maps to the dimension in the same position of the tie points array. The size of a parameter array dimension must be either i) the size as the corresponding tie points array dimension; ii) the size of the interpolation subarea dimension for the corresponding tie points array dimension; or iii) 1.

dependent_tie_points: dict, optional

If the interpolation method requires dependent tie point arrays then these are provided as array_like values, each keyed by its identity. A dependent tie points array must provide values for all interpolation subareas, from which the applicable elements are defined by the indices indices.

A dependent tie points array must have the same shape as the tie points array, and each dimension maps to the dimension in the same position of the tie points array.

interpolation_description: str, optional

A complete description of the non-standardised interpolation method.

source: optional

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

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

context_manager: function, optional

A context manager that provides a runtime context for the conversion of data, dependent_tie_points, and parameters to numpy arrays.

Methods

Methods

Units

The Units object containing the units of the array.

array

Return an independent numpy array containing the data.

astype

Cast the data to a specified type.

bounds

True if the tie points array represents bounds tie points.

compressed_dimensions

Mapping of compressed to uncompressed dimensions.

copy

Return a deep copy of the array.

data

The full compressed array spanning all subarrays.

dependent_tie_points

The dependent tie points dictionary.

dtype

The data-type of the uncompressed data.

first

Relative interpolation subarea positions.

get_attributes

The attributes of the array.

get_calendar

The calendar of the array.

get_compression_type

Returns the array's compression type.

get_filename

Return the name of the file containing the data.

get_interpolation_description

Get a non-standardised interpolation method description.

get_units

The units of the array.

indices

The indices of the data that define this subarray.

ndim

Number of array dimensions.

parameters

The interpolation parameters dictionary.

shape

The shape of the uncompressed data.

size

Number of elements in the array.

subarea_indices

Location of interpolation subarea.