def test_parse_azimuth(self):
     data = [('N30E', 30),
             ('E30N', 60),
             ('E30S', 120),
             ('S80E', 100),
             ('S10W', 190),
             ('W10S', 260),
             ('W30N', 300),
             ('N10E', 10),
             ('N10W', 350),
             ('N 10 W', 350),
             ('310', 310),
             (' 310 ', 310),
             ('32.5', 32.5),
             ]
     for strike, azi in data:
         assert azi == mplstereonet.parse_azimuth(strike)
Beispiel #2
0
 def test_parse_azimuth(self):
     data = [
         ('N30E', 30),
         ('E30N', 60),
         ('E30S', 120),
         ('S80E', 100),
         ('S10W', 190),
         ('W10S', 260),
         ('W30N', 300),
         ('N10E', 10),
         ('N10W', 350),
         ('N 10 W', 350),
         ('310', 310),
         (' 310 ', 310),
         ('32.5', 32.5),
     ]
     for strike, azi in data:
         assert azi == mplstereonet.parse_azimuth(strike)
Beispiel #3
0
import matplotlib.pyplot as plt
import numpy as np
import mplstereonet
from six.moves import input as raw_input
import csv

# Create equal area stereonet
fig = plt.figure()
ax = fig.add_subplot(111, projection='stereonet')

strike = raw_input("Enter a strike in azimuth (i.e. 212) or quadrant (i.e. N30W) format: ")
dip = input("Enter a dip value in degrees and press ENTER: ")

# Parse strike entry and convert to azimuth as necessary.
# Print for testing & verification
azimuth = int(mplstereonet.parse_azimuth(strike))
print("Azimuth bearing: ", azimuth)

# Calculate dip direction per RHR.
# This is supposedly included with mplstereonet as strike2_dipdirection, but isn't working
dip_direction = azimuth + 90
if dip_direction > 360:
    dip_direction -= 360
print("Dip ", dip, " degrees, Dip Direction: ", dip_direction, " degrees") # Print dip angle and direction (in azimuth)

# Plot everyt)hing
ax.plane(azimuth, dip, 'g-', linewidth=2)
ax.pole(azimuth, dip, 'g^', markersize=15, marker="x")
ax.rake(azimuth, dip, -25)

ax.grid() # This draws the grid on the stereonet
Beispiel #4
0
 def test_parse_azimuth_errors(self):
     data = ['30NW', '30S', 'A40N', 'N10S', 'S80N', 'E10W', 'W30E']
     for quad in data:
         with pytest.raises(ValueError):
             mplstereonet.parse_azimuth(quad)
# Read strike and dip data from file, skipping headers
with open('strikesdips.csv','r') as csvfile:
    csvreader = csv.reader(csvfile)
    headers = next(csvreader) # grabs header row
    for row in csvreader:
        strikes.append(row[0])
        dips.append((int(row[1])))

# Initializing a couple things
azimuths = []
strikesLength = len(strikes)
# dipsLength = len(dips) # This is unnecessary at the moment, unused

# Parse all strike inputs and convert to azimuth if necessary.
for i in range(strikesLength):
    azimuths.append(mplstereonet.parse_azimuth(strikes[i]))

# Generate color map for entries
# See https://matplotlib.org/gallery/color/colormap_reference.html &
# https://matplotlib.org/tutorials/colors/colormaps.html
cmap = plt.cm.get_cmap("hsv", strikesLength+1)

# Plot poles or planes per user input
poles = raw_input("Do you want to plot poles instead of planes? (Y/N): ")
if poles in ['Y','y','yes']:
    i=0
    for i in range(strikesLength):
        ax.pole(azimuths[i], dips[i], 'g^', marker='o', markersize=8, color=cmap(i))
if poles in ['N','n','no']:
    i=0
    for i in range(strikesLength):
 def test_parse_azimuth_errors(self):
     data = ['30NW', '30S', 'A40N', 'N10S', 'S80N', 'E10W', 'W30E']
     for quad in data:
         with pytest.raises(ValueError):
             mplstereonet.parse_azimuth(quad)