@idm-plugin/meteo2 0.8.3 → 0.8.4
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.js +263 -262
- package/dist/index.umd.cjs +2 -2
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -8,9 +8,9 @@ import { fetchWeatherApi as v } from "openmeteo";
|
|
|
8
8
|
import { Meteo2Assist as Q } from "@idm-plugin/meteo";
|
|
9
9
|
import U0 from "xml2js";
|
|
10
10
|
import { LaneHelper as q0 } from "@idm-plugin/geo2";
|
|
11
|
-
let
|
|
11
|
+
let t;
|
|
12
12
|
try {
|
|
13
|
-
|
|
13
|
+
t = x.getLogger("meteo");
|
|
14
14
|
} catch {
|
|
15
15
|
} finally {
|
|
16
16
|
}
|
|
@@ -27,24 +27,24 @@ class Q0 {
|
|
|
27
27
|
*/
|
|
28
28
|
static async queryPointMeteo(M, b, z, p = !1, c = "", W = {}) {
|
|
29
29
|
typeof z == "number" && (z = z < 1e12 ? z * 1e3 : z);
|
|
30
|
-
const
|
|
30
|
+
const O = L(z), o = {
|
|
31
31
|
searchParams: {
|
|
32
32
|
lng: M,
|
|
33
33
|
lat: b,
|
|
34
|
-
ts:
|
|
34
|
+
ts: O.valueOf(),
|
|
35
35
|
params: p ? "watertemp" : void 0,
|
|
36
36
|
source: c == null ? void 0 : c.toLowerCase()
|
|
37
37
|
},
|
|
38
38
|
timeout: 3e4
|
|
39
39
|
}, q = L(), R = q.valueOf();
|
|
40
|
-
|
|
40
|
+
O.isBefore(q.subtract(1, "month")) && (t == null || t.warn("[%s] get history meteo on %s: %j", W.requestId, O.format(), o));
|
|
41
41
|
const n = "https://aod4idm.idmwx.com/api/ocean/point", Y = await H.get(n, o).json(), f = L().valueOf();
|
|
42
|
-
if (
|
|
42
|
+
if (t == null || t.info("[%s] get meteo(cost: %d ms) from %s with options: %j", W.requestId, f - R, n, o), (Y == null ? void 0 : Y.code) === 0)
|
|
43
43
|
return {
|
|
44
44
|
...Y.data,
|
|
45
45
|
source: c
|
|
46
46
|
};
|
|
47
|
-
|
|
47
|
+
t == null || t.warn("[%s] get meteo failed: %j", W.requestId, Y);
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
50
|
* 点查海洋气象要素(指定要素组合)
|
|
@@ -62,24 +62,24 @@ class Q0 {
|
|
|
62
62
|
*/
|
|
63
63
|
static async queryPointFactor(M, b, z, p = "wind,wave,current,watertemp,visibility", c = "", W = {}) {
|
|
64
64
|
typeof z == "number" && (z = z < 1e12 ? z * 1e3 : z);
|
|
65
|
-
const
|
|
65
|
+
const O = L(z), o = {
|
|
66
66
|
searchParams: {
|
|
67
67
|
lng: M,
|
|
68
68
|
lat: b,
|
|
69
|
-
ts:
|
|
69
|
+
ts: O.valueOf(),
|
|
70
70
|
params: p,
|
|
71
71
|
source: c == null ? void 0 : c.toLowerCase()
|
|
72
72
|
},
|
|
73
73
|
timeout: 3e4
|
|
74
74
|
}, q = L(), R = q.valueOf();
|
|
75
|
-
|
|
75
|
+
O.isBefore(q.subtract(1, "month")) && (t == null || t.warn("[%s] get history factors on %s: %j", W.requestId, O.format(), o));
|
|
76
76
|
const n = "https://aod4idm.idmwx.com/api/ocean/factor", Y = await H.get(n, o).json(), f = L().valueOf();
|
|
77
|
-
if (
|
|
77
|
+
if (t == null || t.info("[%s] get factors(cost: %d ms) from %s with options: %j", W.requestId, f - R, n, o), (Y == null ? void 0 : Y.code) === 0)
|
|
78
78
|
return {
|
|
79
79
|
...Y.data,
|
|
80
80
|
source: c
|
|
81
81
|
};
|
|
82
|
-
|
|
82
|
+
t == null || t.warn("[%s] get factors failed: %j", W.requestId, Y);
|
|
83
83
|
}
|
|
84
84
|
/**
|
|
85
85
|
* @see https://api.windy.com/point-forecast/docs
|
|
@@ -88,7 +88,7 @@ class Q0 {
|
|
|
88
88
|
static async queryWindyPointForecast(M, b, z, p = {}) {
|
|
89
89
|
const c = "https://api.windy.com/api/point-forecast/v2", W = [];
|
|
90
90
|
try {
|
|
91
|
-
let
|
|
91
|
+
let O = L().valueOf();
|
|
92
92
|
const o = await H.post(c, {
|
|
93
93
|
headers: {
|
|
94
94
|
"Content-Type": "application/json"
|
|
@@ -119,7 +119,7 @@ class Q0 {
|
|
|
119
119
|
}
|
|
120
120
|
}).json();
|
|
121
121
|
let q = L().valueOf();
|
|
122
|
-
|
|
122
|
+
t == null || t.info("[%s] get gfs-factors(cost: %d ms) from %s", p.requestId, q - O, c), O = q;
|
|
123
123
|
const R = await H.post(c, {
|
|
124
124
|
headers: {
|
|
125
125
|
"Content-Type": "application/json"
|
|
@@ -133,7 +133,7 @@ class Q0 {
|
|
|
133
133
|
levels: ["surface"]
|
|
134
134
|
}
|
|
135
135
|
}).json();
|
|
136
|
-
q = L().valueOf(),
|
|
136
|
+
q = L().valueOf(), t == null || t.info("[%s] get gfs-wave-factors(cost: %d ms) from %s", p.requestId, q - O, c);
|
|
137
137
|
for (let Y = 0; Y < o.ts.length; Y++) {
|
|
138
138
|
const f = this.populateUVFactor(o["wind_u-surface"][Y], o["wind_v-surface"][Y], !1, p);
|
|
139
139
|
f.scale = this.calculateBeaufortWindForceScale(f.speed), W.push({
|
|
@@ -160,13 +160,13 @@ class Q0 {
|
|
|
160
160
|
}
|
|
161
161
|
const n = [];
|
|
162
162
|
for (let Y = 0; Y < R.ts.length; Y++) {
|
|
163
|
-
const f = this.calculateDouglasScale(R["waves_height-surface"][Y], R["waves_direction-surface"][Y], R["waves_period-surface"][Y]), T = this.calculateDouglasScale(R["wwaves_height-surface"][Y], R["wwaves_direction-surface"][Y], R["wwaves_period-surface"][Y]),
|
|
163
|
+
const f = this.calculateDouglasScale(R["waves_height-surface"][Y], R["waves_direction-surface"][Y], R["waves_period-surface"][Y]), T = this.calculateDouglasScale(R["wwaves_height-surface"][Y], R["wwaves_direction-surface"][Y], R["wwaves_period-surface"][Y]), u = this.calculateDouglasScale(R["swell1_height-surface"][Y], R["swell1_direction-surface"][Y], R["swell1_period-surface"][Y]), V = this.calculateDouglasScale(R["swell2_height-surface"][Y], R["swell2_direction-surface"][Y], R["swell2_period-surface"][Y]);
|
|
164
164
|
n.push({
|
|
165
165
|
utc: L(R.ts[Y]).utc().format(),
|
|
166
166
|
wave: {
|
|
167
167
|
sig: f,
|
|
168
168
|
wd: T,
|
|
169
|
-
swell:
|
|
169
|
+
swell: u,
|
|
170
170
|
swell2: V
|
|
171
171
|
}
|
|
172
172
|
});
|
|
@@ -175,8 +175,8 @@ class Q0 {
|
|
|
175
175
|
const f = n.find((T) => T.utc === Y.utc);
|
|
176
176
|
Y.wave = f == null ? void 0 : f.wave;
|
|
177
177
|
}
|
|
178
|
-
} catch (
|
|
179
|
-
|
|
178
|
+
} catch (O) {
|
|
179
|
+
t.warn("[%s] get-gfs-factor failed: %s", p.requestId, O);
|
|
180
180
|
}
|
|
181
181
|
return W;
|
|
182
182
|
}
|
|
@@ -188,12 +188,12 @@ class Q0 {
|
|
|
188
188
|
* @param options
|
|
189
189
|
*/
|
|
190
190
|
static populateUVFactor(M, b, z = !1, p = {}) {
|
|
191
|
-
const c = Math.round(Math.sqrt(Math.pow(M, 2) + Math.pow(b, 2)) * 1e4) / 1e4, { degree: W, direction:
|
|
191
|
+
const c = Math.round(Math.sqrt(Math.pow(M, 2) + Math.pow(b, 2)) * 1e4) / 1e4, { degree: W, direction: O } = this.calculateUVDirection(M, b, z, p), o = this.convertMs2Kts(c);
|
|
192
192
|
return {
|
|
193
193
|
speed: c,
|
|
194
194
|
kts: o,
|
|
195
195
|
degree: W,
|
|
196
|
-
direction:
|
|
196
|
+
direction: O,
|
|
197
197
|
eastward: Math.round(M * 1e4) / 1e4,
|
|
198
198
|
northward: Math.round(b * 1e4) / 1e4
|
|
199
199
|
};
|
|
@@ -259,8 +259,8 @@ class Q0 {
|
|
|
259
259
|
};
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
|
-
var
|
|
263
|
-
function
|
|
262
|
+
var u0 = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
263
|
+
function t0(e) {
|
|
264
264
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
265
265
|
}
|
|
266
266
|
var Y0 = { exports: {} };
|
|
@@ -271,15 +271,15 @@ var Y0 = { exports: {} };
|
|
|
271
271
|
throw new RangeError("invalid coordinates");
|
|
272
272
|
if (90 <= b)
|
|
273
273
|
return "Etc/GMT";
|
|
274
|
-
var W = -1,
|
|
274
|
+
var W = -1, O = 48 * (180 + z) / 360.00000000000006, o = 24 * (90 - b) / 180.00000000000003, q = 0 | O, R = 0 | o, n = 96 * R + 2 * q;
|
|
275
275
|
for (n = 56 * p.charCodeAt(n) + p.charCodeAt(n + 1) - 1995; n + c.length < 3136; )
|
|
276
|
-
n = 56 * p.charCodeAt(n = 8 * (W = W + n + 1) + 4 * (R = 0 | (o = 2 * (o - R) % 2)) + 2 * (q = 0 | (
|
|
276
|
+
n = 56 * p.charCodeAt(n = 8 * (W = W + n + 1) + 4 * (R = 0 | (o = 2 * (o - R) % 2)) + 2 * (q = 0 | (O = 2 * (O - q) % 2)) + 2304) + p.charCodeAt(n + 1) - 1995;
|
|
277
277
|
return c[n + c.length - 3136];
|
|
278
278
|
}
|
|
279
279
|
e.exports = M;
|
|
280
280
|
})(Y0);
|
|
281
281
|
var V0 = Y0.exports;
|
|
282
|
-
const s0 = /* @__PURE__ */
|
|
282
|
+
const s0 = /* @__PURE__ */ t0(V0);
|
|
283
283
|
var d0 = { exports: {} };
|
|
284
284
|
(function(e) {
|
|
285
285
|
//! moment-timezone.js
|
|
@@ -289,41 +289,41 @@ var d0 = { exports: {} };
|
|
|
289
289
|
//! github.com/moment/moment-timezone
|
|
290
290
|
(function(M, b) {
|
|
291
291
|
e.exports ? e.exports = b(L) : b(M.moment);
|
|
292
|
-
})(
|
|
292
|
+
})(u0, function(M) {
|
|
293
293
|
M.version === void 0 && M.default && (M = M.default);
|
|
294
|
-
var b = "0.5.48", z = {}, p = {}, c = {}, W = {},
|
|
294
|
+
var b = "0.5.48", z = {}, p = {}, c = {}, W = {}, O = {}, o;
|
|
295
295
|
(!M || typeof M.version != "string") && F("Moment Timezone requires Moment.js. See https://momentjs.com/timezone/docs/#/use-it/browser/");
|
|
296
296
|
var q = M.version.split("."), R = +q[0], n = +q[1];
|
|
297
297
|
(R < 2 || R === 2 && n < 6) && F("Moment Timezone requires Moment.js >= 2.6.0. You are using Moment.js " + M.version + ". See momentjs.com");
|
|
298
|
-
function Y(
|
|
299
|
-
return
|
|
298
|
+
function Y(A) {
|
|
299
|
+
return A > 96 ? A - 87 : A > 64 ? A - 29 : A - 48;
|
|
300
300
|
}
|
|
301
|
-
function f(
|
|
302
|
-
var d = 0, a =
|
|
303
|
-
for (
|
|
301
|
+
function f(A) {
|
|
302
|
+
var d = 0, a = A.split("."), X = a[0], i = a[1] || "", S = 1, P, B = 0, E = 1;
|
|
303
|
+
for (A.charCodeAt(0) === 45 && (d = 1, E = -1), d; d < X.length; d++)
|
|
304
304
|
P = Y(X.charCodeAt(d)), B = 60 * B + P;
|
|
305
305
|
for (d = 0; d < i.length; d++)
|
|
306
306
|
S = S / 60, P = Y(i.charCodeAt(d)), B += P * S;
|
|
307
307
|
return B * E;
|
|
308
308
|
}
|
|
309
|
-
function T(
|
|
310
|
-
for (var d = 0; d <
|
|
311
|
-
|
|
309
|
+
function T(A) {
|
|
310
|
+
for (var d = 0; d < A.length; d++)
|
|
311
|
+
A[d] = f(A[d]);
|
|
312
312
|
}
|
|
313
|
-
function
|
|
313
|
+
function u(A, d) {
|
|
314
314
|
for (var a = 0; a < d; a++)
|
|
315
|
-
|
|
316
|
-
|
|
315
|
+
A[a] = Math.round((A[a - 1] || 0) + A[a] * 6e4);
|
|
316
|
+
A[d - 1] = 1 / 0;
|
|
317
317
|
}
|
|
318
|
-
function V(
|
|
318
|
+
function V(A, d) {
|
|
319
319
|
var a = [], X;
|
|
320
320
|
for (X = 0; X < d.length; X++)
|
|
321
|
-
a[X] =
|
|
321
|
+
a[X] = A[d[X]];
|
|
322
322
|
return a;
|
|
323
323
|
}
|
|
324
|
-
function l(
|
|
325
|
-
var d =
|
|
326
|
-
return T(a), T(X), T(i),
|
|
324
|
+
function l(A) {
|
|
325
|
+
var d = A.split("|"), a = d[2].split(" "), X = d[3].split(""), i = d[4].split(" ");
|
|
326
|
+
return T(a), T(X), T(i), u(i, X.length), {
|
|
327
327
|
name: d[0],
|
|
328
328
|
abbrs: V(d[1].split(" "), X),
|
|
329
329
|
offsets: V(a, X),
|
|
@@ -331,92 +331,92 @@ var d0 = { exports: {} };
|
|
|
331
331
|
population: d[5] | 0
|
|
332
332
|
};
|
|
333
333
|
}
|
|
334
|
-
function U(
|
|
335
|
-
|
|
334
|
+
function U(A) {
|
|
335
|
+
A && this._set(l(A));
|
|
336
336
|
}
|
|
337
|
-
function r(
|
|
337
|
+
function r(A, d) {
|
|
338
338
|
var a = d.length;
|
|
339
|
-
if (
|
|
339
|
+
if (A < d[0])
|
|
340
340
|
return 0;
|
|
341
|
-
if (a > 1 && d[a - 1] === 1 / 0 &&
|
|
341
|
+
if (a > 1 && d[a - 1] === 1 / 0 && A >= d[a - 2])
|
|
342
342
|
return a - 1;
|
|
343
|
-
if (
|
|
343
|
+
if (A >= d[a - 1])
|
|
344
344
|
return -1;
|
|
345
345
|
for (var X, i = 0, S = a - 1; S - i > 1; )
|
|
346
|
-
X = Math.floor((i + S) / 2), d[X] <=
|
|
346
|
+
X = Math.floor((i + S) / 2), d[X] <= A ? i = X : S = X;
|
|
347
347
|
return S;
|
|
348
348
|
}
|
|
349
349
|
U.prototype = {
|
|
350
|
-
_set: function(
|
|
351
|
-
this.name =
|
|
350
|
+
_set: function(A) {
|
|
351
|
+
this.name = A.name, this.abbrs = A.abbrs, this.untils = A.untils, this.offsets = A.offsets, this.population = A.population;
|
|
352
352
|
},
|
|
353
|
-
_index: function(
|
|
354
|
-
var d = +
|
|
353
|
+
_index: function(A) {
|
|
354
|
+
var d = +A, a = this.untils, X;
|
|
355
355
|
if (X = r(d, a), X >= 0)
|
|
356
356
|
return X;
|
|
357
357
|
},
|
|
358
358
|
countries: function() {
|
|
359
|
-
var
|
|
359
|
+
var A = this.name;
|
|
360
360
|
return Object.keys(c).filter(function(d) {
|
|
361
|
-
return c[d].zones.indexOf(
|
|
361
|
+
return c[d].zones.indexOf(A) !== -1;
|
|
362
362
|
});
|
|
363
363
|
},
|
|
364
|
-
parse: function(
|
|
365
|
-
var d = +
|
|
364
|
+
parse: function(A) {
|
|
365
|
+
var d = +A, a = this.offsets, X = this.untils, i = X.length - 1, S, P, B, E;
|
|
366
366
|
for (E = 0; E < i; E++)
|
|
367
367
|
if (S = a[E], P = a[E + 1], B = a[E && E - 1], S < P && s.moveAmbiguousForward ? S = P : S > B && s.moveInvalidForward && (S = B), d < X[E] - S * 6e4)
|
|
368
368
|
return a[E];
|
|
369
369
|
return a[i];
|
|
370
370
|
},
|
|
371
|
-
abbr: function(
|
|
372
|
-
return this.abbrs[this._index(
|
|
371
|
+
abbr: function(A) {
|
|
372
|
+
return this.abbrs[this._index(A)];
|
|
373
373
|
},
|
|
374
|
-
offset: function(
|
|
375
|
-
return F("zone.offset has been deprecated in favor of zone.utcOffset"), this.offsets[this._index(
|
|
374
|
+
offset: function(A) {
|
|
375
|
+
return F("zone.offset has been deprecated in favor of zone.utcOffset"), this.offsets[this._index(A)];
|
|
376
376
|
},
|
|
377
|
-
utcOffset: function(
|
|
378
|
-
return this.offsets[this._index(
|
|
377
|
+
utcOffset: function(A) {
|
|
378
|
+
return this.offsets[this._index(A)];
|
|
379
379
|
}
|
|
380
380
|
};
|
|
381
|
-
function Z(
|
|
382
|
-
this.name =
|
|
381
|
+
function Z(A, d) {
|
|
382
|
+
this.name = A, this.zones = d;
|
|
383
383
|
}
|
|
384
|
-
function m(
|
|
385
|
-
var d =
|
|
386
|
-
a && a[0] ? (a = a[0].match(/[A-Z]/g), a = a ? a.join("") : void 0) : (a = d.match(/[A-Z]{3,5}/g), a = a ? a[0] : void 0), a === "GMT" && (a = void 0), this.at = +
|
|
384
|
+
function m(A) {
|
|
385
|
+
var d = A.toTimeString(), a = d.match(/\([a-z ]+\)/i);
|
|
386
|
+
a && a[0] ? (a = a[0].match(/[A-Z]/g), a = a ? a.join("") : void 0) : (a = d.match(/[A-Z]{3,5}/g), a = a ? a[0] : void 0), a === "GMT" && (a = void 0), this.at = +A, this.abbr = a, this.offset = A.getTimezoneOffset();
|
|
387
387
|
}
|
|
388
|
-
function G(
|
|
389
|
-
this.zone =
|
|
388
|
+
function G(A) {
|
|
389
|
+
this.zone = A, this.offsetScore = 0, this.abbrScore = 0;
|
|
390
390
|
}
|
|
391
|
-
G.prototype.scoreOffsetAt = function(
|
|
392
|
-
this.offsetScore += Math.abs(this.zone.utcOffset(
|
|
391
|
+
G.prototype.scoreOffsetAt = function(A) {
|
|
392
|
+
this.offsetScore += Math.abs(this.zone.utcOffset(A.at) - A.offset), this.zone.abbr(A.at).replace(/[^A-Z]/g, "") !== A.abbr && this.abbrScore++;
|
|
393
393
|
};
|
|
394
|
-
function I(
|
|
395
|
-
for (var a, X; X = ((d.at -
|
|
396
|
-
a = new m(new Date(
|
|
397
|
-
return
|
|
394
|
+
function I(A, d) {
|
|
395
|
+
for (var a, X; X = ((d.at - A.at) / 12e4 | 0) * 6e4; )
|
|
396
|
+
a = new m(new Date(A.at + X)), a.offset === A.offset ? A = a : d = a;
|
|
397
|
+
return A;
|
|
398
398
|
}
|
|
399
399
|
function C() {
|
|
400
|
-
var
|
|
400
|
+
var A = (/* @__PURE__ */ new Date()).getFullYear() - 2, d = new m(new Date(A, 0, 1)), a = d.offset, X = [d], i, S, P, B;
|
|
401
401
|
for (B = 1; B < 48; B++)
|
|
402
|
-
P = new Date(
|
|
402
|
+
P = new Date(A, B, 1).getTimezoneOffset(), P !== a && (S = new m(new Date(A, B, 1)), i = I(d, S), X.push(i), X.push(new m(new Date(i.at + 6e4))), d = S, a = P);
|
|
403
403
|
for (B = 0; B < 4; B++)
|
|
404
|
-
X.push(new m(new Date(
|
|
404
|
+
X.push(new m(new Date(A + B, 0, 1))), X.push(new m(new Date(A + B, 6, 1)));
|
|
405
405
|
return X;
|
|
406
406
|
}
|
|
407
|
-
function w(
|
|
408
|
-
return
|
|
407
|
+
function w(A, d) {
|
|
408
|
+
return A.offsetScore !== d.offsetScore ? A.offsetScore - d.offsetScore : A.abbrScore !== d.abbrScore ? A.abbrScore - d.abbrScore : A.zone.population !== d.zone.population ? d.zone.population - A.zone.population : d.zone.name.localeCompare(A.zone.name);
|
|
409
409
|
}
|
|
410
|
-
function y(
|
|
410
|
+
function y(A, d) {
|
|
411
411
|
var a, X;
|
|
412
412
|
for (T(d), a = 0; a < d.length; a++)
|
|
413
|
-
X = d[a],
|
|
413
|
+
X = d[a], O[X] = O[X] || {}, O[X][A] = !0;
|
|
414
414
|
}
|
|
415
|
-
function M0(
|
|
416
|
-
var d =
|
|
415
|
+
function M0(A) {
|
|
416
|
+
var d = A.length, a = {}, X = [], i = {}, S, P, B, E;
|
|
417
417
|
for (S = 0; S < d; S++)
|
|
418
|
-
if (B =
|
|
419
|
-
E =
|
|
418
|
+
if (B = A[S].offset, !i.hasOwnProperty(B)) {
|
|
419
|
+
E = O[B] || {};
|
|
420
420
|
for (P in E)
|
|
421
421
|
E.hasOwnProperty(P) && (a[P] = !0);
|
|
422
422
|
i[B] = !0;
|
|
@@ -427,12 +427,12 @@ var d0 = { exports: {} };
|
|
|
427
427
|
}
|
|
428
428
|
function z0() {
|
|
429
429
|
try {
|
|
430
|
-
var
|
|
431
|
-
if (
|
|
432
|
-
var d = W[J(
|
|
430
|
+
var A = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
431
|
+
if (A && A.length > 3) {
|
|
432
|
+
var d = W[J(A)];
|
|
433
433
|
if (d)
|
|
434
434
|
return d;
|
|
435
|
-
F("Moment Timezone found " +
|
|
435
|
+
F("Moment Timezone found " + A + " from the Intl api, but did not have that data loaded.");
|
|
436
436
|
}
|
|
437
437
|
} catch {
|
|
438
438
|
}
|
|
@@ -444,52 +444,52 @@ var d0 = { exports: {} };
|
|
|
444
444
|
}
|
|
445
445
|
return S.sort(w), S.length > 0 ? S[0].zone.name : void 0;
|
|
446
446
|
}
|
|
447
|
-
function X0(
|
|
448
|
-
return (!o ||
|
|
447
|
+
function X0(A) {
|
|
448
|
+
return (!o || A) && (o = z0()), o;
|
|
449
449
|
}
|
|
450
|
-
function J(
|
|
451
|
-
return (
|
|
450
|
+
function J(A) {
|
|
451
|
+
return (A || "").toLowerCase().replace(/\//g, "_");
|
|
452
452
|
}
|
|
453
|
-
function A0(
|
|
453
|
+
function A0(A) {
|
|
454
454
|
var d, a, X, i;
|
|
455
|
-
for (typeof
|
|
456
|
-
X =
|
|
455
|
+
for (typeof A == "string" && (A = [A]), d = 0; d < A.length; d++)
|
|
456
|
+
X = A[d].split("|"), a = X[0], i = J(a), z[i] = A[d], W[i] = a, y(i, X[2].split(" "));
|
|
457
457
|
}
|
|
458
|
-
function g(
|
|
459
|
-
|
|
460
|
-
var a = z[
|
|
461
|
-
return a instanceof U ? a : typeof a == "string" ? (a = new U(a), z[
|
|
458
|
+
function g(A, d) {
|
|
459
|
+
A = J(A);
|
|
460
|
+
var a = z[A], X;
|
|
461
|
+
return a instanceof U ? a : typeof a == "string" ? (a = new U(a), z[A] = a, a) : p[A] && d !== g && (X = g(p[A], g)) ? (a = z[A] = new U(), a._set(X), a.name = W[A], a) : null;
|
|
462
462
|
}
|
|
463
463
|
function n0() {
|
|
464
|
-
var
|
|
465
|
-
for (
|
|
466
|
-
W.hasOwnProperty(
|
|
464
|
+
var A, d = [];
|
|
465
|
+
for (A in W)
|
|
466
|
+
W.hasOwnProperty(A) && (z[A] || z[p[A]]) && W[A] && d.push(W[A]);
|
|
467
467
|
return d.sort();
|
|
468
468
|
}
|
|
469
469
|
function L0() {
|
|
470
470
|
return Object.keys(c);
|
|
471
471
|
}
|
|
472
|
-
function c0(
|
|
472
|
+
function c0(A) {
|
|
473
473
|
var d, a, X, i;
|
|
474
|
-
for (typeof
|
|
475
|
-
a =
|
|
474
|
+
for (typeof A == "string" && (A = [A]), d = 0; d < A.length; d++)
|
|
475
|
+
a = A[d].split("|"), X = J(a[0]), i = J(a[1]), p[X] = i, W[X] = a[0], p[i] = X, W[i] = a[1];
|
|
476
476
|
}
|
|
477
|
-
function e0(
|
|
477
|
+
function e0(A) {
|
|
478
478
|
var d, a, X, i;
|
|
479
|
-
if (!(!
|
|
480
|
-
for (d = 0; d <
|
|
481
|
-
i =
|
|
479
|
+
if (!(!A || !A.length))
|
|
480
|
+
for (d = 0; d < A.length; d++)
|
|
481
|
+
i = A[d].split("|"), a = i[0].toUpperCase(), X = i[1].split(" "), c[a] = new Z(
|
|
482
482
|
a,
|
|
483
483
|
X
|
|
484
484
|
);
|
|
485
485
|
}
|
|
486
|
-
function T0(
|
|
487
|
-
return
|
|
486
|
+
function T0(A) {
|
|
487
|
+
return A = A.toUpperCase(), c[A] || null;
|
|
488
488
|
}
|
|
489
|
-
function i0(
|
|
490
|
-
if (
|
|
489
|
+
function i0(A, d) {
|
|
490
|
+
if (A = T0(A), !A)
|
|
491
491
|
return null;
|
|
492
|
-
var a =
|
|
492
|
+
var a = A.zones.sort();
|
|
493
493
|
return d ? a.map(function(X) {
|
|
494
494
|
var i = g(X);
|
|
495
495
|
return {
|
|
@@ -498,59 +498,59 @@ var d0 = { exports: {} };
|
|
|
498
498
|
};
|
|
499
499
|
}) : a;
|
|
500
500
|
}
|
|
501
|
-
function r0(
|
|
502
|
-
A0(
|
|
501
|
+
function r0(A) {
|
|
502
|
+
A0(A.zones), c0(A.links), e0(A.countries), s.dataVersion = A.version;
|
|
503
503
|
}
|
|
504
|
-
function b0(
|
|
505
|
-
return b0.didShowError || (b0.didShowError = !0, F("moment.tz.zoneExists('" +
|
|
504
|
+
function b0(A) {
|
|
505
|
+
return b0.didShowError || (b0.didShowError = !0, F("moment.tz.zoneExists('" + A + "') has been deprecated in favor of !moment.tz.zone('" + A + "')")), !!g(A);
|
|
506
506
|
}
|
|
507
|
-
function p0(
|
|
508
|
-
var d =
|
|
509
|
-
return !!(
|
|
507
|
+
function p0(A) {
|
|
508
|
+
var d = A._f === "X" || A._f === "x";
|
|
509
|
+
return !!(A._a && A._tzm === void 0 && !d);
|
|
510
510
|
}
|
|
511
|
-
function F(
|
|
512
|
-
typeof console < "u" && typeof console.error == "function" && console.error(
|
|
511
|
+
function F(A) {
|
|
512
|
+
typeof console < "u" && typeof console.error == "function" && console.error(A);
|
|
513
513
|
}
|
|
514
|
-
function s(
|
|
514
|
+
function s(A) {
|
|
515
515
|
var d = Array.prototype.slice.call(arguments, 0, -1), a = arguments[arguments.length - 1], X = M.utc.apply(null, d), i;
|
|
516
|
-
return !M.isMoment(
|
|
516
|
+
return !M.isMoment(A) && p0(X) && (i = g(a)) && X.add(i.parse(X), "minutes"), X.tz(a), X;
|
|
517
517
|
}
|
|
518
518
|
s.version = b, s.dataVersion = "", s._zones = z, s._links = p, s._names = W, s._countries = c, s.add = A0, s.link = c0, s.load = r0, s.zone = g, s.zoneExists = b0, s.guess = X0, s.names = n0, s.Zone = U, s.unpack = l, s.unpackBase60 = f, s.needsOffset = p0, s.moveInvalidForward = !0, s.moveAmbiguousForward = !1, s.countries = L0, s.zonesForCountry = i0;
|
|
519
519
|
var D = M.fn;
|
|
520
|
-
M.tz = s, M.defaultZone = null, M.updateOffset = function(
|
|
520
|
+
M.tz = s, M.defaultZone = null, M.updateOffset = function(A, d) {
|
|
521
521
|
var a = M.defaultZone, X;
|
|
522
|
-
if (
|
|
523
|
-
if (X =
|
|
524
|
-
var i =
|
|
525
|
-
|
|
522
|
+
if (A._z === void 0 && (a && p0(A) && !A._isUTC && A.isValid() && (A._d = M.utc(A._a)._d, A.utc().add(a.parse(A), "minutes")), A._z = a), A._z)
|
|
523
|
+
if (X = A._z.utcOffset(A), Math.abs(X) < 16 && (X = X / 60), A.utcOffset !== void 0) {
|
|
524
|
+
var i = A._z;
|
|
525
|
+
A.utcOffset(-X, d), A._z = i;
|
|
526
526
|
} else
|
|
527
|
-
|
|
528
|
-
}, D.tz = function(
|
|
529
|
-
if (
|
|
530
|
-
if (typeof
|
|
531
|
-
throw new Error("Time zone name must be a string, got " +
|
|
532
|
-
return this._z = g(
|
|
527
|
+
A.zone(X, d);
|
|
528
|
+
}, D.tz = function(A, d) {
|
|
529
|
+
if (A) {
|
|
530
|
+
if (typeof A != "string")
|
|
531
|
+
throw new Error("Time zone name must be a string, got " + A + " [" + typeof A + "]");
|
|
532
|
+
return this._z = g(A), this._z ? M.updateOffset(this, d) : F("Moment Timezone has no data for " + A + ". See http://momentjs.com/timezone/docs/#/data-loading/."), this;
|
|
533
533
|
}
|
|
534
534
|
if (this._z)
|
|
535
535
|
return this._z.name;
|
|
536
536
|
};
|
|
537
|
-
function W0(
|
|
537
|
+
function W0(A) {
|
|
538
538
|
return function() {
|
|
539
|
-
return this._z ? this._z.abbr(this) :
|
|
539
|
+
return this._z ? this._z.abbr(this) : A.call(this);
|
|
540
540
|
};
|
|
541
541
|
}
|
|
542
|
-
function o0(
|
|
542
|
+
function o0(A) {
|
|
543
543
|
return function() {
|
|
544
|
-
return this._z = null,
|
|
544
|
+
return this._z = null, A.apply(this, arguments);
|
|
545
545
|
};
|
|
546
546
|
}
|
|
547
|
-
function f0(
|
|
547
|
+
function f0(A) {
|
|
548
548
|
return function() {
|
|
549
|
-
return arguments.length > 0 && (this._z = null),
|
|
549
|
+
return arguments.length > 0 && (this._z = null), A.apply(this, arguments);
|
|
550
550
|
};
|
|
551
551
|
}
|
|
552
|
-
D.zoneName = W0(D.zoneName), D.zoneAbbr = W0(D.zoneAbbr), D.utc = o0(D.utc), D.local = o0(D.local), D.utcOffset = f0(D.utcOffset), M.tz.setDefault = function(
|
|
553
|
-
return (R < 2 || R === 2 && n < 9) && F("Moment Timezone setDefault() requires Moment.js >= 2.9.0. You are using Moment.js " + M.version + "."), M.defaultZone =
|
|
552
|
+
D.zoneName = W0(D.zoneName), D.zoneAbbr = W0(D.zoneAbbr), D.utc = o0(D.utc), D.local = o0(D.local), D.utcOffset = f0(D.utcOffset), M.tz.setDefault = function(A) {
|
|
553
|
+
return (R < 2 || R === 2 && n < 9) && F("Moment Timezone setDefault() requires Moment.js >= 2.9.0. You are using Moment.js " + M.version + "."), M.defaultZone = A ? g(A) : null, M;
|
|
554
554
|
};
|
|
555
555
|
var $ = M.momentProperties;
|
|
556
556
|
return Object.prototype.toString.call($) === "[object Array]" ? ($.push("_z"), $.push("_a")) : $ && ($._z = null), M;
|
|
@@ -1491,14 +1491,14 @@ class y0 {
|
|
|
1491
1491
|
if (M.start_dates instanceof Array)
|
|
1492
1492
|
for (let W = 0; W < M.start_dates.length; W++) {
|
|
1493
1493
|
M.start_date = M.start_dates[W], M.end_date = M.end_dates[W], M.fake = M.fakes[W];
|
|
1494
|
-
const
|
|
1495
|
-
this.debug && h.debug("[%s] fetch weather via %s with %j", b.requestId,
|
|
1494
|
+
const O = M.url[W];
|
|
1495
|
+
this.debug && h.debug("[%s] fetch weather via %s with %j", b.requestId, O, {
|
|
1496
1496
|
start_date: M.start_date,
|
|
1497
1497
|
end_date: M.end_date,
|
|
1498
1498
|
fake: M.fake,
|
|
1499
1499
|
step: W
|
|
1500
1500
|
});
|
|
1501
|
-
const o = await v(
|
|
1501
|
+
const o = await v(O, M), q = await this.parseWeatherData(o, M, b);
|
|
1502
1502
|
p ? await this.mergeSegments(p, q) : p = q;
|
|
1503
1503
|
}
|
|
1504
1504
|
else {
|
|
@@ -1529,7 +1529,7 @@ class y0 {
|
|
|
1529
1529
|
* @param options
|
|
1530
1530
|
*/
|
|
1531
1531
|
async marineForecast(M, b = {}) {
|
|
1532
|
-
var z, p, c, W,
|
|
1532
|
+
var z, p, c, W, O, o, q, R;
|
|
1533
1533
|
try {
|
|
1534
1534
|
const n = L();
|
|
1535
1535
|
let Y;
|
|
@@ -1553,8 +1553,8 @@ class y0 {
|
|
|
1553
1553
|
delete M.apikey;
|
|
1554
1554
|
const f = L();
|
|
1555
1555
|
this.debug && h.info("[%s] fetch marine api (%j) cost: %d ms", b.requestId, M.url, f.diff(n, "ms"));
|
|
1556
|
-
const T = await this.mergeMarineData(Y),
|
|
1557
|
-
return (p = (z = U == null ? void 0 : U.hourly) == null ? void 0 : z.wave_height) != null && p.every((r) => r !== null) ? [U] : (W = (c = l == null ? void 0 : l.hourly) == null ? void 0 : c.wave_height) != null && W.every((r) => r !== null) ? [l] : (o = (
|
|
1556
|
+
const T = await this.mergeMarineData(Y), u = T.find((r) => r.model === "ncep_gfswave016"), V = T.find((r) => r.model === "ncep_gfswave025"), l = T.find((r) => r.model === "meteofrance_wave"), U = T.find((r) => r.model === "best_match");
|
|
1557
|
+
return (p = (z = U == null ? void 0 : U.hourly) == null ? void 0 : z.wave_height) != null && p.every((r) => r !== null) ? [U] : (W = (c = l == null ? void 0 : l.hourly) == null ? void 0 : c.wave_height) != null && W.every((r) => r !== null) ? [l] : (o = (O = u == null ? void 0 : u.hourly) == null ? void 0 : O.wave_height) != null && o.every((r) => r !== null) ? [u] : (R = (q = V == null ? void 0 : V.hourly) == null ? void 0 : q.wave_height) != null && R.every((r) => r !== null) ? [V] : T != null && T.length ? [T[0]] : [];
|
|
1558
1558
|
} catch (n) {
|
|
1559
1559
|
return h.warn("[%s] marine forecast failed: %s, with %j", b.requestId, n, M), [];
|
|
1560
1560
|
}
|
|
@@ -1567,11 +1567,11 @@ class y0 {
|
|
|
1567
1567
|
* @private
|
|
1568
1568
|
*/
|
|
1569
1569
|
async parseWeatherData(M, b, z = {}) {
|
|
1570
|
-
var W,
|
|
1570
|
+
var W, O, o, q, R, n, Y;
|
|
1571
1571
|
const p = [], c = Math.pow(10, z.precision || 6);
|
|
1572
1572
|
for (let f = 0; f < M.length; f++) {
|
|
1573
|
-
const T = M[f],
|
|
1574
|
-
if (Z.timezone = V || void 0, Z.offset = this.prettyTimezoneOffset(
|
|
1573
|
+
const T = M[f], u = T.utcOffsetSeconds(), V = T.timezone(), l = T.current(), U = T.hourly(), r = T.daily(), Z = {};
|
|
1574
|
+
if (Z.timezone = V || void 0, Z.offset = this.prettyTimezoneOffset(u), Z.model = b.models instanceof Array ? (W = b.models) == null ? void 0 : W[f] : b.models || "best_match", l) {
|
|
1575
1575
|
const m = L();
|
|
1576
1576
|
Z.current = {
|
|
1577
1577
|
time: L.unix(Number(l.time())).utc().format()
|
|
@@ -1592,7 +1592,7 @@ class y0 {
|
|
|
1592
1592
|
)
|
|
1593
1593
|
};
|
|
1594
1594
|
for (let C = 0; C < U.variablesLength(); C++) {
|
|
1595
|
-
const w = (q = (o = (
|
|
1595
|
+
const w = (q = (o = (O = U.variables(C).valuesArray()) == null ? void 0 : O.toString()) == null ? void 0 : o.split(",")) == null ? void 0 : q.map((y) => isNaN(y) ? null : Math.round(Number(y) * c) / c);
|
|
1596
1596
|
Z.hourly[b.hourly[C]] = w;
|
|
1597
1597
|
}
|
|
1598
1598
|
const I = L();
|
|
@@ -1628,9 +1628,9 @@ class y0 {
|
|
|
1628
1628
|
for (let W = M[z][p][c].length; W < b[z][p][c].length; W++)
|
|
1629
1629
|
M[z][p][c].push(b[z][p][c][W]);
|
|
1630
1630
|
} else {
|
|
1631
|
-
const W = L(b[z][p].date),
|
|
1631
|
+
const W = L(b[z][p].date), O = L(M[z][p].date);
|
|
1632
1632
|
for (let o = 0; o < b[z][p][c].length; o++) {
|
|
1633
|
-
const q = W.clone().add(o, "h").diff(
|
|
1633
|
+
const q = W.clone().add(o, "h").diff(O, "h");
|
|
1634
1634
|
q < M[z][p][c].length ? M[z][p][c][q] === null && (M[z][p][c][q] = b[z][p][c][o]) : c === "time" ? M[z][p][c].push(q) : M[z][p][c].push(b[z][p][c][o]);
|
|
1635
1635
|
}
|
|
1636
1636
|
}
|
|
@@ -1645,12 +1645,12 @@ class y0 {
|
|
|
1645
1645
|
return M;
|
|
1646
1646
|
}
|
|
1647
1647
|
async mergeMarineData(M) {
|
|
1648
|
-
var c, W,
|
|
1648
|
+
var c, W, O, o;
|
|
1649
1649
|
const b = [], z = M.find((q) => q.model === "best_match");
|
|
1650
1650
|
z && b.push(z);
|
|
1651
1651
|
const p = M.find((q) => q.model === "meteofrance_currents");
|
|
1652
1652
|
for (const q of M)
|
|
1653
|
-
["best_match", "meteofrance_currents"].includes(q.model) || (q.hourly.ocean_current_velocity = (c = p == null ? void 0 : p.hourly) == null ? void 0 : c.ocean_current_velocity, q.hourly.ocean_current_direction = (W = p == null ? void 0 : p.hourly) == null ? void 0 : W.ocean_current_direction, q.hourly.sea_level_height_msl = (
|
|
1653
|
+
["best_match", "meteofrance_currents"].includes(q.model) || (q.hourly.ocean_current_velocity = (c = p == null ? void 0 : p.hourly) == null ? void 0 : c.ocean_current_velocity, q.hourly.ocean_current_direction = (W = p == null ? void 0 : p.hourly) == null ? void 0 : W.ocean_current_direction, q.hourly.sea_level_height_msl = (O = p == null ? void 0 : p.hourly) == null ? void 0 : O.sea_level_height_msl, q.hourly.sea_surface_temperature = (o = p == null ? void 0 : p.hourly) == null ? void 0 : o.sea_surface_temperature, b.push(q));
|
|
1654
1654
|
return b;
|
|
1655
1655
|
}
|
|
1656
1656
|
pickForecastUrl(M, b, z, p = {}) {
|
|
@@ -1662,13 +1662,13 @@ class y0 {
|
|
|
1662
1662
|
if (!(b != null && b.length))
|
|
1663
1663
|
return ["best_match"];
|
|
1664
1664
|
const z = [];
|
|
1665
|
-
for (let
|
|
1666
|
-
const o = b[
|
|
1665
|
+
for (let O = 0; O < b.length; O++) {
|
|
1666
|
+
const o = b[O];
|
|
1667
1667
|
["ecmwf_wam025", "meteofrance_wave", "ewam", "gwam", "era5_ocean"].includes(o) ? z.push("meteofrance_currents", o) : ["gfswave", "ncep_gfswave025", "ncep_gfswave016"].includes(o) ? z.push("meteofrance_currents", "ncep_gfswave025", "ncep_gfswave016") : z.push("best_match");
|
|
1668
1668
|
}
|
|
1669
|
-
const p = z.reduce((
|
|
1670
|
-
return p.sort((
|
|
1671
|
-
const q = c.indexOf(
|
|
1669
|
+
const p = z.reduce((O, o) => (O.includes(o) || O.push(o), O), []), c = ["best_match", "meteofrance_currents", "meteofrance_wave", "ecmwf_wam025", "ncep_gfswave025", "gwam", "era5_ocean", "ewam", "ncep_gfswave016"];
|
|
1670
|
+
return p.sort((O, o) => {
|
|
1671
|
+
const q = c.indexOf(O), R = c.indexOf(o);
|
|
1672
1672
|
return q - R;
|
|
1673
1673
|
}), p;
|
|
1674
1674
|
}
|
|
@@ -1681,21 +1681,21 @@ class y0 {
|
|
|
1681
1681
|
* @private
|
|
1682
1682
|
*/
|
|
1683
1683
|
async prepare(M, b, z, p = {}) {
|
|
1684
|
-
var
|
|
1685
|
-
const c = L.utc(),
|
|
1684
|
+
var R, n;
|
|
1685
|
+
const c = p.maxDays || 14, W = L.utc(), O = M ? L.utc(M) : void 0, o = b ? await this.pickUpdateMeta(z.models) : [], q = (n = (R = o[0]) == null ? void 0 : R.meta) != null && n.endTime ? L(o[0].meta.endTime) : W.clone().add(c, "day");
|
|
1686
1686
|
if (M) {
|
|
1687
|
-
const
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
], z.end_dates = [
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
], z.end_dates = [
|
|
1687
|
+
const Y = O.clone().utc().add(p.forecastDays ?? 1, "day");
|
|
1688
|
+
Y.isAfter(q) ? (Y.subtract(1, "year"), O.isAfter(q) ? (O.subtract(1, "year"), z.start_dates = [
|
|
1689
|
+
O.clone().subtract(p.pastDays || 0, "day").utc().format("YYYY-MM-DD")
|
|
1690
|
+
], z.end_dates = [Y.utc().format("YYYY-MM-DD")], z.fakes = [!0], z.url = [this.pickForecastUrl(b, p.selfHosted ?? !0, !0, p)]) : (z.start_dates = [
|
|
1691
|
+
O.clone().subtract(p.pastDays || 0, "day").utc().format("YYYY-MM-DD"),
|
|
1692
|
+
q.clone().subtract(1, "year").subtract(1, "day").utc().format("YYYY-MM-DD")
|
|
1693
|
+
], z.end_dates = [q.clone().subtract(1, "day").utc().format("YYYY-MM-DD"), Y.utc().format("YYYY-MM-DD")], z.fakes = [!1, !0], z.url = [
|
|
1694
1694
|
this.pickForecastUrl(b, p.selfHosted ?? !0, !1, p),
|
|
1695
1695
|
this.pickForecastUrl(b, p.selfHosted ?? !0, !0, p)
|
|
1696
1696
|
])) : (z.start_dates = [
|
|
1697
|
-
|
|
1698
|
-
], z.end_dates = [
|
|
1697
|
+
O.clone().subtract(p.pastDays || 0, "day").utc().format("YYYY-MM-DD")
|
|
1698
|
+
], z.end_dates = [Y.utc().format("YYYY-MM-DD")], z.fakes = [!1], z.url = [this.pickForecastUrl(b, p.selfHosted ?? !0, O.isBefore(W.clone().subtract(30, "day")), p)]);
|
|
1699
1699
|
} else
|
|
1700
1700
|
z.forecast_days = p.forecastDays, z.past_days = p.pastDays, z.fake = !1, z.url = this.pickForecastUrl(b, p.selfHosted ?? !0, !1, p);
|
|
1701
1701
|
return z;
|
|
@@ -1745,38 +1745,39 @@ class y0 {
|
|
|
1745
1745
|
* @param withHourly
|
|
1746
1746
|
* @param options
|
|
1747
1747
|
*/
|
|
1748
|
-
async spotForecast(M, b, z, p = !0, c = !0, W = !1,
|
|
1748
|
+
async spotForecast(M, b, z, p = !0, c = !0, W = !1, O = {
|
|
1749
1749
|
forecastDays: 1,
|
|
1750
1750
|
pastDays: 0,
|
|
1751
1751
|
precision: 6,
|
|
1752
|
-
selfHosted: !0
|
|
1752
|
+
selfHosted: !0,
|
|
1753
|
+
maxDays: 14
|
|
1753
1754
|
}) {
|
|
1754
|
-
var T,
|
|
1755
|
-
b = this.toStdLng(b), this.debug && h.info("[%s] spot forecast params: %j",
|
|
1755
|
+
var T, u, V, l, U, r;
|
|
1756
|
+
b = this.toStdLng(b), this.debug && h.info("[%s] spot forecast params: %j", O.requestId, { lat: M, lng: b, datetime: z, simplify: p, withDaily: c, withHourly: W, options: O });
|
|
1756
1757
|
const o = {
|
|
1757
1758
|
apikey: this.apikey,
|
|
1758
1759
|
latitude: M,
|
|
1759
1760
|
longitude: b,
|
|
1760
1761
|
cell_selection: "sea",
|
|
1761
1762
|
wind_speed_unit: "kn",
|
|
1762
|
-
models: ((T =
|
|
1763
|
+
models: ((T = O.weatherModels) == null ? void 0 : T.split(",")) || ["best_match"],
|
|
1763
1764
|
timezone: "auto"
|
|
1764
1765
|
};
|
|
1765
1766
|
let q;
|
|
1766
1767
|
const R = this.timezoneOffset(M, b);
|
|
1767
|
-
z && (q = L.utc(z).utcOffset(R), q.subtract(R > 0 ? R : -R, "h"),
|
|
1768
|
-
const n = await this.weatherForecast(o,
|
|
1768
|
+
z && (q = L.utc(z).utcOffset(R), q.subtract(R > 0 ? R : -R, "h"), O.selfHistory = !(q != null && q.isBefore(L.utc().subtract(120, "days")))), c && (o.daily = ((u = this.FORECAST.WEATHER_VARIABLES.NORMAL.DAILY) == null ? void 0 : u.split(",")) || []), q || (O.forecastDays = O.forecastDays || 1, O.pastDays = 0, W = !0), W && (o.hourly = ((V = this.FORECAST.WEATHER_VARIABLES.NORMAL.HOURLY) == null ? void 0 : V.split(",")) || []), O.maxDays = O.maxDays || 14, O.pastDays = O.pastDays || 0, O.pastDays = O.pastDays > 7 ? 7 : O.pastDays < 0 ? 0 : O.pastDays, O.forecastDays = O.forecastDays ?? 1, O.forecastDays = O.forecastDays > O.maxDays ? O.maxDays : O.forecastDays < 0 ? 1 : O.forecastDays, await this.prepare(q == null ? void 0 : q.utc().format(), !1, o, O);
|
|
1769
|
+
const n = await this.weatherForecast(o, O), Y = {
|
|
1769
1770
|
apikey: this.apikey,
|
|
1770
1771
|
latitude: M,
|
|
1771
1772
|
longitude: b,
|
|
1772
1773
|
cell_selection: "sea",
|
|
1773
1774
|
timezone: "auto",
|
|
1774
1775
|
wind_speed_unit: "kn",
|
|
1775
|
-
models: this.pickMarineModels(
|
|
1776
|
+
models: this.pickMarineModels(O.marineModels)
|
|
1776
1777
|
};
|
|
1777
|
-
c && (Y.daily = this.FORECAST.MARINE_VARIABLES.DAILY.split(",")), q || (
|
|
1778
|
-
let f = await this.marineForecast(Y,
|
|
1779
|
-
return (r = (U = (l = f[0]) == null ? void 0 : l.hourly) == null ? void 0 : U.wave_height) != null && r.every((Z) => Z === null || Z === 0) && (Y.models = this.pickMarineModels("best_match,ncep_gfswave025,meteofrance_wave"), f = await this.marineForecast(Y,
|
|
1778
|
+
c && (Y.daily = this.FORECAST.MARINE_VARIABLES.DAILY.split(",")), q || (O.forecastDays = O.forecastDays || 1, W = !0), W && (Y.hourly = this.FORECAST.MARINE_VARIABLES.HOURLY.split(",")), await this.prepare(q == null ? void 0 : q.utc().format(), !0, Y, O);
|
|
1779
|
+
let f = await this.marineForecast(Y, O);
|
|
1780
|
+
return (r = (U = (l = f[0]) == null ? void 0 : l.hourly) == null ? void 0 : U.wave_height) != null && r.every((Z) => Z === null || Z === 0) && (Y.models = this.pickMarineModels("best_match,ncep_gfswave025,meteofrance_wave"), f = await this.marineForecast(Y, O)), { weather: n, marine: f };
|
|
1780
1781
|
}
|
|
1781
1782
|
/**
|
|
1782
1783
|
* 历史再分析数据
|
|
@@ -1799,11 +1800,11 @@ class y0 {
|
|
|
1799
1800
|
* @param withMarine
|
|
1800
1801
|
* @param options
|
|
1801
1802
|
*/
|
|
1802
|
-
async spotHistorical(M, b, z, p, c = !0, W = !0,
|
|
1803
|
+
async spotHistorical(M, b, z, p, c = !0, W = !0, O = !1, o = {
|
|
1803
1804
|
precision: 6
|
|
1804
1805
|
}) {
|
|
1805
|
-
var
|
|
1806
|
-
b = this.toStdLng(b), this.debug && h.info("[%s] spot historical params: %j", o.requestId, { lat: M, lng: b, startDate: z, endDate: p, withMarine:
|
|
1806
|
+
var u, V;
|
|
1807
|
+
b = this.toStdLng(b), this.debug && h.info("[%s] spot historical params: %j", o.requestId, { lat: M, lng: b, startDate: z, endDate: p, withMarine: O, options: o });
|
|
1807
1808
|
const q = this.timezoneOffset(M, b), R = L.utc(z).utcOffset(q), n = L.utc(p).utcOffset(q);
|
|
1808
1809
|
R.subtract(q > 0 ? q : -q, "h"), n.subtract(q > 0 ? q : -q, "h");
|
|
1809
1810
|
const Y = {
|
|
@@ -1812,7 +1813,7 @@ class y0 {
|
|
|
1812
1813
|
longitude: b,
|
|
1813
1814
|
cell_selection: "sea",
|
|
1814
1815
|
wind_speed_unit: "kn",
|
|
1815
|
-
models: ((
|
|
1816
|
+
models: ((u = o.weatherModels) == null ? void 0 : u.split(",")) || ["best_match"],
|
|
1816
1817
|
timezone: "auto",
|
|
1817
1818
|
url: this.HISTORICAL.OM_URL,
|
|
1818
1819
|
start_date: R.format("YYYY-MM-DD"),
|
|
@@ -1821,7 +1822,7 @@ class y0 {
|
|
|
1821
1822
|
c && (Y.daily = this.HISTORICAL.WEATHER_VARIABLES.DAILY.split(",")), W && (Y.hourly = this.HISTORICAL.WEATHER_VARIABLES.HOURLY.split(","));
|
|
1822
1823
|
const f = await this.weatherForecast(Y, o);
|
|
1823
1824
|
let T;
|
|
1824
|
-
if (
|
|
1825
|
+
if (O) {
|
|
1825
1826
|
const l = {
|
|
1826
1827
|
apikey: this.apikey,
|
|
1827
1828
|
latitude: M,
|
|
@@ -1855,8 +1856,8 @@ class y0 {
|
|
|
1855
1856
|
precision: 6
|
|
1856
1857
|
}) {
|
|
1857
1858
|
b = this.toStdLng(b), this.debug && h.info("[%s] spot seasonal params: %j", W.requestId, { lat: M, lng: b, startDate: z, endDate: p, options: W });
|
|
1858
|
-
const
|
|
1859
|
-
o.subtract(
|
|
1859
|
+
const O = this.timezoneOffset(M, b), o = L.utc(z).utcOffset(O), q = p ? L.utc(p).utcOffset(O) : o.clone().add(1, "month");
|
|
1860
|
+
o.subtract(O > 0 ? O : -O, "h"), q.subtract(O > 0 ? O : -O, "h");
|
|
1860
1861
|
const R = {
|
|
1861
1862
|
apikey: this.apikey,
|
|
1862
1863
|
latitude: M,
|
|
@@ -1896,8 +1897,8 @@ class y0 {
|
|
|
1896
1897
|
}) {
|
|
1897
1898
|
var n;
|
|
1898
1899
|
b = this.toStdLng(b), this.debug && h.info("[%s] spot climate params: %j", c.requestId, { lat: M, lng: b, startDate: z, endDate: p, options: c });
|
|
1899
|
-
const W = this.timezoneOffset(M, b),
|
|
1900
|
-
o.subtract(W > 0 ? W : -W, "h"),
|
|
1900
|
+
const W = this.timezoneOffset(M, b), O = L.utc(z).utcOffset(W), o = p ? L.utc(p).utcOffset(W) : O.clone().add(1, "day");
|
|
1901
|
+
o.subtract(W > 0 ? W : -W, "h"), O.subtract(W > 0 ? W : -W, "h");
|
|
1901
1902
|
const q = {
|
|
1902
1903
|
apikey: this.apikey,
|
|
1903
1904
|
latitude: M,
|
|
@@ -1907,7 +1908,7 @@ class y0 {
|
|
|
1907
1908
|
models: ((n = c.weatherModels) == null ? void 0 : n.split(",")) || "EC_Earth3P_HR",
|
|
1908
1909
|
timezone: "auto",
|
|
1909
1910
|
url: this.CLIMATE.OM_URL,
|
|
1910
|
-
start_date:
|
|
1911
|
+
start_date: O.format("YYYY-MM-DD"),
|
|
1911
1912
|
end_date: o.format("YYYY-MM-DD"),
|
|
1912
1913
|
daily: this.CLIMATE.WEATHER_VARIABLES.DAILY.split(",")
|
|
1913
1914
|
};
|
|
@@ -1923,17 +1924,17 @@ class y0 {
|
|
|
1923
1924
|
}
|
|
1924
1925
|
});
|
|
1925
1926
|
try {
|
|
1926
|
-
const
|
|
1927
|
-
if (
|
|
1928
|
-
const o =
|
|
1927
|
+
const O = await W.json();
|
|
1928
|
+
if (O.code === 0) {
|
|
1929
|
+
const o = O.data, q = Q.standardWeatherModels();
|
|
1929
1930
|
for (const R of q) {
|
|
1930
1931
|
const n = Q.autoPickSubCategories(R.alias), f = o.filter((T) => n.includes(T.category)).map((T) => {
|
|
1931
1932
|
var U, r, Z, m, G, I;
|
|
1932
|
-
const
|
|
1933
|
+
const u = L.unix((U = T.meta) == null ? void 0 : U.data_end_time).utc(), V = L.unix((r = T.meta) == null ? void 0 : r.last_run_availability_time).utc(), l = u.diff(V, "days");
|
|
1933
1934
|
return {
|
|
1934
1935
|
category: T.category,
|
|
1935
1936
|
meta: {
|
|
1936
|
-
endTime:
|
|
1937
|
+
endTime: u.format(),
|
|
1937
1938
|
availabilityTime: V.format(),
|
|
1938
1939
|
days: l,
|
|
1939
1940
|
initialisationTime: L.unix((Z = T.meta) == null ? void 0 : Z.last_run_initialisation_time).utc().format(),
|
|
@@ -1947,8 +1948,8 @@ class y0 {
|
|
|
1947
1948
|
}
|
|
1948
1949
|
this.METEO2_UPDATE.version = z + 1, this.METEO2_UPDATE.etime = p.unix();
|
|
1949
1950
|
}
|
|
1950
|
-
} catch (
|
|
1951
|
-
h.error("[%s] update meteo2 error: %s", M.requestId,
|
|
1951
|
+
} catch (O) {
|
|
1952
|
+
h.error("[%s] update meteo2 error: %s", M.requestId, O);
|
|
1952
1953
|
}
|
|
1953
1954
|
}
|
|
1954
1955
|
return this.METEO2_UPDATE;
|
|
@@ -2009,10 +2010,10 @@ class k0 {
|
|
|
2009
2010
|
* @param datum
|
|
2010
2011
|
* @param options
|
|
2011
2012
|
*/
|
|
2012
|
-
async tidesForecast(M, b, z = 7, p = "today", c = !0, W = !1,
|
|
2013
|
-
p = p || "today", z = z || 7, b = this.toStdLng(b), this.debug && a0.info("[%s] spot tides forecast params: %j", q.requestId, { lat: M, lng: b, date: p, extremes: c, heights: W, datums:
|
|
2013
|
+
async tidesForecast(M, b, z = 7, p = "today", c = !0, W = !1, O = !1, o = "CD", q = {}) {
|
|
2014
|
+
p = p || "today", z = z || 7, b = this.toStdLng(b), this.debug && a0.info("[%s] spot tides forecast params: %j", q.requestId, { lat: M, lng: b, date: p, extremes: c, heights: W, datums: O, datum: o });
|
|
2014
2015
|
let R = `https://www.worldtides.info/api/v3?lat=${M}&lon=${b}&days=${z}&date=${p}&datum=${o}&key=${this.apikey}&localtime`;
|
|
2015
|
-
c && (R = `${R}&extremes`), W && (R = `${R}&heights`),
|
|
2016
|
+
c && (R = `${R}&extremes`), W && (R = `${R}&heights`), O && (R = `${R}&datums`);
|
|
2016
2017
|
const Y = await (await fetch(R)).json();
|
|
2017
2018
|
return Y.status === 200 ? {
|
|
2018
2019
|
rqt: {
|
|
@@ -2074,14 +2075,14 @@ class k {
|
|
|
2074
2075
|
var c;
|
|
2075
2076
|
const z = L.utc(b.reftime).format(), p = {};
|
|
2076
2077
|
return (c = b.records) == null || c.forEach((W) => {
|
|
2077
|
-
const
|
|
2078
|
+
const O = L.utc(W.time), o = O.diff(z, "hour"), q = Number(W.pressure / 100), R = Number(W.lat), n = Number(W.lon), Y = Number(W.windSpeed * 3600 / 1852);
|
|
2078
2079
|
p[o] = {
|
|
2079
2080
|
lat: isNaN(R) ? null : R,
|
|
2080
2081
|
lng: isNaN(n) ? null : n,
|
|
2081
2082
|
pressure: isNaN(q) ? null : Math.round(q) || null,
|
|
2082
|
-
utc:
|
|
2083
|
+
utc: O.format(),
|
|
2083
2084
|
wind: {
|
|
2084
|
-
datetime:
|
|
2085
|
+
datetime: O.format(),
|
|
2085
2086
|
kts: isNaN(Y) ? null : Math.round(Y) || null,
|
|
2086
2087
|
type: N.parseTropicalType(Y),
|
|
2087
2088
|
r7: null,
|
|
@@ -2126,8 +2127,8 @@ class k {
|
|
|
2126
2127
|
static async realtimeForecast() {
|
|
2127
2128
|
const M = "https://node.windy.com/tc/v2/storms", b = await H.get(M).json(), z = [];
|
|
2128
2129
|
for (const p of b.storms) {
|
|
2129
|
-
const c = `https://node.windy.com/tc/v2/storms/${p.id}`, W = await H.get(c).json(),
|
|
2130
|
-
z.push(
|
|
2130
|
+
const c = `https://node.windy.com/tc/v2/storms/${p.id}`, W = await H.get(c).json(), O = await k.parseTropical(W);
|
|
2131
|
+
z.push(O);
|
|
2131
2132
|
}
|
|
2132
2133
|
return z;
|
|
2133
2134
|
}
|
|
@@ -2135,8 +2136,8 @@ class k {
|
|
|
2135
2136
|
const _ = class _ {
|
|
2136
2137
|
static async parseHistory(M) {
|
|
2137
2138
|
const b = `https://hifleet.com/hifleetapi/gettyphooninfo2.do?xuhao=${M}`, z = await H.post(b).text(), p = await _.parser.parseStringPromise(z), c = p.typhoon.position instanceof Array ? p.typhoon.position : [p.typhoon.position], W = [];
|
|
2138
|
-
for (const
|
|
2139
|
-
const o = L(
|
|
2139
|
+
for (const O of c) {
|
|
2140
|
+
const o = L(O.updatetime).utcOffset(8).utc().format(), q = Number(O.lat), R = Number(O.lon), n = Number(O.pressure), Y = Number(O.windspeed * 3600 / 1852), f = N.parseWindCircle(O.c7quad1 / 1.852), T = N.parseWindCircle(O.c7quad2 / 1.852), u = N.parseWindCircle(O.c7quad3 / 1.852), V = N.parseWindCircle(O.c7quad4 / 1.852), l = N.parseWindCircle(O.c10quad1 / 1.852), U = N.parseWindCircle(O.c10quad2 / 1.852), r = N.parseWindCircle(O.c10quad3 / 1.852), Z = N.parseWindCircle(O.c10quad4 / 1.852), m = N.parseWindCircle(O.c12quad1 / 1.852), G = N.parseWindCircle(O.c12quad2 / 1.852), I = N.parseWindCircle(O.c12quad3 / 1.852), C = N.parseWindCircle(O.c12quad4 / 1.852), { r7: w, r10: y, r12: M0 } = N.estimateWindRadii(Y, q), z0 = {
|
|
2140
2141
|
updated: o,
|
|
2141
2142
|
lat: isNaN(q) ? null : q,
|
|
2142
2143
|
lng: isNaN(R) ? null : R,
|
|
@@ -2147,7 +2148,7 @@ const _ = class _ {
|
|
|
2147
2148
|
r7: w,
|
|
2148
2149
|
r7ne: f,
|
|
2149
2150
|
r7nw: T,
|
|
2150
|
-
r7sw:
|
|
2151
|
+
r7sw: u,
|
|
2151
2152
|
r7se: V,
|
|
2152
2153
|
r10: y,
|
|
2153
2154
|
r10ne: l,
|
|
@@ -2163,10 +2164,10 @@ const _ = class _ {
|
|
|
2163
2164
|
};
|
|
2164
2165
|
W.push(z0);
|
|
2165
2166
|
}
|
|
2166
|
-
return W.sort((
|
|
2167
|
+
return W.sort((O, o) => L(o.updated).unix() - L(O.updated).unix()), W;
|
|
2167
2168
|
}
|
|
2168
2169
|
static async parseForecast(M, b) {
|
|
2169
|
-
const z = `https://hifleet.com/hifleetapi/gettyphooforecast.do?xuhao=${M}`, p = await H.post(z).text(), c = await _.parser.parseStringPromise(p), W = c.list.forecast instanceof Array ? c.list.forecast : [c.list.forecast],
|
|
2170
|
+
const z = `https://hifleet.com/hifleetapi/gettyphooforecast.do?xuhao=${M}`, p = await H.post(z).text(), c = await _.parser.parseStringPromise(p), W = c.list.forecast instanceof Array ? c.list.forecast : [c.list.forecast], O = [];
|
|
2170
2171
|
for (const o of W)
|
|
2171
2172
|
if (o.xuhao === M) {
|
|
2172
2173
|
const q = o.positions.forecastposition instanceof Array ? o.positions.forecastposition : [o.positions.forecastposition];
|
|
@@ -2176,9 +2177,9 @@ const _ = class _ {
|
|
|
2176
2177
|
for (const Y of q) {
|
|
2177
2178
|
const f = L(Y.forecasttime).utcOffset(8).utc(), T = f.diff(b, "hours");
|
|
2178
2179
|
if (T) {
|
|
2179
|
-
const
|
|
2180
|
+
const u = Number(Y.forelat), V = Number(Y.forelon), l = Number(Y.forepressure), U = Number(Y.forespeed * 3600 / 1852);
|
|
2180
2181
|
R[T] = {
|
|
2181
|
-
lat: isNaN(
|
|
2182
|
+
lat: isNaN(u) ? null : u,
|
|
2182
2183
|
lng: isNaN(V) ? null : V,
|
|
2183
2184
|
pressure: l ? Math.round(l) : null,
|
|
2184
2185
|
utc: f.format(),
|
|
@@ -2213,15 +2214,15 @@ const _ = class _ {
|
|
|
2213
2214
|
model: N.parseTropicalModel(o.country).toLowerCase(),
|
|
2214
2215
|
hours: R
|
|
2215
2216
|
};
|
|
2216
|
-
|
|
2217
|
+
O.push(n);
|
|
2217
2218
|
}
|
|
2218
2219
|
}
|
|
2219
|
-
return
|
|
2220
|
+
return O;
|
|
2220
2221
|
}
|
|
2221
2222
|
static async parseTropical(M) {
|
|
2222
|
-
var W,
|
|
2223
|
+
var W, O, o;
|
|
2223
2224
|
const b = await _.parseHistory(M.xuhao), z = (W = b.at(0)) == null ? void 0 : W.updated, p = await _.parseForecast(M.xuhao, z ? L(z) : void 0), c = {
|
|
2224
|
-
id: (
|
|
2225
|
+
id: (O = M.enname) == null ? void 0 : O.toLowerCase(),
|
|
2225
2226
|
name: (o = M.enname) == null ? void 0 : o.toLowerCase(),
|
|
2226
2227
|
cnName: M.name,
|
|
2227
2228
|
history: b,
|
|
@@ -2233,8 +2234,8 @@ const _ = class _ {
|
|
|
2233
2234
|
const M = "https://hifleet.com/hifleetapi/getCurrentTyphoon2.do", b = await H.post(M).text(), z = await _.parser.parseStringPromise(b), p = [], c = z.typhoon.position instanceof Array ? z.typhoon.position : [z.typhoon.position];
|
|
2234
2235
|
for (const W of c)
|
|
2235
2236
|
if (W) {
|
|
2236
|
-
const
|
|
2237
|
-
p.push(
|
|
2237
|
+
const O = await _.parseTropical(W);
|
|
2238
|
+
p.push(O);
|
|
2238
2239
|
}
|
|
2239
2240
|
return p;
|
|
2240
2241
|
}
|
|
@@ -2256,40 +2257,40 @@ class N {
|
|
|
2256
2257
|
const b = Object.values(O0);
|
|
2257
2258
|
return (z = M.forecasts) == null || z.sort((p, c) => {
|
|
2258
2259
|
var o, q;
|
|
2259
|
-
const W = b.indexOf((o = p.model) == null ? void 0 : o.toUpperCase()),
|
|
2260
|
-
return (W === -1 ? 999 : W) - (
|
|
2260
|
+
const W = b.indexOf((o = p.model) == null ? void 0 : o.toUpperCase()), O = b.indexOf((q = c.model) == null ? void 0 : q.toUpperCase());
|
|
2261
|
+
return (W === -1 ? 999 : W) - (O === -1 ? 999 : O);
|
|
2261
2262
|
}), M;
|
|
2262
2263
|
}
|
|
2263
2264
|
static async mergeTropicals(M = !0, b = {}) {
|
|
2264
2265
|
var c, W;
|
|
2265
2266
|
const z = await k.realtimeForecast(), p = M ? await j.realtimeForecast() : [];
|
|
2266
|
-
for (const
|
|
2267
|
+
for (const O of z) {
|
|
2267
2268
|
const o = p.find((R) => {
|
|
2268
2269
|
var n, Y;
|
|
2269
|
-
return ((n = R.name) == null ? void 0 : n.toLowerCase()) === ((Y =
|
|
2270
|
+
return ((n = R.name) == null ? void 0 : n.toLowerCase()) === ((Y = O.name) == null ? void 0 : Y.toLowerCase());
|
|
2270
2271
|
});
|
|
2271
2272
|
if (o) {
|
|
2272
|
-
|
|
2273
|
+
O.cnName = o.cnName, (c = o.history) != null && c.length && (O.history = o.history), O.history.sort((R, n) => L(n.updated).valueOf() - L(R.updated).valueOf());
|
|
2273
2274
|
for (const R of o.forecasts)
|
|
2274
|
-
["CMA", "JMA", "CNTW", "CNHK", "KMA"].includes((W = R.model) == null ? void 0 : W.toUpperCase()) && !
|
|
2275
|
+
["CMA", "JMA", "CNTW", "CNHK", "KMA"].includes((W = R.model) == null ? void 0 : W.toUpperCase()) && !O.forecasts.find((n) => n.model.toLowerCase() === R.model.toLowerCase()) && O.forecasts.push(R);
|
|
2275
2276
|
}
|
|
2276
|
-
|
|
2277
|
-
const q =
|
|
2278
|
-
q &&
|
|
2277
|
+
O.history = O.history.reduce((R, n) => (R.find((Y) => Y.updated === n.updated) || R.push(n), R), []);
|
|
2278
|
+
const q = O.history[0];
|
|
2279
|
+
q && O.forecasts.forEach((R) => {
|
|
2279
2280
|
R.date = q.updated;
|
|
2280
2281
|
const n = L(q.updated), Y = {};
|
|
2281
2282
|
for (const f in R.hours) {
|
|
2282
|
-
const T = R.hours[f],
|
|
2283
|
-
|
|
2283
|
+
const T = R.hours[f], u = L(T.utc).diff(n, "h");
|
|
2284
|
+
u > 0 && (Y[u] = T);
|
|
2284
2285
|
}
|
|
2285
2286
|
R.hours = Y;
|
|
2286
|
-
}), await N.tropicalMovement(
|
|
2287
|
+
}), await N.tropicalMovement(O);
|
|
2287
2288
|
}
|
|
2288
|
-
for (const
|
|
2289
|
+
for (const O of p)
|
|
2289
2290
|
z.every((o) => {
|
|
2290
2291
|
var q, R;
|
|
2291
|
-
return ((q = o.name) == null ? void 0 : q.toLowerCase()) !== ((R =
|
|
2292
|
-
}) && z.push(
|
|
2292
|
+
return ((q = o.name) == null ? void 0 : q.toLowerCase()) !== ((R = O.name) == null ? void 0 : R.toLowerCase());
|
|
2293
|
+
}) && z.push(O);
|
|
2293
2294
|
return z;
|
|
2294
2295
|
}
|
|
2295
2296
|
/**
|
|
@@ -2301,10 +2302,10 @@ class N {
|
|
|
2301
2302
|
let b = null;
|
|
2302
2303
|
M.forecasts.forEach((p) => {
|
|
2303
2304
|
const c = p.hours, W = Object.keys(c);
|
|
2304
|
-
for (let
|
|
2305
|
-
const o = c[W[
|
|
2305
|
+
for (let O = 0; O < W.length - 1; O++) {
|
|
2306
|
+
const o = c[W[O]];
|
|
2306
2307
|
b = b || o;
|
|
2307
|
-
const q = c[W[
|
|
2308
|
+
const q = c[W[O + 1]];
|
|
2308
2309
|
o.movement = N.calculateMovement(o, q);
|
|
2309
2310
|
const R = N.supplementWindRadii(o);
|
|
2310
2311
|
o.wind = { ...o.wind || {}, ...R };
|
|
@@ -2314,8 +2315,8 @@ class N {
|
|
|
2314
2315
|
for (let p = 0; p < M.history.length - 1; p++) {
|
|
2315
2316
|
const c = M.history[p + 1], W = M.history[p];
|
|
2316
2317
|
z = z || W, c.movement = N.calculateMovement(c, W);
|
|
2317
|
-
const
|
|
2318
|
-
c.wind = { ...c.wind || {}, ...
|
|
2318
|
+
const O = N.supplementWindRadii(c);
|
|
2319
|
+
c.wind = { ...c.wind || {}, ...O };
|
|
2319
2320
|
}
|
|
2320
2321
|
if (z && b) {
|
|
2321
2322
|
z.movement = N.calculateMovement(z, b);
|
|
@@ -2361,8 +2362,8 @@ class N {
|
|
|
2361
2362
|
return 0;
|
|
2362
2363
|
let c = z, W = z * 10;
|
|
2363
2364
|
for (; W - c > 0.1; ) {
|
|
2364
|
-
const
|
|
2365
|
-
b * Math.sqrt(q) > M ? c =
|
|
2365
|
+
const O = (c + W) / 2, o = z / O, q = Math.pow(o, p) * Math.exp(1 - Math.pow(o, p));
|
|
2366
|
+
b * Math.sqrt(q) > M ? c = O : W = O;
|
|
2366
2367
|
}
|
|
2367
2368
|
return Q.kmh2kts(c + W);
|
|
2368
2369
|
}
|
|
@@ -2373,10 +2374,10 @@ class N {
|
|
|
2373
2374
|
* @returns 风圈半径对象
|
|
2374
2375
|
*/
|
|
2375
2376
|
static estimateWindRadii(M, b) {
|
|
2376
|
-
const z = Q.kts2ms(M), p = N.estimateRMW(z, b), c = N.estimateHollandB(z, p, b), W = N.findWindRadius(17.2, z, p, c),
|
|
2377
|
+
const z = Q.kts2ms(M), p = N.estimateRMW(z, b), c = N.estimateHollandB(z, p, b), W = N.findWindRadius(17.2, z, p, c), O = N.findWindRadius(28.5, z, p, c), o = N.findWindRadius(37, z, p, c);
|
|
2377
2378
|
return {
|
|
2378
2379
|
r7: W ? Math.round(W) : null,
|
|
2379
|
-
r10:
|
|
2380
|
+
r10: O ? Math.round(O) : null,
|
|
2380
2381
|
r12: o ? Math.round(o) : null
|
|
2381
2382
|
};
|
|
2382
2383
|
}
|
|
@@ -2393,7 +2394,7 @@ class N {
|
|
|
2393
2394
|
return { ne: null, nw: null, se: null, sw: null };
|
|
2394
2395
|
if (b < 9)
|
|
2395
2396
|
return { ne: M, nw: M, se: M, sw: M };
|
|
2396
|
-
const W = 0.15 * Math.min(b / (20 / 1.852), 1),
|
|
2397
|
+
const W = 0.15 * Math.min(b / (20 / 1.852), 1), O = {
|
|
2397
2398
|
ne: (45 - z + 360) % 360,
|
|
2398
2399
|
nw: (315 - z + 360) % 360,
|
|
2399
2400
|
se: (135 - z + 360) % 360,
|
|
@@ -2403,10 +2404,10 @@ class N {
|
|
|
2403
2404
|
return 1 - W * n;
|
|
2404
2405
|
};
|
|
2405
2406
|
return {
|
|
2406
|
-
ne: Math.round(M * o(
|
|
2407
|
-
nw: Math.round(M * o(
|
|
2408
|
-
se: Math.round(M * o(
|
|
2409
|
-
sw: Math.round(M * o(
|
|
2407
|
+
ne: Math.round(M * o(O.ne)),
|
|
2408
|
+
nw: Math.round(M * o(O.nw)),
|
|
2409
|
+
se: Math.round(M * o(O.se)),
|
|
2410
|
+
sw: Math.round(M * o(O.sw))
|
|
2410
2411
|
};
|
|
2411
2412
|
}
|
|
2412
2413
|
/**
|
|
@@ -2439,16 +2440,16 @@ class N {
|
|
|
2439
2440
|
r12se: null,
|
|
2440
2441
|
r12sw: null
|
|
2441
2442
|
};
|
|
2442
|
-
const W = N.estimateWindRadii(c, z),
|
|
2443
|
+
const W = N.estimateWindRadii(c, z), O = {};
|
|
2443
2444
|
return ["r7", "r10", "r12"].forEach((q) => {
|
|
2444
2445
|
const R = W[q];
|
|
2445
2446
|
if (R) {
|
|
2446
|
-
|
|
2447
|
+
O[q] = R;
|
|
2447
2448
|
const n = N.estimateAsymmetricRadii(R, (p == null ? void 0 : p.kts) || 0, (p == null ? void 0 : p.deg) || 0, z > 0 ? "N" : "S");
|
|
2448
|
-
|
|
2449
|
+
O[`${q}ne`] = n.ne, O[`${q}nw`] = n.nw, O[`${q}se`] = n.se, O[`${q}sw`] = n.sw;
|
|
2449
2450
|
} else
|
|
2450
|
-
|
|
2451
|
-
}),
|
|
2451
|
+
O[q] = null, O[`${q}ne`] = null, O[`${q}nw`] = null, O[`${q}se`] = null, O[`${q}sw`] = null;
|
|
2452
|
+
}), O;
|
|
2452
2453
|
}
|
|
2453
2454
|
/**
|
|
2454
2455
|
* 台风类型
|