cfdm.CellConnectivity.normalise

CellConnectivity.normalise(start_index=0, remove_empty_columns=False, inplace=False)[source]

Normalise the data values.

Normalised data is in a form that is suitable for creating a CF-netCDF UGRID “face_face_connectivity” variable.

Normalisation does not change the logical content of the data. It converts the data so that the set of values comprises all of the integers in the range [0, N-1] (if the start_index parameter is 0), or [1, N] (if start_index is 1), where N is the number of cells.

New in version (cfdm): 1.11.0.0

Parameters
start_index: int, optional

The start index for the data values in the normalised data. Must be 0 (the default) or 1 for zero- or one-based indices respectively.

remove_empty_columns: bool, optional

If True then remove any array columns that are entirely missing data. By default these are retained.

inplace: bool, optional

If True then do the operation in-place and return None.

Returns
CellConnectivity or None

The normalised cell connectivity construct, or None if the operation was in-place.

**Examples*

>>>
>>> data = cfdm.Data(
...   [[4, 1, 10, 125], [1, 4, -99, -99], [125, 4, -99, -99]]
... ).masked_values(-99)
>>> c = cfdm.CellConnectivity(cell='point', data=data)
>>> print(c.array)
[[4 1 10 125]
 [1 4 -- --]
 [125 4 -- --]]
>>> print(c.normalise().array)
[[0 1 2]
 [1 0 --]
 [2 0 --]]
>>> print(c.normalise(start_index=1).array)
[[1 2 3]
 [2 1 --]
 [3 1 --]]