Create topological features in pygplates and have issue when resolve these features

Hello everyone:

I have tried to create topological features from regular or reconstructable features (gpml:PassiveContinentalBoundary or gpml:SubductionZone) in pygplates. When I loaded these topological features in GPlates, these features behaved as what I understood of topological features. And my understand about a topological feature is as the following:

  1. Topological feature can have any pygplates.FeatureType (gpml:PassiveContinentalBoundary or gpml:SubductionZone or gpml:MidOceanRidge)
  2. Topological feature does not need to have a PlateID or any other attributes because the topological feature has references to regular or reconstructable features that make up the topological feature. These regular or reconstructable features have all required attributes - PlateID, valid time, name, etc.
  3. When one wants to resolve topological features, make sure to include both topological features and regular or reconstructable features that topological features have references as the input to pygplates.resolve_topology.

I am not sure what I have done wrong that I could not resolve the topological features I previously created in pygplates. There was no Error message from pygplates.resolve_topology; however, the output is empty. I have checked to make sure that I indicated the valid time. I also included both topological features and regular/reconstructable features as the input to pygplates.resovle_topology.

Will you please give me advice or suggestion with this issue? Thank you so much.

Hi Lavie,

What you describe sounds correct.

Usually this problem is related to Feature IDs in one way or another. Have a look at this post which covers two possible issues with feature IDs (duplicated IDs or a Shapefile mapping problem).

If that doesn’t solve the problem then feel free to send me some files that reproduce the problem and I’ll have a look.

Regards,
John

Dear John:

Thank you so much for your help. After following your suggestions in the previous post, I still could not solve the issue. I checked to make sure that my topological features had references to reconstructable features and these gpml files were included in the input to pygplates.resolve_topology. Thus, I herein enclose the link to the Shared OneDrive folder which contains input files and Python file that I created to test pygplates.resolve_topology. The link can only be accessed through your email (I believed I sent the link to your email already). Many thanks for your time and your guidance.

Hi Lavie,

Thanks for sending the input files and Python test script!

I noticed all your topologies are topological lines.

By default pygplates.resolve_topologies() only outputs resolved boundaries and networks. This is because most use cases do not want the building blocks of plate/network boundaries (ie, lines). If you want to output the resolved lines you can specify that with the resolve_topology_types parameter (see code below).

So, in your case, you’ll want to change…

resolved_topologies = []
resolved_topological_sections = []
pygplates.resolve_topologies(
    topological_features,
    rotation_model,
    resolved_topologies,
    time,
    resolved_topological_sections,
    anchor_plate_id = 700)

…to…

resolved_topologies = []
pygplates.resolve_topologies(
    topological_features,
    rotation_model,
    resolved_topologies,
    time,
    anchor_plate_id = 700,
    resolve_topology_types = pygplates.ResolveTopologyType.line)

Note that I’ve removed your resolved_topological_sections argument since it’s not going to have anything meaningful in it since you only have topological lines (ie, not boundaries or networks). In fact if I had left that in then an error would have occurred (unless you also specified the resolve_topological_section_types argument to include boundaries and/or networks, and then resolved_topological_sections would have been empty anyway).

Dear John:

Thank you so much for your time and your help with the issue. In your explanation, I notice you said that by default pygplates.resolve_topologies() would only output resolved boundaries and networks. I am confused because I thought my topological features were tectonic boundaries. I understand these features are topological lines but their feature types are pygplates.FeatureType.gpml_subduction_zone or pygplates.FeatureType.gpml_mid_ocean_ridge. Thus, my question is how I correctly interpret/understand/define ‘boundaries’ in topological features?

Once again, many thanks for taking time to provide detailed explanation - as you always do :grin:

Hi Lavie,

Your features are topological lines because their geometries are topological lines (and in your GPML files you’ll see <gpml:TopologicalLine>).

The feature type (such as pygplates.FeatureType.gpml_subduction_zone) does play a role in this but the only role it plays is to restrict the types of geometries allowed (as determined by the GPlates Geological Information Model - GPGIM). So a SubductionZone feature type only allows lines (not polygons or networks) since it’s really meant to be a line feature.

Now if you created a topological feature in pyGPlates using, for example, pygplates.Feature.create_topological_feature there’s a verify_information_model parameter that can disable this GPGIM restriction (but then you might have a little trouble loading that into GPlates). Ultimately we want to loosen up the GPGIM in this regard, but for now, if you want a topological boundary I would choose a feature type that is used for boundary features (subduction zones are really meant to be line features). A gpml:TopologicalClosedPlateBoundary is probably your best bet.

Dear John:

Thanks for your careful explanation.