@neaps/tide-predictor 0.3.0 → 0.4.1
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.
- package/dist/index.cjs +1056 -365
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -56
- package/dist/index.d.ts +3 -56
- package/dist/index.js +1056 -365
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -182,132 +182,6 @@ const astro = (time) => {
|
|
|
182
182
|
};
|
|
183
183
|
var astronomy_default = astro;
|
|
184
184
|
|
|
185
|
-
//#endregion
|
|
186
|
-
//#region src/harmonics/prediction.ts
|
|
187
|
-
const modulus = (a, b) => {
|
|
188
|
-
return (a % b + b) % b;
|
|
189
|
-
};
|
|
190
|
-
const addExtremesOffsets = (extreme, offsets) => {
|
|
191
|
-
if (typeof offsets === "undefined" || !offsets) return extreme;
|
|
192
|
-
if (extreme.high && offsets.height?.high) if (offsets.height.type === "fixed") extreme.level += offsets.height.high;
|
|
193
|
-
else extreme.level *= offsets.height.high;
|
|
194
|
-
if (extreme.low && offsets.height?.low) if (offsets.height.type === "fixed") extreme.level += offsets.height.low;
|
|
195
|
-
else extreme.level *= offsets.height.low;
|
|
196
|
-
if (extreme.high && offsets.time?.high) extreme.time = new Date(extreme.time.getTime() + offsets.time.high * 60 * 1e3);
|
|
197
|
-
if (extreme.low && offsets.time?.low) extreme.time = new Date(extreme.time.getTime() + offsets.time.low * 60 * 1e3);
|
|
198
|
-
return extreme;
|
|
199
|
-
};
|
|
200
|
-
const getExtremeLabel = (label, highLowLabels) => {
|
|
201
|
-
if (typeof highLowLabels !== "undefined" && typeof highLowLabels[label] !== "undefined") return highLowLabels[label];
|
|
202
|
-
return {
|
|
203
|
-
high: "High",
|
|
204
|
-
low: "Low"
|
|
205
|
-
}[label];
|
|
206
|
-
};
|
|
207
|
-
const predictionFactory = ({ timeline, constituents: constituents$1, start }) => {
|
|
208
|
-
const getLevel = (hour, modelBaseSpeed, modelU, modelF, modelBaseValue) => {
|
|
209
|
-
const amplitudes = [];
|
|
210
|
-
let result = 0;
|
|
211
|
-
constituents$1.forEach((constituent) => {
|
|
212
|
-
const amplitude = constituent.amplitude;
|
|
213
|
-
const phase = constituent.phase;
|
|
214
|
-
const f = modelF[constituent.name];
|
|
215
|
-
const speed = modelBaseSpeed[constituent.name];
|
|
216
|
-
const u = modelU[constituent.name];
|
|
217
|
-
const V0 = modelBaseValue[constituent.name];
|
|
218
|
-
amplitudes.push(amplitude * f * Math.cos(speed * hour + (V0 + u) - phase));
|
|
219
|
-
});
|
|
220
|
-
amplitudes.forEach((item) => {
|
|
221
|
-
result += item;
|
|
222
|
-
});
|
|
223
|
-
return result;
|
|
224
|
-
};
|
|
225
|
-
const prediction = {};
|
|
226
|
-
prediction.getExtremesPrediction = (options) => {
|
|
227
|
-
const { labels, offsets } = typeof options !== "undefined" ? options : {};
|
|
228
|
-
const results = [];
|
|
229
|
-
const { baseSpeed, u, f, baseValue } = prepare();
|
|
230
|
-
let goingUp = false;
|
|
231
|
-
let goingDown = false;
|
|
232
|
-
let lastLevel = getLevel(0, baseSpeed, u[0], f[0], baseValue);
|
|
233
|
-
timeline.items.forEach((time, index) => {
|
|
234
|
-
const hour = timeline.hours[index];
|
|
235
|
-
const level = getLevel(hour, baseSpeed, u[index], f[index], baseValue);
|
|
236
|
-
if (level > lastLevel && goingDown) results.push(addExtremesOffsets({
|
|
237
|
-
time: timeline.items[index - 1],
|
|
238
|
-
level: lastLevel,
|
|
239
|
-
high: false,
|
|
240
|
-
low: true,
|
|
241
|
-
label: getExtremeLabel("low", labels)
|
|
242
|
-
}, offsets));
|
|
243
|
-
if (level < lastLevel && goingUp) results.push(addExtremesOffsets({
|
|
244
|
-
time: timeline.items[index - 1],
|
|
245
|
-
level: lastLevel,
|
|
246
|
-
high: true,
|
|
247
|
-
low: false,
|
|
248
|
-
label: getExtremeLabel("high", labels)
|
|
249
|
-
}, offsets));
|
|
250
|
-
if (level > lastLevel) {
|
|
251
|
-
goingUp = true;
|
|
252
|
-
goingDown = false;
|
|
253
|
-
}
|
|
254
|
-
if (level < lastLevel) {
|
|
255
|
-
goingUp = false;
|
|
256
|
-
goingDown = true;
|
|
257
|
-
}
|
|
258
|
-
lastLevel = level;
|
|
259
|
-
});
|
|
260
|
-
return results;
|
|
261
|
-
};
|
|
262
|
-
prediction.getTimelinePrediction = () => {
|
|
263
|
-
const results = [];
|
|
264
|
-
const { baseSpeed, u, f, baseValue } = prepare();
|
|
265
|
-
timeline.items.forEach((time, index) => {
|
|
266
|
-
const hour = timeline.hours[index];
|
|
267
|
-
const prediction$1 = {
|
|
268
|
-
time,
|
|
269
|
-
hour,
|
|
270
|
-
level: getLevel(hour, baseSpeed, u[index], f[index], baseValue)
|
|
271
|
-
};
|
|
272
|
-
results.push(prediction$1);
|
|
273
|
-
});
|
|
274
|
-
return results;
|
|
275
|
-
};
|
|
276
|
-
const prepare = () => {
|
|
277
|
-
const baseAstro = astronomy_default(start);
|
|
278
|
-
const baseValue = {};
|
|
279
|
-
const baseSpeed = {};
|
|
280
|
-
const u = [];
|
|
281
|
-
const f = [];
|
|
282
|
-
constituents$1.forEach((constituent) => {
|
|
283
|
-
const value = constituent._model.value(baseAstro);
|
|
284
|
-
const speed = constituent._model.speed(baseAstro);
|
|
285
|
-
baseValue[constituent.name] = d2r * value;
|
|
286
|
-
baseSpeed[constituent.name] = d2r * speed;
|
|
287
|
-
});
|
|
288
|
-
timeline.items.forEach((time) => {
|
|
289
|
-
const uItem = {};
|
|
290
|
-
const fItem = {};
|
|
291
|
-
const itemAstro = astronomy_default(time);
|
|
292
|
-
constituents$1.forEach((constituent) => {
|
|
293
|
-
const constituentU = modulus(constituent._model.u(itemAstro), 360);
|
|
294
|
-
uItem[constituent.name] = d2r * constituentU;
|
|
295
|
-
fItem[constituent.name] = modulus(constituent._model.f(itemAstro), 360);
|
|
296
|
-
});
|
|
297
|
-
u.push(uItem);
|
|
298
|
-
f.push(fItem);
|
|
299
|
-
});
|
|
300
|
-
return {
|
|
301
|
-
baseValue,
|
|
302
|
-
baseSpeed,
|
|
303
|
-
u,
|
|
304
|
-
f
|
|
305
|
-
};
|
|
306
|
-
};
|
|
307
|
-
return Object.freeze(prediction);
|
|
308
|
-
};
|
|
309
|
-
var prediction_default = predictionFactory;
|
|
310
|
-
|
|
311
185
|
//#endregion
|
|
312
186
|
//#region src/node-corrections/index.ts
|
|
313
187
|
const corrections = {
|
|
@@ -430,46 +304,11 @@ const corrections = {
|
|
|
430
304
|
var node_corrections_default = corrections;
|
|
431
305
|
|
|
432
306
|
//#endregion
|
|
433
|
-
//#region src/constituents/
|
|
434
|
-
|
|
435
|
-
* Computes the dot notation of two arrays
|
|
436
|
-
*/
|
|
437
|
-
const dotArray = (a, b) => {
|
|
438
|
-
const results = [];
|
|
439
|
-
a.forEach((value, index) => {
|
|
440
|
-
results.push(value * b[index]);
|
|
441
|
-
});
|
|
442
|
-
return results.reduce((total, value) => total + value);
|
|
443
|
-
};
|
|
444
|
-
const astronimicDoodsonNumber = (astro$1) => {
|
|
445
|
-
return [
|
|
446
|
-
astro$1["T+h-s"],
|
|
447
|
-
astro$1.s,
|
|
448
|
-
astro$1.h,
|
|
449
|
-
astro$1.p,
|
|
450
|
-
astro$1.N,
|
|
451
|
-
astro$1.pp,
|
|
452
|
-
astro$1["90"]
|
|
453
|
-
];
|
|
454
|
-
};
|
|
455
|
-
const astronomicSpeed = (astro$1) => {
|
|
456
|
-
const results = [];
|
|
457
|
-
astronimicDoodsonNumber(astro$1).forEach((number) => {
|
|
458
|
-
results.push(number.speed);
|
|
459
|
-
});
|
|
460
|
-
return results;
|
|
461
|
-
};
|
|
462
|
-
const astronomicValues = (astro$1) => {
|
|
463
|
-
const results = [];
|
|
464
|
-
astronimicDoodsonNumber(astro$1).forEach((number) => {
|
|
465
|
-
results.push(number.value);
|
|
466
|
-
});
|
|
467
|
-
return results;
|
|
468
|
-
};
|
|
469
|
-
const constituentFactory = (name, coefficients$1, u, f) => {
|
|
307
|
+
//#region src/constituents/definition.ts
|
|
308
|
+
function defineConstituent(names, coefficients$1, u, f) {
|
|
470
309
|
if (!coefficients$1) throw new Error("Coefficient must be defined for a constituent");
|
|
471
|
-
|
|
472
|
-
|
|
310
|
+
return Object.freeze({
|
|
311
|
+
names: Array.isArray(names) ? names : [names],
|
|
473
312
|
coefficients: coefficients$1,
|
|
474
313
|
value: (astro$1) => {
|
|
475
314
|
return dotArray(coefficients$1, astronomicValues(astro$1));
|
|
@@ -479,14 +318,9 @@ const constituentFactory = (name, coefficients$1, u, f) => {
|
|
|
479
318
|
},
|
|
480
319
|
u: typeof u !== "undefined" ? u : node_corrections_default.uZero,
|
|
481
320
|
f: typeof f !== "undefined" ? f : node_corrections_default.fUnity
|
|
482
|
-
};
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
var constituent_default = constituentFactory;
|
|
486
|
-
|
|
487
|
-
//#endregion
|
|
488
|
-
//#region src/constituents/compound-constituent.ts
|
|
489
|
-
const compoundConstituentFactory = (name, members) => {
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
function defineCompoundConstituent(names, members) {
|
|
490
324
|
const coefficients$1 = [];
|
|
491
325
|
members.forEach(({ constituent, factor }) => {
|
|
492
326
|
constituent.coefficients.forEach((coefficient, index) => {
|
|
@@ -494,8 +328,8 @@ const compoundConstituentFactory = (name, members) => {
|
|
|
494
328
|
coefficients$1[index] += coefficient * factor;
|
|
495
329
|
});
|
|
496
330
|
});
|
|
497
|
-
|
|
498
|
-
|
|
331
|
+
return Object.freeze({
|
|
332
|
+
names: Array.isArray(names) ? names : [names],
|
|
499
333
|
coefficients: coefficients$1,
|
|
500
334
|
speed: (astro$1) => {
|
|
501
335
|
let speed = 0;
|
|
@@ -525,69 +359,71 @@ const compoundConstituentFactory = (name, members) => {
|
|
|
525
359
|
});
|
|
526
360
|
return f.reduce((previous, value) => previous * value);
|
|
527
361
|
}
|
|
528
|
-
};
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Computes the dot notation of two arrays
|
|
366
|
+
*/
|
|
367
|
+
function dotArray(a, b) {
|
|
368
|
+
const results = [];
|
|
369
|
+
a.forEach((value, index) => {
|
|
370
|
+
results.push(value * b[index]);
|
|
371
|
+
});
|
|
372
|
+
return results.reduce((total, value) => total + value);
|
|
373
|
+
}
|
|
374
|
+
function astronimicDoodsonNumber(astro$1) {
|
|
375
|
+
return [
|
|
376
|
+
astro$1["T+h-s"],
|
|
377
|
+
astro$1.s,
|
|
378
|
+
astro$1.h,
|
|
379
|
+
astro$1.p,
|
|
380
|
+
astro$1.N,
|
|
381
|
+
astro$1.pp,
|
|
382
|
+
astro$1["90"]
|
|
383
|
+
];
|
|
384
|
+
}
|
|
385
|
+
function astronomicSpeed(astro$1) {
|
|
386
|
+
const results = [];
|
|
387
|
+
astronimicDoodsonNumber(astro$1).forEach((number) => {
|
|
388
|
+
results.push(number.speed);
|
|
389
|
+
});
|
|
390
|
+
return results;
|
|
391
|
+
}
|
|
392
|
+
function astronomicValues(astro$1) {
|
|
393
|
+
const results = [];
|
|
394
|
+
astronimicDoodsonNumber(astro$1).forEach((number) => {
|
|
395
|
+
results.push(number.value);
|
|
396
|
+
});
|
|
397
|
+
return results;
|
|
398
|
+
}
|
|
399
|
+
var definition_default = {};
|
|
532
400
|
|
|
533
401
|
//#endregion
|
|
534
|
-
//#region src/constituents/
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
0,
|
|
543
|
-
0
|
|
544
|
-
], node_corrections_default.uZero, node_corrections_default.fUnity);
|
|
545
|
-
constituents.SA = constituent_default("Sa", [
|
|
546
|
-
0,
|
|
547
|
-
0,
|
|
548
|
-
1,
|
|
549
|
-
0,
|
|
550
|
-
0,
|
|
551
|
-
0,
|
|
552
|
-
0
|
|
553
|
-
], node_corrections_default.uZero, node_corrections_default.fUnity);
|
|
554
|
-
constituents.SSA = constituent_default("Ssa", [
|
|
555
|
-
0,
|
|
556
|
-
0,
|
|
402
|
+
//#region src/constituents/M2.ts
|
|
403
|
+
/**
|
|
404
|
+
* Lunar semi-diurnal (M2).
|
|
405
|
+
* Primary principal lunar constituent; largest semi-diurnal tidal component globally.
|
|
406
|
+
* Amplitude varies 10-20% over lunar node cycle; typically 0.2-0.5m in coastal areas.
|
|
407
|
+
* Base constituent for many compound shallow-water constituents.
|
|
408
|
+
*/
|
|
409
|
+
var M2_default = defineConstituent("M2", [
|
|
557
410
|
2,
|
|
558
411
|
0,
|
|
559
412
|
0,
|
|
560
413
|
0,
|
|
561
|
-
0
|
|
562
|
-
], node_corrections_default.uZero, node_corrections_default.fUnity);
|
|
563
|
-
constituents.MM = constituent_default("MM", [
|
|
564
|
-
0,
|
|
565
|
-
1,
|
|
566
|
-
0,
|
|
567
|
-
-1,
|
|
568
|
-
0,
|
|
569
|
-
0,
|
|
570
|
-
0
|
|
571
|
-
], node_corrections_default.uZero, node_corrections_default.fMm);
|
|
572
|
-
constituents.MF = constituent_default("MF", [
|
|
573
|
-
0,
|
|
574
|
-
2,
|
|
575
|
-
0,
|
|
576
|
-
0,
|
|
577
414
|
0,
|
|
578
415
|
0,
|
|
579
416
|
0
|
|
580
|
-
], node_corrections_default.
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
constituents.O1 = constituent_default("O1", [
|
|
417
|
+
], node_corrections_default.uM2, node_corrections_default.fM2);
|
|
418
|
+
|
|
419
|
+
//#endregion
|
|
420
|
+
//#region src/constituents/O1.ts
|
|
421
|
+
/**
|
|
422
|
+
* Lunar diurnal (O1).
|
|
423
|
+
* Primary lunar diurnal constituent; one-per-lunar-day oscillation.
|
|
424
|
+
* Amplitude varies 10-20% due to lunar node effects.
|
|
425
|
+
*/
|
|
426
|
+
var O1_default = defineConstituent("O1", [
|
|
591
427
|
1,
|
|
592
428
|
-1,
|
|
593
429
|
0,
|
|
@@ -596,7 +432,30 @@ constituents.O1 = constituent_default("O1", [
|
|
|
596
432
|
0,
|
|
597
433
|
1
|
|
598
434
|
], node_corrections_default.uO1, node_corrections_default.fO1);
|
|
599
|
-
|
|
435
|
+
|
|
436
|
+
//#endregion
|
|
437
|
+
//#region src/constituents/2MK3.ts
|
|
438
|
+
/**
|
|
439
|
+
* Shallow-water terdiurnal (2MK3 = M2 + O1).
|
|
440
|
+
* Lunar-lunar interaction from M2 semi-diurnal and O1 diurnal components.
|
|
441
|
+
* Generated in shallow-water environments; typical amplitude <1 cm.
|
|
442
|
+
*/
|
|
443
|
+
var _2MK3_default = defineCompoundConstituent("2MK3", [{
|
|
444
|
+
constituent: M2_default,
|
|
445
|
+
factor: 1
|
|
446
|
+
}, {
|
|
447
|
+
constituent: O1_default,
|
|
448
|
+
factor: 1
|
|
449
|
+
}]);
|
|
450
|
+
|
|
451
|
+
//#endregion
|
|
452
|
+
//#region src/constituents/K1.ts
|
|
453
|
+
/**
|
|
454
|
+
* Lunisolar diurnal (K1).
|
|
455
|
+
* Combined lunar and solar diurnal constituent; strongest diurnal tide in many regions.
|
|
456
|
+
* Often comparable in amplitude to O1; amplitude ratio K1/O1 varies with latitude.
|
|
457
|
+
*/
|
|
458
|
+
var K1_default = defineConstituent("K1", [
|
|
600
459
|
1,
|
|
601
460
|
1,
|
|
602
461
|
0,
|
|
@@ -605,52 +464,88 @@ constituents.K1 = constituent_default("K1", [
|
|
|
605
464
|
0,
|
|
606
465
|
-1
|
|
607
466
|
], node_corrections_default.uK1, node_corrections_default.fK1);
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
467
|
+
|
|
468
|
+
//#endregion
|
|
469
|
+
//#region src/constituents/2MK5.ts
|
|
470
|
+
/**
|
|
471
|
+
* Shallow-water fifth-diurnal from M2-K1 interaction.
|
|
472
|
+
*
|
|
473
|
+
* Note: Found in coastal tide predictions, especially in enclosed bays and harbors.
|
|
474
|
+
* Amplitude typically 0.1-0.5 cm depending on location and water depth.
|
|
475
|
+
* Shallow-water constituent only; not present in deep ocean.
|
|
476
|
+
*
|
|
477
|
+
* @see NOAA CO-OPS
|
|
478
|
+
*/
|
|
479
|
+
var _2MK5_default = defineCompoundConstituent("2MK5", [{
|
|
480
|
+
constituent: M2_default,
|
|
481
|
+
factor: 2
|
|
482
|
+
}, {
|
|
483
|
+
constituent: K1_default,
|
|
484
|
+
factor: 1
|
|
485
|
+
}]);
|
|
486
|
+
|
|
487
|
+
//#endregion
|
|
488
|
+
//#region src/constituents/2MO5.ts
|
|
489
|
+
/**
|
|
490
|
+
* Shallow-water fifth-diurnal from M2-O1 interaction.
|
|
491
|
+
*
|
|
492
|
+
* Note: Primarily shallow-water coastal phenomenon, not present in deep ocean.
|
|
493
|
+
* Amplitude typically <0.5 cm except in extreme shallow-water or enclosed basins.
|
|
494
|
+
* Found in coastal tide predictions alongside other shallow-water constituents.
|
|
495
|
+
*
|
|
496
|
+
* @see NOAA CO-OPS
|
|
497
|
+
*/
|
|
498
|
+
var _2MO5_default = defineCompoundConstituent("2MO5", [{
|
|
499
|
+
constituent: M2_default,
|
|
500
|
+
factor: 2
|
|
501
|
+
}, {
|
|
502
|
+
constituent: O1_default,
|
|
503
|
+
factor: 1
|
|
504
|
+
}]);
|
|
505
|
+
|
|
506
|
+
//#endregion
|
|
507
|
+
//#region src/constituents/S2.ts
|
|
508
|
+
/**
|
|
509
|
+
* Solar semi-diurnal (S2).
|
|
510
|
+
* Principal solar semi-diurnal constituent; largest solar tide component.
|
|
511
|
+
* Amplitude typically 20-50% of M2; varies with geographic location and latitude.
|
|
512
|
+
* Ratio M2/S2 determines tidal form factor (diurnal vs semi-diurnal regimes).
|
|
513
|
+
* Base constituent for many compound shallow-water constituents.
|
|
514
|
+
*/
|
|
515
|
+
var S2_default = defineConstituent("S2", [
|
|
516
|
+
2,
|
|
517
|
+
2,
|
|
629
518
|
-2,
|
|
630
519
|
0,
|
|
631
520
|
0,
|
|
632
521
|
0,
|
|
633
|
-
1
|
|
634
|
-
], node_corrections_default.uZero, node_corrections_default.fUnity);
|
|
635
|
-
constituents.S1 = constituent_default("S1", [
|
|
636
|
-
1,
|
|
637
|
-
1,
|
|
638
|
-
-1,
|
|
639
|
-
0,
|
|
640
|
-
0,
|
|
641
|
-
0,
|
|
642
522
|
0
|
|
643
523
|
], node_corrections_default.uZero, node_corrections_default.fUnity);
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
524
|
+
|
|
525
|
+
//#endregion
|
|
526
|
+
//#region src/constituents/2MS6.ts
|
|
527
|
+
/**
|
|
528
|
+
* Sixth-diurnal shallow-water interaction: 2×M2 + S2.
|
|
529
|
+
*
|
|
530
|
+
* Generated only in shallow water; typical amplitude 0.01-0.2 meters depending on depth.
|
|
531
|
+
* Included in IHO shallow-water constituent tables and NOAA analysis (order #37).
|
|
532
|
+
*/
|
|
533
|
+
var _2MS6_default = defineCompoundConstituent("2MS6", [{
|
|
534
|
+
constituent: M2_default,
|
|
535
|
+
factor: 2
|
|
536
|
+
}, {
|
|
537
|
+
constituent: S2_default,
|
|
538
|
+
factor: 1
|
|
539
|
+
}]);
|
|
540
|
+
|
|
541
|
+
//#endregion
|
|
542
|
+
//#region src/constituents/2N2.ts
|
|
543
|
+
/**
|
|
544
|
+
* Lunar semi-diurnal (2N2).
|
|
545
|
+
* Second-order lunar semi-diurnal from Moon's orbital ellipticity.
|
|
546
|
+
* Amplitude typically 5-10% of M2; significant in semi-diurnal analysis.
|
|
547
|
+
*/
|
|
548
|
+
var _2N2_default = defineConstituent("2N2", [
|
|
654
549
|
2,
|
|
655
550
|
-2,
|
|
656
551
|
0,
|
|
@@ -659,7 +554,15 @@ constituents["2N2"] = constituent_default("2N2", [
|
|
|
659
554
|
0,
|
|
660
555
|
0
|
|
661
556
|
], node_corrections_default.uM2, node_corrections_default.fM2);
|
|
662
|
-
|
|
557
|
+
|
|
558
|
+
//#endregion
|
|
559
|
+
//#region src/constituents/N2.ts
|
|
560
|
+
/**
|
|
561
|
+
* Lunar elliptic semi-diurnal (N2).
|
|
562
|
+
* Primary lunar elliptic semi-diurnal constituent from Moon's orbital variations.
|
|
563
|
+
* Amplitude typically 5-15% of M2; third-largest semi-diurnal constituent.
|
|
564
|
+
*/
|
|
565
|
+
var N2_default = defineConstituent("N2", [
|
|
663
566
|
2,
|
|
664
567
|
-1,
|
|
665
568
|
0,
|
|
@@ -668,25 +571,149 @@ constituents.N2 = constituent_default("N2", [
|
|
|
668
571
|
0,
|
|
669
572
|
0
|
|
670
573
|
], node_corrections_default.uM2, node_corrections_default.fM2);
|
|
671
|
-
|
|
574
|
+
|
|
575
|
+
//#endregion
|
|
576
|
+
//#region src/constituents/J1.ts
|
|
577
|
+
/**
|
|
578
|
+
* Lunar diurnal (J1).
|
|
579
|
+
* Shallow-water lunar diurnal constituent; generally much smaller than O1 and K1.
|
|
580
|
+
* Typically important only in shallow-water systems and enclosed basins.
|
|
581
|
+
* Amplitude usually <5% of O1; rarely significant in routine predictions.
|
|
582
|
+
*/
|
|
583
|
+
var J1_default = defineConstituent("J1", [
|
|
584
|
+
1,
|
|
672
585
|
2,
|
|
586
|
+
0,
|
|
673
587
|
-1,
|
|
588
|
+
0,
|
|
589
|
+
0,
|
|
590
|
+
-1
|
|
591
|
+
], node_corrections_default.uJ1, node_corrections_default.fJ1);
|
|
592
|
+
|
|
593
|
+
//#endregion
|
|
594
|
+
//#region src/constituents/2Q1.ts
|
|
595
|
+
/**
|
|
596
|
+
* Shallow-water diurnal (2Q1 = N2-J1).
|
|
597
|
+
* Derived from interaction of semi-diurnal N2 and diurnal J1 constituents.
|
|
598
|
+
* Amplitude typically very small; rarely significant.
|
|
599
|
+
* Found only in shallow-water regions with strong tidal distortion.
|
|
600
|
+
*/
|
|
601
|
+
var _2Q1_default = defineCompoundConstituent("2Q1", [{
|
|
602
|
+
constituent: N2_default,
|
|
603
|
+
factor: 1
|
|
604
|
+
}, {
|
|
605
|
+
constituent: J1_default,
|
|
606
|
+
factor: -1
|
|
607
|
+
}]);
|
|
608
|
+
|
|
609
|
+
//#endregion
|
|
610
|
+
//#region src/constituents/2SM2.ts
|
|
611
|
+
/**
|
|
612
|
+
* Shallow-water semi-diurnal (2SM2).
|
|
613
|
+
* Compound constituent: 2×S2 - M2
|
|
614
|
+
* Solar-lunar interaction constituent generated in shallow-water environments.
|
|
615
|
+
* Amplitude typically <2% of M2; complementary to MU2.
|
|
616
|
+
*/
|
|
617
|
+
var _2SM2_default = defineCompoundConstituent("2SM2", [{
|
|
618
|
+
constituent: S2_default,
|
|
619
|
+
factor: 2
|
|
620
|
+
}, {
|
|
621
|
+
constituent: M2_default,
|
|
622
|
+
factor: -1
|
|
623
|
+
}]);
|
|
624
|
+
|
|
625
|
+
//#endregion
|
|
626
|
+
//#region src/constituents/L2.ts
|
|
627
|
+
/**
|
|
628
|
+
* Lunar elliptic semi-diurnal (L2).
|
|
629
|
+
* Secondary lunar elliptic semi-diurnal from Moon's orbital variations and perigee effects.
|
|
630
|
+
* Amplitude typically 1-3% of M2; often grouped with other lunar elliptic constituents.
|
|
631
|
+
* Important in detailed harmonic analyses of semi-diurnal tides.
|
|
632
|
+
*/
|
|
633
|
+
var L2_default = defineConstituent("L2", [
|
|
674
634
|
2,
|
|
635
|
+
1,
|
|
636
|
+
0,
|
|
675
637
|
-1,
|
|
676
638
|
0,
|
|
677
639
|
0,
|
|
640
|
+
2
|
|
641
|
+
], node_corrections_default.uL2, node_corrections_default.fL2);
|
|
642
|
+
|
|
643
|
+
//#endregion
|
|
644
|
+
//#region src/constituents/3L2.ts
|
|
645
|
+
/**
|
|
646
|
+
* Triple lunar elliptic; 3 times L2 interaction.
|
|
647
|
+
*
|
|
648
|
+
* Warning: Not in standard IHO constituent bank. Mainly historical/theoretical interest.
|
|
649
|
+
* Very small amplitude (<0.1 cm); found only in extreme shallow water or enclosed basins.
|
|
650
|
+
* Often ignored in routine tide predictions.
|
|
651
|
+
*
|
|
652
|
+
* @see Schureman, P. (1958). Manual of Harmonic Analysis and Prediction of Tides
|
|
653
|
+
*/
|
|
654
|
+
var _3L2_default = defineCompoundConstituent("3L2", [{
|
|
655
|
+
constituent: L2_default,
|
|
656
|
+
factor: 3
|
|
657
|
+
}]);
|
|
658
|
+
|
|
659
|
+
//#endregion
|
|
660
|
+
//#region src/constituents/3N2.ts
|
|
661
|
+
/**
|
|
662
|
+
* Triple N2 shallow-water harmonic (3 × N2).
|
|
663
|
+
*
|
|
664
|
+
* Note: Shallow-water constituent with definition based on compound frequency estimates.
|
|
665
|
+
* Typical amplitude <0.5 cm; often <0.1 cm except in extreme shallow-water or enclosed basins.
|
|
666
|
+
* Rarely significant in routine tide predictions.
|
|
667
|
+
*
|
|
668
|
+
* @see NOAA CO-OPS shallow-water constituents
|
|
669
|
+
*/
|
|
670
|
+
var _3N2_default = defineCompoundConstituent("3N2", [{
|
|
671
|
+
constituent: N2_default,
|
|
672
|
+
factor: 3
|
|
673
|
+
}]);
|
|
674
|
+
|
|
675
|
+
//#endregion
|
|
676
|
+
//#region src/constituents/EP2.ts
|
|
677
|
+
/**
|
|
678
|
+
* Lunar elliptic semi-diurnal constituent (ε2).
|
|
679
|
+
*/
|
|
680
|
+
var EP2_default = defineConstituent("EP2", [
|
|
681
|
+
2,
|
|
682
|
+
-3,
|
|
683
|
+
2,
|
|
684
|
+
1,
|
|
685
|
+
0,
|
|
686
|
+
0,
|
|
678
687
|
0
|
|
679
688
|
], node_corrections_default.uM2, node_corrections_default.fM2);
|
|
680
|
-
|
|
689
|
+
|
|
690
|
+
//#endregion
|
|
691
|
+
//#region src/constituents/K2.ts
|
|
692
|
+
/**
|
|
693
|
+
* Lunisolar semi-diurnal (K2).
|
|
694
|
+
* Combined lunar and solar semi-diurnal constituent from declination effects.
|
|
695
|
+
* Amplitude typically 10-30% of S2; second-largest solar-related semi-diurnal component.
|
|
696
|
+
* Important in semi-diurnal tidal analysis, especially at mid-latitudes.
|
|
697
|
+
*/
|
|
698
|
+
var K2_default = defineConstituent("K2", [
|
|
699
|
+
2,
|
|
681
700
|
2,
|
|
682
|
-
0,
|
|
683
701
|
0,
|
|
684
702
|
0,
|
|
685
703
|
0,
|
|
686
704
|
0,
|
|
687
705
|
0
|
|
688
|
-
], node_corrections_default.
|
|
689
|
-
|
|
706
|
+
], node_corrections_default.uK2, node_corrections_default.fK2);
|
|
707
|
+
|
|
708
|
+
//#endregion
|
|
709
|
+
//#region src/constituents/LAMBDA2.ts
|
|
710
|
+
/**
|
|
711
|
+
* Lunar semi-diurnal (λ2, lambda2).
|
|
712
|
+
* Lunar semi-diurnal constituent from Moon's perigee effects.
|
|
713
|
+
* Amplitude typically <5% of M2; important in detailed constituent analysis.
|
|
714
|
+
* IHO standard designation (previously abbreviated as LAM2).
|
|
715
|
+
*/
|
|
716
|
+
var LAMBDA2_default = defineConstituent(["LAM2", "LAMBDA2"], [
|
|
690
717
|
2,
|
|
691
718
|
1,
|
|
692
719
|
-2,
|
|
@@ -695,149 +722,815 @@ constituents.LAM2 = constituent_default("LAM2", [
|
|
|
695
722
|
0,
|
|
696
723
|
2
|
|
697
724
|
], node_corrections_default.uM2, node_corrections_default.fM2);
|
|
698
|
-
|
|
699
|
-
|
|
725
|
+
|
|
726
|
+
//#endregion
|
|
727
|
+
//#region src/constituents/M1.ts
|
|
728
|
+
/**
|
|
729
|
+
* Lunar diurnal elliptic (M1).
|
|
730
|
+
* Secondary lunar diurnal constituent from Moon's elliptical orbit.
|
|
731
|
+
* Typically very small amplitude; usually <1% of O1.
|
|
732
|
+
* Rarely significant except in detailed harmonic analyses.
|
|
733
|
+
*/
|
|
734
|
+
var M1_default = defineConstituent("M1", [
|
|
700
735
|
1,
|
|
701
736
|
0,
|
|
702
|
-
-1,
|
|
703
737
|
0,
|
|
704
738
|
0,
|
|
705
|
-
2
|
|
706
|
-
], node_corrections_default.uL2, node_corrections_default.fL2);
|
|
707
|
-
constituents.T2 = constituent_default("T2", [
|
|
708
|
-
2,
|
|
709
|
-
2,
|
|
710
|
-
-3,
|
|
711
739
|
0,
|
|
712
740
|
0,
|
|
713
|
-
1
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
741
|
+
1
|
|
742
|
+
], node_corrections_default.uM1, node_corrections_default.fM1);
|
|
743
|
+
|
|
744
|
+
//#endregion
|
|
745
|
+
//#region src/constituents/M3.ts
|
|
746
|
+
/**
|
|
747
|
+
* Lunar terdiurnal (M3).
|
|
748
|
+
* Third-diurnal lunar constituent from Moon's orbital motion.
|
|
749
|
+
* Typically found in shallow water and resonant systems.
|
|
750
|
+
* Amplitude usually <2% of M2; important in some shallow-water analyses.
|
|
751
|
+
*/
|
|
752
|
+
var M3_default = defineConstituent("M3", [
|
|
753
|
+
3,
|
|
754
|
+
0,
|
|
755
|
+
0,
|
|
720
756
|
0,
|
|
721
757
|
0,
|
|
722
758
|
0,
|
|
723
759
|
0
|
|
724
|
-
],
|
|
725
|
-
|
|
726
|
-
|
|
760
|
+
], (a) => {
|
|
761
|
+
return node_corrections_default.uModd(a, 3);
|
|
762
|
+
}, (a) => {
|
|
763
|
+
return node_corrections_default.fModd(a, 3);
|
|
764
|
+
});
|
|
765
|
+
|
|
766
|
+
//#endregion
|
|
767
|
+
//#region src/constituents/M4.ts
|
|
768
|
+
/**
|
|
769
|
+
* Shallow-water quarter-diurnal (M4 = 2×M2).
|
|
770
|
+
* First overtide of M2; generated in shallow-water environments.
|
|
771
|
+
* Amplitude typically 2-10% of M2; largest of the quarter-diurnal constituents.
|
|
772
|
+
* Important indicator of shallow-water tidal distortion.
|
|
773
|
+
*/
|
|
774
|
+
var M4_default = defineCompoundConstituent("M4", [{
|
|
775
|
+
constituent: M2_default,
|
|
776
|
+
factor: 2
|
|
777
|
+
}]);
|
|
778
|
+
|
|
779
|
+
//#endregion
|
|
780
|
+
//#region src/constituents/M6.ts
|
|
781
|
+
/**
|
|
782
|
+
* Shallow-water sixth-diurnal (M6 = 3×M2).
|
|
783
|
+
* Second overtide of M2; generated in shallow-water environments.
|
|
784
|
+
* Amplitude typically 0.5-3% of M2; important in extreme shallow water.
|
|
785
|
+
* Indicator of significant tidal distortion and non-linear effects.
|
|
786
|
+
*/
|
|
787
|
+
var M6_default = defineCompoundConstituent("M6", [{
|
|
788
|
+
constituent: M2_default,
|
|
789
|
+
factor: 3
|
|
790
|
+
}]);
|
|
791
|
+
|
|
792
|
+
//#endregion
|
|
793
|
+
//#region src/constituents/M8.ts
|
|
794
|
+
/**
|
|
795
|
+
* Shallow-water eighth-diurnal (M8 = 4×M2).
|
|
796
|
+
* Third overtide of M2; generated in extreme shallow-water environments.
|
|
797
|
+
* Amplitude typically <0.5% of M2; very rarely significant.
|
|
798
|
+
* Found only in highly distorted tidal regimes (extreme shallow water, enclosed basins).
|
|
799
|
+
*/
|
|
800
|
+
var M8_default = defineCompoundConstituent("M8", [{
|
|
801
|
+
constituent: M2_default,
|
|
802
|
+
factor: 4
|
|
803
|
+
}]);
|
|
804
|
+
|
|
805
|
+
//#endregion
|
|
806
|
+
//#region src/constituents/MA2.ts
|
|
807
|
+
/**
|
|
808
|
+
* Lunar variational semi-diurnal constituent (μ2, mu2).
|
|
809
|
+
* Derived from Moon's orbital parameter variations.
|
|
810
|
+
*
|
|
811
|
+
* Note: Often included with M2 family in modern analysis. Minor constituent with
|
|
812
|
+
* location-dependent amplitude.
|
|
813
|
+
*/
|
|
814
|
+
var MA2_default = defineConstituent("MA2", [
|
|
727
815
|
2,
|
|
816
|
+
0,
|
|
728
817
|
-1,
|
|
729
818
|
0,
|
|
730
819
|
0,
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
], node_corrections_default.
|
|
734
|
-
|
|
735
|
-
|
|
820
|
+
0,
|
|
821
|
+
0
|
|
822
|
+
], node_corrections_default.uM2, node_corrections_default.fM2);
|
|
823
|
+
|
|
824
|
+
//#endregion
|
|
825
|
+
//#region src/constituents/MB2.ts
|
|
826
|
+
/**
|
|
827
|
+
* Lunar elliptic constituent from parameter variations.
|
|
828
|
+
*
|
|
829
|
+
* From https://iho.int/mtg_docs/com_wg/IHOTC/IHOTC_Misc/TWCWG_Constituent_list.pdf:
|
|
830
|
+
*
|
|
831
|
+
* > MB2 was originally called Ma2 but this became ambiguous when spoken, or typed on
|
|
832
|
+
* > computers without lower case, and so it was initially changed to MA2*. However, this
|
|
833
|
+
* > in turn was thought to be clumsy and hence MB2 was finally adopted. Although
|
|
834
|
+
* > theoretically they should have the same values of u and f as M2, they are so small
|
|
835
|
+
* > that they are commonly treated as having values of u = 0 and f = 1.
|
|
836
|
+
*
|
|
837
|
+
* @see Schureman, P. (1958). Manual of Harmonic Analysis and Prediction of Tides
|
|
838
|
+
*/
|
|
839
|
+
var MB2_default = defineConstituent("MB2", [
|
|
736
840
|
2,
|
|
737
841
|
0,
|
|
842
|
+
1,
|
|
738
843
|
0,
|
|
739
844
|
0,
|
|
740
845
|
0,
|
|
741
846
|
0
|
|
742
|
-
], node_corrections_default.
|
|
743
|
-
|
|
744
|
-
|
|
847
|
+
], node_corrections_default.uM2, node_corrections_default.fM2);
|
|
848
|
+
|
|
849
|
+
//#endregion
|
|
850
|
+
//#region src/constituents/MF.ts
|
|
851
|
+
/**
|
|
852
|
+
* Lunar fortnightly (MF).
|
|
853
|
+
* Long-period constituent from lunar inequality interactions.
|
|
854
|
+
* Significant in long-term water level records and coastal resonances.
|
|
855
|
+
*/
|
|
856
|
+
var MF_default = defineConstituent("MF", [
|
|
745
857
|
0,
|
|
858
|
+
2,
|
|
746
859
|
0,
|
|
747
860
|
0,
|
|
748
861
|
0,
|
|
749
862
|
0,
|
|
750
863
|
0
|
|
751
|
-
],
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
864
|
+
], node_corrections_default.uMf, node_corrections_default.fMf);
|
|
865
|
+
|
|
866
|
+
//#endregion
|
|
867
|
+
//#region src/constituents/MK3.ts
|
|
868
|
+
/**
|
|
869
|
+
* Shallow-water terdiurnal (MK3).
|
|
870
|
+
* Compound constituent: M2 + K1
|
|
871
|
+
* Lunisolar interaction from M2 semi-diurnal and K1 diurnal components.
|
|
872
|
+
* Generated in shallow-water environments; typical amplitude 0.5-2 cm.
|
|
873
|
+
* Often paired with 2MK3 in terdiurnal tide analysis.
|
|
874
|
+
*/
|
|
875
|
+
var MK3_default = defineCompoundConstituent("MK3", [{
|
|
876
|
+
constituent: M2_default,
|
|
758
877
|
factor: 1
|
|
759
878
|
}, {
|
|
760
|
-
constituent:
|
|
761
|
-
factor:
|
|
879
|
+
constituent: K1_default,
|
|
880
|
+
factor: 1
|
|
762
881
|
}]);
|
|
763
|
-
|
|
764
|
-
|
|
882
|
+
|
|
883
|
+
//#endregion
|
|
884
|
+
//#region src/constituents/MKS2.ts
|
|
885
|
+
/**
|
|
886
|
+
* Three-way shallow-water interaction of M2, K1, and S2.
|
|
887
|
+
*
|
|
888
|
+
* Warning: Not in standard IHO constituent bank. Shallow-water specific constituent
|
|
889
|
+
* with definition varying by application and water depth. Use with caution and document
|
|
890
|
+
* the specific convention used in your analysis.
|
|
891
|
+
*
|
|
892
|
+
* @see NOAA CO-OPS shallow-water constituents
|
|
893
|
+
*/
|
|
894
|
+
var MKS2_default = defineCompoundConstituent("MKS2", [
|
|
895
|
+
{
|
|
896
|
+
constituent: M2_default,
|
|
897
|
+
factor: 1
|
|
898
|
+
},
|
|
899
|
+
{
|
|
900
|
+
constituent: K1_default,
|
|
901
|
+
factor: 1
|
|
902
|
+
},
|
|
903
|
+
{
|
|
904
|
+
constituent: S2_default,
|
|
905
|
+
factor: -1
|
|
906
|
+
}
|
|
907
|
+
]);
|
|
908
|
+
|
|
909
|
+
//#endregion
|
|
910
|
+
//#region src/constituents/MM.ts
|
|
911
|
+
/**
|
|
912
|
+
* Lunar monthly (MM).
|
|
913
|
+
* Long-period constituent from lunar declination variations.
|
|
914
|
+
* Important for long-term water level studies.
|
|
915
|
+
*/
|
|
916
|
+
var MM_default = defineConstituent("MM", [
|
|
917
|
+
0,
|
|
918
|
+
1,
|
|
919
|
+
0,
|
|
920
|
+
-1,
|
|
921
|
+
0,
|
|
922
|
+
0,
|
|
923
|
+
0
|
|
924
|
+
], node_corrections_default.uZero, node_corrections_default.fMm);
|
|
925
|
+
|
|
926
|
+
//#endregion
|
|
927
|
+
//#region src/constituents/MN4.ts
|
|
928
|
+
/**
|
|
929
|
+
* Shallow-water quarter-diurnal (MN4).
|
|
930
|
+
* Compound constituent: M2 + N2
|
|
931
|
+
* Lunar-lunar elliptic interaction from M2 and N2 semi-diurnal components.
|
|
932
|
+
* Generated in shallow-water environments; typical amplitude 1-5 cm.
|
|
933
|
+
* Often significant in shallow seas and estuaries.
|
|
934
|
+
*/
|
|
935
|
+
var MN4_default = defineCompoundConstituent("MN4", [{
|
|
936
|
+
constituent: M2_default,
|
|
765
937
|
factor: 1
|
|
766
938
|
}, {
|
|
767
|
-
constituent:
|
|
768
|
-
factor:
|
|
939
|
+
constituent: N2_default,
|
|
940
|
+
factor: 1
|
|
769
941
|
}]);
|
|
770
|
-
|
|
771
|
-
|
|
942
|
+
|
|
943
|
+
//#endregion
|
|
944
|
+
//#region src/constituents/MS4.ts
|
|
945
|
+
/**
|
|
946
|
+
* Shallow-water quarter-diurnal (MS4).
|
|
947
|
+
* Compound constituent: M2 + S2
|
|
948
|
+
* Lunar-solar interaction from M2 and S2 semi-diurnal components.
|
|
949
|
+
* Generated in shallow-water environments; typical amplitude 1-5 cm.
|
|
950
|
+
* Often second-largest quarter-diurnal component after M4.
|
|
951
|
+
*/
|
|
952
|
+
var MS4_default = defineCompoundConstituent("MS4", [{
|
|
953
|
+
constituent: M2_default,
|
|
772
954
|
factor: 1
|
|
773
955
|
}, {
|
|
774
|
-
constituent:
|
|
775
|
-
factor:
|
|
956
|
+
constituent: S2_default,
|
|
957
|
+
factor: 1
|
|
776
958
|
}]);
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
constituent:
|
|
789
|
-
factor: -1
|
|
790
|
-
}]);
|
|
791
|
-
constituents["2MK3"] = compound_constituent_default("2MK3", [{
|
|
792
|
-
constituent: constituents.M2,
|
|
959
|
+
|
|
960
|
+
//#endregion
|
|
961
|
+
//#region src/constituents/MSF.ts
|
|
962
|
+
/**
|
|
963
|
+
* Lunisolar synodic fortnightly (MSF = S2-M2).
|
|
964
|
+
* Long-period constituent representing beat frequency between solar S2 and lunar M2.
|
|
965
|
+
* Manifests as fortnightly modulation of tidal range (spring-neap cycle).
|
|
966
|
+
* Amplitude typically 5-15% of M2; represents the primary spring-neap variation.
|
|
967
|
+
* Important for tidal range predictions and coastal flooding assessments.
|
|
968
|
+
*/
|
|
969
|
+
var MSF_default = defineCompoundConstituent("MSF", [{
|
|
970
|
+
constituent: S2_default,
|
|
793
971
|
factor: 1
|
|
794
972
|
}, {
|
|
795
|
-
constituent:
|
|
796
|
-
factor: 1
|
|
973
|
+
constituent: M2_default,
|
|
974
|
+
factor: -1
|
|
797
975
|
}]);
|
|
798
|
-
|
|
799
|
-
|
|
976
|
+
|
|
977
|
+
//#endregion
|
|
978
|
+
//#region src/constituents/MSQM.ts
|
|
979
|
+
/**
|
|
980
|
+
* Lunar-solar interaction compound constituent.
|
|
981
|
+
*
|
|
982
|
+
* Warning: Non-standard constituent not in IHO or modern NOAA standard tables.
|
|
983
|
+
* Definition varies significantly across sources. Rarely used in modern tide prediction.
|
|
984
|
+
* Appears in Schureman's tables as variant shallow-water interaction.
|
|
985
|
+
*
|
|
986
|
+
* @see NOAA CO-OPS shallow-water constituents
|
|
987
|
+
* @see Schureman shallow-water analysis tables
|
|
988
|
+
*/
|
|
989
|
+
var MSQM_default = defineCompoundConstituent("MSQM", [
|
|
990
|
+
{
|
|
991
|
+
constituent: M2_default,
|
|
992
|
+
factor: 1
|
|
993
|
+
},
|
|
994
|
+
{
|
|
995
|
+
constituent: S2_default,
|
|
996
|
+
factor: 1
|
|
997
|
+
},
|
|
998
|
+
{
|
|
999
|
+
constituent: K1_default,
|
|
1000
|
+
factor: 1
|
|
1001
|
+
}
|
|
1002
|
+
]);
|
|
1003
|
+
|
|
1004
|
+
//#endregion
|
|
1005
|
+
//#region src/constituents/T2.ts
|
|
1006
|
+
/**
|
|
1007
|
+
* Solar elliptic semi-diurnal (T2).
|
|
1008
|
+
* Larger solar elliptic semi-diurnal constituent from solar declination effects.
|
|
1009
|
+
* Amplitude typically <5% of S2; increases at higher latitudes.
|
|
1010
|
+
* Forms part of solar semi-diurnal analysis alongside S2 and R2.
|
|
1011
|
+
*/
|
|
1012
|
+
var T2_default = defineConstituent("T2", [
|
|
1013
|
+
2,
|
|
1014
|
+
2,
|
|
1015
|
+
-3,
|
|
1016
|
+
0,
|
|
1017
|
+
0,
|
|
1018
|
+
1,
|
|
1019
|
+
0
|
|
1020
|
+
], node_corrections_default.uZero, node_corrections_default.fUnity);
|
|
1021
|
+
|
|
1022
|
+
//#endregion
|
|
1023
|
+
//#region src/constituents/MTM.ts
|
|
1024
|
+
/**
|
|
1025
|
+
* Lunar-solar shallow-water interaction (M2 modulated by lunar orbit).
|
|
1026
|
+
*
|
|
1027
|
+
* Warning: Not in modern IHO standard constituents; mostly historical interest.
|
|
1028
|
+
* Often replaced by specific ν2, λ2, or other lunar elliptic terms in modern analysis.
|
|
1029
|
+
* Amplitude is location and depth-dependent.
|
|
1030
|
+
*
|
|
1031
|
+
* @see NOAA CO-OPS shallow-water variants
|
|
1032
|
+
* @see Schureman Manual
|
|
1033
|
+
*/
|
|
1034
|
+
var MTM_default = defineCompoundConstituent("MTM", [{
|
|
1035
|
+
constituent: M2_default,
|
|
800
1036
|
factor: 1
|
|
801
1037
|
}, {
|
|
802
|
-
constituent:
|
|
1038
|
+
constituent: T2_default,
|
|
803
1039
|
factor: 1
|
|
804
1040
|
}]);
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
1041
|
+
|
|
1042
|
+
//#endregion
|
|
1043
|
+
//#region src/constituents/MU2.ts
|
|
1044
|
+
/**
|
|
1045
|
+
* Shallow-water semi-diurnal (MU2 or μ2).
|
|
1046
|
+
* Compound constituent: 2×M2 - S2
|
|
1047
|
+
* Lunar variational constituent generated in shallow-water environments.
|
|
1048
|
+
* Amplitude typically <2% of M2; found in coastal shallow-water predictions.
|
|
1049
|
+
*/
|
|
1050
|
+
var MU2_default = defineCompoundConstituent("MU2", [{
|
|
1051
|
+
constituent: M2_default,
|
|
1052
|
+
factor: 2
|
|
808
1053
|
}, {
|
|
809
|
-
constituent:
|
|
810
|
-
factor: 1
|
|
1054
|
+
constituent: S2_default,
|
|
1055
|
+
factor: -1
|
|
811
1056
|
}]);
|
|
812
|
-
|
|
813
|
-
|
|
1057
|
+
|
|
1058
|
+
//#endregion
|
|
1059
|
+
//#region src/constituents/N4.ts
|
|
1060
|
+
/**
|
|
1061
|
+
* Second overtide of N2; shallow-water quarter-diurnal harmonic.
|
|
1062
|
+
* Amplitude ranges 0.25 to 2.25 times mean due to 18.613-year lunar node cycle.
|
|
1063
|
+
*
|
|
1064
|
+
* Note: Shallow-water constituent, typically found in tide predictions for coastal areas.
|
|
1065
|
+
*/
|
|
1066
|
+
var N4_default = defineCompoundConstituent("N4", [{
|
|
1067
|
+
constituent: N2_default,
|
|
814
1068
|
factor: 2
|
|
815
1069
|
}]);
|
|
816
|
-
|
|
817
|
-
|
|
1070
|
+
|
|
1071
|
+
//#endregion
|
|
1072
|
+
//#region src/constituents/NU2.ts
|
|
1073
|
+
/**
|
|
1074
|
+
* Lunar elliptic semi-diurnal (NU2).
|
|
1075
|
+
* Secondary lunar elliptic semi-diurnal from Moon's orbital variations.
|
|
1076
|
+
* Amplitude typically 2-5% of M2; smaller than N2.
|
|
1077
|
+
* Important in detailed semi-diurnal constituent analysis.
|
|
1078
|
+
*/
|
|
1079
|
+
var NU2_default = defineConstituent("NU2", [
|
|
1080
|
+
2,
|
|
1081
|
+
-1,
|
|
1082
|
+
2,
|
|
1083
|
+
-1,
|
|
1084
|
+
0,
|
|
1085
|
+
0,
|
|
1086
|
+
0
|
|
1087
|
+
], node_corrections_default.uM2, node_corrections_default.fM2);
|
|
1088
|
+
|
|
1089
|
+
//#endregion
|
|
1090
|
+
//#region src/constituents/OO1.ts
|
|
1091
|
+
/**
|
|
1092
|
+
* Lunar diurnal (OO1).
|
|
1093
|
+
* Second-order lunar diurnal constituent from Moon's orbital eccentricity.
|
|
1094
|
+
* Typically very small amplitude; <2% of O1 in most locations.
|
|
1095
|
+
* Important for detailed harmonic analysis in some regions.
|
|
1096
|
+
*/
|
|
1097
|
+
var OO1_default = defineConstituent("OO1", [
|
|
1098
|
+
1,
|
|
1099
|
+
3,
|
|
1100
|
+
0,
|
|
1101
|
+
0,
|
|
1102
|
+
0,
|
|
1103
|
+
0,
|
|
1104
|
+
-1
|
|
1105
|
+
], node_corrections_default.uOO1, node_corrections_default.fOO1);
|
|
1106
|
+
|
|
1107
|
+
//#endregion
|
|
1108
|
+
//#region src/constituents/P1.ts
|
|
1109
|
+
/**
|
|
1110
|
+
* Solar diurnal (P1).
|
|
1111
|
+
* Principal solar diurnal constituent; one-per-solar-day oscillation.
|
|
1112
|
+
* Amplitude typically 1/3 of K1; varies with latitude.
|
|
1113
|
+
* Forms key component of diurnal tidal analysis alongside K1 and O1.
|
|
1114
|
+
*/
|
|
1115
|
+
var P1_default = defineConstituent("P1", [
|
|
1116
|
+
1,
|
|
1117
|
+
1,
|
|
1118
|
+
-2,
|
|
1119
|
+
0,
|
|
1120
|
+
0,
|
|
1121
|
+
0,
|
|
1122
|
+
1
|
|
1123
|
+
], node_corrections_default.uZero, node_corrections_default.fUnity);
|
|
1124
|
+
|
|
1125
|
+
//#endregion
|
|
1126
|
+
//#region src/constituents/Q1.ts
|
|
1127
|
+
/**
|
|
1128
|
+
* Elliptic lunar diurnal (Q1).
|
|
1129
|
+
* One solar day and one lunar day modulation interaction.
|
|
1130
|
+
* Amplitude typically 2-5% of O1; important in diurnal constituent analysis.
|
|
1131
|
+
*/
|
|
1132
|
+
var Q1_default = defineConstituent("Q1", [
|
|
1133
|
+
1,
|
|
1134
|
+
-2,
|
|
1135
|
+
0,
|
|
1136
|
+
1,
|
|
1137
|
+
0,
|
|
1138
|
+
0,
|
|
1139
|
+
1
|
|
1140
|
+
], node_corrections_default.uO1, node_corrections_default.fO1);
|
|
1141
|
+
|
|
1142
|
+
//#endregion
|
|
1143
|
+
//#region src/constituents/R2.ts
|
|
1144
|
+
/**
|
|
1145
|
+
* Solar elliptic semi-diurnal (R2).
|
|
1146
|
+
* Smaller solar elliptic semi-diurnal constituent from solar declination effects.
|
|
1147
|
+
* Amplitude typically <2% of S2; smallest of the solar semi-diurnal group.
|
|
1148
|
+
* Rarely significant except in very detailed analyses.
|
|
1149
|
+
*/
|
|
1150
|
+
var R2_default = defineConstituent("R2", [
|
|
1151
|
+
2,
|
|
1152
|
+
2,
|
|
1153
|
+
-1,
|
|
1154
|
+
0,
|
|
1155
|
+
0,
|
|
1156
|
+
-1,
|
|
1157
|
+
2
|
|
1158
|
+
], node_corrections_default.uZero, node_corrections_default.fUnity);
|
|
1159
|
+
|
|
1160
|
+
//#endregion
|
|
1161
|
+
//#region src/constituents/R3.ts
|
|
1162
|
+
/**
|
|
1163
|
+
* Solar elliptic terdiurnal; 1.5 times R2 (smaller solar elliptic semi-diurnal).
|
|
1164
|
+
*
|
|
1165
|
+
* Note: Generated only in shallow water; very small amplitude (<0.05 cm typical).
|
|
1166
|
+
* Usually negligible except in extreme shallow-water environments.
|
|
1167
|
+
*
|
|
1168
|
+
* @see NOAA CO-OPS
|
|
1169
|
+
*/
|
|
1170
|
+
var R3_default = defineCompoundConstituent("R3", [{
|
|
1171
|
+
constituent: R2_default,
|
|
1172
|
+
factor: 1.5
|
|
1173
|
+
}]);
|
|
1174
|
+
|
|
1175
|
+
//#endregion
|
|
1176
|
+
//#region src/constituents/RHO1.ts
|
|
1177
|
+
/**
|
|
1178
|
+
* Shallow-water diurnal (RHO1, ρ1).
|
|
1179
|
+
* Compound constituent: NU2-K1 (ν2-K1)
|
|
1180
|
+
* Derived from interaction of semi-diurnal NU2 and diurnal K1 constituents.
|
|
1181
|
+
* Amplitude typically very small; rarely significant.
|
|
1182
|
+
* Found only in shallow-water regions with strong tidal distortion.
|
|
1183
|
+
*/
|
|
1184
|
+
var RHO1_default = defineCompoundConstituent(["RHO", "RHO1"], [{
|
|
1185
|
+
constituent: NU2_default,
|
|
818
1186
|
factor: 1
|
|
819
1187
|
}, {
|
|
820
|
-
constituent:
|
|
821
|
-
factor: 1
|
|
1188
|
+
constituent: K1_default,
|
|
1189
|
+
factor: -1
|
|
822
1190
|
}]);
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
1191
|
+
|
|
1192
|
+
//#endregion
|
|
1193
|
+
//#region src/constituents/S1.ts
|
|
1194
|
+
/**
|
|
1195
|
+
* Solar diurnal (S1).
|
|
1196
|
+
* Secondary solar diurnal constituent related to solar declination inequality.
|
|
1197
|
+
* Usually very small amplitude; typically dominated by K1 and P1 in diurnal analysis.
|
|
1198
|
+
* Rarely included in routine harmonic analyses.
|
|
1199
|
+
*/
|
|
1200
|
+
var S1_default = defineConstituent("S1", [
|
|
1201
|
+
1,
|
|
1202
|
+
1,
|
|
1203
|
+
-1,
|
|
1204
|
+
0,
|
|
1205
|
+
0,
|
|
1206
|
+
0,
|
|
1207
|
+
0
|
|
1208
|
+
], node_corrections_default.uZero, node_corrections_default.fUnity);
|
|
1209
|
+
|
|
1210
|
+
//#endregion
|
|
1211
|
+
//#region src/constituents/S3.ts
|
|
1212
|
+
/**
|
|
1213
|
+
* Solar terdiurnal overtide; shallow-water only.
|
|
1214
|
+
*
|
|
1215
|
+
* Note: Generated only in shallow water; not found in deep ocean.
|
|
1216
|
+
* Typical amplitude <1 cm except in extreme shallow-water environments.
|
|
1217
|
+
*
|
|
1218
|
+
* @see NOAA CO-OPS
|
|
1219
|
+
*/
|
|
1220
|
+
var S3_default = defineCompoundConstituent("S3", [{
|
|
1221
|
+
constituent: S2_default,
|
|
1222
|
+
factor: 1.5
|
|
826
1223
|
}]);
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
1224
|
+
|
|
1225
|
+
//#endregion
|
|
1226
|
+
//#region src/constituents/S4.ts
|
|
1227
|
+
/**
|
|
1228
|
+
* Shallow-water quarter-diurnal (S4).
|
|
1229
|
+
* Compound constituent: 2×S2
|
|
1230
|
+
* First overtide of S2; generated in shallow-water environments.
|
|
1231
|
+
* Amplitude typically 1-3% of S2; smallest of the common quarter-diurnal constituents.
|
|
1232
|
+
* Purely solar, so has fixed amplitude and phase at any location.
|
|
1233
|
+
*/
|
|
1234
|
+
var S4_default = defineCompoundConstituent("S4", [{
|
|
1235
|
+
constituent: S2_default,
|
|
1236
|
+
factor: 2
|
|
830
1237
|
}]);
|
|
831
|
-
|
|
832
|
-
|
|
1238
|
+
|
|
1239
|
+
//#endregion
|
|
1240
|
+
//#region src/constituents/S6.ts
|
|
1241
|
+
/**
|
|
1242
|
+
* Shallow-water sixth-diurnal (S6).
|
|
1243
|
+
* Compound constituent: 3×S2
|
|
1244
|
+
* Second overtide of S2; generated in shallow-water environments.
|
|
1245
|
+
* Amplitude typically 0.5-1% of S2; smallest of the common overtides.
|
|
1246
|
+
* Rarely significant except in extreme shallow water or resonant systems.
|
|
1247
|
+
*/
|
|
1248
|
+
var S6_default = defineCompoundConstituent("S6", [{
|
|
1249
|
+
constituent: S2_default,
|
|
833
1250
|
factor: 3
|
|
834
1251
|
}]);
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
1252
|
+
|
|
1253
|
+
//#endregion
|
|
1254
|
+
//#region src/constituents/SA.ts
|
|
1255
|
+
/**
|
|
1256
|
+
* Solar annual (Sa).
|
|
1257
|
+
* Long-term constituent driven by solar declination variations over the year.
|
|
1258
|
+
*/
|
|
1259
|
+
var SA_default = defineConstituent(["SA", "Sa"], [
|
|
1260
|
+
0,
|
|
1261
|
+
0,
|
|
1262
|
+
1,
|
|
1263
|
+
0,
|
|
1264
|
+
0,
|
|
1265
|
+
0,
|
|
1266
|
+
0
|
|
1267
|
+
], node_corrections_default.uZero, node_corrections_default.fUnity);
|
|
1268
|
+
|
|
1269
|
+
//#endregion
|
|
1270
|
+
//#region src/constituents/SGM.ts
|
|
1271
|
+
/**
|
|
1272
|
+
* Lunar diurnal variational constituent (σ1, sigma1).
|
|
1273
|
+
* Derived from Moon's declination variations.
|
|
1274
|
+
*
|
|
1275
|
+
* Note: Often has small amplitude; closely related to K1 and O1 variations.
|
|
1276
|
+
*/
|
|
1277
|
+
var SGM_default = defineConstituent(["SGM", "SIGMA1"], [
|
|
1278
|
+
1,
|
|
1279
|
+
-3,
|
|
1280
|
+
2,
|
|
1281
|
+
0,
|
|
1282
|
+
0,
|
|
1283
|
+
0,
|
|
1284
|
+
-1
|
|
1285
|
+
], node_corrections_default.uO1, node_corrections_default.fO1);
|
|
1286
|
+
|
|
1287
|
+
//#endregion
|
|
1288
|
+
//#region src/constituents/SSA.ts
|
|
1289
|
+
/**
|
|
1290
|
+
* Solar semi-annual (Ssa).
|
|
1291
|
+
* Semi-annual constituent from solar declination with twice-yearly periodicity.
|
|
1292
|
+
*/
|
|
1293
|
+
var SSA_default = defineConstituent(["Ssa", "SSA"], [
|
|
1294
|
+
0,
|
|
1295
|
+
0,
|
|
1296
|
+
2,
|
|
1297
|
+
0,
|
|
1298
|
+
0,
|
|
1299
|
+
0,
|
|
1300
|
+
0
|
|
1301
|
+
], node_corrections_default.uZero, node_corrections_default.fUnity);
|
|
1302
|
+
|
|
1303
|
+
//#endregion
|
|
1304
|
+
//#region src/constituents/T3.ts
|
|
1305
|
+
/**
|
|
1306
|
+
* Solar elliptic terdiurnal; 1.5 times T2 (larger solar elliptic semi-diurnal).
|
|
1307
|
+
*
|
|
1308
|
+
* Note: Generated only in shallow water; minimal amplitude (<0.1 cm typical).
|
|
1309
|
+
* Rarely significant except in extreme shallow-water or enclosed basins.
|
|
1310
|
+
*
|
|
1311
|
+
* @see NOAA CO-OPS
|
|
1312
|
+
*/
|
|
1313
|
+
var T3_default = defineCompoundConstituent("T3", [{
|
|
1314
|
+
constituent: T2_default,
|
|
1315
|
+
factor: 1.5
|
|
838
1316
|
}]);
|
|
1317
|
+
|
|
1318
|
+
//#endregion
|
|
1319
|
+
//#region src/constituents/Z0.ts
|
|
1320
|
+
/**
|
|
1321
|
+
* Mean sea level (Z0).
|
|
1322
|
+
* Not a tidal constituent in the strict sense, but represents the mean sea level offset
|
|
1323
|
+
* or the "zero" reference level used in tidal predictions.
|
|
1324
|
+
* No astronomical forcing; typically determined from harmonic analysis of observed data.
|
|
1325
|
+
*/
|
|
1326
|
+
var Z0_default = defineConstituent("Z0", [
|
|
1327
|
+
0,
|
|
1328
|
+
0,
|
|
1329
|
+
0,
|
|
1330
|
+
0,
|
|
1331
|
+
0,
|
|
1332
|
+
0,
|
|
1333
|
+
0
|
|
1334
|
+
], node_corrections_default.uZero, node_corrections_default.fUnity);
|
|
1335
|
+
|
|
1336
|
+
//#endregion
|
|
1337
|
+
//#region src/constituents/index.ts
|
|
1338
|
+
const constituentModules = {
|
|
1339
|
+
"./2MK3.ts": _2MK3_default,
|
|
1340
|
+
"./2MK5.ts": _2MK5_default,
|
|
1341
|
+
"./2MO5.ts": _2MO5_default,
|
|
1342
|
+
"./2MS6.ts": _2MS6_default,
|
|
1343
|
+
"./2N2.ts": _2N2_default,
|
|
1344
|
+
"./2Q1.ts": _2Q1_default,
|
|
1345
|
+
"./2SM2.ts": _2SM2_default,
|
|
1346
|
+
"./3L2.ts": _3L2_default,
|
|
1347
|
+
"./3N2.ts": _3N2_default,
|
|
1348
|
+
"./EP2.ts": EP2_default,
|
|
1349
|
+
"./J1.ts": J1_default,
|
|
1350
|
+
"./K1.ts": K1_default,
|
|
1351
|
+
"./K2.ts": K2_default,
|
|
1352
|
+
"./L2.ts": L2_default,
|
|
1353
|
+
"./LAMBDA2.ts": LAMBDA2_default,
|
|
1354
|
+
"./M1.ts": M1_default,
|
|
1355
|
+
"./M2.ts": M2_default,
|
|
1356
|
+
"./M3.ts": M3_default,
|
|
1357
|
+
"./M4.ts": M4_default,
|
|
1358
|
+
"./M6.ts": M6_default,
|
|
1359
|
+
"./M8.ts": M8_default,
|
|
1360
|
+
"./MA2.ts": MA2_default,
|
|
1361
|
+
"./MB2.ts": MB2_default,
|
|
1362
|
+
"./MF.ts": MF_default,
|
|
1363
|
+
"./MK3.ts": MK3_default,
|
|
1364
|
+
"./MKS2.ts": MKS2_default,
|
|
1365
|
+
"./MM.ts": MM_default,
|
|
1366
|
+
"./MN4.ts": MN4_default,
|
|
1367
|
+
"./MS4.ts": MS4_default,
|
|
1368
|
+
"./MSF.ts": MSF_default,
|
|
1369
|
+
"./MSQM.ts": MSQM_default,
|
|
1370
|
+
"./MTM.ts": MTM_default,
|
|
1371
|
+
"./MU2.ts": MU2_default,
|
|
1372
|
+
"./N2.ts": N2_default,
|
|
1373
|
+
"./N4.ts": N4_default,
|
|
1374
|
+
"./NU2.ts": NU2_default,
|
|
1375
|
+
"./O1.ts": O1_default,
|
|
1376
|
+
"./OO1.ts": OO1_default,
|
|
1377
|
+
"./P1.ts": P1_default,
|
|
1378
|
+
"./Q1.ts": Q1_default,
|
|
1379
|
+
"./R2.ts": R2_default,
|
|
1380
|
+
"./R3.ts": R3_default,
|
|
1381
|
+
"./RHO1.ts": RHO1_default,
|
|
1382
|
+
"./S1.ts": S1_default,
|
|
1383
|
+
"./S2.ts": S2_default,
|
|
1384
|
+
"./S3.ts": S3_default,
|
|
1385
|
+
"./S4.ts": S4_default,
|
|
1386
|
+
"./S6.ts": S6_default,
|
|
1387
|
+
"./SA.ts": SA_default,
|
|
1388
|
+
"./SGM.ts": SGM_default,
|
|
1389
|
+
"./SSA.ts": SSA_default,
|
|
1390
|
+
"./T2.ts": T2_default,
|
|
1391
|
+
"./T3.ts": T3_default,
|
|
1392
|
+
"./Z0.ts": Z0_default,
|
|
1393
|
+
"./definition.ts": definition_default
|
|
1394
|
+
};
|
|
1395
|
+
const constituents = {};
|
|
1396
|
+
for (const [path, module$1] of Object.entries(constituentModules)) {
|
|
1397
|
+
if (path.match(/index|definition/)) continue;
|
|
1398
|
+
module$1.names.forEach((name) => {
|
|
1399
|
+
constituents[name] = module$1;
|
|
1400
|
+
});
|
|
1401
|
+
}
|
|
839
1402
|
var constituents_default = constituents;
|
|
840
1403
|
|
|
1404
|
+
//#endregion
|
|
1405
|
+
//#region src/harmonics/prediction.ts
|
|
1406
|
+
const modulus = (a, b) => {
|
|
1407
|
+
return (a % b + b) % b;
|
|
1408
|
+
};
|
|
1409
|
+
const addExtremesOffsets = (extreme, offsets) => {
|
|
1410
|
+
if (typeof offsets === "undefined" || !offsets) return extreme;
|
|
1411
|
+
if (extreme.high && offsets.height?.high) if (offsets.height.type === "fixed") extreme.level += offsets.height.high;
|
|
1412
|
+
else extreme.level *= offsets.height.high;
|
|
1413
|
+
if (extreme.low && offsets.height?.low) if (offsets.height.type === "fixed") extreme.level += offsets.height.low;
|
|
1414
|
+
else extreme.level *= offsets.height.low;
|
|
1415
|
+
if (extreme.high && offsets.time?.high) extreme.time = new Date(extreme.time.getTime() + offsets.time.high * 60 * 1e3);
|
|
1416
|
+
if (extreme.low && offsets.time?.low) extreme.time = new Date(extreme.time.getTime() + offsets.time.low * 60 * 1e3);
|
|
1417
|
+
return extreme;
|
|
1418
|
+
};
|
|
1419
|
+
const getExtremeLabel = (label, highLowLabels) => {
|
|
1420
|
+
if (typeof highLowLabels !== "undefined" && typeof highLowLabels[label] !== "undefined") return highLowLabels[label];
|
|
1421
|
+
return {
|
|
1422
|
+
high: "High",
|
|
1423
|
+
low: "Low"
|
|
1424
|
+
}[label];
|
|
1425
|
+
};
|
|
1426
|
+
const predictionFactory = ({ timeline, constituents: constituents$1, start }) => {
|
|
1427
|
+
const getLevel = (hour, modelBaseSpeed, modelU, modelF, modelBaseValue) => {
|
|
1428
|
+
const amplitudes = [];
|
|
1429
|
+
let result = 0;
|
|
1430
|
+
constituents$1.forEach((constituent) => {
|
|
1431
|
+
const amplitude = constituent.amplitude;
|
|
1432
|
+
const phase = constituent.phase;
|
|
1433
|
+
const f = modelF[constituent.name];
|
|
1434
|
+
const speed = modelBaseSpeed[constituent.name];
|
|
1435
|
+
const u = modelU[constituent.name];
|
|
1436
|
+
const V0 = modelBaseValue[constituent.name];
|
|
1437
|
+
amplitudes.push(amplitude * f * Math.cos(speed * hour + (V0 + u) - phase));
|
|
1438
|
+
});
|
|
1439
|
+
amplitudes.forEach((item) => {
|
|
1440
|
+
result += item;
|
|
1441
|
+
});
|
|
1442
|
+
return result;
|
|
1443
|
+
};
|
|
1444
|
+
const prediction = {};
|
|
1445
|
+
prediction.getExtremesPrediction = (options) => {
|
|
1446
|
+
const { labels, offsets } = typeof options !== "undefined" ? options : {};
|
|
1447
|
+
const results = [];
|
|
1448
|
+
const { baseSpeed, u, f, baseValue } = prepare();
|
|
1449
|
+
let goingUp = false;
|
|
1450
|
+
let goingDown = false;
|
|
1451
|
+
let lastLevel = getLevel(0, baseSpeed, u[0], f[0], baseValue);
|
|
1452
|
+
timeline.items.forEach((time, index) => {
|
|
1453
|
+
const hour = timeline.hours[index];
|
|
1454
|
+
const level = getLevel(hour, baseSpeed, u[index], f[index], baseValue);
|
|
1455
|
+
if (level > lastLevel && goingDown) results.push(addExtremesOffsets({
|
|
1456
|
+
time: timeline.items[index - 1],
|
|
1457
|
+
level: lastLevel,
|
|
1458
|
+
high: false,
|
|
1459
|
+
low: true,
|
|
1460
|
+
label: getExtremeLabel("low", labels)
|
|
1461
|
+
}, offsets));
|
|
1462
|
+
if (level < lastLevel && goingUp) results.push(addExtremesOffsets({
|
|
1463
|
+
time: timeline.items[index - 1],
|
|
1464
|
+
level: lastLevel,
|
|
1465
|
+
high: true,
|
|
1466
|
+
low: false,
|
|
1467
|
+
label: getExtremeLabel("high", labels)
|
|
1468
|
+
}, offsets));
|
|
1469
|
+
if (level > lastLevel) {
|
|
1470
|
+
goingUp = true;
|
|
1471
|
+
goingDown = false;
|
|
1472
|
+
}
|
|
1473
|
+
if (level < lastLevel) {
|
|
1474
|
+
goingUp = false;
|
|
1475
|
+
goingDown = true;
|
|
1476
|
+
}
|
|
1477
|
+
lastLevel = level;
|
|
1478
|
+
});
|
|
1479
|
+
return results;
|
|
1480
|
+
};
|
|
1481
|
+
prediction.getTimelinePrediction = () => {
|
|
1482
|
+
const results = [];
|
|
1483
|
+
const { baseSpeed, u, f, baseValue } = prepare();
|
|
1484
|
+
timeline.items.forEach((time, index) => {
|
|
1485
|
+
const hour = timeline.hours[index];
|
|
1486
|
+
const prediction$1 = {
|
|
1487
|
+
time,
|
|
1488
|
+
hour,
|
|
1489
|
+
level: getLevel(hour, baseSpeed, u[index], f[index], baseValue)
|
|
1490
|
+
};
|
|
1491
|
+
results.push(prediction$1);
|
|
1492
|
+
});
|
|
1493
|
+
return results;
|
|
1494
|
+
};
|
|
1495
|
+
const prepare = () => {
|
|
1496
|
+
const baseAstro = astronomy_default(start);
|
|
1497
|
+
const baseValue = {};
|
|
1498
|
+
const baseSpeed = {};
|
|
1499
|
+
const u = [];
|
|
1500
|
+
const f = [];
|
|
1501
|
+
constituents$1.forEach((constituent) => {
|
|
1502
|
+
const model = constituents_default[constituent.name];
|
|
1503
|
+
if (!model) return;
|
|
1504
|
+
const value = model.value(baseAstro);
|
|
1505
|
+
const speed = model.speed(baseAstro);
|
|
1506
|
+
baseValue[constituent.name] = d2r * value;
|
|
1507
|
+
baseSpeed[constituent.name] = d2r * speed;
|
|
1508
|
+
});
|
|
1509
|
+
timeline.items.forEach((time) => {
|
|
1510
|
+
const uItem = {};
|
|
1511
|
+
const fItem = {};
|
|
1512
|
+
const itemAstro = astronomy_default(time);
|
|
1513
|
+
constituents$1.forEach((constituent) => {
|
|
1514
|
+
const model = constituents_default[constituent.name];
|
|
1515
|
+
if (!model) return;
|
|
1516
|
+
const constituentU = modulus(model.u(itemAstro), 360);
|
|
1517
|
+
uItem[constituent.name] = d2r * constituentU;
|
|
1518
|
+
fItem[constituent.name] = modulus(model.f(itemAstro), 360);
|
|
1519
|
+
});
|
|
1520
|
+
u.push(uItem);
|
|
1521
|
+
f.push(fItem);
|
|
1522
|
+
});
|
|
1523
|
+
return {
|
|
1524
|
+
baseValue,
|
|
1525
|
+
baseSpeed,
|
|
1526
|
+
u,
|
|
1527
|
+
f
|
|
1528
|
+
};
|
|
1529
|
+
};
|
|
1530
|
+
return Object.freeze(prediction);
|
|
1531
|
+
};
|
|
1532
|
+
var prediction_default = predictionFactory;
|
|
1533
|
+
|
|
841
1534
|
//#endregion
|
|
842
1535
|
//#region src/harmonics/index.ts
|
|
843
1536
|
const getDate = (time) => {
|
|
@@ -868,13 +1561,11 @@ const harmonicsFactory = ({ harmonicConstituents, offset }) => {
|
|
|
868
1561
|
if (typeof constituent.name === "undefined") throw new Error("Harmonic constituents must have a name property");
|
|
869
1562
|
if (constituents_default[constituent.name] !== void 0) constituents$1.push({
|
|
870
1563
|
...constituent,
|
|
871
|
-
_model: constituents_default[constituent.name],
|
|
872
1564
|
phase: d2r * constituent.phase
|
|
873
1565
|
});
|
|
874
1566
|
});
|
|
875
1567
|
if (offset !== false) constituents$1.push({
|
|
876
1568
|
name: "Z0",
|
|
877
|
-
_model: constituents_default.Z0,
|
|
878
1569
|
phase: 0,
|
|
879
1570
|
amplitude: offset
|
|
880
1571
|
});
|