@idm-plugin/meteo2 0.9.6 → 0.9.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 CHANGED
@@ -364,7 +364,7 @@ var N0 = { exports: {} };
364
364
  parse: function(c) {
365
365
  var R = +c, X = this.offsets, e = this.untils, f = e.length - 1, u, _, B, G;
366
366
  for (G = 0; G < f; G++)
367
- if (u = X[G], _ = X[G + 1], B = X[G && G - 1], u < _ && m.moveAmbiguousForward ? u = _ : u > B && m.moveInvalidForward && (u = B), R < e[G] - u * 6e4)
367
+ if (u = X[G], _ = X[G + 1], B = X[G && G - 1], u < _ && E.moveAmbiguousForward ? u = _ : u > B && E.moveInvalidForward && (u = B), R < e[G] - u * 6e4)
368
368
  return X[G];
369
369
  return X[f];
370
370
  },
@@ -381,7 +381,7 @@ var N0 = { exports: {} };
381
381
  function l(c, R) {
382
382
  this.name = c, this.zones = R;
383
383
  }
384
- function I(c) {
384
+ function m(c) {
385
385
  var R = c.toTimeString(), X = R.match(/\([a-z ]+\)/i);
386
386
  X && X[0] ? (X = X[0].match(/[A-Z]/g), X = X ? X.join("") : void 0) : (X = R.match(/[A-Z]{3,5}/g), X = X ? X[0] : void 0), X === "GMT" && (X = void 0), this.at = +c, this.abbr = X, this.offset = c.getTimezoneOffset();
387
387
  }
@@ -391,17 +391,17 @@ var N0 = { exports: {} };
391
391
  P.prototype.scoreOffsetAt = function(c) {
392
392
  this.offsetScore += Math.abs(this.zone.utcOffset(c.at) - c.offset), this.zone.abbr(c.at).replace(/[^A-Z]/g, "") !== c.abbr && this.abbrScore++;
393
393
  };
394
- function E(c, R) {
394
+ function I(c, R) {
395
395
  for (var X, e; e = ((R.at - c.at) / 12e4 | 0) * 6e4; )
396
- X = new I(new Date(c.at + e)), X.offset === c.offset ? c = X : R = X;
396
+ X = new m(new Date(c.at + e)), X.offset === c.offset ? c = X : R = X;
397
397
  return c;
398
398
  }
399
399
  function C() {
400
- var c = (/* @__PURE__ */ new Date()).getFullYear() - 2, R = new I(new Date(c, 0, 1)), X = R.offset, e = [R], f, u, _, B;
400
+ var c = (/* @__PURE__ */ new Date()).getFullYear() - 2, R = new m(new Date(c, 0, 1)), X = R.offset, e = [R], f, u, _, B;
401
401
  for (B = 1; B < 48; B++)
402
- _ = new Date(c, B, 1).getTimezoneOffset(), _ !== X && (u = new I(new Date(c, B, 1)), f = E(R, u), e.push(f), e.push(new I(new Date(f.at + 6e4))), R = u, X = _);
402
+ _ = new Date(c, B, 1).getTimezoneOffset(), _ !== X && (u = new m(new Date(c, B, 1)), f = I(R, u), e.push(f), e.push(new m(new Date(f.at + 6e4))), R = u, X = _);
403
403
  for (B = 0; B < 4; B++)
404
- e.push(new I(new Date(c + B, 0, 1))), e.push(new I(new Date(c + B, 6, 1)));
404
+ e.push(new m(new Date(c + B, 0, 1))), e.push(new m(new Date(c + B, 6, 1)));
405
405
  return e;
406
406
  }
407
407
  function v(c, R) {
@@ -499,7 +499,7 @@ var N0 = { exports: {} };
499
499
  }) : X;
500
500
  }
501
501
  function B0(c) {
502
- W0(c.zones), M0(c.links), K(c.countries), m.dataVersion = c.version;
502
+ W0(c.zones), M0(c.links), K(c.countries), E.dataVersion = c.version;
503
503
  }
504
504
  function a0(c) {
505
505
  return a0.didShowError || (a0.didShowError = !0, j("moment.tz.zoneExists('" + c + "') has been deprecated in favor of !moment.tz.zone('" + c + "')")), !!y(c);
@@ -511,13 +511,13 @@ var N0 = { exports: {} };
511
511
  function j(c) {
512
512
  typeof console < "u" && typeof console.error == "function" && console.error(c);
513
513
  }
514
- function m(c) {
514
+ function E(c) {
515
515
  var R = Array.prototype.slice.call(arguments, 0, -1), X = arguments[arguments.length - 1], e = M.utc.apply(null, R), f;
516
516
  return !M.isMoment(c) && n0(e) && (f = y(X)) && e.add(f.parse(e), "minutes"), e.tz(X), e;
517
517
  }
518
- m.version = p, m.dataVersion = "", m._zones = b, m._links = O, m._names = o, m._countries = W, m.add = W0, m.link = M0, m.load = B0, m.zone = y, m.zoneExists = a0, m.guess = d0, m.names = H, m.Zone = S, m.unpack = V, m.unpackBase60 = t, m.needsOffset = n0, m.moveInvalidForward = !0, m.moveAmbiguousForward = !1, m.countries = T, m.zonesForCountry = U0;
518
+ E.version = p, E.dataVersion = "", E._zones = b, E._links = O, E._names = o, E._countries = W, E.add = W0, E.link = M0, E.load = B0, E.zone = y, E.zoneExists = a0, E.guess = d0, E.names = H, E.Zone = S, E.unpack = V, E.unpackBase60 = t, E.needsOffset = n0, E.moveInvalidForward = !0, E.moveAmbiguousForward = !1, E.countries = T, E.zonesForCountry = U0;
519
519
  var F = M.fn;
520
- M.tz = m, M.defaultZone = null, M.updateOffset = function(c, R) {
520
+ M.tz = E, M.defaultZone = null, M.updateOffset = function(c, R) {
521
521
  var X = M.defaultZone, e;
522
522
  if (c._z === void 0 && (X && n0(c) && !c._isUTC && c.isValid() && (c._d = M.utc(c._a)._d, c.utc().add(X.parse(c), "minutes")), c._z = X), c._z)
523
523
  if (e = c._z.utcOffset(c), Math.abs(e) < 16 && (e = e / 60), c.utcOffset !== void 0) {
@@ -1559,7 +1559,7 @@ class b0 {
1559
1559
  fake: M.fake,
1560
1560
  step: r
1561
1561
  });
1562
- const I = await o0(l, M), P = await this.parseWeatherData(I, M, p);
1562
+ const m = await o0(l, M), P = await this.parseWeatherData(m, M, p);
1563
1563
  Y ? await this.mergeSegments(Y, P) : Y = P;
1564
1564
  }
1565
1565
  else {
@@ -1588,19 +1588,19 @@ class b0 {
1588
1588
  for (let t = 0; t < M.length; t++) {
1589
1589
  const i = M[t], U = i.utcOffsetSeconds(), s = i.timezone(), V = i.current(), S = i.hourly(), r = i.daily(), l = {};
1590
1590
  if (l.timezone = s || void 0, l.offset = b0.prettyTimezoneOffset(U), l.model = p.models instanceof Array ? (o = p.models) == null ? void 0 : o[t] : p.models || "best_match", V) {
1591
- const I = L();
1591
+ const m = L();
1592
1592
  l.current = {
1593
1593
  time: L.unix(Number(V.time())).utc().format()
1594
1594
  };
1595
- for (let E = 0; E < V.variablesLength(); E++) {
1596
- const C = V.variables(E).value();
1597
- l.current[p.current[E]] = isNaN(C) ? null : Math.round(C * W) / W;
1595
+ for (let I = 0; I < V.variablesLength(); I++) {
1596
+ const C = V.variables(I).value();
1597
+ l.current[p.current[I]] = isNaN(C) ? null : Math.round(C * W) / W;
1598
1598
  }
1599
1599
  const P = L();
1600
- this.debug && D.debug("[%s] fetch current variables cost: %d ms", b.requestId, P.diff(I, "ms"));
1600
+ this.debug && D.debug("[%s] fetch current variables cost: %d ms", b.requestId, P.diff(m, "ms"));
1601
1601
  }
1602
1602
  if (S) {
1603
- const I = L(), P = L.unix(Number(S.time())).add(p.fake ? 1 : 0, "year");
1603
+ const m = L(), P = L.unix(Number(S.time())).add(p.fake ? 1 : 0, "year");
1604
1604
  l.hourly = {
1605
1605
  date: P.utc().format(),
1606
1606
  time: b0.range(Number(S.time()), Number(S.timeEnd()), S.interval()).map(
@@ -1611,22 +1611,22 @@ class b0 {
1611
1611
  const v = (d = (q = (A = S.variables(C).valuesArray()) == null ? void 0 : A.toString()) == null ? void 0 : q.split(",")) == null ? void 0 : d.map((g) => isNaN(g) ? null : Math.round(Number(g) * W) / W);
1612
1612
  l.hourly[p.hourly[C]] = v;
1613
1613
  }
1614
- const E = L();
1615
- this.debug && D.debug("[%s] fetch hourly variables cost: %d ms", b.requestId, E.diff(I, "ms"));
1614
+ const I = L();
1615
+ this.debug && D.debug("[%s] fetch hourly variables cost: %d ms", b.requestId, I.diff(m, "ms"));
1616
1616
  }
1617
1617
  if (r) {
1618
- const I = L();
1618
+ const m = L();
1619
1619
  l.daily = {
1620
1620
  time: b0.range(Number(r.time()), Number(r.timeEnd()), r.interval()).map(
1621
- (E) => L.unix(E).add(p.fake ? 1 : 0, "year").utc().format()
1621
+ (I) => L.unix(I).add(p.fake ? 1 : 0, "year").utc().format()
1622
1622
  )
1623
1623
  };
1624
- for (let E = 0; E < r.variablesLength(); E += b.memberLength ?? 1) {
1625
- const C = (Y = (a = (n = r.variables(E).valuesArray()) == null ? void 0 : n.toString()) == null ? void 0 : a.split(",")) == null ? void 0 : Y.map((v) => isNaN(v) ? null : Math.round(Number(v) * W) / W);
1626
- l.daily[p.daily[E / (b.memberLength ?? 1)]] = C;
1624
+ for (let I = 0; I < r.variablesLength(); I += b.memberLength ?? 1) {
1625
+ const C = (Y = (a = (n = r.variables(I).valuesArray()) == null ? void 0 : n.toString()) == null ? void 0 : a.split(",")) == null ? void 0 : Y.map((v) => isNaN(v) ? null : Math.round(Number(v) * W) / W);
1626
+ l.daily[p.daily[I / (b.memberLength ?? 1)]] = C;
1627
1627
  }
1628
1628
  const P = L();
1629
- this.debug && D.debug("[%s] fetch daily variables cost: %d ms", b.requestId, P.diff(I, "ms"));
1629
+ this.debug && D.debug("[%s] fetch daily variables cost: %d ms", b.requestId, P.diff(m, "ms"));
1630
1630
  }
1631
1631
  O.push(l);
1632
1632
  }
@@ -1639,10 +1639,10 @@ class b0 {
1639
1639
  * @private
1640
1640
  */
1641
1641
  async parseSeasonalDailyVariable(M, p, b = {}) {
1642
- var o, A, q, d, n, a, Y, t, i, U, s, V, S, r, l, I;
1642
+ var o, A, q, d, n, a, Y, t, i, U, s, V, S, r, l, m;
1643
1643
  const O = [], W = Math.pow(10, b.precision || 6);
1644
1644
  for (let P = 0; P < M.length; P++) {
1645
- const E = M[P], C = E.utcOffsetSeconds(), v = E.timezone(), g = E.daily(), k = [...Array(g.variablesLength())].map((T, M0) => g.variables(M0)), O0 = k.filter(
1645
+ const I = M[P], C = I.utcOffsetSeconds(), v = I.timezone(), g = I.daily(), k = [...Array(g.variablesLength())].map((T, M0) => g.variables(M0)), O0 = k.filter(
1646
1646
  (T) => (T == null ? void 0 : T.variable()) === z0.temperature && (T == null ? void 0 : T.altitude()) === 2 && (T == null ? void 0 : T.aggregation()) === c0.maximum
1647
1647
  ), d0 = k.filter(
1648
1648
  (T) => (T == null ? void 0 : T.variable()) === z0.temperature && (T == null ? void 0 : T.altitude()) === 2 && (T == null ? void 0 : T.aggregation()) === c0.minimum
@@ -1667,7 +1667,7 @@ class b0 {
1667
1667
  for (const K of y)
1668
1668
  H.daily.wind_direction_10m_dominant = (S = (V = (s = K.valuesArray()) == null ? void 0 : s.toString()) == null ? void 0 : V.split(",")) == null ? void 0 : S.map((h) => isNaN(h) ? null : Math.round(Number(h) * W) / W);
1669
1669
  for (const K of W0)
1670
- H.daily.wind_speed_10m_max = (I = (l = (r = K.valuesArray()) == null ? void 0 : r.toString()) == null ? void 0 : l.split(",")) == null ? void 0 : I.map((h) => isNaN(h) ? null : Math.round(Number(h) * W) / W);
1670
+ H.daily.wind_speed_10m_max = (m = (l = (r = K.valuesArray()) == null ? void 0 : r.toString()) == null ? void 0 : l.split(",")) == null ? void 0 : m.map((h) => isNaN(h) ? null : Math.round(Number(h) * W) / W);
1671
1671
  const M0 = L();
1672
1672
  D.debug("[%s] fetch daily variables cost: %d ms", b.requestId, M0.diff(T, "ms"));
1673
1673
  }
@@ -1811,7 +1811,7 @@ class b0 {
1811
1811
  selfHosted: !0,
1812
1812
  maxDays: 14
1813
1813
  }) {
1814
- var i, U, s, V, S, r;
1814
+ var i, U, s, V, S, r, l;
1815
1815
  p = this.toStdLng(p), this.debug && D.info("[%s] spot forecast params: %j", A.requestId, { lat: M, lng: p, datetime: b, simplify: O, withDaily: W, withHourly: o, options: A });
1816
1816
  const q = {
1817
1817
  apikey: this.apikey,
@@ -1836,7 +1836,7 @@ class b0 {
1836
1836
  };
1837
1837
  W && (Y.daily = this.FORECAST.MARINE_VARIABLES.DAILY.split(",")), d || (A.forecastDays = A.forecastDays || 1, o = !0), o && (Y.hourly = this.FORECAST.MARINE_VARIABLES.HOURLY.split(",")), await this.prepare(d == null ? void 0 : d.utc().format(), !0, Y, A);
1838
1838
  let t = await this.marineForecast(Y, A);
1839
- return (r = (S = (V = t[0]) == null ? void 0 : V.hourly) == null ? void 0 : S.wave_height) != null && r.every((l) => l === null || l === 0) && (Y.models = this.pickMarineModels("best_match,ncep_gfswave025,ecmwf_wam025,meteofrance_wave"), t = await this.marineForecast(Y, A)), { weather: a, marine: t };
1839
+ return (r = (S = (V = t[0]) == null ? void 0 : V.hourly) == null ? void 0 : S.wave_height) != null && r.every((m) => m === null || m === 0) && (Y.models = this.pickMarineModels("best_match,ncep_gfswave025,ecmwf_wam025,meteofrance_wave"), t = await this.marineForecast(Y, A)), { weather: a, marine: t, wparams: q, mparams: Y, datetime: (l = d == null ? void 0 : d.utc()) == null ? void 0 : l.format() };
1840
1840
  }
1841
1841
  /**
1842
1842
  * 历史再分析数据
@@ -1989,7 +1989,7 @@ class b0 {
1989
1989
  const q = A.data, d = w.standardWeatherModels();
1990
1990
  for (const n of d) {
1991
1991
  const a = w.autoPickSubCategories(n.alias), t = q.filter((i) => a.includes(i.category)).map((i) => {
1992
- var S, r, l, I, P, E;
1992
+ var S, r, l, m, P, I;
1993
1993
  const U = L.unix((S = i.meta) == null ? void 0 : S.data_end_time).utc(), s = L.unix((r = i.meta) == null ? void 0 : r.last_run_availability_time).utc(), V = U.diff(s, "days");
1994
1994
  return {
1995
1995
  category: i.category,
@@ -1998,9 +1998,9 @@ class b0 {
1998
1998
  availabilityTime: s.format(),
1999
1999
  days: V,
2000
2000
  initialisationTime: L.unix((l = i.meta) == null ? void 0 : l.last_run_initialisation_time).utc().format(),
2001
- modificationTime: L.unix((I = i.meta) == null ? void 0 : I.last_run_modification_time).utc().format(),
2001
+ modificationTime: L.unix((m = i.meta) == null ? void 0 : m.last_run_modification_time).utc().format(),
2002
2002
  temporalResolution: Math.round(((P = i.meta) == null ? void 0 : P.temporal_resolution_seconds) / 3600),
2003
- frequency: Math.round(((E = i.meta) == null ? void 0 : E.update_interval_seconds) / 3600)
2003
+ frequency: Math.round(((I = i.meta) == null ? void 0 : I.update_interval_seconds) / 3600)
2004
2004
  }
2005
2005
  };
2006
2006
  });
@@ -2199,7 +2199,7 @@ const J = class J {
2199
2199
  static async parseHistory(M) {
2200
2200
  const p = `https://hifleet.com/hifleetapi/gettyphooninfo2.do?xuhao=${M}`, b = await $.post(p).text(), O = await J.parser.parseStringPromise(b), W = O.typhoon.position instanceof Array ? O.typhoon.position : [O.typhoon.position], o = [];
2201
2201
  for (const A of W) {
2202
- const q = L(A.updatetime).utcOffset(8).utc().format(), d = Number(A.lat), n = Number(A.lon), a = Number(A.pressure), Y = Number(A.windspeed * 3600 / 1852), t = N.parseWindCircle(A.c7quad1 / 1.852), i = N.parseWindCircle(A.c7quad2 / 1.852), U = N.parseWindCircle(A.c7quad3 / 1.852), s = N.parseWindCircle(A.c7quad4 / 1.852), V = N.parseWindCircle(A.c10quad1 / 1.852), S = N.parseWindCircle(A.c10quad2 / 1.852), r = N.parseWindCircle(A.c10quad3 / 1.852), l = N.parseWindCircle(A.c10quad4 / 1.852), I = N.parseWindCircle(A.c12quad1 / 1.852), P = N.parseWindCircle(A.c12quad2 / 1.852), E = N.parseWindCircle(A.c12quad3 / 1.852), C = N.parseWindCircle(A.c12quad4 / 1.852), { r7: v, r10: g, r12: k } = N.estimateWindRadii(Y, d), O0 = {
2202
+ const q = L(A.updatetime).utcOffset(8).utc().format(), d = Number(A.lat), n = Number(A.lon), a = Number(A.pressure), Y = Number(A.windspeed * 3600 / 1852), t = N.parseWindCircle(A.c7quad1 / 1.852), i = N.parseWindCircle(A.c7quad2 / 1.852), U = N.parseWindCircle(A.c7quad3 / 1.852), s = N.parseWindCircle(A.c7quad4 / 1.852), V = N.parseWindCircle(A.c10quad1 / 1.852), S = N.parseWindCircle(A.c10quad2 / 1.852), r = N.parseWindCircle(A.c10quad3 / 1.852), l = N.parseWindCircle(A.c10quad4 / 1.852), m = N.parseWindCircle(A.c12quad1 / 1.852), P = N.parseWindCircle(A.c12quad2 / 1.852), I = N.parseWindCircle(A.c12quad3 / 1.852), C = N.parseWindCircle(A.c12quad4 / 1.852), { r7: v, r10: g, r12: k } = N.estimateWindRadii(Y, d), O0 = {
2203
2203
  updated: q,
2204
2204
  lat: isNaN(d) ? null : d,
2205
2205
  lng: isNaN(n) ? null : n,
@@ -2219,9 +2219,9 @@ const J = class J {
2219
2219
  r10sw: r,
2220
2220
  r10se: l,
2221
2221
  r12: k,
2222
- r12ne: I,
2222
+ r12ne: m,
2223
2223
  r12nw: P,
2224
- r12sw: E,
2224
+ r12sw: I,
2225
2225
  r12se: C
2226
2226
  }
2227
2227
  };