コード例 #1
0
def planar_daylight(strike,dip,to_plot=True,facecolor='none',edgecolor='b',segments=100):
    """
    Draws the planar daylight envelope (cone) with respect to a 
    slope face with a given strike and dip.
    
    Parameters
    ----------
    strike : number or sequence of numbers
        The strike of the plane(s) in degrees, with dip direction indicated by
        the azimuth (e.g. 315 vs. 135) specified following the "right hand
        rule".
    dip : number or sequence of numbers
        The dip of the plane(s) in degrees.
        
    Returns
    -------
    pde_plunge, pde_bearing, pde_angle: arrays
        Arrays of plunges, bearings, and angles of the planar daylight envelopes (cones).
    """

    strikes, dips = np.atleast_1d(strike, dip)
#    calculating plunge and bearing of pole to plane
    p_plunge, p_bearing=st.pole2plunge_bearing(strikes, dips)
#    calculating plunge, bearing, and angle of planar daylight envelope (cone)
    pde_plunge=45+p_plunge/2.
    pde_bearing=p_bearing
    pde_angle=45-p_plunge/2.-10**-9
#    plotting daylight envelope
    if to_plot:
        ax=plt.gca()
        ax.cone(pde_plunge,pde_bearing, pde_angle,facecolor=facecolor,edgecolor=edgecolor)#,label='pDE')
    return pde_plunge,pde_bearing,pde_angle
コード例 #2
0
ファイル: test_analysis.py プロジェクト: ivn888/mplstereonet
    def test_sd_input(self):
        for strike in range(0, 100, 10):
            for dip in range(0, 370, 10):
                dips = dip + np.array([-10, -5, 0, 5, 10])
                strikes = strike + np.array([0, 0, 0, 0, 0])

                plu, azi, vals = mplstereonet.eigenvectors(strikes, dips)

                plunge, bearing = mplstereonet.pole2plunge_bearing(strike, dip)
                self.compare_plungebearing(plunge, bearing, plu[0], azi[0])
                assert np.allclose(vals, [1.09433342, 1.67776947e-02, 0])
コード例 #3
0
    def test_sd_input(self):
        for strike in range(0, 100, 10):
            for dip in range(0, 370, 10):
                dips = dip + np.array([-10, -5, 0, 5, 10])
                strikes = strike + np.array([0, 0, 0, 0, 0])

                plu, azi, vals = mplstereonet.eigenvectors(strikes, dips)

                plunge, bearing = mplstereonet.pole2plunge_bearing(strike, dip)
                self.compare_plungebearing(plunge, bearing, plu[0], azi[0])
                assert np.allclose(vals, [1.09433342, 1.67776947e-02, 0])
コード例 #4
0
    def fitfold(self):
        strike, dip = self.get_strike_dip()
                # discards the old graph
        self.ax.hold(True)
        fit_strike,fit_dip = mplstereonet.fit_girdle(strike,dip)
        lon, lat = mplstereonet.pole(fit_strike, fit_dip)
        (plunge,), (bearing,) = mplstereonet.pole2plunge_bearing(fit_strike, fit_dip)       
        template = u'Plunge / Direction of Fold Axis\n{:02.0f}\u00b0/{:03.0f}\u00b0'
        self.ax.annotate(template.format(plunge, bearing), ha='center', va='bottom',
            xy=(lon, lat), xytext=(-50, 20), textcoords='offset points',
            arrowprops=dict(arrowstyle='-|>', facecolor='black'))

        self.ax.plane(fit_strike, fit_dip, color='red', lw=2)
        self.ax.pole(fit_strike, fit_dip, marker='o', color='red', markersize=14)
        self.canvas.draw() 
コード例 #5
0
def fisher_fit(strike, dip):
    """
    fit (strike, dip) dataset using fisher distribution

    :param strike: array
    :param dip: array
    :return:
    kappa: float
        -fisher constant
    resultant_orien: (float, float)
        -resultant orientation
    """
    plunge, bearing = mplstereonet.pole2plunge_bearing(strike, dip)
    resultant_v, (r_value, theta_confi,
                  kappa) = mplstereonet.find_fisher_stats(plunge, bearing)
    resultant_orien = mplstereonet.plunge_bearing2pole(resultant_v[0],
                                                       resultant_v[1])
    return kappa, resultant_orien
コード例 #6
0
ファイル: gtstereo.py プロジェクト: lachlangrose/GeoTools
    def fitfold(self):
        strike = []
        dip = []
        for f in self.layer.selectedFeatures():
            dip.append(f['dip']) #self.dip_combo.currentText()])
            strike.append(f['strike'])#self.strike_combo.currentText()]) 
        # discards the old graph
        self.ax.hold(True)
        fit_strike,fit_dip = mplstereonet.fit_girdle(strike,dip)
        lon, lat = mplstereonet.pole(fit_strike, fit_dip)
        (plunge,), (bearing,) = mplstereonet.pole2plunge_bearing(fit_strike, fit_dip)       
        template = u'P/B of Fold Axis\n{:02.0f}\u00b0/{:03.0f}\u00b0'
        self.ax.annotate(template.format(plunge, bearing), ha='center', va='bottom',
            xy=(lon, lat), xytext=(-50, 20), textcoords='offset points',
            arrowprops=dict(arrowstyle='-|>', facecolor='black'))

        print fit_strike, fit_dip
        self.ax.plane(fit_strike, fit_dip, color='red', lw=2)
        self.ax.pole(fit_strike, fit_dip, marker='o', color='red', markersize=14)
        self.canvas.draw() 
コード例 #7
0
def plot_bedding_stereonets(orientations_clean,geology,c_l,display):
    import mplstereonet
    import matplotlib.pyplot as plt
    
    orientations = gpd.sjoin(orientations_clean, geology, how="left", op="within")
    
    groups=geology[c_l['g']].unique()
    codes=geology[c_l['c']].unique()
    print("All observations n=",len(orientations_clean))
    print('groups',groups,'\ncodes',codes)

    if(display):
        fig, ax = mplstereonet.subplots(figsize=(7,7))
    if(c_l['otype']=='dip direction'):
        strikes = orientations[c_l['dd']].values -90
    else:
        strikes = orientations[c_l['dd']].values
       
    dips = orientations[c_l['d']].values
    if(display):
        cax = ax.density_contourf(strikes, dips, measurement='poles')
        ax.pole(strikes, dips, markersize=5, color='w')
        ax.grid(True)
        text = ax.text(2.2, 1.37, "All data", color='b')
        plt.show()
    group_girdle={}

    for gp in groups:
        
        all_orientations=orientations[orientations[c_l['g']]==gp]
        if(len(all_orientations)==1):
            print("----------------------------------------------------------------------------------------------------------------------")
            print(gp,"observations has 1 observation")
            group_girdle[gp]=(-999,-999,1)
            
        elif(len(all_orientations)>0):
            print("----------------------------------------------------------------------------------------------------------------------")
            print(gp,"observations n=",len(all_orientations))
            if(display):
                fig, ax = mplstereonet.subplots(figsize=(5,5))
            if(c_l['otype']=='dip direction'):
                strikes = all_orientations[c_l['dd']].values -90
            else:
                strikes = all_orientations[c_l['dd']].values
               
            dips = all_orientations[c_l['d']].values
            if(display):
                cax = ax.density_contourf(strikes, dips, measurement='poles')
                ax.pole(strikes, dips, markersize=5, color='w')
                ax.grid(True)
                text = ax.text(2.2, 1.37,gp, color='b')
                plt.show()
            fit_strike, fit_dip = mplstereonet.fit_girdle(strikes, dips)
            (plunge,), (bearing,) = mplstereonet.pole2plunge_bearing(fit_strike, fit_dip)            
            group_girdle[gp]=(plunge, bearing,len(all_orientations))
            print('strike/dip of girdle',fit_strike, '/', fit_dip)                
        else:
            print("----------------------------------------------------------------------------------------------------------------------")
            print(gp,"observations has no observations")
            group_girdle[gp]=(-999,-999,0)

    if(False):
        for gp in groups:

            print("----------------------------------------------------------------------------------------------------------------------")
            print(gp)
            #display(all_sorts2)
            ind=0
            orientations2=orientations[orientations[c_l['g']]==gp]
    
            for code in codes:
                orientations3=orientations2[orientations2[c_l['c']]==code]
                ind2=int(fmod(ind,3))
                if(len(orientations3)>0):
                    print(code,"observations n=",len(orientations3))
                #display(orientations2)
                if(len(orientations3)>0):
                    if(ind2==0):
                        fig, ax = mplstereonet.subplots(1,3,figsize=(15,15))
                    if(c_l['otype']=='dip direction'):
                        strikes = orientations3[c_l['dd']].values -90
                    else:
                        strikes = orientations3[c_l['dd']].values
    
                    dips = orientations3[c_l['d']].values
    
                    cax = ax[ind2].density_contourf(strikes, dips, measurement='poles')
                    ax[ind2].pole(strikes, dips, markersize=5, color='w')
                    ax[ind2].grid(True)
                    #fig.colorbar(cax)
                    text = ax[ind2].text(2.2, 1.37, code, color='b')
                    
                    # Fit a plane to the girdle of the distribution and display it.
                    fit_strike, fit_dip = mplstereonet.fit_girdle(strikes, dips)
                    print('strike/dip of girdle',fit_strike, '/', fit_dip)                
                   
                    if(ind2==2):
                        plt.show()
    
                    ind=ind+1
                    
    
            if(ind>0 and not ind2==2):
                plt.show()
    return(group_girdle)
コード例 #8
0
s, d = mplstereonet.plunge_bearing2pole(real_plunge, real_bearing)
lon, lat = mplstereonet.plane(s, d, segments=num_points)
lon += np.random.normal(0, np.radians(15), lon.shape)
lat += np.random.normal(0, np.radians(15), lat.shape)
strike, dip = mplstereonet.geographic2pole(lon, lat)

# Plot the raw data and contour it:
fig, ax = mplstereonet.subplots()
ax.density_contourf(strike, dip, cmap='gist_earth')
ax.density_contour(strike, dip, colors='black')
ax.pole(strike, dip, marker='.', color='black')

# Fit a plane to the girdle of the distribution and display it.
fit_strike, fit_dip = mplstereonet.fit_girdle(strike, dip)
ax.plane(fit_strike, fit_dip, color='red', lw=2)
ax.pole(fit_strike, fit_dip, marker='o', color='red', markersize=14)

# Add some annotation of the result
lon, lat = mplstereonet.pole(fit_strike, fit_dip)
(plunge, ), (bearing, ) = mplstereonet.pole2plunge_bearing(fit_strike, fit_dip)
template = u'P/B of Fold Axis\n{:02.0f}\u00b0/{:03.0f}\u00b0'
ax.annotate(template.format(plunge, bearing),
            ha='center',
            va='bottom',
            xy=(lon, lat),
            xytext=(-50, 20),
            textcoords='offset points',
            arrowprops=dict(arrowstyle='-|>', facecolor='black'))

plt.show()
コード例 #9
0
ファイル: evaluate.py プロジェクト: ricsatjr/rockinematics
def planarFailure(sstr, sdip, jfriction, jstr, jdip, to_plot=False):
    """
    Evaluates planar failure of joints vis-a-vis a slope face 
    with a given strike and dip, such that a joint's pole plots 1) within the
    planar daylight envelope, and 2) outside the planar friction envelope
    
    Parameters
    ----------
    sstr : int or float
        The strike of the slope face in degrees, with dip direction indicated by
        the azimuth (e.g. 315 vs. 135) specified following the "right hand
        rule".
    sdip : int or float
        The dip of the slope face in degrees.
    jfriction : int, float, or array of int or float
        The friction angle of the joint plane in degrees.
    jstr : int, float, or array of int or float
        The strike of the joint plane in degrees, with dip direction indicated by
        the azimuth (e.g. 315 vs. 135) specified following the "right hand
        rule".
    jdip : int, float, or array of int or float
        The dip of the joint plane in degrees.
        
    Returns
    -------
    planarFail: boolean array of size = len(np.atleast_1d(jstr)) 
        Indicates if corresponding joints will allow planar failure.
    """
    #    ensure jstr, jdip, and jfriction are 1-d arrays
    jstr, jdip = np.atleast_1d(jstr, jdip)
    try:
        len(jfriction)
        uniformFriction = False
    except:
        jfriction = jfriction * (np.ones(len(jstr)))
        uniformFriction = True


#    determinde daylight and friction envelopes
    pde_plunge, pde_bearing, pde_angle = env.planar_daylight(sstr, sdip, False)
    pfe_plunge, pfe_bearing, pfe_angle = env.planar_friction(jfriction, False)
    #    convert joint plane (strike-dip) to pole (plunge-bearing)
    jplunge, jbearing = st.pole2plunge_bearing(jstr, jdip)
    #    evaluate if joint poles are contained within daylight and friction envelopes (cones)
    inDaylight = np.empty(len(jstr))
    outFriction = np.empty(len(jstr))
    for a in range(len(jstr)):
        inDaylight[a] = line_in_cone(pde_plunge, pde_bearing, pde_angle,
                                     jplunge[a], jbearing[a])
        outFriction[a] = ~line_in_cone(pfe_plunge[a], pfe_bearing[a],
                                       pfe_angle[a], jplunge[a], jbearing[a])
    planarFail = (inDaylight == True) & (outFriction == True)
    #    plotting results
    if uniformFriction and to_plot:
        env.setup_axes(sstr,
                       sdip,
                       jfriction[0],
                       failure='planar',
                       to_plot=True)
        plt.gca().pole(jstr[~planarFail],
                       jdip[~planarFail],
                       color='0.5',
                       marker='.')
        plt.gca().pole(jstr[planarFail],
                       jdip[planarFail],
                       color='r',
                       marker='.')
    return planarFail
コード例 #10
0
ファイル: evaluate.py プロジェクト: ricsatjr/rockinematics
def topplingFailure(sstr, sdip, jfriction, jstr, jdip, to_plot=False):
    """
    Evaluates toppling failure of joints vis-a-vis a slope face 
    with a given strike and dip, such that a joint's pole plots 1) within the
    toppling slip limits, and 2) on the convex side of the toppling friction 
    envelope
    
    Parameters
    ----------
    sstr : int or float
        The strike of the slope face in degrees, with dip direction indicated by
        the azimuth (e.g. 315 vs. 135) specified following the "right hand
        rule".
    sdip : int or float
        The dip of the slope face in degrees.
    jfriction : int, float, or array of int or float
        The friction angle of the joint plane in degrees.
    jstr : int, float, or array of int or float
        The strike of the joint plane in degrees, with dip direction indicated by
        the azimuth (e.g. 315 vs. 135) specified following the "right hand
        rule".
    jdip : int, float, or array of int or float
        The dip of the joint plane in degrees.
        
    Returns
    -------
    topplingFail: boolean array of size = len(np.atleast_1d(jstr)) 
        Indicates if corresponding joints will allow toppling failure.
    """
    #    ensure jstr, jdip, and jfriction are 1-d arrays
    jstr, jdip = np.atleast_1d(jstr, jdip)
    try:
        len(jfriction)
        uniformFriction = False
    except:
        jfriction = jfriction * (np.ones(len(jstr)))
        uniformFriction = True


#    determine daylight and friction envelopes
    tsl_plunge, tsl_bearing, tsl_angle = env.toppling_slipLimits(
        sstr, sdip, False)
    tfe_strike, tfe_dip = env.toppling_friction(sstr, sdip, jfriction, False)
    #    convert joint plane (strike-dip) to pole (plunge-bearing)
    jplunge, jbearing = st.pole2plunge_bearing(jstr, jdip)
    #    evaluate if joint poles are contained within slip limits (cones) and friction envelope (great circles)
    inSlipLimit1 = np.empty(len(jstr))
    inSlipLimit2 = np.empty(len(jstr))
    convexFriction = np.empty(len(jstr))
    for a in range(len(jstr)):
        inSlipLimit1[a] = ~line_in_cone(tsl_plunge, tsl_bearing, tsl_angle,
                                        jplunge[a], jbearing[a])
        inSlipLimit2[a] = ~line_in_cone(tsl_plunge, tsl_bearing + 180,
                                        tsl_angle, jplunge[a], jbearing[a])
        convexFriction[a] = line_above_plane(tfe_strike[0], tfe_dip[a],
                                             jplunge[a], jbearing[a])
    topplingFail = ((inSlipLimit1 == True) & (inSlipLimit2 == True) &
                    (convexFriction == True))
    #    plotting results
    if uniformFriction and to_plot:
        env.setup_axes(sstr,
                       sdip,
                       jfriction[a],
                       failure='toppling',
                       to_plot=True)
        plt.gca().pole(jstr[~topplingFail],
                       jdip[~topplingFail],
                       color='0.5',
                       marker='.')
        plt.gca().pole(jstr[topplingFail],
                       jdip[topplingFail],
                       color='r',
                       marker='.')
    return topplingFail
コード例 #11
0
# In the end, we'll have strikes and dips as measured from bedding in the fold.
# *strike* and *dip* below would normally be your input.
num_points = 200
real_bearing, real_plunge = 300, 5
s, d = mplstereonet.plunge_bearing2pole(real_plunge, real_bearing)
lon, lat = mplstereonet.plane(s, d, segments=num_points)
lon += np.random.normal(0, np.radians(15), lon.shape)
lat += np.random.normal(0, np.radians(15), lat.shape)
strike, dip = mplstereonet.geographic2pole(lon, lat)

# Plot the raw data and contour it:
fig, ax = mplstereonet.subplots()
ax.density_contourf(strike, dip, cmap='gist_earth')
ax.density_contour(strike, dip, colors='black')
ax.pole(strike, dip, marker='.', color='black')

# Fit a plane to the girdle of the distribution and display it.
fit_strike, fit_dip = mplstereonet.fit_girdle(strike, dip)
ax.plane(fit_strike, fit_dip, color='red', lw=2)
ax.pole(fit_strike, fit_dip, marker='o', color='red', markersize=14)

# Add some annotation of the result
lon, lat = mplstereonet.pole(fit_strike, fit_dip)
(plunge,), (bearing,) = mplstereonet.pole2plunge_bearing(fit_strike, fit_dip)
template = u'P/B of Fold Axis\n{:02.0f}\u00b0/{:03.0f}\u00b0'
ax.annotate(template.format(plunge, bearing), ha='center', va='bottom',
            xy=(lon, lat), xytext=(-50, 20), textcoords='offset points',
            arrowprops=dict(arrowstyle='-|>', facecolor='black'))

plt.show()