pygplates专栏——Reonstruct features——Reconstruct flowline features

pygplates专栏——Reonstruct features——Reconstruct flowline features

  • Reconstruct flowline features
    • 导出flowlines重建到文件中
      • 示例代码
    • 查询重建的flowline
      • 示例代码

Reconstruct flowline features

导出flowlines重建到文件中

示例代码

import pygplates

# 加载板块运动轨迹
rotation_model = pygplates.RotationModel("Muller2019-Young2019-Cao2020_CombinedRotations.rot")
# 加载flowline特征
flowline_features = pygplates.FeatureCollection("4-output_flowline.gpml")
# 重建时间
reconstruction_time = 50
# 保存文件名
export_filename = "6-Exported_reconstructed_flowlines_output_{0}Ma.shp".format(reconstruction_time)
# 重建与保存
pygplates.reconstruct(flowline_features, rotation_model, export_filename, reconstruction_time,
                      reconstruct_type=pygplates.ReconstructType.flowline)

查询重建的flowline

示例代码

import pygplates

# 指定两个起始点
seed_points = pygplates.MultiPointOnSphere(
    [
        (-35.547600, -17.873000),
        (-46.208000, -13.623000)
    ])
# 时间取样列表
times = range(0, 91, 5)
# 创建一个flowline特征
flowline_feature = pygplates.Feature.create_flowline(
        seed_points,
        times,
        valid_time=(max(times), min(times)),
        left_plate=201,
        right_plate=701)
# 加载一个板块运动模型
rotation_model = pygplates.RotationModel("Muller2019-Young2019-Cao2020_CombinedRotations.rot")
# 重建时间
reconstruction_time = 50
# 重建flowline特征
reconstructed_flowlines = []
pygplates.reconstruct(flowline_feature, rotation_model, reconstructed_flowlines, reconstruction_time,
    reconstruct_type=pygplates.ReconstructType.flowline)
# 遍历所有flowline
for reconstructed_flowline in reconstructed_flowlines:
    # 输出flowline的左右板块ID
    print("flowline: left %d, right %d at %fMa" % (
        reconstructed_flowline.get_feature().get_left_plate(),
        reconstructed_flowline.get_feature().get_right_plate(),
        reconstruction_time
    ))
    # 输出重建起始点
    print("  reconstructed seed point: lat: %f, lon: %f" % reconstructed_flowline.get_reconstructed_seed_point().to_lat_lon())
    flowline_times = reconstructed_flowline.get_feature().get_times()
    print("  left flowline:")
    # 遍历左边的点,第一个点是最晚的,最后一个点是最早的,所以我们反转顺序
    for point_index, left_point in enumerate(reversed(reconstructed_flowline.get_left_flowline())):
        lat, lon = left_point.to_lat_lon()
        # 第一个点是最早的,最后一个点是重建起始点
        time = flowline_times[-1-point_index]
        print("  time: %f, lat: %f, lon: %f" % (time, lat, lon))
    print("  right flowline:")
    for point_index, right_point in enumerate(reversed(reconstructed_flowline.get_right_flowline())):
        lat, lon = right_point.to_lat_lon()
        # 第一个点是最早的,最后一个点是重建起始点
        time = flowline_times[-1-point_index]
        print("  time: %f, lat: %f, lon: %f" % (time, lat, lon))

你可能感兴趣的:(pyGPlates,python,pygplates)