Skip to main content
Geosciences LibreTexts

4.6: Relative Plate Velocity Jupyter Notebook

  • Page ID
    11879
  • Instructions

    • To use this page, read the text between each of the python code windows, then press RUN to execute the code in the box.
    • It is necessary to run each of the boxes in order.
    • Don't click restart in the cells unless you come back to the top of the page and start over.
    • If you modify the code, this modification will not remain after you leave or refresh this page.
    • You must run simulations/cells that require user input to completion. Make sure you see the Message informing you a cell is complete before continuing to the next cell. Here's why you must do this:
      • These cells may not be re-run until the simulation is completed, otherwise no output will be generated.
      • All following cells will not run until the user input cell is completed.
    • For Dropdown Menus: You do not need to rerun the cells with the menu to change your selection. However, you must rerun all of the following cells to implement the change.

    Be patient, some times it can take 1-2 minutes for the juypter kernel to start.

    An example about relative plate velocities.

    Key Questions: Consider these as you work your way through this page.

    Holding Plate A fixed:

    • What is the plate boundary type between Plates A and B?
    • What is the relative velocity of Plate B with respect to Plate A?

    Holding Plate B fixed:

    • Has the plate boundary type changed?
    • What is the relative velocity of Plate A with respect to Plate B?

    First, let's import the necessary libraries.

    import numpy as np
    import matplotlib.pyplot as plt
    
    print('The libraries are imported')

    Now let's plot our plates. The first portion of this code will ask you for the plate velocities and their directions. Directions are given in azimuth in degrees measured clockwise from north (e.g., south is 180). Then it fills in the two plates and plots your chosen velocity as vectors. At the bottom of the graph is the list of velocity components, you will need these for the key questions. Run this cell, and answer the key questions.

    print('Please enter the absolute plate velocity for plate A between 0 and 10 cm/yr:')
    va = float(input())
    while va <= 0 or va > 10:
        print('Invalid Velocity, please enter a velocity between 0 and 10 cm/yr:')
        va = float(input())
        
    print('Please enter the azimuth of the plate velocity between 0 and 360 degrees:')
    aza = float(input())
    while aza < 0 or aza > 360:
        print('Invalid Azimuth: please enter a value between 0 and 360 degrees')
        aza = float(input())
        
    print('Please enter the absolute plate velocity for plate B between 0 and 10 cm/yr:')
    vb = float(input())
    while vb <= 0 or vb > 10:
        print('Invalid Velocity, please enter a velocity between 0 and 10 cm/yr:')
        vb = float(input())
        
    print('Please enter the azimuth of the plate velocity between 0 and 360 degrees:')
    azb = float(input())
    while azb < 0 or azb > 360:
        print('Invalid Azimuth: please enter a value between 0 and 360 degrees')
        azb = float(input())
        
    x0 = np.arange(0.5,10.5,2.5)
    x1 = np.arange(10.5,20.5,2.5)
    X0,Y0 = np.meshgrid(x0,x0)
    X1,Y1 = np.meshgrid(x1,x0)
    V1X = va * np.sin(np.radians(aza))
    V1Y = va * np.cos(np.radians(aza))
    V2X = vb * np.sin(np.radians(azb))
    V2Y = vb * np.cos(np.radians(azb))
    
    bbox = dict(boxstyle ="round", fc = '1')
    
    fig, ax = plt.subplots(figsize=(14,7))
    ax.fill_betweenx((0,10),0,10,color = 'yellow')
    ax.fill_betweenx((0,10),10,20,color = 'lightsteelblue')
    ax.vlines(10,0,10,color='red')
    ax.quiver(X0,Y0,V1X,V1Y,headwidth=5,scale=100,width = 0.005)
    ax.quiver(X1,Y1,V2X,V2Y,headwidth=5,scale=100,width = 0.005)
    ax.set_xlim(0,20)
    ax.set_ylim(0,10)
    ax.set_title('Plate Motions')
    ax.axis('off')
    ax.annotate('Plate A',(.5,9.5),bbox=bbox,fontsize=13)
    ax.annotate('Plate B',(10.5,9.5),bbox=bbox,fontsize=13)
    ax.text(0,-1,'Velocity Components (cm/yr): Va_x = '+'{:.3f}'.format(V1X) +', Va_y = '+'{:.3f}'.format(V1Y)+', Vb_x = '+'{:.3f}'.format(V2X)+', Vb_y = '+'{:.3f}'.format(V2Y),bbox=bbox,fontsize=13)
    plt.show()
    
    print('The simulation is complete, please answer the key questions')

    Key Questions: Consider these as you work your way through this page.

    Holding Plate A fixed:

    • What is the plate boundary type between Plates A and B?
    • What is the relative velocity of Plate B with respect to Plate A?

    Holding Plate B fixed:

    • Has the plate boundary type changed?
    • What is the relative velocity of Plate A with respect to Plate B?