odc.geo.roi.roi_normalise

odc.geo.roi.roi_normalise(roi, shape)[source]

Normalise ROI.

Fill in missing .start/.stop, also deal with negative values, which are treated as offsets from the end.

.step parameter is left unchanged.

Return type:

Union[NormalizedSlice, Tuple[NormalizedSlice, ...]]

Example

np.s_[:3, 4:  ], (10, 20) => np.s_[0:3, 4:20]
np.s_[:3,  :-3], (10, 20) => np.s_[0:3, 0:17]