pygplates.GpmlTimeWindow

class pygplates.GpmlTimeWindow

Bases: instance

A time window associates an arbitrary property value with a specific time period. The property value does not vary over the time period of the window. Typically a sequence of time windows are used in a GpmlPiecewiseAggregation where the sequence of windows form a piecewise-constant (staircase function) property value over time (since each time window has a constant property value) assuming the windows do not have overlaps or gaps in time.

Time windows are equality (==, !=) comparable (but not hashable - cannot be used as a key in a dict). This includes comparing the property value in the two time windows being compared (see PropertyValue) as well as the time period.

A GpmlTimeWindow can also be pickled.

Changed in version 0.42: Added pickle support.

__init__(property_value, begin_time, end_time)

Create a time window given a property value and time range.

Parameters:
  • property_value (PropertyValue) – arbitrary property value

  • begin_time (float or GeoTimeInstant) – the begin time of the time window

  • end_time (float or GeoTimeInstant) – the end time of the time window

Raises:

GmlTimePeriodBeginTimeLaterThanEndTimeError if begin time is later than end time

time_window = pygplates.GpmlTimeWindow(property_value, begin_time, end_time)

Note that begin_time must be further in the past than the end_time begin_time > end_time.

Methods

__init__(property_value, begin_time, end_time)

Create a time window given a property value and time range.

get_begin_time()

Returns the begin time of this time window.

get_end_time()

Returns the end time of this time window.

get_value()

Returns the property value of this time window.

get_value_type()

Returns the type of property value returned by get_value().

set_begin_time(time)

Sets the begin time of this time window.

set_end_time(time)

Sets the end time of this time window.

set_value(property_value)

Sets the property value associated with this time window.

get_begin_time()

Returns the begin time of this time window.

Return type:

float

You can use GeoTimeInstant with the returned float to check for distant past or distant future for example. See GmlTimeInstant.get_time() for more details.

get_end_time()

Returns the end time of this time window.

Return type:

float

You can use GeoTimeInstant with the returned float to check for distant past or distant future for example. See GmlTimeInstant.get_time() for more details.

get_value()

Returns the property value of this time window.

Return type:

PropertyValue

get_value_type()

Returns the type of property value returned by get_value().

For example, it might return pygplates.GmlLineString which is a class object (not an instance).

Return type:

a class object of the property type (derived from PropertyValue)

Added in version 0.21.

set_begin_time(time)

Sets the begin time of this time window.

Parameters:

time (float or GeoTimeInstant) – the begin time of this time window

Raises:

GmlTimePeriodBeginTimeLaterThanEndTimeError if begin time is later than end time

set_end_time(time)

Sets the end time of this time window.

Parameters:

time (float or GeoTimeInstant) – the end time of this time window

Raises:

GmlTimePeriodBeginTimeLaterThanEndTimeError if begin time is later than end time

set_value(property_value)

Sets the property value associated with this time window.

Parameters:

property_value (PropertyValue) – arbitrary property value

This essentially replaces the previous property value. Note that an alternative is to directly modify the property value returned by get_value() using its property value methods.