pygplates.PlatePartitioner returns NaN for some points


I have used some of the Gplates tutorials for pygplates on the GitHub page to calculate velocity vectors (with the ultimate goal of feeding them to convection codes). While for the majority of points this works fine, there are some regions that don’t get a plate id and None is returned by partition_point() (See the figure attached). Considering that calculating velocities through the GUI with the same velocities works perfectly fine, I was wondering if there is something wrong with the script, or this is just a bug in pygplates. Please see the link below for the code:


Hi Sia,

There are a couple of issues that could be causing problems, related to the input files and compatibility between the capabilities of pygplates versus GPlates GUI:

  1. Specifying all the required input files for the topological reconstruction.

Based on the code you linked, it looks like you are using the Muller 2019 reconstruction with deformation, but you only specify one rotation file and one topology file (in each case the ‘global’ files). Assuming that you are using the original published version of that reconstruction, then the full set of plate topologies depends on many other files besides just these two files (the .rot and .gpml files associated the deforming meshes for each region). If all of those files are not specified at the beginning of your script, then the plate boundaries won’t be constructed correctly. This may not be immediately obvious however, since the script will still run without any errors and you’d still end up seeing velocities over much of the Earth (as in your figure). However, when I tried using only the two files specified in your code, and loaded only those files into GPlates GUI, then what I got was a set of broken topologies where there were a few gaps on the Earth that corresponded to the gaps in your attached image.

(you could try using the files in the GPlates 2.3 sample data where the same sets of features are merged into far fewer files)

  1. Compatibility between pygplates and deforming reconstructions.

As far as I am aware, pygplates does not yet support exporting velocities for points within deforming meshes in the same way as the GPlates GUI. So even if all the correct files are specified, you’ll likely still not get any velocities out within the regions covered by deforming meshes (again you wouldn’t get an error, they will all be returned as zero).