Check rotation file for inconsistancies

Does anybody know of any Python and pyGPlates code to check rotation files for inconsistancies, especially at cross-overs. I would rather use existing code than start writing my own version if already available.


1 Like

Hi Bruce

pygplates has the synchronize_crossovers method which might help, not sure whether there are any example scripts around on GitHub.

I’ve also written a cleanup/conversion script for rotation files which might come in handy which you’re welcome to use:

The script converts from *.rot files to *.grot files and does some housekeeping, including detection and cleanup of cross overs. It relies on the module which has a detect_crossover part:

    """Reads a list of stage rotations and the associated dictionary
    and iterates over content in sequence. Checks whether the next
    fPID is different to current one and the ages are the same.
    In case of a crossover not yet marked, it will correct the metadata
    entries in the dictionary.
    Entries to MPRS dictionary will be made, the @XO_ tag will only
    be added to the younger end of the cross over.

Now, these scripts haven’t been extensively tested, so please use with caution. In addition the documentation is not done professionally so some things might not be clear. In that case, pls reach out.


ps The repository URL is

Hi Bruce,

In addition to what Christian has provided, I’ve just added a script diagnose_rotations to PlateTectonicTools. I had meant to add it a while ago but it needed a little touch-up first.

You can run it as:

python -m ptt.diagnose_rotations <rotation_file1.rot> <rotation_file2.rot> ...

…and it’ll print any issues to the console.

The issues it finds include:

  • Moving/fixed rotation sequences with no enabled poles (or just one enabled pole).
    • Or the enabled times are not monotonically increasing.
  • Moving/fixed rotation sequences with the same moving plate ID that:
    • Overlap in time.
    • Abut (adjoin) in time but have different total rotations at the adjoining time.
      • This includes crossovers (ie, where the fixed plate ID is different).
      • And also includes rotations with same fixed plate ID but across different files.
        • For example, 0-250Ma in one file and 250-410Ma in another, but the 250Ma rotation differs.

Some lines from an example output are:

Moving_pid(233), fixed_pid(109): two different rotations at time 250.
Moving_pid(506), fixed_pid1(505), fixed_pid2(505): sequences overlap between 0 and 250.
Moving_pid(544), young_fixed_pid(503), old_fixed_pid(522): crossover at time 250 needs fixing.

Running python -m ptt.diagnose_rotations produces the following help:

usage: [-h] [-t ROTATION_THRESHOLD_DEGREES] rotation_filename [rotation_filename ...]

Diagnose one or more rotation files to check for inconsistencies.

    NOTE: Separate the positional and optional arguments with '--' (workaround for bug in argparse module).
    For example...

    python input_rotations1.rot input_rotations2.rot

positional arguments:
  rotation_filename     One or more rotation filenames.

  -h, --help            show this help message and exit
                        Two rotations differ if either the rotation latitude, longitude or angle differ by the specified amount (in degrees).
                        The default (0.01 degrees) is useful for some PLATES rotation files that are typically accurate to 2 decimal places.

Thanks to both Christian and John. I will follow up to use the code you refer to. It will definitely be useful but my initial reason for asking was actually to try to identify crossovers where I have unusually large motion due to incorrect values on either side of the crossover. I don’t think that what you refer to addresses this.

I don’t have good internet at present so will have to wait a while to access the code to try myself.



1 Like