tsp 1.7.1__py3-none-any.whl → 1.7.7__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.
Potentially problematic release.
This version of tsp might be problematic. Click here for more details.
- tsp/__init__.py +11 -11
- tsp/__meta__.py +1 -1
- tsp/core.py +1035 -1010
- tsp/data/2023-01-06_755-test-Dataset_2031-Constant_Over_Interval-Hourly-Ground_Temperature-Thermistor_Automated.timeserie.csv +4 -4
- tsp/data/2023-01-06_755-test.metadata.txt +208 -208
- tsp/data/NTGS_example_csv.csv +6 -0
- tsp/data/NTGS_example_slash_dates.csv +6 -0
- tsp/data/example_geotop.csv +5240 -5240
- tsp/data/example_gtnp.csv +1298 -1298
- tsp/data/example_permos.csv +8 -0
- tsp/data/test_geotop_has_space.txt +5 -0
- tsp/dataloggers/AbstractReader.py +43 -43
- tsp/dataloggers/FG2.py +110 -110
- tsp/dataloggers/GP5W.py +114 -114
- tsp/dataloggers/Geoprecision.py +34 -34
- tsp/dataloggers/HOBO.py +914 -914
- tsp/dataloggers/RBRXL800.py +190 -190
- tsp/dataloggers/RBRXR420.py +308 -307
- tsp/dataloggers/__init__.py +15 -15
- tsp/dataloggers/logr.py +115 -115
- tsp/dataloggers/test_files/004448.DAT +2543 -2543
- tsp/dataloggers/test_files/004531.DAT +17106 -17106
- tsp/dataloggers/test_files/004531.HEX +3587 -3587
- tsp/dataloggers/test_files/004534.HEX +3587 -3587
- tsp/dataloggers/test_files/010252.dat +1731 -1731
- tsp/dataloggers/test_files/010252.hex +1739 -1739
- tsp/dataloggers/test_files/010274.hex +1291 -1291
- tsp/dataloggers/test_files/010278.hex +3544 -3544
- tsp/dataloggers/test_files/012064.dat +1286 -1286
- tsp/dataloggers/test_files/012064.hex +1294 -1294
- tsp/dataloggers/test_files/012081.hex +3532 -3532
- tsp/dataloggers/test_files/07B1592.DAT +1483 -1483
- tsp/dataloggers/test_files/07B1592.HEX +1806 -1806
- tsp/dataloggers/test_files/07B4450.DAT +2234 -2234
- tsp/dataloggers/test_files/07B4450.HEX +2559 -2559
- tsp/dataloggers/test_files/CSc_CR1000_1.dat +295 -0
- tsp/dataloggers/test_files/FG2_399.csv +9881 -9881
- tsp/dataloggers/test_files/GP5W.csv +1121 -1121
- tsp/dataloggers/test_files/GP5W_260.csv +1884 -1884
- tsp/dataloggers/test_files/GP5W_270.csv +2210 -2210
- tsp/dataloggers/test_files/H08-030-08_HOBOware.csv +998 -998
- tsp/dataloggers/test_files/RBR_01.dat +1046 -1046
- tsp/dataloggers/test_files/RBR_02.dat +2426 -2426
- tsp/dataloggers/test_files/RSTDT2055.csv +2152 -2152
- tsp/dataloggers/test_files/U23-001_HOBOware.csv +1001 -1001
- tsp/dataloggers/test_files/hobo-negative-2.txt +6396 -6396
- tsp/dataloggers/test_files/hobo-negative-3.txt +5593 -5593
- tsp/dataloggers/test_files/hobo-positive-number-1.txt +1000 -1000
- tsp/dataloggers/test_files/hobo-positive-number-2.csv +1003 -1003
- tsp/dataloggers/test_files/hobo-positive-number-3.csv +1133 -1133
- tsp/dataloggers/test_files/hobo-positive-number-4.csv +1209 -1209
- tsp/dataloggers/test_files/hobo2.csv +8702 -8702
- tsp/dataloggers/test_files/hobo_1_AB.csv +21732 -21732
- tsp/dataloggers/test_files/hobo_1_AB_Details.txt +133 -133
- tsp/dataloggers/test_files/hobo_1_AB_classic.csv +4373 -4373
- tsp/dataloggers/test_files/hobo_1_AB_defaults.csv +21732 -21732
- tsp/dataloggers/test_files/hobo_1_AB_minimal.txt +1358 -1358
- tsp/dataloggers/test_files/hobo_1_AB_var2.csv +3189 -3189
- tsp/dataloggers/test_files/hobo_1_AB_var3.csv +2458 -2458
- tsp/dataloggers/test_files/logR_ULogC16-32_1.csv +106 -106
- tsp/dataloggers/test_files/logR_ULogC16-32_2.csv +100 -100
- tsp/dataloggers/test_files/mon_3_Ta_2010-08-18_2013-02-08.txt +21724 -21724
- tsp/dataloggers/test_files/rbr_001.dat +1133 -1133
- tsp/dataloggers/test_files/rbr_001.hex +1139 -1139
- tsp/dataloggers/test_files/rbr_001_no_comment.dat +1132 -1132
- tsp/dataloggers/test_files/rbr_001_no_comment.hex +1138 -1138
- tsp/dataloggers/test_files/rbr_002.dat +1179 -1179
- tsp/dataloggers/test_files/rbr_002.hex +1185 -1185
- tsp/dataloggers/test_files/rbr_003.hex +1292 -1292
- tsp/dataloggers/test_files/rbr_003.xls +0 -0
- tsp/dataloggers/test_files/rbr_xl_001.DAT +1105 -1105
- tsp/dataloggers/test_files/rbr_xl_002.DAT +1126 -1126
- tsp/dataloggers/test_files/rbr_xl_003.DAT +4622 -4622
- tsp/dataloggers/test_files/rbr_xl_003.HEX +3587 -3587
- tsp/gtnp.py +148 -141
- tsp/labels.py +3 -3
- tsp/misc.py +90 -90
- tsp/physics.py +101 -101
- tsp/plots/static.py +374 -305
- tsp/readers.py +548 -536
- tsp/scratch.py +6 -0
- tsp/time.py +45 -45
- tsp/tspwarnings.py +15 -0
- tsp/utils.py +101 -101
- tsp/version.py +1 -1
- {tsp-1.7.1.dist-info → tsp-1.7.7.dist-info}/LICENSE +674 -674
- {tsp-1.7.1.dist-info → tsp-1.7.7.dist-info}/METADATA +10 -6
- tsp-1.7.7.dist-info/RECORD +95 -0
- {tsp-1.7.1.dist-info → tsp-1.7.7.dist-info}/WHEEL +5 -5
- tsp-1.7.1.dist-info/RECORD +0 -88
- {tsp-1.7.1.dist-info → tsp-1.7.7.dist-info}/top_level.txt +0 -0
tsp/physics.py
CHANGED
|
@@ -1,101 +1,101 @@
|
|
|
1
|
-
import numpy as np
|
|
2
|
-
from typing import Optional
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
def analytical_fourier(depths: "np.ndarray", times: "np.ndarray",
|
|
6
|
-
Q:float=0.2,
|
|
7
|
-
c:float=1.6e6,
|
|
8
|
-
k:float=2.5,
|
|
9
|
-
A:float=6,
|
|
10
|
-
MAGST:float=-0.5) -> "np.ndarray":
|
|
11
|
-
"""Create sinusoidal synthetic data for examples and testing
|
|
12
|
-
|
|
13
|
-
Parameters
|
|
14
|
-
----------
|
|
15
|
-
depths : np.ndarray
|
|
16
|
-
array of depths in m
|
|
17
|
-
times : np.ndarray
|
|
18
|
-
array of times in seconds
|
|
19
|
-
Q : Optional[float], optional
|
|
20
|
-
Geothermal heat flux [W m-2], by default 0.2
|
|
21
|
-
c : Optional[float], optional
|
|
22
|
-
heat capacity [J m-3 K-1], by default 1.6e6
|
|
23
|
-
k : Optional[float], optional
|
|
24
|
-
thermal conductivity [W m-1 K-1], by default 2.5
|
|
25
|
-
A : Optional[float], optional
|
|
26
|
-
Amplitude of temperature fluctuation [C], by default 6
|
|
27
|
-
MAGST : Optional[float], optional
|
|
28
|
-
mean annual ground surface temperature [C], by default -0.5
|
|
29
|
-
|
|
30
|
-
Returns
|
|
31
|
-
-------
|
|
32
|
-
TSP
|
|
33
|
-
_description_
|
|
34
|
-
"""
|
|
35
|
-
tau = 31536000 # [s]
|
|
36
|
-
w = 2 * np.pi / tau # []
|
|
37
|
-
alpha = k / c
|
|
38
|
-
|
|
39
|
-
initial = initial_analytic(MAGST, Q, k, depths)
|
|
40
|
-
initial = np.repeat(initial[np.newaxis, :], len(times), axis=0)
|
|
41
|
-
|
|
42
|
-
T = initial + delta_analytic(A0=A, z=depths, w=w, alpha=alpha, t=times)
|
|
43
|
-
|
|
44
|
-
return T
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
def initial_analytic(MAGST:float, Q:float, k:float, z:np.ndarray) -> np.ndarray:
|
|
48
|
-
""" Initial conditions for steady-state analytical temperature oscillation
|
|
49
|
-
|
|
50
|
-
Parameters
|
|
51
|
-
----------
|
|
52
|
-
MAGST : float
|
|
53
|
-
mean annual ground surface temperature [C]
|
|
54
|
-
Q : float
|
|
55
|
-
Geothermal heat flux [W m-2]
|
|
56
|
-
k : float
|
|
57
|
-
thermal conductivity [W m-1 K-1]
|
|
58
|
-
z : np.ndarray
|
|
59
|
-
ordered list of depths [m]
|
|
60
|
-
|
|
61
|
-
Returns
|
|
62
|
-
-------
|
|
63
|
-
np.ndarray
|
|
64
|
-
initial temperature conditions [C]
|
|
65
|
-
|
|
66
|
-
"""
|
|
67
|
-
z = np.atleast_1d(z)
|
|
68
|
-
initial = MAGST - (Q / k) * -np.abs(sorted(z))
|
|
69
|
-
|
|
70
|
-
return initial
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
def delta_analytic(A0:float, z:np.ndarray, w:float, alpha:float, t:np.ndarray) -> np.ndarray:
|
|
74
|
-
""" Analytical solution to heat conduction equation
|
|
75
|
-
|
|
76
|
-
Parameters
|
|
77
|
-
----------
|
|
78
|
-
A0 : float
|
|
79
|
-
Amplitude of temperature fluctuation [C]
|
|
80
|
-
z : np.ndarray
|
|
81
|
-
depth [m]
|
|
82
|
-
w : float
|
|
83
|
-
period of temperature fluctuation [s]
|
|
84
|
-
kappa : float
|
|
85
|
-
thermal diffusivity [W m-1 K-1]
|
|
86
|
-
t : np.ndarray
|
|
87
|
-
time in seconds [s]
|
|
88
|
-
|
|
89
|
-
Returns
|
|
90
|
-
-------
|
|
91
|
-
np.ndarray
|
|
92
|
-
"""
|
|
93
|
-
nz = len(z)
|
|
94
|
-
nt = len(t)
|
|
95
|
-
z = np.repeat(np.atleast_1d(z)[np.newaxis, :], nt, axis=0)
|
|
96
|
-
t = np.repeat(np.atleast_1d(t)[:, np.newaxis], nz, axis=1)
|
|
97
|
-
S = np.sqrt(w / (2 * alpha))
|
|
98
|
-
A = A0 * np.exp(-z * S)
|
|
99
|
-
osc = np.cos(w * t - z * S)
|
|
100
|
-
|
|
101
|
-
return A * osc
|
|
1
|
+
import numpy as np
|
|
2
|
+
from typing import Optional
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def analytical_fourier(depths: "np.ndarray", times: "np.ndarray",
|
|
6
|
+
Q:float=0.2,
|
|
7
|
+
c:float=1.6e6,
|
|
8
|
+
k:float=2.5,
|
|
9
|
+
A:float=6,
|
|
10
|
+
MAGST:float=-0.5) -> "np.ndarray":
|
|
11
|
+
"""Create sinusoidal synthetic data for examples and testing
|
|
12
|
+
|
|
13
|
+
Parameters
|
|
14
|
+
----------
|
|
15
|
+
depths : np.ndarray
|
|
16
|
+
array of depths in m
|
|
17
|
+
times : np.ndarray
|
|
18
|
+
array of times in seconds
|
|
19
|
+
Q : Optional[float], optional
|
|
20
|
+
Geothermal heat flux [W m-2], by default 0.2
|
|
21
|
+
c : Optional[float], optional
|
|
22
|
+
heat capacity [J m-3 K-1], by default 1.6e6
|
|
23
|
+
k : Optional[float], optional
|
|
24
|
+
thermal conductivity [W m-1 K-1], by default 2.5
|
|
25
|
+
A : Optional[float], optional
|
|
26
|
+
Amplitude of temperature fluctuation [C], by default 6
|
|
27
|
+
MAGST : Optional[float], optional
|
|
28
|
+
mean annual ground surface temperature [C], by default -0.5
|
|
29
|
+
|
|
30
|
+
Returns
|
|
31
|
+
-------
|
|
32
|
+
TSP
|
|
33
|
+
_description_
|
|
34
|
+
"""
|
|
35
|
+
tau = 31536000 # [s]
|
|
36
|
+
w = 2 * np.pi / tau # []
|
|
37
|
+
alpha = k / c
|
|
38
|
+
|
|
39
|
+
initial = initial_analytic(MAGST, Q, k, depths)
|
|
40
|
+
initial = np.repeat(initial[np.newaxis, :], len(times), axis=0)
|
|
41
|
+
|
|
42
|
+
T = initial + delta_analytic(A0=A, z=depths, w=w, alpha=alpha, t=times)
|
|
43
|
+
|
|
44
|
+
return T
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def initial_analytic(MAGST:float, Q:float, k:float, z:np.ndarray) -> np.ndarray:
|
|
48
|
+
""" Initial conditions for steady-state analytical temperature oscillation
|
|
49
|
+
|
|
50
|
+
Parameters
|
|
51
|
+
----------
|
|
52
|
+
MAGST : float
|
|
53
|
+
mean annual ground surface temperature [C]
|
|
54
|
+
Q : float
|
|
55
|
+
Geothermal heat flux [W m-2]
|
|
56
|
+
k : float
|
|
57
|
+
thermal conductivity [W m-1 K-1]
|
|
58
|
+
z : np.ndarray
|
|
59
|
+
ordered list of depths [m]
|
|
60
|
+
|
|
61
|
+
Returns
|
|
62
|
+
-------
|
|
63
|
+
np.ndarray
|
|
64
|
+
initial temperature conditions [C]
|
|
65
|
+
|
|
66
|
+
"""
|
|
67
|
+
z = np.atleast_1d(z)
|
|
68
|
+
initial = MAGST - (Q / k) * -np.abs(sorted(z))
|
|
69
|
+
|
|
70
|
+
return initial
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def delta_analytic(A0:float, z:np.ndarray, w:float, alpha:float, t:np.ndarray) -> np.ndarray:
|
|
74
|
+
""" Analytical solution to heat conduction equation
|
|
75
|
+
|
|
76
|
+
Parameters
|
|
77
|
+
----------
|
|
78
|
+
A0 : float
|
|
79
|
+
Amplitude of temperature fluctuation [C]
|
|
80
|
+
z : np.ndarray
|
|
81
|
+
depth [m]
|
|
82
|
+
w : float
|
|
83
|
+
period of temperature fluctuation [s]
|
|
84
|
+
kappa : float
|
|
85
|
+
thermal diffusivity [W m-1 K-1]
|
|
86
|
+
t : np.ndarray
|
|
87
|
+
time in seconds [s]
|
|
88
|
+
|
|
89
|
+
Returns
|
|
90
|
+
-------
|
|
91
|
+
np.ndarray
|
|
92
|
+
"""
|
|
93
|
+
nz = len(z)
|
|
94
|
+
nt = len(t)
|
|
95
|
+
z = np.repeat(np.atleast_1d(z)[np.newaxis, :], nt, axis=0)
|
|
96
|
+
t = np.repeat(np.atleast_1d(t)[:, np.newaxis], nz, axis=1)
|
|
97
|
+
S = np.sqrt(w / (2 * alpha))
|
|
98
|
+
A = A0 * np.exp(-z * S)
|
|
99
|
+
osc = np.cos(w * t - z * S)
|
|
100
|
+
|
|
101
|
+
return A * osc
|