index

module of dascore.xarray source

A lazy, evenly sampled datetime/timedelta index for xarray.

xarray materializes every dimension coordinate into a numpy array and a pandas index, which for a long merged time coordinate costs 8 bytes a sample before any data loads — a year of millisecond sampling is a quarter terabyte of labels. pandas has no computed-on-demand datetime index (freq is metadata on a fully allocated array), so xarray grew the CoordinateTransform machinery instead; its own RangeIndex serves lazy float labels on top of it. This module supplies the temporal counterpart: labels are start + i * step computed from the position on demand, and selection inverts that arithmetic exactly in python integers — int64 subtraction of a far-away label wraps around, and float inversion loses sample precision once offsets pass 2**53 ns, about 104 days.

Everything here is imported only behind the optional xarray dependency.

Classes

Name Description
TemporalRangeIndex An xarray index over a TemporalRangeTransform.
TemporalRangeTransform Positions to evenly sampled datetime64/timedelta64 labels and back.