pygplates.PropertyValue¶

class
pygplates.
PropertyValue
¶ Bases:
Boost.Python.instance
The base class inherited by all derived property value classes. Property values are equality (
==
,!=
) comparable (but not hashable  cannot be used as a key in adict
). Two property values will only compare equal if they have the same derived property value type (and the same internal values). For example, aGpmlPlateId
property value instance and aXsInteger
property value instance will always compare asFalse
.The list of derived property value classes includes:
Enumeration
GmlDataBlock
GmlLineString
GmlMultiPoint
GmlOrientableCurve
GmlPoint
GmlPolygon
GmlTimeInstant
GmlTimePeriod
GpmlArray
GpmlConstantValue
GpmlFiniteRotation
GpmlIrregularSampling
GpmlKeyValueDictionary
GpmlOldPlatesHeader
GpmlPiecewiseAggregation
GpmlPlateId
GpmlPolarityChronId
XsBoolean
XsDouble
XsInteger
XsString
The following subset of derived property value classes are topological geometries:
The following subset of derived property value classes are timedependent wrappers:
You can use
get_value()
to extract a value at a specific time from a timedependent wrapper.A property value can be deep copied using
clone()
.
__init__
()¶ Raises an exception This class cannot be instantiated from Python
Methods
__init__
Raises an exception This class cannot be instantiated from Python accept_visitor
(visitor)Accept a property value visitor so that it can visit this property value. clone
()Create a duplicate of this property value (derived) instance, including a recursive copy of any nested property values that this instance might contain. get_geometry
()Extracts the geometry
if this property value contains a geometry.get_value
([time=0])Extracts the value, of this possibly timedependent property value, at the reconstruction time. 
accept_visitor
(visitor)¶ Accept a property value visitor so that it can visit this property value. As part of the visitor pattern, this enables the visitor instance to discover the derived class type of this property. Note that there is no common interface shared by all property value types, hence the visitor pattern provides one way to find out which type of property value is being visited.
Parameters: visitor ( PropertyValueVisitor
) – the visitor instance visiting this property value

clone
()¶ Create a duplicate of this property value (derived) instance, including a recursive copy of any nested property values that this instance might contain.
Return type: PropertyValue

get_geometry
()¶ Extracts the
geometry
if this property value contains a geometry.Return type: GeometryOnSphere
or NoneThis function searches for a geometry in the following standard geometry property value types:
GmlPoint
GmlMultiPoint
GmlPolygon
GmlLineString
GmlOrientableCurve
(a possible wrapper aroundGmlLineString
)GpmlConstantValue
(a possible wrapper around any of the above)
If this property value does not contain a geometry then
None
is returned.Timedependent geometry properties are not yet supported, so the only timedependent property value wrapper currently supported by this function is
GpmlConstantValue
.To extract geometry from a specific feature property:
property_value = feature.get_value(pygplates.PropertyName.gpml_pole_position) if property_value: geometry = property_value.get_geometry()
…however
Feature.get_geometry()
provides an easier way to extract geometry from a feature with:geometry = feature.get_geometry(pygplates.PropertyName.gpml_pole_position)
To extract all geometries from a feature (regardless of which properties they came from):
all_geometries = [] for property in feature: property_value = property.get_value() if property_value: geometry = property_value.get_geometry() if geometry: all_geometries.append(geometry)
…however again
Feature.get_geometry()
does this more easily with:all_geometries = feature.get_geometry(lambda property: True, pygplates.PropertyReturn.all)

get_value
([time=0])¶ Extracts the value, of this possibly timedependent property value, at the reconstruction time.
Parameters: time (float or GeoTimeInstant
) – the time to extract value (defaults to present day)Return type: PropertyValue
or NoneIf this property value is a timedependent property (
GpmlConstantValue
,GpmlIrregularSampling
orGpmlPiecewiseAggregation
) then a nested property value is extracted at the reconstruction time and returned. Otherwise this property value instance is simply returned as is (since it’s not a timedependent property value).Returns
None
if this property value is a timedependent property (GpmlConstantValue
,GpmlIrregularSampling
orGpmlPiecewiseAggregation
) and time is outside its time range (of time samples or time windows).Note that if this property value is a
GpmlIrregularSampling
instance then the extracted property value is interpolated (at reconstruction time) if property value can be interpolated (currently onlyGpmlFiniteRotation
andXsDouble
), otherwiseNone
is returned.The following example demonstrates extracting an interpolated finite rotation from a
total reconstruction pole
at time 20Ma:gpml_finite_rotation_20Ma = total_reconstruction_pole.get_value(20) if gpml_finite_rotation_20Ma: print 'Interpolated finite rotation at 20Ma: %s' % gpml_finite_rotation_20Ma.get_finite_rotation()