7.3.14. Util Module

parflow.tools.util._check_key_is_empty(key: slice) → bool

Checks if an accessor key is empty.

Parameters:

key – An accessor key in the form of a slice object

Returns:

A boolean specifying whether the key is empty

parflow.tools.util._key_to_explicit_accessor(key: slice | int | Iterable) → dict

Unifies key accessor types for simpler indexing on xarray datasets.

Parameters:

key – The accessor key specifying the elements to select from an array

Returns:

A dictionary representation of the key with entries for ‘start’, ‘stop’, and ‘indices’ which is compatible with xarray selectors.