pygplates.GpmlTimeSample

class pygplates.GpmlTimeSample

Bases: instance

A time sample associates an arbitrary property value with a specific time instant. Typically a sequence of time samples are used in a GpmlIrregularSampling. The most common example of this is a time-dependent sequence of total reconstruction poles.

Time samples 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 samples being compared (see PropertyValue) as well as the time instant, description string and disabled flag.

A GpmlTimeSample can also be pickled.

Changed in version 0.42: Added pickle support.

__init__(property_value, time[, description][, is_enabled=True])

Create a time sample given a property value and time and optionally a description string and disabled flag.

Parameters:
  • property_value (PropertyValue) – arbitrary property value

  • time (float or GeoTimeInstant) – the time position associated with the property value

  • description (string or None) – description of the time sample

  • is_enabled (bool) – whether time sample is enabled

time_sample = pygplates.GpmlTimeSample(property_value, time)

Methods

__init__(property_value, time, ...)

Create a time sample given a property value and time and optionally a description string and disabled flag.

get_description()

Returns the description of this time sample, or None.

get_time()

Returns the time position of this time sample.

get_value()

Returns the property value of this time sample.

get_value_type()

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

is_disabled()

Returns whether this time sample is disabled or not.

is_enabled()

Returns whether this time sample is enabled.

set_description([description])

Sets the description associated with this time sample, or removes it if none specified.

set_disabled([is_disabled=True])

Sets whether this time sample is disabled.

set_enabled([is_enabled=True])

Sets whether this time sample is enabled.

set_time(time)

Sets the time position associated with this time sample.

set_value(property_value)

Sets the property value associated with this time sample.

get_description()

Returns the description of this time sample, or None.

Return type:

string or None

get_time()

Returns the time position of this time sample.

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 sample.

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.

is_disabled()

Returns whether this time sample is disabled or not.

Return type:

bool

For example, a disabled total reconstruction pole (in a GpmlIrregularSampling sequence) is ignored when interpolating rotations at some arbitrary time.

is_enabled()

Returns whether this time sample is enabled.

Return type:

bool

For example, only enabled total reconstruction poles (in a GpmlIrregularSampling sequence) are considered when interpolating rotations at some arbitrary time.

set_description([description])

Sets the description associated with this time sample, or removes it if none specified.

Parameters:

description (string or None) – description of the time sample

set_disabled([is_disabled=True])

Sets whether this time sample is disabled.

Parameters:

is_disabled (bool) – whether time sample is disabled (defaults to True)

set_enabled([is_enabled=True])

Sets whether this time sample is enabled.

Parameters:

is_enabled (bool) – whether time sample is enabled (defaults to True)

set_time(time)

Sets the time position associated with this time sample.

Parameters:

time (float or GeoTimeInstant) – the time position associated with the property value

set_value(property_value)

Sets the property value associated with this time sample.

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.