uataq.instruments.Instrument.clip_to_active#

Instrument.clip_to_active(time_range)[source]#

Narrow a requested time range to when this instrument was installed.

Parameters:

time_range (TimeRange | str | tuple[str | datetime | datetime64 | None, str | datetime | datetime64 | None] | list[str | datetime | datetime64 | None] | slice | None) – The requested time range.

Returns:

The requested range intersected with active_range. Never wider than what was asked for.

Return type:

TimeRange

Raises:

InactiveInstrumentError – If the requested range does not overlap the active range at all. Both are half-open, so a range that only touches it – stopping at the installation date, or starting at the removal date – does not overlap it.

Notes

Without this, a request that reaches past a swap reads the replacement instrument’s files as though they were this one’s: research groups reuse a file name across an instrument change (the horel group calls both MetOne models esampler), so the file name cannot distinguish them, but the installation and removal dates can.