Quaternions
Quaternions
Description:
HTTP GET request to get quaternions at given times for some plate IDs.
Endpoint:
https://gws.gplates.org/rotation/get_quaternions
Parameters:
times : a list of times, such as
times=10,20,30
. a single time can also be used, such astimes=100
[required]pids : a list of plate IDs [required]
model : name for the reconstruction model (if not specified, will use the default model)
group_by_pid : group the results by plate IDs
start : start time, such as "start=1"
end : end time, such as "end=100"
step : the size of step from start time to end time, such as "step=1"
Examples:
🟢 E1: get quaternions at 100Ma for plate ID 701
Click this link to try this example in a web browser.
Alternatively, use curl command.
curl "https://gws.gplates.org/rotation/get_quaternions?times=100&pids=701"
🟢 E2: get quaternions at 10Ma, 50Ma, 100Ma for plate ID 701, 801, 901
Click this link to try this example in a web browser.
Alternatively, use curl command.
curl "https://gws.gplates.org/rotation/get_quaternions?times=10,50,100&pids=701,801,901"
🟢 E3: get quaternions at 10Ma, 50Ma, 100Ma for all plate IDs
Click this link to try this example in a web browser.
Alternatively, use curl command.
curl "https://gws.gplates.org/rotation/get_quaternions?times=10,50,100"
🟢 E4: get quaternions from 1Ma to 100Ma with step 2Ma; group the results by plate IDs
Click this link to try this example in a web browser.
Alternatively, use curl command.
curl "https://gws.gplates.org/rotation/get_quaternions?start=1&end=100&step=2&pids=701,801,901&group_by_pid"
🟢 E5: a Python example. The Python file can be found at https://github.com/GPlates/gplates-web-service/blob/master/examples/get_rotation_with_web_service.py
import jsonimport randomimport requestsSERVER_URL = "https://gws.gplates.org"time = 100.0# get all the plate IDs in the reconstruction tree at 100Maurl = f"{SERVER_URL}/rotation/get_plate_ids?time={time}"r = requests.get(url)pids = json.loads(r.text)# print(pids)# pick up 10 random plate IDs from above plate IDsrandom_pids = [pids[random.randint(0, len(pids) - 1)] for _ in range(10)]print(random_pids)times = list(range(0, 101, 10)) # give a list of times# get quaternions for each time and plate ID# if the plate id does not exist at the time, return identity rotation [1.0, 0.0, 0.0, 0.0](not moving)url = f"{SERVER_URL}/rotation/get_quaternions?times={times}&pids={random_pids}"# print(url)r = requests.get(url)ret = json.loads(r.text)print(json.dumps(ret, indent=4, sort_keys=True))