pygplates.TopologicalSnapshot
- class pygplates.TopologicalSnapshot
Bases:
Boost.Python.instance
A snapshot of topologies at a specific geological time.
New in version 0.30.
- __init__(topological_features, rotation_model, reconstruction_time[, anchor_plate_id][, default_resolve_topology_parameters])
Create from topological features and a rotation model at a specific reconstruction time.
- Parameters
topological_features (
FeatureCollection
, or string, orFeature
, or sequence ofFeature
, or sequence of any combination of those four types) – The topological boundary and/or network features and the topological section features they reference (regular and topological lines) as a feature collection, or filename, or feature, or sequence of features, or a sequence (eg,list
ortuple
) of any combination of those four types. Note: Each sequence entry can optionally be a 2-tuple (entry,ResolveTopologyParameters
) to override default_resolve_topology_parameters for that entry.rotation_model (
RotationModel
orFeatureCollection
or string or sequence ofFeatureCollection
instances and/or strings) – A rotation model or a rotation feature collection or a rotation filename or a sequence of rotation feature collections and/or rotation filenamesreconstruction_time (float or
GeoTimeInstant
) – the specific geological time to resolve toanchor_plate_id (int) – The anchored plate id used for all reconstructions (resolving topologies, and reconstructing regular features). Defaults to the default anchor plate of rotation_model.
default_resolve_topology_parameters (
ResolveTopologyParameters
) – Default parameters used to resolve topologies. Note that these can optionally be overridden in topological_features. Defaults todefault-constructed ResolveTopologyParameters
).
Create a topological snapshot by resolving topologies at a specific reconstruction time:
reconstruction_time = 100 topology_features = pygplates.FeatureCollection('topologies.gpml') rotation_model = pygplates.RotationModel('rotations.rot') topological_snapshot = pygplates.TopologicalSnapshot(topology_features, rotation_model, reconstruction_time)
Changed in version 0.31: Added default_resolve_topology_parameters argument.
Methods
__init__
(topological_features, ...)Create from topological features and a rotation model at a specific reconstruction time.
Exports the resolved topological sections to a file.
export_resolved_topologies
(export_filename, ...)Exports the resolved topologies to a file.
Return the anchor plate ID (see
constructor
).Returns the resolved topological sections of the requested type(s).
Returns the resolved topologies of the requested type(s).
Return the rotation model used internally.
- export_resolved_topological_sections(export_filename[, resolve_topological_section_types][, export_topological_line_sub_segments=True][, wrap_to_dateline=True])
Exports the resolved topological sections to a file.
- Parameters
export_filename (string) – the name of the export file
resolve_topological_section_types (a bitwise combination of any of
pygplates.ResolveTopologyType.boundary
orpygplates.ResolveTopologyType.network
) – Determines whetherResolvedTopologicalBoundary
orResolvedTopologicalNetwork
(or both types) are listed in the exported resolved topological sections. Note thatResolveTopologyType.line
cannot be specified since only topologies with boundaries are considered. Defaults toresolved topological boundaries
andresolved topological networks
.export_topological_line_sub_segments (bool) – Whether to export the individual sub-segments of each boundary segment that came from a resolved topological line (
True
) or export a single geometry per boundary segment (False
). Defaults toTrue
.wrap_to_dateline (bool) – Whether to wrap/clip resolved topological sections to the dateline (currently ignored unless exporting to an ESRI Shapefile format file). Defaults to
True
.
- Raises
ValueError if resolve_topological_section_types (if specified) contains a flag that is not one of
pygplates.ResolveTopologyType.boundary
orpygplates.ResolveTopologyType.network
The following export file formats are currently supported:
Export File Format
Filename Extension
ESRI Shapefile
‘.shp’
GeoJSON
‘.geojson’ or ‘.json’
OGR GMT
‘.gmt’
GMT xy
‘.xy’
The argument export_topological_line_sub_segments only applies to topological lines. It determines whether to export the section of the resolved topological line (contributing to boundaries) or its
sub-segments
. Note that this also determines whether the feature properties (such as plate ID and feature type) of the topological line feature or its individual sub-segment features are exported.Note
Resolved topological sections are exported in the same order as that of their respective topological features (see
constructor
) and the order across topological feature collections (if any) is also retained.Changed in version 0.33: Added export_topological_line_sub_segments argument.
- export_resolved_topologies(export_filename[, resolve_topology_types][, wrap_to_dateline=True][, force_boundary_orientation])
Exports the resolved topologies to a file.
- Parameters
export_filename (string) – the name of the export file
resolve_topology_types (a bitwise combination of any of
pygplates.ResolveTopologyType.line
,pygplates.ResolveTopologyType.boundary
orpygplates.ResolveTopologyType.network
) – specifies the resolved topology types to export - defaults toresolved topological boundaries
andresolved topological networks
(excludesresolved topological lines
)wrap_to_dateline (bool) – Whether to wrap/clip resolved topologies to the dateline (currently ignored unless exporting to an ESRI Shapefile format file). Defaults to
True
.force_boundary_orientation (int) – Optionally force boundary orientation to clockwise (
PolygonOnSphere.Orientation.clockwise
) or counter-clockwise (PolygonOnSphere.Orientation.counter_clockwise
). Only applies to resolved topological boundaries and networks (excludes lines). Note that ESRI Shapefiles always use clockwise orientation (and so ignore this parameter).
- Raises
ValueError if resolve_topology_types (if specified) contains a flag that is not one of
pygplates.ResolveTopologyType.line
,pygplates.ResolveTopologyType.boundary
orpygplates.ResolveTopologyType.network
The following export file formats are currently supported:
Export File Format
Filename Extension
ESRI Shapefile
‘.shp’
GeoJSON
‘.geojson’ or ‘.json’
OGR GMT
‘.gmt’
GMT xy
‘.xy’
Note
Resolved topologies are exported in the same order as that of their respective topological features (see
constructor
) and the order across topological feature collections (if any) is also retained.
- get_anchor_plate_id()
Return the anchor plate ID (see
constructor
).- Return type
int
Note
This is the same as the
default anchor plate ID
ofget_rotation_model()
.
- get_resolved_topological_sections([resolve_topological_section_types][, same_order_as_topological_features=False])
Returns the resolved topological sections of the requested type(s).
- Parameters
resolve_topological_section_types (a bitwise combination of any of
pygplates.ResolveTopologyType.boundary
orpygplates.ResolveTopologyType.network
) – Determines whetherResolvedTopologicalBoundary
orResolvedTopologicalNetwork
(or both types) are listed in the returned resolved topological sections. Note thatResolveTopologyType.line
cannot be specified since only topologies with boundaries are considered. Defaults toresolved topological boundaries
andresolved topological networks
.same_order_as_topological_features (bool) – whether the returned resolved topological sections are sorted in the order of the topological features (including order across topological files, if there were any) - defaults to
False
- Return type
list
ofResolvedTopologicalSection
- Raises
ValueError if resolve_topological_section_types (if specified) contains a flag that is not one of
pygplates.ResolveTopologyType.boundary
orpygplates.ResolveTopologyType.network
- get_resolved_topologies([resolve_topology_types][, same_order_as_topological_features=False])
Returns the resolved topologies of the requested type(s).
- Parameters
resolve_topology_types (a bitwise combination of any of
pygplates.ResolveTopologyType.line
,pygplates.ResolveTopologyType.boundary
orpygplates.ResolveTopologyType.network
) – specifies the resolved topology types to return - defaults toresolved topological boundaries
andresolved topological networks
same_order_as_topological_features (bool) – whether the returned resolved topologies are sorted in the order of the topological features (including order across topological files, if there were any) - defaults to
False
- Returns
the
resolved topological lines
,resolved topological boundaries
andresolved topological networks
(depending on the optional argument resolve_topology_types) - by defaultresolved topological lines
are excluded- Return type
list
- Raises
ValueError if resolve_topology_types (if specified) contains a flag that is not one of
pygplates.ResolveTopologyType.line
,pygplates.ResolveTopologyType.boundary
orpygplates.ResolveTopologyType.network
- get_rotation_model()
Return the rotation model used internally.
- Return type
Note
The
default anchor plate ID
of the returned rotation model may be different to that of the rotation model passed into theconstructor
if an anchor plate ID was specified in theconstructor
.