earthsciencekit 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- earthsciencekit/__init__.py +6 -0
- earthsciencekit/_validation.py +62 -0
- earthsciencekit/atmosphere/__init__.py +57 -0
- earthsciencekit/atmosphere/core/__init__.py +5 -0
- earthsciencekit/atmosphere/core/base.py +10 -0
- earthsciencekit/atmosphere/systems/__init__.py +1 -0
- earthsciencekit/atmosphere/systems/dynamics.py +208 -0
- earthsciencekit/atmosphere/systems/hydrostatics.py +214 -0
- earthsciencekit/atmosphere/systems/moisture.py +162 -0
- earthsciencekit/atmosphere/systems/thermodynamics.py +222 -0
- earthsciencekit/atmosphere/tests/__init__.py +0 -0
- earthsciencekit/atmosphere/tests/test_models.py +741 -0
- earthsciencekit/atmosphere/tests/test_physics.py +81 -0
- earthsciencekit/atmosphere/visualizers/__init__.py +9 -0
- earthsciencekit/climate/__init__.py +63 -0
- earthsciencekit/climate/core/__init__.py +5 -0
- earthsciencekit/climate/core/base.py +10 -0
- earthsciencekit/climate/systems/__init__.py +1 -0
- earthsciencekit/climate/systems/carbon.py +76 -0
- earthsciencekit/climate/systems/forcing.py +124 -0
- earthsciencekit/climate/systems/radiation.py +214 -0
- earthsciencekit/climate/systems/response.py +402 -0
- earthsciencekit/climate/systems/sea_level.py +77 -0
- earthsciencekit/climate/tests/__init__.py +0 -0
- earthsciencekit/climate/tests/test_models.py +1015 -0
- earthsciencekit/climate/tests/test_physics.py +16 -0
- earthsciencekit/climate/visualizers/__init__.py +9 -0
- earthsciencekit/constants/__init__.py +23 -0
- earthsciencekit/geophysics/__init__.py +77 -0
- earthsciencekit/geophysics/core/__init__.py +5 -0
- earthsciencekit/geophysics/core/base.py +10 -0
- earthsciencekit/geophysics/systems/__init__.py +1 -0
- earthsciencekit/geophysics/systems/deformation.py +161 -0
- earthsciencekit/geophysics/systems/dynamo.py +159 -0
- earthsciencekit/geophysics/systems/figure.py +292 -0
- earthsciencekit/geophysics/systems/gravity.py +235 -0
- earthsciencekit/geophysics/systems/magnetism.py +354 -0
- earthsciencekit/geophysics/tests/__init__.py +0 -0
- earthsciencekit/geophysics/tests/test_models.py +898 -0
- earthsciencekit/geophysics/tests/test_physics.py +171 -0
- earthsciencekit/geophysics/visualizers/__init__.py +9 -0
- earthsciencekit/integrators/__init__.py +62 -0
- earthsciencekit/oceanography/__init__.py +61 -0
- earthsciencekit/oceanography/core/__init__.py +5 -0
- earthsciencekit/oceanography/core/base.py +10 -0
- earthsciencekit/oceanography/systems/__init__.py +1 -0
- earthsciencekit/oceanography/systems/circulation.py +388 -0
- earthsciencekit/oceanography/systems/hydrography.py +212 -0
- earthsciencekit/oceanography/systems/inertial.py +86 -0
- earthsciencekit/oceanography/systems/waves.py +281 -0
- earthsciencekit/oceanography/tests/__init__.py +0 -0
- earthsciencekit/oceanography/tests/test_models.py +916 -0
- earthsciencekit/oceanography/tests/test_physics.py +102 -0
- earthsciencekit/oceanography/visualizers/__init__.py +9 -0
- earthsciencekit/plate_tectonics/__init__.py +59 -0
- earthsciencekit/plate_tectonics/core/__init__.py +5 -0
- earthsciencekit/plate_tectonics/core/base.py +10 -0
- earthsciencekit/plate_tectonics/systems/__init__.py +1 -0
- earthsciencekit/plate_tectonics/systems/boundaries.py +201 -0
- earthsciencekit/plate_tectonics/systems/cooling.py +238 -0
- earthsciencekit/plate_tectonics/systems/isostasy.py +157 -0
- earthsciencekit/plate_tectonics/systems/kinematics.py +290 -0
- earthsciencekit/plate_tectonics/tests/__init__.py +0 -0
- earthsciencekit/plate_tectonics/tests/test_models.py +920 -0
- earthsciencekit/plate_tectonics/tests/test_physics.py +94 -0
- earthsciencekit/plate_tectonics/visualizers/__init__.py +9 -0
- earthsciencekit/py.typed +0 -0
- earthsciencekit/results.py +73 -0
- earthsciencekit/seismology/__init__.py +59 -0
- earthsciencekit/seismology/core/__init__.py +5 -0
- earthsciencekit/seismology/core/base.py +10 -0
- earthsciencekit/seismology/systems/__init__.py +1 -0
- earthsciencekit/seismology/systems/interfaces.py +102 -0
- earthsciencekit/seismology/systems/rays.py +221 -0
- earthsciencekit/seismology/systems/sources.py +249 -0
- earthsciencekit/seismology/systems/waves.py +268 -0
- earthsciencekit/seismology/tests/__init__.py +0 -0
- earthsciencekit/seismology/tests/test_models.py +852 -0
- earthsciencekit/seismology/tests/test_physics.py +100 -0
- earthsciencekit/seismology/visualizers/__init__.py +9 -0
- earthsciencekit/tests/__init__.py +0 -0
- earthsciencekit/tests/test_core.py +181 -0
- earthsciencekit/tests/test_relations.py +36 -0
- earthsciencekit/units/__init__.py +66 -0
- earthsciencekit/visualizers/__init__.py +45 -0
- earthsciencekit/volcanology/__init__.py +61 -0
- earthsciencekit/volcanology/core/__init__.py +5 -0
- earthsciencekit/volcanology/core/base.py +10 -0
- earthsciencekit/volcanology/systems/__init__.py +1 -0
- earthsciencekit/volcanology/systems/eruptions.py +161 -0
- earthsciencekit/volcanology/systems/geochemistry.py +226 -0
- earthsciencekit/volcanology/systems/geochronology.py +304 -0
- earthsciencekit/volcanology/systems/magma.py +190 -0
- earthsciencekit/volcanology/tests/__init__.py +0 -0
- earthsciencekit/volcanology/tests/test_models.py +485 -0
- earthsciencekit/volcanology/tests/test_physics.py +176 -0
- earthsciencekit/volcanology/visualizers/__init__.py +9 -0
- earthsciencekit-0.2.0.dist-info/METADATA +127 -0
- earthsciencekit-0.2.0.dist-info/RECORD +102 -0
- earthsciencekit-0.2.0.dist-info/WHEEL +5 -0
- earthsciencekit-0.2.0.dist-info/licenses/LICENSE +15 -0
- earthsciencekit-0.2.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
"""Waves and tides: surface and internal wave dispersion, trochoidal orbits and the equilibrium tide.
|
|
2
|
+
|
|
3
|
+
SI units unless stated otherwise.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import numpy as np
|
|
7
|
+
|
|
8
|
+
from earthsciencekit._validation import model, quantity, require
|
|
9
|
+
|
|
10
|
+
__all__ = [
|
|
11
|
+
"shallow_wave_speed",
|
|
12
|
+
"deep_wave_speed",
|
|
13
|
+
"wave_angular_frequency",
|
|
14
|
+
"deep_group_speed",
|
|
15
|
+
"reduced_gravity",
|
|
16
|
+
"internal_wave_speed",
|
|
17
|
+
"tidal_elevation",
|
|
18
|
+
"gerstner_orbit_radius",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@model
|
|
23
|
+
def shallow_wave_speed(depth, gravity):
|
|
24
|
+
"""Shallow-water gravity wave.
|
|
25
|
+
|
|
26
|
+
Long surface waves respond to water depth through gravity.
|
|
27
|
+
|
|
28
|
+
Parameters
|
|
29
|
+
----------
|
|
30
|
+
depth : float or array_like
|
|
31
|
+
m; constraint: positive.
|
|
32
|
+
gravity : float or array_like
|
|
33
|
+
m/s^2; constraint: positive.
|
|
34
|
+
|
|
35
|
+
Returns
|
|
36
|
+
-------
|
|
37
|
+
numpy scalar or ndarray
|
|
38
|
+
Model value [Pa]. Scalar input returns a NumPy scalar; arrays broadcast.
|
|
39
|
+
|
|
40
|
+
Notes
|
|
41
|
+
-----
|
|
42
|
+
Wavelength much greater than depth, small amplitude, no dispersion.
|
|
43
|
+
Equation: ``np.sqrt(gravity * depth)``.
|
|
44
|
+
Invalid, empty, nonreal or nonfinite inputs raise ValueError.
|
|
45
|
+
NumPy broadcasting applies; singular and overflowing outputs raise ValueError.
|
|
46
|
+
"""
|
|
47
|
+
depth = quantity("depth", depth, lower=0, strict_lower=True)
|
|
48
|
+
gravity = quantity("gravity", gravity, lower=0, strict_lower=True)
|
|
49
|
+
return np.sqrt(gravity * depth)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
@model
|
|
53
|
+
def deep_wave_speed(wavelength, gravity):
|
|
54
|
+
"""Deep-water phase speed.
|
|
55
|
+
|
|
56
|
+
Short waves relative to depth propagate dispersively.
|
|
57
|
+
|
|
58
|
+
Parameters
|
|
59
|
+
----------
|
|
60
|
+
wavelength : float or array_like
|
|
61
|
+
m; constraint: positive.
|
|
62
|
+
gravity : float or array_like
|
|
63
|
+
m/s^2; constraint: positive.
|
|
64
|
+
|
|
65
|
+
Returns
|
|
66
|
+
-------
|
|
67
|
+
numpy scalar or ndarray
|
|
68
|
+
Model value [Pa]. Scalar input returns a NumPy scalar; arrays broadcast.
|
|
69
|
+
|
|
70
|
+
Notes
|
|
71
|
+
-----
|
|
72
|
+
Deep-water small-amplitude gravity waves without capillarity.
|
|
73
|
+
Equation: ``np.sqrt(gravity * wavelength / (2 * np.pi))``.
|
|
74
|
+
Invalid, empty, nonreal or nonfinite inputs raise ValueError.
|
|
75
|
+
NumPy broadcasting applies; singular and overflowing outputs raise ValueError.
|
|
76
|
+
"""
|
|
77
|
+
wavelength = quantity("wavelength", wavelength, lower=0, strict_lower=True)
|
|
78
|
+
gravity = quantity("gravity", gravity, lower=0, strict_lower=True)
|
|
79
|
+
return np.sqrt(gravity * wavelength / (2 * np.pi))
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
@model
|
|
83
|
+
def wave_angular_frequency(wavenumber, depth, gravity):
|
|
84
|
+
"""Finite-depth dispersion relation.
|
|
85
|
+
|
|
86
|
+
The dispersion relation bridges shallow and deep gravity waves.
|
|
87
|
+
|
|
88
|
+
Parameters
|
|
89
|
+
----------
|
|
90
|
+
wavenumber : float or array_like
|
|
91
|
+
1/m; constraint: positive.
|
|
92
|
+
depth : float or array_like
|
|
93
|
+
m; constraint: positive.
|
|
94
|
+
gravity : float or array_like
|
|
95
|
+
m/s^2; constraint: positive.
|
|
96
|
+
|
|
97
|
+
Returns
|
|
98
|
+
-------
|
|
99
|
+
numpy scalar or ndarray
|
|
100
|
+
Model value [Pa]. Scalar input returns a NumPy scalar; arrays broadcast.
|
|
101
|
+
|
|
102
|
+
Notes
|
|
103
|
+
-----
|
|
104
|
+
Linear inviscid surface gravity wave, no current or surface tension.
|
|
105
|
+
Equation: ``np.sqrt(gravity * wavenumber * np.tanh(wavenumber * depth))``.
|
|
106
|
+
Invalid, empty, nonreal or nonfinite inputs raise ValueError.
|
|
107
|
+
NumPy broadcasting applies; singular and overflowing outputs raise ValueError.
|
|
108
|
+
"""
|
|
109
|
+
wavenumber = quantity("wavenumber", wavenumber, lower=0, strict_lower=True)
|
|
110
|
+
depth = quantity("depth", depth, lower=0, strict_lower=True)
|
|
111
|
+
gravity = quantity("gravity", gravity, lower=0, strict_lower=True)
|
|
112
|
+
return np.sqrt(gravity * wavenumber * np.tanh(wavenumber * depth))
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
@model
|
|
116
|
+
def deep_group_speed(wavelength, gravity):
|
|
117
|
+
"""Deep-water group speed.
|
|
118
|
+
|
|
119
|
+
Wave energy travels at group speed rather than crest phase speed.
|
|
120
|
+
|
|
121
|
+
Parameters
|
|
122
|
+
----------
|
|
123
|
+
wavelength : float or array_like
|
|
124
|
+
m; constraint: positive.
|
|
125
|
+
gravity : float or array_like
|
|
126
|
+
m/s^2; constraint: positive.
|
|
127
|
+
|
|
128
|
+
Returns
|
|
129
|
+
-------
|
|
130
|
+
numpy scalar or ndarray
|
|
131
|
+
Model value [Pa]. Scalar input returns a NumPy scalar; arrays broadcast.
|
|
132
|
+
|
|
133
|
+
Notes
|
|
134
|
+
-----
|
|
135
|
+
Deep-water gravity waves; group speed is half phase speed.
|
|
136
|
+
Equation: ``0.5 * np.sqrt(gravity * wavelength / (2 * np.pi))``.
|
|
137
|
+
Invalid, empty, nonreal or nonfinite inputs raise ValueError.
|
|
138
|
+
NumPy broadcasting applies; singular and overflowing outputs raise ValueError.
|
|
139
|
+
"""
|
|
140
|
+
wavelength = quantity("wavelength", wavelength, lower=0, strict_lower=True)
|
|
141
|
+
gravity = quantity("gravity", gravity, lower=0, strict_lower=True)
|
|
142
|
+
return 0.5 * np.sqrt(gravity * wavelength / (2 * np.pi))
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
@model
|
|
146
|
+
def gerstner_orbit_radius(rest_depth, amplitude, wavenumber):
|
|
147
|
+
"""Particle-orbit radius in a Gerstner trochoidal wave.
|
|
148
|
+
|
|
149
|
+
Water particles in a deep-water wave move on circles that shrink with depth.
|
|
150
|
+
|
|
151
|
+
Parameters
|
|
152
|
+
----------
|
|
153
|
+
rest_depth : float or array_like
|
|
154
|
+
m; constraint: nonnegative. Depth of the particle's orbit centre below the mean surface.
|
|
155
|
+
amplitude : float or array_like
|
|
156
|
+
m; constraint: nonnegative. Orbit radius at the surface.
|
|
157
|
+
wavenumber : float or array_like
|
|
158
|
+
1/m; constraint: positive.
|
|
159
|
+
|
|
160
|
+
Returns
|
|
161
|
+
-------
|
|
162
|
+
numpy scalar or ndarray
|
|
163
|
+
Model value [m]. Scalar input returns a NumPy scalar; arrays broadcast.
|
|
164
|
+
|
|
165
|
+
Notes
|
|
166
|
+
-----
|
|
167
|
+
Exact nonlinear deep-water solution with closed orbits and no Stokes drift; the flow has vorticity.
|
|
168
|
+
``amplitude * wavenumber`` must not exceed 1, where the surface trochoid forms a cusp.
|
|
169
|
+
A particle at rest position ``(a, b)`` moves to ``(a - r sin(k a - omega t), -b + r cos(k a - omega t))``
|
|
170
|
+
with ``omega = sqrt(g k)``.
|
|
171
|
+
Equation: ``amplitude * np.exp(-wavenumber * rest_depth)``.
|
|
172
|
+
Invalid, empty, nonreal or nonfinite inputs raise ValueError.
|
|
173
|
+
NumPy broadcasting applies; singular and overflowing outputs raise ValueError.
|
|
174
|
+
"""
|
|
175
|
+
rest_depth = quantity("rest_depth", rest_depth, lower=0)
|
|
176
|
+
amplitude = quantity("amplitude", amplitude, lower=0)
|
|
177
|
+
wavenumber = quantity("wavenumber", wavenumber, lower=0, strict_lower=True)
|
|
178
|
+
require(amplitude * wavenumber <= 1, "a trochoid steeper than amplitude * wavenumber = 1 overturns")
|
|
179
|
+
return amplitude * np.exp(-wavenumber * rest_depth)
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
@model
|
|
183
|
+
def reduced_gravity(density_difference, reference_density, gravity):
|
|
184
|
+
"""Two-layer reduced gravity.
|
|
185
|
+
|
|
186
|
+
A small density contrast slows internal waves relative to surface waves.
|
|
187
|
+
|
|
188
|
+
Parameters
|
|
189
|
+
----------
|
|
190
|
+
density_difference : float or array_like
|
|
191
|
+
kg/m^3; constraint: nonnegative.
|
|
192
|
+
reference_density : float or array_like
|
|
193
|
+
kg/m^3; constraint: positive.
|
|
194
|
+
gravity : float or array_like
|
|
195
|
+
m/s^2; constraint: positive.
|
|
196
|
+
|
|
197
|
+
Returns
|
|
198
|
+
-------
|
|
199
|
+
numpy scalar or ndarray
|
|
200
|
+
Model value [Pa]. Scalar input returns a NumPy scalar; arrays broadcast.
|
|
201
|
+
|
|
202
|
+
Notes
|
|
203
|
+
-----
|
|
204
|
+
Boussinesq small density contrast; output is acceleration.
|
|
205
|
+
Equation: ``gravity * density_difference / reference_density``.
|
|
206
|
+
Invalid, empty, nonreal or nonfinite inputs raise ValueError.
|
|
207
|
+
NumPy broadcasting applies; singular and overflowing outputs raise ValueError.
|
|
208
|
+
"""
|
|
209
|
+
density_difference = quantity("density_difference", density_difference, lower=0)
|
|
210
|
+
reference_density = quantity("reference_density", reference_density, lower=0, strict_lower=True)
|
|
211
|
+
gravity = quantity("gravity", gravity, lower=0, strict_lower=True)
|
|
212
|
+
return gravity * density_difference / reference_density
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
@model
|
|
216
|
+
def internal_wave_speed(reduced_gravity, upper_depth, lower_depth):
|
|
217
|
+
"""Two-layer internal long wave.
|
|
218
|
+
|
|
219
|
+
Layer depths and buoyancy jointly set internal long-wave speed.
|
|
220
|
+
|
|
221
|
+
Parameters
|
|
222
|
+
----------
|
|
223
|
+
reduced_gravity : float or array_like
|
|
224
|
+
m/s^2; constraint: positive.
|
|
225
|
+
upper_depth : float or array_like
|
|
226
|
+
m; constraint: positive.
|
|
227
|
+
lower_depth : float or array_like
|
|
228
|
+
m; constraint: positive.
|
|
229
|
+
|
|
230
|
+
Returns
|
|
231
|
+
-------
|
|
232
|
+
numpy scalar or ndarray
|
|
233
|
+
Model value [Pa]. Scalar input returns a NumPy scalar; arrays broadcast.
|
|
234
|
+
|
|
235
|
+
Notes
|
|
236
|
+
-----
|
|
237
|
+
Hydrostatic two-layer fluid under a rigid lid.
|
|
238
|
+
Equation: ``np.sqrt(reduced_gravity * upper_depth * lower_depth / (upper_depth + lower_depth))``.
|
|
239
|
+
Invalid, empty, nonreal or nonfinite inputs raise ValueError.
|
|
240
|
+
NumPy broadcasting applies; singular and overflowing outputs raise ValueError.
|
|
241
|
+
"""
|
|
242
|
+
reduced_gravity = quantity("reduced_gravity", reduced_gravity, lower=0, strict_lower=True)
|
|
243
|
+
upper_depth = quantity("upper_depth", upper_depth, lower=0, strict_lower=True)
|
|
244
|
+
lower_depth = quantity("lower_depth", lower_depth, lower=0, strict_lower=True)
|
|
245
|
+
return np.sqrt(reduced_gravity * upper_depth * lower_depth / (upper_depth + lower_depth))
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
@model
|
|
249
|
+
def tidal_elevation(time, amplitude, period, phase):
|
|
250
|
+
"""Single harmonic tide.
|
|
251
|
+
|
|
252
|
+
Harmonic constituents provide an inspectable tide representation.
|
|
253
|
+
|
|
254
|
+
Parameters
|
|
255
|
+
----------
|
|
256
|
+
time : float or array_like
|
|
257
|
+
s; constraint: real.
|
|
258
|
+
amplitude : float or array_like
|
|
259
|
+
m; constraint: nonnegative.
|
|
260
|
+
period : float or array_like
|
|
261
|
+
s; constraint: positive.
|
|
262
|
+
phase : float or array_like
|
|
263
|
+
rad; constraint: real.
|
|
264
|
+
|
|
265
|
+
Returns
|
|
266
|
+
-------
|
|
267
|
+
numpy scalar or ndarray
|
|
268
|
+
Model value [Pa]. Scalar input returns a NumPy scalar; arrays broadcast.
|
|
269
|
+
|
|
270
|
+
Notes
|
|
271
|
+
-----
|
|
272
|
+
One supplied constituent; not a site-specific tide prediction or navigational product.
|
|
273
|
+
Equation: ``amplitude * np.cos(2 * np.pi * time / period + phase)``.
|
|
274
|
+
Invalid, empty, nonreal or nonfinite inputs raise ValueError.
|
|
275
|
+
NumPy broadcasting applies; singular and overflowing outputs raise ValueError.
|
|
276
|
+
"""
|
|
277
|
+
time = quantity("time", time)
|
|
278
|
+
amplitude = quantity("amplitude", amplitude, lower=0)
|
|
279
|
+
period = quantity("period", period, lower=0, strict_lower=True)
|
|
280
|
+
phase = quantity("phase", phase)
|
|
281
|
+
return amplitude * np.cos(2 * np.pi * time / period + phase)
|
|
File without changes
|