Skip to content

Commit

Permalink
Getting notebooks working and some cleanup to address usability and m…
Browse files Browse the repository at this point in the history
…aintainability
  • Loading branch information
medlin01GA authored and medlin01GA committed Feb 13, 2019
1 parent 474116a commit ccec142
Show file tree
Hide file tree
Showing 4 changed files with 989 additions and 487 deletions.
31 changes: 31 additions & 0 deletions seismic/xcorqc/notebooks/analytic_plot_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import math
import numpy as np
from mpl_toolkits.basemap import Basemap
from shapely.geometry import Polygon
from descartes import PolygonPatch


def distance(origin, destination):
lat1, lon1 = origin
lat2, lon2 = destination
radius = 6371 # km

dlat = math.radians(lat2-lat1)
dlon = math.radians(lon2-lon1)
a = math.sin(dlat/2) * math.sin(dlat/2) + math.cos(math.radians(lat1)) \
* math.cos(math.radians(lat2)) * math.sin(dlon/2) * math.sin(dlon/2)
c = 2 * math.atan2(math.sqrt(a), math.sqrt(1-a))
d = radius * c

return d


def drawBBox(minLon, minLat, maxLon, maxLat, bm, **kwargs):
bblons = np.array([minLon, maxLon, maxLon, minLon, minLon])
bblats = np.array([minLat, minLat, maxLat, maxLat, minLat])

x, y = bm( bblons, bblats )
xy = zip(x,y)
poly = Polygon(xy)
bm.ax.add_patch(PolygonPatch(poly, **kwargs))

431 changes: 0 additions & 431 deletions seismic/xcorqc/notebooks/stationAnalytics.ipynb

This file was deleted.

0 comments on commit ccec142

Please sign in to comment.