cht-tide 0.0.1__tar.gz
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.
- cht_tide-0.0.1/LICENSE +21 -0
- cht_tide-0.0.1/PKG-INFO +15 -0
- cht_tide-0.0.1/README.md +1 -0
- cht_tide-0.0.1/cht_tide/__init__.py +7 -0
- cht_tide-0.0.1/cht_tide/astro.py +241 -0
- cht_tide-0.0.1/cht_tide/constituent.py +245 -0
- cht_tide-0.0.1/cht_tide/nodal_corrections.py +202 -0
- cht_tide-0.0.1/cht_tide/read_bca.py +184 -0
- cht_tide-0.0.1/cht_tide/tide.py +469 -0
- cht_tide-0.0.1/cht_tide/tide_predict.py +41 -0
- cht_tide-0.0.1/cht_tide.egg-info/PKG-INFO +15 -0
- cht_tide-0.0.1/cht_tide.egg-info/SOURCES.txt +17 -0
- cht_tide-0.0.1/cht_tide.egg-info/dependency_links.txt +1 -0
- cht_tide-0.0.1/cht_tide.egg-info/requires.txt +6 -0
- cht_tide-0.0.1/cht_tide.egg-info/top_level.txt +1 -0
- cht_tide-0.0.1/cht_tide.egg-info/zip-safe +1 -0
- cht_tide-0.0.1/pyproject.toml +41 -0
- cht_tide-0.0.1/setup.cfg +4 -0
- cht_tide-0.0.1/tests/test_tide_timeseries.py +107 -0
cht_tide-0.0.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Deltares
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
cht_tide-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: cht_tide
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Combining of tidal components to time series
|
|
5
|
+
Author-email: Maarten van Ormondt <maarten.vanormondt@deltares.nl>, Julian Hofer <Julian.Hofer@deltares.nl>, Sarwan Peiter <Sarwan.Peiter@deltares.nl>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Source, https://github.com/Deltares/cht_tide
|
|
8
|
+
Classifier: Intended Audience :: Science/Research
|
|
9
|
+
Classifier: Topic :: Scientific/Engineering :: Hydrology
|
|
10
|
+
Requires-Python: >=3.10
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
Provides-Extra: tests
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
|
|
15
|
+
# Coastal Hazards Toolkit -Tides
|
cht_tide-0.0.1/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Coastal Hazards Toolkit -Tides
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
# Copyright notice
|
|
2
|
+
# --------------------------------------------------------------------
|
|
3
|
+
# Copyright (C) 2020 Deltares
|
|
4
|
+
# Freek Scheel
|
|
5
|
+
#
|
|
6
|
+
# freek.scheel@deltares.nl
|
|
7
|
+
#
|
|
8
|
+
# P.O. Box 177
|
|
9
|
+
# 2600 MH Delft
|
|
10
|
+
# The Netherlands
|
|
11
|
+
#
|
|
12
|
+
# This library is free software: you can redistribute it and/or modify
|
|
13
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
|
14
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
15
|
+
# (at your option) any later version.
|
|
16
|
+
#
|
|
17
|
+
# This library is distributed in the hope that it will be useful,
|
|
18
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
19
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
20
|
+
# GNU General Public License for more details.
|
|
21
|
+
#
|
|
22
|
+
# You should have received a copy of the GNU General Public License
|
|
23
|
+
# along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
24
|
+
# --------------------------------------------------------------------
|
|
25
|
+
from collections import namedtuple
|
|
26
|
+
|
|
27
|
+
import numpy as np
|
|
28
|
+
|
|
29
|
+
d2r, r2d = np.pi / 180.0, 180.0 / np.pi
|
|
30
|
+
|
|
31
|
+
# Most of this is based around Meeus's Astronomical Algorithms, since it
|
|
32
|
+
# presents reasonably good approximations of all the quantities we require in a
|
|
33
|
+
# clear fashion. Reluctant to go all out and use VSOP87 unless it can be shown
|
|
34
|
+
# to make a significant difference to the resulting accuracy of harmonic
|
|
35
|
+
# analysis.
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
# Convert a sexagesimal angle into decimal degrees
|
|
39
|
+
def s2d(degrees, arcmins=0, arcsecs=0, mas=0, muas=0):
|
|
40
|
+
return (
|
|
41
|
+
degrees
|
|
42
|
+
+ (arcmins / 60.0)
|
|
43
|
+
+ (arcsecs / (60.0 * 60.0))
|
|
44
|
+
+ (mas / (60.0 * 60.0 * 1e3))
|
|
45
|
+
+ (muas / (60.0 * 60.0 * 1e6))
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
# Evaluate a polynomial at argument
|
|
50
|
+
def polynomial(coefficients, argument):
|
|
51
|
+
return sum([c * (argument**i) for i, c in enumerate(coefficients)])
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
# Evaluate the first derivative of a polynomial at argument
|
|
55
|
+
def d_polynomial(coefficients, argument):
|
|
56
|
+
return sum([c * i * (argument ** (i - 1)) for i, c in enumerate(coefficients)])
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
# Meeus formula 11.1
|
|
60
|
+
def T(t):
|
|
61
|
+
return (JD(t) - 2451545.0) / 36525
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
# Meeus formula 7.1
|
|
65
|
+
def JD(t):
|
|
66
|
+
Y, M = t.year, t.month
|
|
67
|
+
D = (
|
|
68
|
+
t.day
|
|
69
|
+
+ t.hour / (24.0)
|
|
70
|
+
+ t.minute / (24.0 * 60.0)
|
|
71
|
+
+ t.second / (24.0 * 60.0 * 60.0)
|
|
72
|
+
+ t.microsecond / (24.0 * 60.0 * 60.0 * 1e6)
|
|
73
|
+
)
|
|
74
|
+
if M <= 2:
|
|
75
|
+
Y = Y - 1
|
|
76
|
+
M = M + 12
|
|
77
|
+
A = np.floor(Y / 100.0)
|
|
78
|
+
B = 2 - A + np.floor(A / 4.0)
|
|
79
|
+
return np.floor(365.25 * (Y + 4716)) + np.floor(30.6001 * (M + 1)) + D + B - 1524.5
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
# Meeus formula 21.3
|
|
83
|
+
terrestrial_obliquity_coefficients = (
|
|
84
|
+
s2d(23, 26, 21.448),
|
|
85
|
+
-s2d(0, 0, 4680.93),
|
|
86
|
+
-s2d(0, 0, 1.55),
|
|
87
|
+
s2d(0, 0, 1999.25),
|
|
88
|
+
-s2d(0, 0, 51.38),
|
|
89
|
+
-s2d(0, 0, 249.67),
|
|
90
|
+
-s2d(0, 0, 39.05),
|
|
91
|
+
s2d(0, 0, 7.12),
|
|
92
|
+
s2d(0, 0, 27.87),
|
|
93
|
+
s2d(0, 0, 5.79),
|
|
94
|
+
s2d(0, 0, 2.45),
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
# Adjust these coefficients for parameter T rather than U
|
|
98
|
+
terrestrial_obliquity_coefficients = [
|
|
99
|
+
c * (1e-2) ** i for i, c in enumerate(terrestrial_obliquity_coefficients)
|
|
100
|
+
]
|
|
101
|
+
|
|
102
|
+
# Not entirely sure about this interpretation, but this is the difference
|
|
103
|
+
# between Meeus formulae 24.2 and 24.3 and seems to work
|
|
104
|
+
solar_perigee_coefficients = (
|
|
105
|
+
280.46645 - 357.52910,
|
|
106
|
+
36000.76932 - 35999.05030,
|
|
107
|
+
0.0003032 + 0.0001559,
|
|
108
|
+
0.00000048,
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
# Meeus formula 24.2
|
|
112
|
+
solar_longitude_coefficients = (280.46645, 36000.76983, 0.0003032)
|
|
113
|
+
|
|
114
|
+
# This value is taken from JPL Horizon and is essentially constant
|
|
115
|
+
lunar_inclination_coefficients = (5.145,)
|
|
116
|
+
|
|
117
|
+
# Meeus formula 45.1
|
|
118
|
+
lunar_longitude_coefficients = (
|
|
119
|
+
218.3164591,
|
|
120
|
+
481267.88134236,
|
|
121
|
+
-0.0013268,
|
|
122
|
+
1 / 538841.0 - 1 / 65194000.0,
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
# Meeus formula 45.7
|
|
126
|
+
lunar_node_coefficients = (
|
|
127
|
+
125.0445550,
|
|
128
|
+
-1934.1361849,
|
|
129
|
+
0.0020762,
|
|
130
|
+
1 / 467410.0,
|
|
131
|
+
-1 / 60616000.0,
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
# Meeus, unnumbered formula directly preceded by 45.7
|
|
135
|
+
lunar_perigee_coefficients = (
|
|
136
|
+
83.3532430,
|
|
137
|
+
4069.0137111,
|
|
138
|
+
-0.0103238,
|
|
139
|
+
-1 / 80053.0,
|
|
140
|
+
1 / 18999000.0,
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
# Now follow some useful auxiliary values, we won't need their speed.
|
|
145
|
+
# See notes on Table 6 in Schureman for I, nu, xi, nu', 2nu''
|
|
146
|
+
def _I(N, i, omega):
|
|
147
|
+
N, i, omega = d2r * N, d2r * i, d2r * omega
|
|
148
|
+
cosI = np.cos(i) * np.cos(omega) - np.sin(i) * np.sin(omega) * np.cos(N)
|
|
149
|
+
return r2d * np.arccos(cosI)
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
def _xi(N, i, omega):
|
|
153
|
+
N, i, omega = d2r * N, d2r * i, d2r * omega
|
|
154
|
+
e1 = np.cos(0.5 * (omega - i)) / np.cos(0.5 * (omega + i)) * np.tan(0.5 * N)
|
|
155
|
+
e2 = np.sin(0.5 * (omega - i)) / np.sin(0.5 * (omega + i)) * np.tan(0.5 * N)
|
|
156
|
+
e1, e2 = np.arctan(e1), np.arctan(e2)
|
|
157
|
+
e1, e2 = e1 - 0.5 * N, e2 - 0.5 * N
|
|
158
|
+
return -(e1 + e2) * r2d
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
def _nu(N, i, omega):
|
|
162
|
+
N, i, omega = d2r * N, d2r * i, d2r * omega
|
|
163
|
+
e1 = np.cos(0.5 * (omega - i)) / np.cos(0.5 * (omega + i)) * np.tan(0.5 * N)
|
|
164
|
+
e2 = np.sin(0.5 * (omega - i)) / np.sin(0.5 * (omega + i)) * np.tan(0.5 * N)
|
|
165
|
+
e1, e2 = np.arctan(e1), np.arctan(e2)
|
|
166
|
+
e1, e2 = e1 - 0.5 * N, e2 - 0.5 * N
|
|
167
|
+
return (e1 - e2) * r2d
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
# Schureman equation 224
|
|
171
|
+
# Can we be more precise than B "the solar coefficient" = 0.1681?
|
|
172
|
+
def _nup(N, i, omega):
|
|
173
|
+
I = d2r * _I(N, i, omega)
|
|
174
|
+
nu = d2r * _nu(N, i, omega)
|
|
175
|
+
return r2d * np.arctan(
|
|
176
|
+
np.sin(2 * I) * np.sin(nu) / (np.sin(2 * I) * np.cos(nu) + 0.3347)
|
|
177
|
+
)
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
# Schureman equation 232
|
|
181
|
+
def _nupp(N, i, omega):
|
|
182
|
+
I = d2r * _I(N, i, omega)
|
|
183
|
+
nu = d2r * _nu(N, i, omega)
|
|
184
|
+
tan2nupp = (np.sin(I) ** 2 * np.sin(2 * nu)) / (
|
|
185
|
+
np.sin(I) ** 2 * np.cos(2 * nu) + 0.0727
|
|
186
|
+
)
|
|
187
|
+
return r2d * 0.5 * np.arctan(tan2nupp)
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
AstronomicalParameter = namedtuple("AstronomicalParameter", ["value", "speed"])
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
def astro(t):
|
|
194
|
+
a = {}
|
|
195
|
+
# We can use polynomial fits from Meeus to obtain good approximations to
|
|
196
|
+
# some astronomical values (and therefore speeds).
|
|
197
|
+
polynomials = {
|
|
198
|
+
"s": lunar_longitude_coefficients,
|
|
199
|
+
"h": solar_longitude_coefficients,
|
|
200
|
+
"p": lunar_perigee_coefficients,
|
|
201
|
+
"N": lunar_node_coefficients,
|
|
202
|
+
"pp": solar_perigee_coefficients,
|
|
203
|
+
"90": (90.0,),
|
|
204
|
+
"omega": terrestrial_obliquity_coefficients,
|
|
205
|
+
"i": lunar_inclination_coefficients,
|
|
206
|
+
}
|
|
207
|
+
# Polynomials are in T, that is Julian Centuries; we want our speeds to be
|
|
208
|
+
# in the more convenient unit of degrees per hour.
|
|
209
|
+
dT_dHour = 1 / (24 * 365.25 * 100)
|
|
210
|
+
for name, coefficients in polynomials.items():
|
|
211
|
+
a[name] = AstronomicalParameter(
|
|
212
|
+
np.mod(polynomial(coefficients, T(t)), 360.0),
|
|
213
|
+
d_polynomial(coefficients, T(t)) * dT_dHour,
|
|
214
|
+
)
|
|
215
|
+
|
|
216
|
+
# Some other parameters defined by Schureman which are dependent on the
|
|
217
|
+
# parameters N, i, omega for use in node factor calculations. We don't need
|
|
218
|
+
# their speeds.
|
|
219
|
+
args = [each.value for each in [a["N"], a["i"], a["omega"]]]
|
|
220
|
+
for name, function in {
|
|
221
|
+
"I": _I,
|
|
222
|
+
"xi": _xi,
|
|
223
|
+
"nu": _nu,
|
|
224
|
+
"nup": _nup,
|
|
225
|
+
"nupp": _nupp,
|
|
226
|
+
}.items():
|
|
227
|
+
a[name] = AstronomicalParameter(np.mod(function(*args), 360.0), None)
|
|
228
|
+
|
|
229
|
+
# We don't work directly with the T (hours) parameter, instead our spanning
|
|
230
|
+
# set for equilibrium arguments #is given by T+h-s, s, h, p, N, pp, 90.
|
|
231
|
+
# This is in line with convention.
|
|
232
|
+
hour = AstronomicalParameter((JD(t) - np.floor(JD(t))) * 360.0, 15.0)
|
|
233
|
+
a["T+h-s"] = AstronomicalParameter(
|
|
234
|
+
hour.value + a["h"].value - a["s"].value,
|
|
235
|
+
hour.speed + a["h"].speed - a["s"].speed,
|
|
236
|
+
)
|
|
237
|
+
# It is convenient to calculate Schureman's P here since several node
|
|
238
|
+
# factors need it, although it could be argued that these
|
|
239
|
+
# (along with I, xi, nu etc) belong somewhere else.
|
|
240
|
+
a["P"] = AstronomicalParameter(np.mod(a["p"].value - a["xi"].value, 360.0), None)
|
|
241
|
+
return a
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
# Copyright notice
|
|
2
|
+
# --------------------------------------------------------------------
|
|
3
|
+
# Copyright (C) 2020 Deltares
|
|
4
|
+
# Freek Scheel
|
|
5
|
+
#
|
|
6
|
+
# freek.scheel@deltares.nl
|
|
7
|
+
#
|
|
8
|
+
# P.O. Box 177
|
|
9
|
+
# 2600 MH Delft
|
|
10
|
+
# The Netherlands
|
|
11
|
+
#
|
|
12
|
+
# This library is free software: you can redistribute it and/or modify
|
|
13
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
|
14
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
15
|
+
# (at your option) any later version.
|
|
16
|
+
#
|
|
17
|
+
# This library is distributed in the hope that it will be useful,
|
|
18
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
19
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
20
|
+
# GNU General Public License for more details.
|
|
21
|
+
#
|
|
22
|
+
# You should have received a copy of the GNU General Public License
|
|
23
|
+
# along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
24
|
+
# --------------------------------------------------------------------
|
|
25
|
+
|
|
26
|
+
import operator as op
|
|
27
|
+
import string
|
|
28
|
+
from functools import reduce
|
|
29
|
+
|
|
30
|
+
import numpy as np
|
|
31
|
+
|
|
32
|
+
import cht_tide.nodal_corrections as nc
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class BaseConstituent(object):
|
|
36
|
+
xdo_int = {
|
|
37
|
+
"A": 1,
|
|
38
|
+
"B": 2,
|
|
39
|
+
"C": 3,
|
|
40
|
+
"D": 4,
|
|
41
|
+
"E": 5,
|
|
42
|
+
"F": 6,
|
|
43
|
+
"G": 7,
|
|
44
|
+
"H": 8,
|
|
45
|
+
"I": 9,
|
|
46
|
+
"J": 10,
|
|
47
|
+
"K": 11,
|
|
48
|
+
"L": 12,
|
|
49
|
+
"M": 13,
|
|
50
|
+
"N": 14,
|
|
51
|
+
"O": 15,
|
|
52
|
+
"P": 16,
|
|
53
|
+
"Q": 17,
|
|
54
|
+
"R": -8,
|
|
55
|
+
"S": -7,
|
|
56
|
+
"T": -6,
|
|
57
|
+
"U": -5,
|
|
58
|
+
"V": -4,
|
|
59
|
+
"W": -3,
|
|
60
|
+
"X": -2,
|
|
61
|
+
"Y": -1,
|
|
62
|
+
"Z": 0,
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
int_xdo = {v: k for k, v in xdo_int.items()}
|
|
66
|
+
|
|
67
|
+
def __init__(self, name, xdo="", coefficients=[], u=nc.u_zero, f=nc.f_unity):
|
|
68
|
+
if xdo == "":
|
|
69
|
+
self.coefficients = np.array(coefficients)
|
|
70
|
+
else:
|
|
71
|
+
self.coefficients = np.array(self.xdo_to_coefficients(xdo))
|
|
72
|
+
self.name = name
|
|
73
|
+
self.u = u
|
|
74
|
+
self.f = f
|
|
75
|
+
|
|
76
|
+
def xdo_to_coefficients(self, xdo):
|
|
77
|
+
return [self.xdo_int[l.upper()] for l in xdo if l in string.ascii_letters]
|
|
78
|
+
|
|
79
|
+
def coefficients_to_xdo(self, coefficients):
|
|
80
|
+
return "".join([self.int_xdo[c] for c in coefficients])
|
|
81
|
+
|
|
82
|
+
def V(self, astro):
|
|
83
|
+
return np.dot(self.coefficients, self.astro_values(astro))
|
|
84
|
+
|
|
85
|
+
def xdo(self):
|
|
86
|
+
return self.coefficients_to_xdo(self.coefficients)
|
|
87
|
+
|
|
88
|
+
def speed(self, a):
|
|
89
|
+
return np.dot(self.coefficients, self.astro_speeds(a))
|
|
90
|
+
|
|
91
|
+
def astro_xdo(self, a):
|
|
92
|
+
return [a["T+h-s"], a["s"], a["h"], a["p"], a["N"], a["pp"], a["90"]]
|
|
93
|
+
|
|
94
|
+
def astro_speeds(self, a):
|
|
95
|
+
return np.array([each.speed for each in self.astro_xdo(a)])
|
|
96
|
+
|
|
97
|
+
def astro_values(self, a):
|
|
98
|
+
return np.array([each.value for each in self.astro_xdo(a)])
|
|
99
|
+
|
|
100
|
+
# Consider two out of phase constituents which travel at the same speed to
|
|
101
|
+
# be identical
|
|
102
|
+
def __eq__(self, c):
|
|
103
|
+
return np.all(self.coefficients[:-1] == c.coefficients[:-1])
|
|
104
|
+
|
|
105
|
+
def __hash__(self):
|
|
106
|
+
return hash(tuple(self.coefficients[:-1]))
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
class CompoundConstituent(BaseConstituent):
|
|
110
|
+
def __init__(self, members=[], **kwargs):
|
|
111
|
+
self.members = members
|
|
112
|
+
|
|
113
|
+
if "u" not in kwargs:
|
|
114
|
+
kwargs["u"] = self.u
|
|
115
|
+
if "f" not in kwargs:
|
|
116
|
+
kwargs["f"] = self.f
|
|
117
|
+
|
|
118
|
+
super(CompoundConstituent, self).__init__(**kwargs)
|
|
119
|
+
|
|
120
|
+
self.coefficients = reduce(op.add, [c.coefficients * n for (c, n) in members])
|
|
121
|
+
|
|
122
|
+
def speed(self, a):
|
|
123
|
+
return reduce(op.add, [n * c.speed(a) for (c, n) in self.members])
|
|
124
|
+
|
|
125
|
+
def V(self, a):
|
|
126
|
+
return reduce(op.add, [n * c.V(a) for (c, n) in self.members])
|
|
127
|
+
|
|
128
|
+
def u(self, a):
|
|
129
|
+
return reduce(op.add, [n * c.u(a) for (c, n) in self.members])
|
|
130
|
+
|
|
131
|
+
def f(self, a):
|
|
132
|
+
return reduce(op.mul, [c.f(a) ** abs(n) for (c, n) in self.members])
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
###### Base Constituents
|
|
136
|
+
# Long Term
|
|
137
|
+
_Z0 = BaseConstituent(name="Z0", xdo="Z ZZZ ZZZ", u=nc.u_zero, f=nc.f_unity)
|
|
138
|
+
_Sa = BaseConstituent(name="Sa", xdo="Z ZAZ ZZZ", u=nc.u_zero, f=nc.f_unity)
|
|
139
|
+
_Ssa = BaseConstituent(name="Ssa", xdo="Z ZBZ ZZZ", u=nc.u_zero, f=nc.f_unity)
|
|
140
|
+
_Mm = BaseConstituent(name="Mm", xdo="Z AZY ZZZ", u=nc.u_zero, f=nc.f_Mm)
|
|
141
|
+
_Mf = BaseConstituent(name="Mf", xdo="Z BZZ ZZZ", u=nc.u_Mf, f=nc.f_Mf)
|
|
142
|
+
|
|
143
|
+
# Diurnals
|
|
144
|
+
_Q1 = BaseConstituent(name="Q1", xdo="A XZA ZZA", u=nc.u_O1, f=nc.f_O1)
|
|
145
|
+
_O1 = BaseConstituent(name="O1", xdo="A YZZ ZZA", u=nc.u_O1, f=nc.f_O1)
|
|
146
|
+
_K1 = BaseConstituent(name="K1", xdo="A AZZ ZZY", u=nc.u_K1, f=nc.f_K1)
|
|
147
|
+
_J1 = BaseConstituent(name="J1", xdo="A BZY ZZY", u=nc.u_J1, f=nc.f_J1)
|
|
148
|
+
|
|
149
|
+
# M1 is a tricky business for reasons of convention, rather than theory. The
|
|
150
|
+
# reasons for this are best summarised by Schureman paragraphs 126, 127 and in
|
|
151
|
+
# the comments found in congen_input.txt of xtides, so I won't go over all this
|
|
152
|
+
# again here.
|
|
153
|
+
|
|
154
|
+
_M1 = BaseConstituent(name="M1", xdo="A ZZZ ZZA", u=nc.u_M1, f=nc.f_M1)
|
|
155
|
+
_P1 = BaseConstituent(name="P1", xdo="A AXZ ZZA", u=nc.u_zero, f=nc.f_unity)
|
|
156
|
+
_S1 = BaseConstituent(name="S1", xdo="A AYZ ZZZ", u=nc.u_zero, f=nc.f_unity)
|
|
157
|
+
_OO1 = BaseConstituent(name="OO1", xdo="A CZZ ZZY", u=nc.u_OO1, f=nc.f_OO1)
|
|
158
|
+
|
|
159
|
+
# Semi-Diurnals
|
|
160
|
+
_2N2 = BaseConstituent(name="2N2", xdo="B XZB ZZZ", u=nc.u_M2, f=nc.f_M2)
|
|
161
|
+
_N2 = BaseConstituent(name="N2", xdo="B YZA ZZZ", u=nc.u_M2, f=nc.f_M2)
|
|
162
|
+
_nu2 = BaseConstituent(name="nu2", xdo="B YBY ZZZ", u=nc.u_M2, f=nc.f_M2)
|
|
163
|
+
_M2 = BaseConstituent(name="M2", xdo="B ZZZ ZZZ", u=nc.u_M2, f=nc.f_M2)
|
|
164
|
+
_lambda2 = BaseConstituent(name="lambda2", xdo="B AXA ZZB", u=nc.u_M2, f=nc.f_M2)
|
|
165
|
+
_L2 = BaseConstituent(name="L2", xdo="B AZY ZZB", u=nc.u_L2, f=nc.f_L2)
|
|
166
|
+
_T2 = BaseConstituent(name="T2", xdo="B BWZ ZAZ", u=nc.u_zero, f=nc.f_unity)
|
|
167
|
+
_S2 = BaseConstituent(name="S2", xdo="B BXZ ZZZ", u=nc.u_zero, f=nc.f_unity)
|
|
168
|
+
_R2 = BaseConstituent(name="R2", xdo="B BYZ ZYB", u=nc.u_zero, f=nc.f_unity)
|
|
169
|
+
_K2 = BaseConstituent(name="K2", xdo="B BZZ ZZZ", u=nc.u_K2, f=nc.f_K2)
|
|
170
|
+
|
|
171
|
+
# Third-Diurnals
|
|
172
|
+
_M3 = BaseConstituent(
|
|
173
|
+
name="M3", xdo="C ZZZ ZZZ", u=lambda a: nc.u_Modd(a, 3), f=lambda a: nc.f_Modd(a, 3)
|
|
174
|
+
)
|
|
175
|
+
|
|
176
|
+
###### Compound Constituents
|
|
177
|
+
# Long Term
|
|
178
|
+
_MSF = CompoundConstituent(name="MSF", members=[(_S2, 1), (_M2, -1)])
|
|
179
|
+
|
|
180
|
+
# Diurnal
|
|
181
|
+
_2Q1 = CompoundConstituent(name="2Q1", members=[(_N2, 1), (_J1, -1)])
|
|
182
|
+
_rho1 = CompoundConstituent(name="rho1", members=[(_nu2, 1), (_K1, -1)])
|
|
183
|
+
|
|
184
|
+
# Semi-Diurnal
|
|
185
|
+
|
|
186
|
+
_mu2 = CompoundConstituent(name="mu2", members=[(_M2, 2), (_S2, -1)]) # 2MS2
|
|
187
|
+
_2SM2 = CompoundConstituent(name="2SM2", members=[(_S2, 2), (_M2, -1)])
|
|
188
|
+
|
|
189
|
+
# Third-Diurnal
|
|
190
|
+
_2MK3 = CompoundConstituent(name="2MK3", members=[(_M2, 1), (_O1, 1)])
|
|
191
|
+
_MK3 = CompoundConstituent(name="MK3", members=[(_M2, 1), (_K1, 1)])
|
|
192
|
+
|
|
193
|
+
# Quarter-Diurnal
|
|
194
|
+
_MN4 = CompoundConstituent(name="MN4", members=[(_M2, 1), (_N2, 1)])
|
|
195
|
+
_M4 = CompoundConstituent(name="M4", members=[(_M2, 2)])
|
|
196
|
+
_MS4 = CompoundConstituent(name="MS4", members=[(_M2, 1), (_S2, 1)])
|
|
197
|
+
_S4 = CompoundConstituent(name="S4", members=[(_S2, 2)])
|
|
198
|
+
|
|
199
|
+
# Sixth-Diurnal
|
|
200
|
+
_M6 = CompoundConstituent(name="M6", members=[(_M2, 3)])
|
|
201
|
+
_S6 = CompoundConstituent(name="S6", members=[(_S2, 3)])
|
|
202
|
+
|
|
203
|
+
# Eighth-Diurnals
|
|
204
|
+
_M8 = CompoundConstituent(name="M8", members=[(_M2, 4)])
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
noaa = [
|
|
208
|
+
_M2,
|
|
209
|
+
_S2,
|
|
210
|
+
_N2,
|
|
211
|
+
_K1,
|
|
212
|
+
_M4,
|
|
213
|
+
_O1,
|
|
214
|
+
_M6,
|
|
215
|
+
_MK3,
|
|
216
|
+
_S4,
|
|
217
|
+
_MN4,
|
|
218
|
+
_nu2,
|
|
219
|
+
_S6,
|
|
220
|
+
_mu2,
|
|
221
|
+
_2N2,
|
|
222
|
+
_OO1,
|
|
223
|
+
_lambda2,
|
|
224
|
+
_S1,
|
|
225
|
+
_M1,
|
|
226
|
+
_J1,
|
|
227
|
+
_Mm,
|
|
228
|
+
_Ssa,
|
|
229
|
+
_Sa,
|
|
230
|
+
_MSF,
|
|
231
|
+
_Mf,
|
|
232
|
+
_rho1,
|
|
233
|
+
_Q1,
|
|
234
|
+
_T2,
|
|
235
|
+
_R2,
|
|
236
|
+
_2Q1,
|
|
237
|
+
_P1,
|
|
238
|
+
_2SM2,
|
|
239
|
+
_M3,
|
|
240
|
+
_L2,
|
|
241
|
+
_2MK3,
|
|
242
|
+
_K2,
|
|
243
|
+
_M8,
|
|
244
|
+
_MS4,
|
|
245
|
+
]
|