This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import numpy as np | |
from matplotlib import ticker, cm | |
from matplotlib.colors import LogNorm | |
import matplotlib | |
matplotlib.rc('xtick', labelsize=20) | |
matplotlib.rc('ytick', labelsize=20) | |
m,h = np.meshgrid(np.logspace(-3,1,100),np.logspace(1,3.5,100)) | |
T = h/m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
rho = 910 | |
g = 9.8 | |
h = 100 | |
alpha = 5 * np.pi/180 | |
y = np.linspace(0,100) | |
dy = np.mean(np.diff(y)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
wavelength = 100 #m | |
c = 4000 # m/s | |
z = np.linspace(-0.5*wavelength,0,100) #m | |
k = 2*np.pi/wavelength | |
up = np.cos(k*z) # phasor; assume exp(i omega t) dependence |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Demo SVD for "PCA" analysis -- using DAS data. | |
See https://stats.stackexchange.com/a/134283 for PCA v SVD distinction | |
''' | |
import h5py | |
import matplotlib.pyplot as plt | |
from scipy.sparse.linalg import svds | |
import numpy as np |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Pull the data for Figure 2 of Olsen and Nettles (2019), | |
Constraints on Terminus Dynamics at Greenland Glaciers From Small Glacial Earthquakes | |
https://agupubs.onlinelibrary.wiley.com/doi/full/10.1029/2019JF005054 | |
''' | |
from obspy import UTCDateTime |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The following are all shell commands that you can run from a terminal on sermeq | |
# 1. Create a new conda environment with cartopy and ipykernel: | |
conda create -n comcat --channel conda-forge python=3.9 | |
# 2. Activate that environment | |
conda activate comcat | |
# 3. Install ipykernel FOR THIS ENVIRONMENT | |
python3 -m ipykernel install --user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import numpy as np | |
import cutde.fullspace as FS | |
from scipy.spatial.transform import Rotation as R | |
# Update the following four lines with well coordinates | |
obsx = np.linspace(-2,2,100) | |
obsy = np.linspace(-2,2,100) | |
obsz = np.linspace(-2,2,100) | |
pts = np.array([obsx, obsy, 0 * obsz]).reshape((3, -1)).T.copy() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
data = [[ 66386, 174296, 75131, 577908, 32015], | |
[ 58230, 381139, 78045, 99308, 160454], | |
[ 89135, 80552, 152558, 497981, 603535], | |
[ 78415, 81858, 150656, 193263, 69638], | |
[139361, 331509, 343164, 781380, 52269]] | |
columns = ('Region 1', 'Region 2', 'Region 3', 'Region 4', 'Region 5') | |
rows = ('M','F','E','X','X') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import h5py | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from scipy.signal import butter, filtfilt | |
path = "/data/data2/south-data-ejm/hdd/South-C1-LR-95km-P1kHz-GL50m-SP2m-FS200Hz_2021-11-01T16_09_15-0700/" | |
file = "South-C1-LR-95km-P1kHz-GL50m-SP2m-FS200Hz_2021-11-01T231114Z.h5" | |
f = h5py.File(path + file, 'r') | |
data = f['Acquisition']['Raw[0]']['RawData'][:, :].astype('int64') | |
f.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
plt.subplots() | |
y = (158,141,90) | |
x = ("Farinotti","Milan","Edasi") | |
yr = (41,40,38) | |
plt.errorbar(x,y,yerr=yr,linestyle='None',marker='o') | |
plt.grid() |