pyinterp.core.period.Period

Contents

pyinterp.core.period.Period#

class pyinterp.core.period.Period(self, begin: object, end: object, within: bool = True)#

Bases: object

A Period.

A Period object representing a time interval.

Parameters:
  • begin – A numpy.datetime64 scalar representing the start of the period.

  • end – A numpy.datetime64 scalar representing the end of the period.

  • within – If True, end is inclusive; if False, end is exclusive.

Attributes

begin

The start date of the period.

last

The last date of the period (inclusive).

resolution

The resolution dtype of the period.

Public Methods

contains(self, point_or_period)

Check if a point is within the period.

duration(self)

Get the duration of the period.

end(self)

Get the exclusive end date of the period (one past the last included date).

extend(self, point)

Extend the period to include the given point.

intersection(self, other)

Get the intersection of this period with another period.

intersects(self, other)

Check if this period intersects with another period.

is_adjacent(self, other)

Check if this period is adjacent to another period.

is_after(self, point)

Check if the entire period is after the given point.

is_before(self, point)

Check if the entire period is before the given point.

is_close(self, date, tolerance)

Check if the given date is within tolerance of the period.

merge(self, other)

Merge this period with another period.

shift(self, offset)

Shift the period by a given timedelta.

Special Methods

__eq__(self, arg, /)

Equality comparison with resolution promotion.

__ge__(self, arg, /)

Greater-than-or-equal comparison with resolution promotion.

__getstate__(self)

Get the state for pickling.

__gt__(self, arg, /)

Greater-than comparison with resolution promotion.

__le__(self, arg, /)

Less-than-or-equal comparison with resolution promotion.

__lt__(self, arg, /)

Less-than comparison with resolution promotion.

__ne__(self, arg, /)

Inequality comparison with resolution promotion.

__new__(*args, **kwargs)

__repr__(self)

String representation of the Period.

__setstate__(self, state)

Set the state of the instance from pickling.

__str__(self)

String representation of the Period.