@idm-plugin/meteo2 0.7.5 → 0.7.7
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 +128 -120
- package/dist/index.umd.cjs +2 -2
- package/dist/worldtides/src/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -299,11 +299,11 @@ var n0 = { exports: {} };
|
|
|
299
299
|
return O > 96 ? O - 87 : O > 64 ? O - 29 : O - 48;
|
|
300
300
|
}
|
|
301
301
|
function f(O) {
|
|
302
|
-
var a = 0, n = O.split("."), R = n[0], t = n[1] || "", U = 1,
|
|
302
|
+
var a = 0, n = O.split("."), R = n[0], t = n[1] || "", U = 1, C, V = 0, I = 1;
|
|
303
303
|
for (O.charCodeAt(0) === 45 && (a = 1, I = -1), a; a < R.length; a++)
|
|
304
|
-
|
|
304
|
+
C = q(R.charCodeAt(a)), V = 60 * V + C;
|
|
305
305
|
for (a = 0; a < t.length; a++)
|
|
306
|
-
U = U / 60,
|
|
306
|
+
U = U / 60, C = q(t.charCodeAt(a)), V += C * U;
|
|
307
307
|
return V * I;
|
|
308
308
|
}
|
|
309
309
|
function e(O) {
|
|
@@ -362,9 +362,9 @@ var n0 = { exports: {} };
|
|
|
362
362
|
});
|
|
363
363
|
},
|
|
364
364
|
parse: function(O) {
|
|
365
|
-
var a = +O, n = this.offsets, R = this.untils, t = R.length - 1, U,
|
|
365
|
+
var a = +O, n = this.offsets, R = this.untils, t = R.length - 1, U, C, V, I;
|
|
366
366
|
for (I = 0; I < t; I++)
|
|
367
|
-
if (U = n[I],
|
|
367
|
+
if (U = n[I], C = n[I + 1], V = n[I && I - 1], U < C && Z.moveAmbiguousForward ? U = C : U > V && Z.moveInvalidForward && (U = V), a < R[I] - U * 6e4)
|
|
368
368
|
return n[I];
|
|
369
369
|
return n[t];
|
|
370
370
|
},
|
|
@@ -381,51 +381,51 @@ var n0 = { exports: {} };
|
|
|
381
381
|
function m(O, a) {
|
|
382
382
|
this.name = O, this.zones = a;
|
|
383
383
|
}
|
|
384
|
-
function
|
|
384
|
+
function l(O) {
|
|
385
385
|
var a = O.toTimeString(), n = a.match(/\([a-z ]+\)/i);
|
|
386
386
|
n && n[0] ? (n = n[0].match(/[A-Z]/g), n = n ? n.join("") : void 0) : (n = a.match(/[A-Z]{3,5}/g), n = n ? n[0] : void 0), n === "GMT" && (n = void 0), this.at = +O, this.abbr = n, this.offset = O.getTimezoneOffset();
|
|
387
387
|
}
|
|
388
|
-
function
|
|
388
|
+
function P(O) {
|
|
389
389
|
this.zone = O, this.offsetScore = 0, this.abbrScore = 0;
|
|
390
390
|
}
|
|
391
|
-
|
|
391
|
+
P.prototype.scoreOffsetAt = function(O) {
|
|
392
392
|
this.offsetScore += Math.abs(this.zone.utcOffset(O.at) - O.offset), this.zone.abbr(O.at).replace(/[^A-Z]/g, "") !== O.abbr && this.abbrScore++;
|
|
393
393
|
};
|
|
394
|
-
function
|
|
394
|
+
function K(O, a) {
|
|
395
395
|
for (var n, R; R = ((a.at - O.at) / 12e4 | 0) * 6e4; )
|
|
396
|
-
n = new
|
|
396
|
+
n = new l(new Date(O.at + R)), n.offset === O.offset ? O = n : a = n;
|
|
397
397
|
return O;
|
|
398
398
|
}
|
|
399
399
|
function h() {
|
|
400
|
-
var O = (/* @__PURE__ */ new Date()).getFullYear() - 2, a = new
|
|
400
|
+
var O = (/* @__PURE__ */ new Date()).getFullYear() - 2, a = new l(new Date(O, 0, 1)), n = a.offset, R = [a], t, U, C, V;
|
|
401
401
|
for (V = 1; V < 48; V++)
|
|
402
|
-
|
|
402
|
+
C = new Date(O, V, 1).getTimezoneOffset(), C !== n && (U = new l(new Date(O, V, 1)), t = K(a, U), R.push(t), R.push(new l(new Date(t.at + 6e4))), a = U, n = C);
|
|
403
403
|
for (V = 0; V < 4; V++)
|
|
404
|
-
R.push(new
|
|
404
|
+
R.push(new l(new Date(O + V, 0, 1))), R.push(new l(new Date(O + V, 6, 1)));
|
|
405
405
|
return R;
|
|
406
406
|
}
|
|
407
|
-
function
|
|
407
|
+
function H(O, a) {
|
|
408
408
|
return O.offsetScore !== a.offsetScore ? O.offsetScore - a.offsetScore : O.abbrScore !== a.abbrScore ? O.abbrScore - a.abbrScore : O.zone.population !== a.zone.population ? a.zone.population - O.zone.population : a.zone.name.localeCompare(O.zone.name);
|
|
409
409
|
}
|
|
410
|
-
function
|
|
410
|
+
function g(O, a) {
|
|
411
411
|
var n, R;
|
|
412
412
|
for (e(a), n = 0; n < a.length; n++)
|
|
413
413
|
R = a[n], A[R] = A[R] || {}, A[R][O] = !0;
|
|
414
414
|
}
|
|
415
|
-
function
|
|
416
|
-
var a = O.length, n = {}, R = [], t = {}, U,
|
|
415
|
+
function G(O) {
|
|
416
|
+
var a = O.length, n = {}, R = [], t = {}, U, C, V, I;
|
|
417
417
|
for (U = 0; U < a; U++)
|
|
418
418
|
if (V = O[U].offset, !t.hasOwnProperty(V)) {
|
|
419
419
|
I = A[V] || {};
|
|
420
|
-
for (
|
|
421
|
-
I.hasOwnProperty(
|
|
420
|
+
for (C in I)
|
|
421
|
+
I.hasOwnProperty(C) && (n[C] = !0);
|
|
422
422
|
t[V] = !0;
|
|
423
423
|
}
|
|
424
424
|
for (U in n)
|
|
425
425
|
n.hasOwnProperty(U) && R.push(W[U]);
|
|
426
426
|
return R;
|
|
427
427
|
}
|
|
428
|
-
function
|
|
428
|
+
function E() {
|
|
429
429
|
try {
|
|
430
430
|
var O = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
431
431
|
if (O && O.length > 3) {
|
|
@@ -436,16 +436,16 @@ var n0 = { exports: {} };
|
|
|
436
436
|
}
|
|
437
437
|
} catch {
|
|
438
438
|
}
|
|
439
|
-
var n = h(), R = n.length, t =
|
|
439
|
+
var n = h(), R = n.length, t = G(n), U = [], C, V, I;
|
|
440
440
|
for (V = 0; V < t.length; V++) {
|
|
441
|
-
for (
|
|
442
|
-
|
|
443
|
-
U.push(
|
|
441
|
+
for (C = new P(y(t[V])), I = 0; I < R; I++)
|
|
442
|
+
C.scoreOffsetAt(n[I]);
|
|
443
|
+
U.push(C);
|
|
444
444
|
}
|
|
445
|
-
return U.sort(
|
|
445
|
+
return U.sort(H), U.length > 0 ? U[0].zone.name : void 0;
|
|
446
446
|
}
|
|
447
447
|
function k(O) {
|
|
448
|
-
return (!o || O) && (o =
|
|
448
|
+
return (!o || O) && (o = E()), o;
|
|
449
449
|
}
|
|
450
450
|
function _(O) {
|
|
451
451
|
return (O || "").toLowerCase().replace(/\//g, "_");
|
|
@@ -453,7 +453,7 @@ var n0 = { exports: {} };
|
|
|
453
453
|
function W0(O) {
|
|
454
454
|
var a, n, R, t;
|
|
455
455
|
for (typeof O == "string" && (O = [O]), a = 0; a < O.length; a++)
|
|
456
|
-
R = O[a].split("|"), n = R[0], t = _(n), b[t] = O[a], W[t] = n,
|
|
456
|
+
R = O[a].split("|"), n = R[0], t = _(n), b[t] = O[a], W[t] = n, g(t, R[2].split(" "));
|
|
457
457
|
}
|
|
458
458
|
function y(O, a) {
|
|
459
459
|
O = _(O);
|
|
@@ -499,7 +499,7 @@ var n0 = { exports: {} };
|
|
|
499
499
|
}) : n;
|
|
500
500
|
}
|
|
501
501
|
function f0(O) {
|
|
502
|
-
W0(O.zones), o0(O.links), T0(O.countries),
|
|
502
|
+
W0(O.zones), o0(O.links), T0(O.countries), Z.dataVersion = O.version;
|
|
503
503
|
}
|
|
504
504
|
function O0(O) {
|
|
505
505
|
return O0.didShowError || (O0.didShowError = !0, v("moment.tz.zoneExists('" + O + "') has been deprecated in favor of !moment.tz.zone('" + O + "')")), !!y(O);
|
|
@@ -511,13 +511,13 @@ var n0 = { exports: {} };
|
|
|
511
511
|
function v(O) {
|
|
512
512
|
typeof console < "u" && typeof console.error == "function" && console.error(O);
|
|
513
513
|
}
|
|
514
|
-
function
|
|
514
|
+
function Z(O) {
|
|
515
515
|
var a = Array.prototype.slice.call(arguments, 0, -1), n = arguments[arguments.length - 1], R = M.utc.apply(null, a), t;
|
|
516
516
|
return !M.isMoment(O) && A0(R) && (t = y(n)) && R.add(t.parse(R), "minutes"), R.tz(n), R;
|
|
517
517
|
}
|
|
518
|
-
|
|
518
|
+
Z.version = z, Z.dataVersion = "", Z._zones = b, Z._links = p, Z._names = W, Z._countries = c, Z.add = W0, Z.link = o0, Z.load = f0, Z.zone = y, Z.zoneExists = O0, Z.guess = k, Z.names = L0, Z.Zone = B, Z.unpack = u, Z.unpackBase60 = f, Z.needsOffset = A0, Z.moveInvalidForward = !0, Z.moveAmbiguousForward = !1, Z.countries = e0, Z.zonesForCountry = r0;
|
|
519
519
|
var w = M.fn;
|
|
520
|
-
M.tz =
|
|
520
|
+
M.tz = Z, M.defaultZone = null, M.updateOffset = function(O, a) {
|
|
521
521
|
var n = M.defaultZone, R;
|
|
522
522
|
if (O._z === void 0 && (n && A0(O) && !O._isUTC && O.isValid() && (O._d = M.utc(O._a)._d, O.utc().add(n.parse(O), "minutes")), O._z = n), O._z)
|
|
523
523
|
if (R = O._z.utcOffset(O), Math.abs(R) < 16 && (R = R / 60), O.utcOffset !== void 0) {
|
|
@@ -1412,9 +1412,9 @@ const E0 = "2025b", I0 = [
|
|
|
1412
1412
|
};
|
|
1413
1413
|
var C0 = Z0;
|
|
1414
1414
|
C0.tz.load(G0);
|
|
1415
|
-
let
|
|
1415
|
+
let D;
|
|
1416
1416
|
try {
|
|
1417
|
-
|
|
1417
|
+
D = p0.getLogger("meteo2");
|
|
1418
1418
|
} catch {
|
|
1419
1419
|
} finally {
|
|
1420
1420
|
}
|
|
@@ -1492,7 +1492,7 @@ class J0 {
|
|
|
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
1494
|
const A = M.url[W];
|
|
1495
|
-
this.debug &&
|
|
1495
|
+
this.debug && D.debug("[%s] fetch weather via %s with %j", z.requestId, A, {
|
|
1496
1496
|
start_date: M.start_date,
|
|
1497
1497
|
end_date: M.end_date,
|
|
1498
1498
|
fake: M.fake,
|
|
@@ -1507,9 +1507,9 @@ class J0 {
|
|
|
1507
1507
|
}
|
|
1508
1508
|
delete M.apikey;
|
|
1509
1509
|
const c = L();
|
|
1510
|
-
return this.debug &&
|
|
1510
|
+
return this.debug && D.info("[%s] fetch weather api (%j) cost: %d ms", z.requestId, M.url, c.diff(b, "ms")), p;
|
|
1511
1511
|
} catch (b) {
|
|
1512
|
-
return
|
|
1512
|
+
return D.warn("[%s] weather forecast failed: %s, with %j", z.requestId, b, M), [];
|
|
1513
1513
|
}
|
|
1514
1514
|
}
|
|
1515
1515
|
/**
|
|
@@ -1537,14 +1537,14 @@ class J0 {
|
|
|
1537
1537
|
for (let S = 0; S < M.start_dates.length; S++) {
|
|
1538
1538
|
M.start_date = M.start_dates[S], M.end_date = M.end_dates[S], M.fake = M.fakes[S];
|
|
1539
1539
|
const m = M.url[S];
|
|
1540
|
-
this.debug &&
|
|
1540
|
+
this.debug && D.debug("[%s] fetch marine via %s with %j", z.requestId, m, {
|
|
1541
1541
|
start_date: M.start_date,
|
|
1542
1542
|
end_date: M.end_date,
|
|
1543
1543
|
fake: M.fake,
|
|
1544
1544
|
step: S
|
|
1545
1545
|
});
|
|
1546
|
-
const
|
|
1547
|
-
q ? await this.mergeSegments(q,
|
|
1546
|
+
const l = await z0(m, M), P = await this.parseWeatherData(l, M, z);
|
|
1547
|
+
q ? await this.mergeSegments(q, P) : q = P;
|
|
1548
1548
|
}
|
|
1549
1549
|
else {
|
|
1550
1550
|
const S = await z0(M.url, M);
|
|
@@ -1552,11 +1552,11 @@ class J0 {
|
|
|
1552
1552
|
}
|
|
1553
1553
|
delete M.apikey;
|
|
1554
1554
|
const f = L();
|
|
1555
|
-
this.debug &&
|
|
1555
|
+
this.debug && D.info("[%s] fetch marine api (%j) cost: %d ms", z.requestId, M.url, f.diff(X, "ms"));
|
|
1556
1556
|
const e = await this.mergeMarineData(q), r = e.find((S) => S.model === "ncep_gfswave016"), N = e.find((S) => S.model === "ncep_gfswave025"), u = e.find((S) => S.model === "meteofrance_wave"), B = e.find((S) => S.model === "best_match");
|
|
1557
1557
|
return (p = (b = B == null ? void 0 : B.hourly) == null ? void 0 : b.wave_height) != null && p.every((S) => S !== null) ? [B] : (W = (c = u == null ? void 0 : u.hourly) == null ? void 0 : c.wave_height) != null && W.every((S) => S !== null) ? [u] : (o = (A = r == null ? void 0 : r.hourly) == null ? void 0 : A.wave_height) != null && o.every((S) => S !== null) ? [r] : (Y = (d = N == null ? void 0 : N.hourly) == null ? void 0 : d.wave_height) != null && Y.every((S) => S !== null) ? [N] : e != null && e.length ? [e[0]] : [];
|
|
1558
1558
|
} catch (X) {
|
|
1559
|
-
return
|
|
1559
|
+
return D.warn("[%s] marine forecast failed: %s, with %j", z.requestId, X, M), [];
|
|
1560
1560
|
}
|
|
1561
1561
|
}
|
|
1562
1562
|
/**
|
|
@@ -1570,62 +1570,62 @@ class J0 {
|
|
|
1570
1570
|
var W, A, o, d, Y, X, q, f, e, r;
|
|
1571
1571
|
const p = [], c = Math.pow(10, b.precision || 6);
|
|
1572
1572
|
for (let N = 0; N < M.length; N++) {
|
|
1573
|
-
const u = M[N], B = u.utcOffsetSeconds(), S = u.timezone(), m = u.current(),
|
|
1573
|
+
const u = M[N], B = u.utcOffsetSeconds(), S = u.timezone(), m = u.current(), l = u.hourly(), P = u.sixHourly(), K = u.daily(), h = {};
|
|
1574
1574
|
if (h.timezone = S || void 0, h.offset = this.prettyTimezoneOffset(B), h.model = z.models instanceof Array ? (W = z.models) == null ? void 0 : W[N] : z.models || "best_match", m) {
|
|
1575
|
-
const
|
|
1575
|
+
const H = L();
|
|
1576
1576
|
h.current = {
|
|
1577
1577
|
time: L.unix(Number(m.time())).utc().format()
|
|
1578
1578
|
};
|
|
1579
|
-
for (let
|
|
1580
|
-
const
|
|
1581
|
-
h.current[z.current[
|
|
1579
|
+
for (let G = 0; G < m.variablesLength(); G++) {
|
|
1580
|
+
const E = m.variables(G).value();
|
|
1581
|
+
h.current[z.current[G]] = isNaN(E) ? null : Math.round(E * c) / c;
|
|
1582
1582
|
}
|
|
1583
|
-
const
|
|
1584
|
-
this.debug &&
|
|
1583
|
+
const g = L();
|
|
1584
|
+
this.debug && D.debug("[%s] fetch current variables cost: %d ms", b.requestId, g.diff(H, "ms"));
|
|
1585
1585
|
}
|
|
1586
|
-
if (
|
|
1587
|
-
const
|
|
1586
|
+
if (l) {
|
|
1587
|
+
const H = L(), g = L.unix(Number(l.time())).add(z.fake ? 1 : 0, "year");
|
|
1588
1588
|
h.hourly = {
|
|
1589
|
-
date:
|
|
1590
|
-
time: this.range(Number(
|
|
1591
|
-
(
|
|
1589
|
+
date: g.utc().format(),
|
|
1590
|
+
time: this.range(Number(l.time()), Number(l.timeEnd()), l.interval()).map(
|
|
1591
|
+
(E) => L.unix(E).add(z.fake ? 1 : 0, "year").diff(g, "h")
|
|
1592
1592
|
)
|
|
1593
1593
|
};
|
|
1594
|
-
for (let
|
|
1595
|
-
const k = (d = (o = (A =
|
|
1596
|
-
h.hourly[z.hourly[
|
|
1594
|
+
for (let E = 0; E < l.variablesLength(); E++) {
|
|
1595
|
+
const k = (d = (o = (A = l.variables(E).valuesArray()) == null ? void 0 : A.toString()) == null ? void 0 : o.split(",")) == null ? void 0 : d.map((_) => isNaN(_) ? null : Math.round(Number(_) * c) / c);
|
|
1596
|
+
h.hourly[z.hourly[E]] = k;
|
|
1597
1597
|
}
|
|
1598
|
-
const
|
|
1599
|
-
this.debug &&
|
|
1598
|
+
const G = L();
|
|
1599
|
+
this.debug && D.debug("[%s] fetch hourly variables cost: %d ms", b.requestId, G.diff(H, "ms"));
|
|
1600
1600
|
}
|
|
1601
|
-
if (
|
|
1602
|
-
const
|
|
1601
|
+
if (P) {
|
|
1602
|
+
const H = L(), g = L.unix(Number(P.time())).add(z.fake ? 1 : 0, "year");
|
|
1603
1603
|
h.sixHourly = {
|
|
1604
|
-
date:
|
|
1605
|
-
time: this.range(Number(
|
|
1606
|
-
(
|
|
1604
|
+
date: g.utc().format(),
|
|
1605
|
+
time: this.range(Number(P.time()), Number(P.timeEnd()), P.interval()).map(
|
|
1606
|
+
(E) => L.unix(E).add(z.fake ? 1 : 0, "year").diff(g, "h")
|
|
1607
1607
|
)
|
|
1608
1608
|
};
|
|
1609
|
-
for (let
|
|
1610
|
-
const k = (q = (X = (Y =
|
|
1611
|
-
|
|
1609
|
+
for (let E = 0; E < P.variablesLength(); E += b.memberLength ?? 1) {
|
|
1610
|
+
const k = (q = (X = (Y = P.variables(E).valuesArray()) == null ? void 0 : Y.toString()) == null ? void 0 : X.split(",")) == null ? void 0 : q.map((_) => isNaN(_) ? null : Math.round(Number(_) * c) / c);
|
|
1611
|
+
P.variables(E), h.sixHourly[z.six_hourly[E / (b.memberLength ?? 1)]] = k;
|
|
1612
1612
|
}
|
|
1613
|
-
const
|
|
1614
|
-
this.debug &&
|
|
1613
|
+
const G = L();
|
|
1614
|
+
this.debug && D.debug("[%s] fetch 6-hourly variables cost: %d ms", b.requestId, G.diff(H, "ms"));
|
|
1615
1615
|
}
|
|
1616
|
-
if (
|
|
1617
|
-
const
|
|
1616
|
+
if (K) {
|
|
1617
|
+
const H = L();
|
|
1618
1618
|
h.daily = {
|
|
1619
|
-
time: this.range(Number(
|
|
1620
|
-
(
|
|
1619
|
+
time: this.range(Number(K.time()), Number(K.timeEnd()), K.interval()).map(
|
|
1620
|
+
(G) => L.unix(G).add(z.fake ? 1 : 0, "year").utc().format()
|
|
1621
1621
|
)
|
|
1622
1622
|
};
|
|
1623
|
-
for (let
|
|
1624
|
-
const
|
|
1625
|
-
h.daily[z.daily[
|
|
1623
|
+
for (let G = 0; G < K.variablesLength(); G += b.memberLength ?? 1) {
|
|
1624
|
+
const E = (r = (e = (f = K.variables(G).valuesArray()) == null ? void 0 : f.toString()) == null ? void 0 : e.split(",")) == null ? void 0 : r.map((k) => isNaN(k) ? null : Math.round(Number(k) * c) / c);
|
|
1625
|
+
h.daily[z.daily[G / (b.memberLength ?? 1)]] = E;
|
|
1626
1626
|
}
|
|
1627
|
-
const
|
|
1628
|
-
this.debug &&
|
|
1627
|
+
const g = L();
|
|
1628
|
+
this.debug && D.debug("[%s] fetch daily variables cost: %d ms", b.requestId, g.diff(H, "ms"));
|
|
1629
1629
|
}
|
|
1630
1630
|
p.push(h);
|
|
1631
1631
|
}
|
|
@@ -1767,7 +1767,7 @@ class J0 {
|
|
|
1767
1767
|
selfHosted: !0
|
|
1768
1768
|
}) {
|
|
1769
1769
|
var e, r, N, u, B, S;
|
|
1770
|
-
z = this.toStdLng(z), this.debug &&
|
|
1770
|
+
z = this.toStdLng(z), this.debug && D.info("[%s] spot forecast params: %j", A.requestId, { lat: M, lng: z, datetime: b, simplify: p, withDaily: c, withHourly: W, options: A });
|
|
1771
1771
|
const o = {
|
|
1772
1772
|
apikey: this.apikey,
|
|
1773
1773
|
latitude: M,
|
|
@@ -1818,7 +1818,7 @@ class J0 {
|
|
|
1818
1818
|
precision: 6
|
|
1819
1819
|
}) {
|
|
1820
1820
|
var r, N;
|
|
1821
|
-
z = this.toStdLng(z), this.debug &&
|
|
1821
|
+
z = this.toStdLng(z), this.debug && D.info("[%s] spot historical params: %j", o.requestId, { lat: M, lng: z, startDate: b, endDate: p, withMarine: A, options: o });
|
|
1822
1822
|
const d = this.timezoneOffset(M, z), Y = L.utc(b).utcOffset(d), X = L.utc(p).utcOffset(d);
|
|
1823
1823
|
Y.subtract(d > 0 ? d : -d, "h"), X.subtract(d > 0 ? d : -d, "h");
|
|
1824
1824
|
const q = {
|
|
@@ -1869,7 +1869,7 @@ class J0 {
|
|
|
1869
1869
|
async spotSeasonal(M, z, b, p, c = !1, W = {
|
|
1870
1870
|
precision: 6
|
|
1871
1871
|
}) {
|
|
1872
|
-
z = this.toStdLng(z), this.debug &&
|
|
1872
|
+
z = this.toStdLng(z), this.debug && D.info("[%s] spot seasonal params: %j", W.requestId, { lat: M, lng: z, startDate: b, endDate: p, options: W });
|
|
1873
1873
|
const A = this.timezoneOffset(M, z), o = L.utc(b).utcOffset(A), d = p ? L.utc(p).utcOffset(A) : o.clone().add(1, "month");
|
|
1874
1874
|
o.subtract(A > 0 ? A : -A, "h"), d.subtract(A > 0 ? A : -A, "h");
|
|
1875
1875
|
const Y = {
|
|
@@ -1910,7 +1910,7 @@ class J0 {
|
|
|
1910
1910
|
precision: 6
|
|
1911
1911
|
}) {
|
|
1912
1912
|
var X;
|
|
1913
|
-
z = this.toStdLng(z), this.debug &&
|
|
1913
|
+
z = this.toStdLng(z), this.debug && D.info("[%s] spot climate params: %j", c.requestId, { lat: M, lng: z, startDate: b, endDate: p, options: c });
|
|
1914
1914
|
const W = this.timezoneOffset(M, z), A = L.utc(b).utcOffset(W), o = p ? L.utc(p).utcOffset(W) : A.clone().add(1, "day");
|
|
1915
1915
|
o.subtract(W > 0 ? W : -W, "h"), A.subtract(W > 0 ? W : -W, "h");
|
|
1916
1916
|
const d = {
|
|
@@ -1931,32 +1931,39 @@ class J0 {
|
|
|
1931
1931
|
async update(M = {}) {
|
|
1932
1932
|
const z = L.unix(this.METEO2_UPDATE.etime), b = this.METEO2_UPDATE.version, p = L();
|
|
1933
1933
|
if (!b || z.clone().add(10, "minute").isBefore(p)) {
|
|
1934
|
-
const c = M.url || "https://meteo3agent.idmwx.com/api/agents/update",
|
|
1934
|
+
const c = M.url || "https://meteo3agent.idmwx.com/api/agents/update", W = await fetch(c, {
|
|
1935
1935
|
headers: {
|
|
1936
1936
|
"Content-Type": "application/json",
|
|
1937
1937
|
Authorization: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImNsYmY5M3I0YTAwMDE4Ymx0NWJ4emFwNWMiLCJyb2xlIjoyMDQ3LCJpYXQiOjE2NzA1NTM0NzAsImV4cCI6Mzg3ODA3MzQ3MH0.MxTv0yLGarZCtOSCZfJHMqrXNMNN0-OL4gBGKGcYcc8"
|
|
1938
1938
|
}
|
|
1939
|
-
})
|
|
1940
|
-
|
|
1941
|
-
const
|
|
1942
|
-
|
|
1943
|
-
const
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
meta:
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1939
|
+
});
|
|
1940
|
+
try {
|
|
1941
|
+
const A = await W.json();
|
|
1942
|
+
if (A.code === 0) {
|
|
1943
|
+
const o = A.data, d = M0.standardWeatherModels();
|
|
1944
|
+
for (const Y of d) {
|
|
1945
|
+
const X = M0.autoPickSubCategories(Y.alias), f = o.filter((e) => X.includes(e.category)).map((e) => {
|
|
1946
|
+
var B, S, m, l, P, K;
|
|
1947
|
+
const r = L.unix((B = e.meta) == null ? void 0 : B.data_end_time).utc(), N = L.unix((S = e.meta) == null ? void 0 : S.last_run_availability_time).utc(), u = r.diff(N, "days");
|
|
1948
|
+
return {
|
|
1949
|
+
category: e.category,
|
|
1950
|
+
meta: {
|
|
1951
|
+
endTime: r.format(),
|
|
1952
|
+
availabilityTime: N.format(),
|
|
1953
|
+
days: u,
|
|
1954
|
+
initialisationTime: L.unix((m = e.meta) == null ? void 0 : m.last_run_initialisation_time).utc().format(),
|
|
1955
|
+
modificationTime: L.unix((l = e.meta) == null ? void 0 : l.last_run_modification_time).utc().format(),
|
|
1956
|
+
temporalResolution: Math.round(((P = e.meta) == null ? void 0 : P.temporal_resolution_seconds) / 3600),
|
|
1957
|
+
frequency: Math.round(((K = e.meta) == null ? void 0 : K.update_interval_seconds) / 3600)
|
|
1958
|
+
}
|
|
1959
|
+
};
|
|
1960
|
+
});
|
|
1961
|
+
f.length && (this.METEO2_UPDATE[Y.alias] = f);
|
|
1962
|
+
}
|
|
1963
|
+
this.METEO2_UPDATE.version = b + 1, this.METEO2_UPDATE.etime = p.unix();
|
|
1958
1964
|
}
|
|
1959
|
-
|
|
1965
|
+
} catch (A) {
|
|
1966
|
+
D.error("[%s] update meteo2 error: %s", M.requestId, A);
|
|
1960
1967
|
}
|
|
1961
1968
|
}
|
|
1962
1969
|
return this.METEO2_UPDATE;
|
|
@@ -1995,6 +2002,7 @@ class k0 {
|
|
|
1995
2002
|
* @param lng
|
|
1996
2003
|
*
|
|
1997
2004
|
* Start date (in YYYY-MM-DD format) to retrieve the tidal heights or extremes starting at midnight local time. You can also pass "today" to use the current date of the location.
|
|
2005
|
+
* @param days
|
|
1998
2006
|
* @param date
|
|
1999
2007
|
*
|
|
2000
2008
|
* If this parameter is present the low and high tides will be returned.
|
|
@@ -2143,7 +2151,7 @@ const J = class J {
|
|
|
2143
2151
|
static async parseHistory(M) {
|
|
2144
2152
|
const z = `https://hifleet.com/hifleetapi/gettyphooninfo2.do?xuhao=${M}`, b = await Q.post(z).text(), p = await J.parser.parseStringPromise(b), c = p.typhoon.position instanceof Array ? p.typhoon.position : [p.typhoon.position], W = [];
|
|
2145
2153
|
for (const A of c) {
|
|
2146
|
-
const o = L(A.updatetime).utcOffset(8).utc().format(), d = Number(A.lat), Y = Number(A.lon), X = Number(A.pressure), q = Number(A.windspeed * 3600 / 1852), f = T.parseWindCircle(A.c7quad1 / 1.852), e = T.parseWindCircle(A.c7quad2 / 1.852), r = T.parseWindCircle(A.c7quad3 / 1.852), N = T.parseWindCircle(A.c7quad4 / 1.852), u = T.parseWindCircle(A.c10quad1 / 1.852), B = T.parseWindCircle(A.c10quad2 / 1.852), S = T.parseWindCircle(A.c10quad3 / 1.852), m = T.parseWindCircle(A.c10quad4 / 1.852),
|
|
2154
|
+
const o = L(A.updatetime).utcOffset(8).utc().format(), d = Number(A.lat), Y = Number(A.lon), X = Number(A.pressure), q = Number(A.windspeed * 3600 / 1852), f = T.parseWindCircle(A.c7quad1 / 1.852), e = T.parseWindCircle(A.c7quad2 / 1.852), r = T.parseWindCircle(A.c7quad3 / 1.852), N = T.parseWindCircle(A.c7quad4 / 1.852), u = T.parseWindCircle(A.c10quad1 / 1.852), B = T.parseWindCircle(A.c10quad2 / 1.852), S = T.parseWindCircle(A.c10quad3 / 1.852), m = T.parseWindCircle(A.c10quad4 / 1.852), l = T.parseWindCircle(A.c12quad1 / 1.852), P = T.parseWindCircle(A.c12quad2 / 1.852), K = T.parseWindCircle(A.c12quad3 / 1.852), h = T.parseWindCircle(A.c12quad4 / 1.852), { r7: H, r10: g, r12: G } = T.estimateWindRadii(q, X, d), E = {
|
|
2147
2155
|
updated: o,
|
|
2148
2156
|
lat: isNaN(d) ? null : d,
|
|
2149
2157
|
lng: isNaN(Y) ? null : Y,
|
|
@@ -2151,24 +2159,24 @@ const J = class J {
|
|
|
2151
2159
|
kts: isNaN(q) ? null : Math.round(q) || null,
|
|
2152
2160
|
type: T.parseTropicalType(q),
|
|
2153
2161
|
wind: {
|
|
2154
|
-
r7:
|
|
2162
|
+
r7: H,
|
|
2155
2163
|
r7ne: f,
|
|
2156
2164
|
r7nw: e,
|
|
2157
2165
|
r7sw: r,
|
|
2158
2166
|
r7se: N,
|
|
2159
|
-
r10:
|
|
2167
|
+
r10: g,
|
|
2160
2168
|
r10ne: u,
|
|
2161
2169
|
r10nw: B,
|
|
2162
2170
|
r10sw: S,
|
|
2163
2171
|
r10se: m,
|
|
2164
|
-
r12:
|
|
2165
|
-
r12ne:
|
|
2166
|
-
r12nw:
|
|
2167
|
-
r12sw:
|
|
2172
|
+
r12: G,
|
|
2173
|
+
r12ne: l,
|
|
2174
|
+
r12nw: P,
|
|
2175
|
+
r12sw: K,
|
|
2168
2176
|
r12se: h
|
|
2169
2177
|
}
|
|
2170
2178
|
};
|
|
2171
|
-
W.push(
|
|
2179
|
+
W.push(E);
|
|
2172
2180
|
}
|
|
2173
2181
|
return W.sort((A, o) => L(o.updated).unix() - L(A.updated).unix()), W;
|
|
2174
2182
|
}
|
|
@@ -2251,7 +2259,7 @@ let b0 = J;
|
|
|
2251
2259
|
class j {
|
|
2252
2260
|
static async parseHistory(M) {
|
|
2253
2261
|
return M.map((z) => {
|
|
2254
|
-
const b = Number(z.lat), p = Number(z.lon), c = Number(z.maxSP * 3600 / 1852), W = Number(z.minP), A = T.parseWindCircle(z.r7Ne / 1.852), o = T.parseWindCircle(z.r7Nw / 1.852), d = T.parseWindCircle(z.r7Se / 1.852), Y = T.parseWindCircle(z.r7Sw / 1.852), X = T.parseWindCircle(z.r10Ne / 1.852), q = T.parseWindCircle(z.r10Nw / 1.852), f = T.parseWindCircle(z.r10Se / 1.852), e = T.parseWindCircle(z.r10Sw / 1.852), r = T.parseWindCircle(z.r12Ne / 1.852), N = T.parseWindCircle(z.r12Nw / 1.852), u = T.parseWindCircle(z.r12Se / 1.852), B = T.parseWindCircle(z.r12Sw / 1.852), { r7: S, r10: m, r12:
|
|
2262
|
+
const b = Number(z.lat), p = Number(z.lon), c = Number(z.maxSP * 3600 / 1852), W = Number(z.minP), A = T.parseWindCircle(z.r7Ne / 1.852), o = T.parseWindCircle(z.r7Nw / 1.852), d = T.parseWindCircle(z.r7Se / 1.852), Y = T.parseWindCircle(z.r7Sw / 1.852), X = T.parseWindCircle(z.r10Ne / 1.852), q = T.parseWindCircle(z.r10Nw / 1.852), f = T.parseWindCircle(z.r10Se / 1.852), e = T.parseWindCircle(z.r10Sw / 1.852), r = T.parseWindCircle(z.r12Ne / 1.852), N = T.parseWindCircle(z.r12Nw / 1.852), u = T.parseWindCircle(z.r12Se / 1.852), B = T.parseWindCircle(z.r12Sw / 1.852), { r7: S, r10: m, r12: l } = T.estimateWindRadii(c, W, b);
|
|
2255
2263
|
return {
|
|
2256
2264
|
updated: L.utc(z.realTime).format(),
|
|
2257
2265
|
lat: isNaN(b) ? null : b || null,
|
|
@@ -2269,7 +2277,7 @@ class j {
|
|
|
2269
2277
|
r10nw: q,
|
|
2270
2278
|
r10se: f,
|
|
2271
2279
|
r10sw: e,
|
|
2272
|
-
r12:
|
|
2280
|
+
r12: l,
|
|
2273
2281
|
r12ne: r,
|
|
2274
2282
|
r12nw: N,
|
|
2275
2283
|
r12se: u,
|
|
@@ -2282,7 +2290,7 @@ class j {
|
|
|
2282
2290
|
return M.map((z) => {
|
|
2283
2291
|
const b = z.currentPosition, p = z.forecastPoints, c = L.utc(b.realTime).format(), W = {};
|
|
2284
2292
|
return p.forEach((A) => {
|
|
2285
|
-
const o = L.utc(A.forecastTime), d = o.diff(c, "hour"), Y = Math.round(A.maxSP * 3600 / 1852), X = Math.round(A.maxSP * 3600 / 1852), q = A.pressure, f = T.parseWindCircle(A.r7Ne / 1.852), e = T.parseWindCircle(A.r7Nw / 1.852), r = T.parseWindCircle(A.r7Sw / 1.852), N = T.parseWindCircle(A.r7Se / 1.852), u = T.parseWindCircle(A.r10Ne / 1.852), B = T.parseWindCircle(A.r10Nw / 1.852), S = T.parseWindCircle(A.r10Sw / 1.852), m = T.parseWindCircle(A.r10Se / 1.852),
|
|
2293
|
+
const o = L.utc(A.forecastTime), d = o.diff(c, "hour"), Y = Math.round(A.maxSP * 3600 / 1852), X = Math.round(A.maxSP * 3600 / 1852), q = A.pressure, f = T.parseWindCircle(A.r7Ne / 1.852), e = T.parseWindCircle(A.r7Nw / 1.852), r = T.parseWindCircle(A.r7Sw / 1.852), N = T.parseWindCircle(A.r7Se / 1.852), u = T.parseWindCircle(A.r10Ne / 1.852), B = T.parseWindCircle(A.r10Nw / 1.852), S = T.parseWindCircle(A.r10Sw / 1.852), m = T.parseWindCircle(A.r10Se / 1.852), l = T.parseWindCircle(A.r12Ne / 1.852), P = T.parseWindCircle(A.r12Nw / 1.852), K = T.parseWindCircle(A.r12Sw / 1.852), h = T.parseWindCircle(A.r12Se / 1.852), { r7: H, r10: g, r12: G } = T.estimateWindRadii(Y, q, A.lat);
|
|
2286
2294
|
W[d] = {
|
|
2287
2295
|
lat: A.lat,
|
|
2288
2296
|
lng: A.lon,
|
|
@@ -2292,20 +2300,20 @@ class j {
|
|
|
2292
2300
|
kts: isNaN(Y) ? null : Y || null,
|
|
2293
2301
|
type: T.parseTropicalType(Y),
|
|
2294
2302
|
datetime: o.format(),
|
|
2295
|
-
r7:
|
|
2303
|
+
r7: H,
|
|
2296
2304
|
r7ne: f,
|
|
2297
2305
|
r7nw: e,
|
|
2298
2306
|
r7sw: r,
|
|
2299
2307
|
r7se: N,
|
|
2300
|
-
r10:
|
|
2308
|
+
r10: g,
|
|
2301
2309
|
r10ne: u,
|
|
2302
2310
|
r10nw: B,
|
|
2303
2311
|
r10sw: S,
|
|
2304
2312
|
r10se: m,
|
|
2305
|
-
r12:
|
|
2306
|
-
r12ne:
|
|
2307
|
-
r12nw:
|
|
2308
|
-
r12sw:
|
|
2313
|
+
r12: G,
|
|
2314
|
+
r12ne: l,
|
|
2315
|
+
r12nw: P,
|
|
2316
|
+
r12sw: K,
|
|
2309
2317
|
r12se: h
|
|
2310
2318
|
},
|
|
2311
2319
|
gusts: {
|
|
@@ -2454,7 +2462,7 @@ class T {
|
|
|
2454
2462
|
p = 51.6 * Math.exp(-0.0223 * M + 0.0281 * c) * Math.pow(Math.max(W, 10) / 100, 0.155);
|
|
2455
2463
|
} else
|
|
2456
2464
|
p = 46.4 * Math.exp(-0.0155 * M + 0.0169 * c);
|
|
2457
|
-
return Math.max(
|
|
2465
|
+
return Math.max(60 / 1.852, Math.min(150 / 1.852, p));
|
|
2458
2466
|
}
|
|
2459
2467
|
/**
|
|
2460
2468
|
* 基于台风强度推算风圈基础半径的经验公式
|