The coordmanager is a simple class for tracking multidimensional coordinates and labels of ndarrays. Various methods exist for trimming, sorting, and filtering the managed arrays based on coordinates.
Initializing CoordinateManagers
Coordinate managers are initialized using the get_coord_manager function. They take a combination of coordinate dictionaries, dimensions, and attributes. They can also be extracted from example patches.
import numpy as np# Get array of coordinate valuestime = cm['time']# Filter data array# this gets a new coord manager and a view of the trimmed data._sorted_time = np.sort(time)t1 = _sorted_time[5]t2 = _sorted_time[-5]new_cm, new_data = cm.select(time=(t1, t2), array=data)print(f"Old data shape: {data.shape}")print(f"New data shape: {new_data.shape}")print(new_cm)