Spaces:
Build error
Build error
single dipping layer
Browse files
app.py
CHANGED
|
@@ -1,114 +1,44 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
-
import bruges as b
|
| 3 |
from einops import repeat
|
| 4 |
import numpy as np
|
| 5 |
-
from bruges.reflection.reflection import zoeppritz_rpp as zrpp
|
| 6 |
import pandas as pd
|
| 7 |
import altair as alt
|
| 8 |
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
-
def
|
| 11 |
-
'''compute pressure velocity from
|
| 12 |
-
shear velocity and poissons ratio'''
|
| 13 |
-
return np.sqrt((vp**2 - 2*poisson*vp**2)/(2 - 2*poisson))
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
def gardners(vp):
|
| 17 |
-
'''compute density via gardners relation'''
|
| 18 |
-
return 1000*0.31*np.power(vp, 0.25)/1.33
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
def cartesian_product(*arrays):
|
| 22 |
-
'''return cartesion product of several arrays'''
|
| 23 |
-
ndim = len(arrays)
|
| 24 |
-
return (np.stack(np.meshgrid(*arrays), axis=-1)
|
| 25 |
-
.reshape(-1, ndim))
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
def loop_zrpp(vp1,vs1,rho1,vp2,vs2,rho2,theta1):
|
| 29 |
-
'''compute reflectivity for many values of
|
| 30 |
-
input parameters.
|
| 31 |
-
"1" denotes layer one, "2" denotes layer two.
|
| 32 |
-
outside this function, I tend to use 0-indexing though.'''
|
| 33 |
-
refl_loop = np.empty(len(vp1), dtype=complex)
|
| 34 |
-
for i in range(vp1.shape[0]):
|
| 35 |
-
refl_loop[i] = zrpp(vp1=vp1[i], vs1=vs1[i], rho1=rho1[i],
|
| 36 |
-
vp2=vp2[i], vs2=vs2[i], rho2=rho2[i],
|
| 37 |
-
theta1=theta1[i])
|
| 38 |
-
return refl_loop
|
| 39 |
-
|
| 40 |
-
def wb_ava_fig(vwater=1520., rwater = 1025., poissons=0.49):
|
| 41 |
'''
|
| 42 |
AVO: Amplitude Versus Offset
|
| 43 |
AVA: Amplitude Versus Angle
|
| 44 |
compute AVA at the WB for a range of values,
|
| 45 |
then plot using altair
|
| 46 |
'''
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
VP1 = VP1
|
| 61 |
-
VS1 = vs_from_poisson(VP1,POI)
|
| 62 |
-
RH1 = gardners(VP1)
|
| 63 |
-
|
| 64 |
-
### Shove into a dict to pass to zrpp
|
| 65 |
-
params = {"vp1": VP0, "vs1": VS0, "rho1": RH0,
|
| 66 |
-
"vp2": VP1, "vs2": VS1, "rho2": RH1,
|
| 67 |
-
"theta1":THE}
|
| 68 |
-
|
| 69 |
-
# Compute zoeppritz equation
|
| 70 |
-
r = loop_zrpp(**params)
|
| 71 |
-
|
| 72 |
-
# Put the results into a DataFrame
|
| 73 |
-
df = pd.DataFrame({"Vp sub-WB": VP1, "Poisson_s ratio": POI, "Vs sub-WB": VS1,
|
| 74 |
-
"Angle": THE, "Amplitude": np.real(r)})
|
| 75 |
-
|
| 76 |
-
# Select only points pre-critical angle
|
| 77 |
-
df["Ang_Crit"] = np.degrees(np.arcsin(1500 / df["Vp sub-WB"].values))
|
| 78 |
-
df = df[df["Angle"] < df["Ang_Crit"]]
|
| 79 |
-
|
| 80 |
-
# Create the altair figure
|
| 81 |
-
highlight = alt.selection(type='single', on='mouseover',
|
| 82 |
-
fields=["Vp sub-WB:Q"], nearest=True)
|
| 83 |
-
|
| 84 |
-
base = alt.Chart(df).encode(
|
| 85 |
-
x="Angle",
|
| 86 |
-
y="Amplitude",
|
| 87 |
-
color="Vp sub-WB:Q",
|
| 88 |
-
tooltip=["Vp sub-WB", "Vs sub-WB", "Angle", "Amplitude"]
|
| 89 |
-
)
|
| 90 |
-
|
| 91 |
-
points = base.mark_circle().encode(
|
| 92 |
-
opacity=alt.value(0)
|
| 93 |
-
).add_selection(
|
| 94 |
-
highlight
|
| 95 |
).properties(
|
| 96 |
-
width=
|
| 97 |
-
height=
|
| 98 |
-
)
|
| 99 |
-
|
| 100 |
-
lines = base.mark_line().encode(
|
| 101 |
-
size=alt.condition(~highlight, alt.value(3), alt.value(7))
|
| 102 |
)
|
| 103 |
|
| 104 |
-
return
|
| 105 |
|
| 106 |
-
|
| 107 |
-
rwater = st.slider("Select a value for density of water", min_value=1005, max_value=1045, value=1025)
|
| 108 |
-
poissons = st.slider("Select a value for Poisson's ratio", min_value=0.4, max_value=0.5, value=0.48)
|
| 109 |
# st.write("Poisson's ratio is:", p)
|
| 110 |
|
| 111 |
|
| 112 |
-
st.altair_chart(
|
| 113 |
|
| 114 |
|
|
|
|
| 1 |
import streamlit as st
|
|
|
|
| 2 |
from einops import repeat
|
| 3 |
import numpy as np
|
|
|
|
| 4 |
import pandas as pd
|
| 5 |
import altair as alt
|
| 6 |
|
| 7 |
+
MAXDIP = 60.
|
| 8 |
+
XMAX = 30
|
| 9 |
+
YMAX = XMAX*np.tan(np.deg2rad(MAXDIP))
|
| 10 |
|
| 11 |
+
def fig_1(dip=26.6):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
'''
|
| 13 |
AVO: Amplitude Versus Offset
|
| 14 |
AVA: Amplitude Versus Angle
|
| 15 |
compute AVA at the WB for a range of values,
|
| 16 |
then plot using altair
|
| 17 |
'''
|
| 18 |
+
X = np.array([0,XMAX])
|
| 19 |
+
dipping_reflector = np.array([0,np.abs(X[0]-X[1])*np.tan(np.deg2rad(dip))])
|
| 20 |
+
|
| 21 |
+
df = pd.DataFrame({"x":X,
|
| 22 |
+
"z":dipping_reflector
|
| 23 |
+
}
|
| 24 |
+
)
|
| 25 |
+
|
| 26 |
+
lines = alt.Chart(df).mark_line().encode(
|
| 27 |
+
alt.X(field="x", type="quantitative", axis = alt.Axis(orient="top"),
|
| 28 |
+
scale=alt.Scale(domain=[0,XMAX])),
|
| 29 |
+
alt.Y(field="z", type="quantitative", scale=alt.Scale(domain=[0,YMAX],
|
| 30 |
+
reverse=True))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
).properties(
|
| 32 |
+
width=YMAX*10,
|
| 33 |
+
height=XMAX*10
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
)
|
| 35 |
|
| 36 |
+
return lines
|
| 37 |
|
| 38 |
+
refector_dip = st.slider("Set reflector dip in degrees", min_value=0.1, max_value=MAXDIP, value=26.6)
|
|
|
|
|
|
|
| 39 |
# st.write("Poisson's ratio is:", p)
|
| 40 |
|
| 41 |
|
| 42 |
+
st.altair_chart(fig_1(refector_dip))
|
| 43 |
|
| 44 |
|