@idm-plugin/meteo2 0.7.4 → 0.7.5

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
@@ -378,7 +378,7 @@ var n0 = { exports: {} };
378
378
  return this.offsets[this._index(O)];
379
379
  }
380
380
  };
381
- function P(O, a) {
381
+ function m(O, a) {
382
382
  this.name = O, this.zones = a;
383
383
  }
384
384
  function E(O) {
@@ -412,7 +412,7 @@ var n0 = { exports: {} };
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 m(O) {
415
+ function P(O) {
416
416
  var a = O.length, n = {}, R = [], t = {}, U, G, V, I;
417
417
  for (U = 0; U < a; U++)
418
418
  if (V = O[U].offset, !t.hasOwnProperty(V)) {
@@ -436,7 +436,7 @@ var n0 = { exports: {} };
436
436
  }
437
437
  } catch {
438
438
  }
439
- var n = h(), R = n.length, t = m(n), U = [], G, V, I;
439
+ var n = h(), R = n.length, t = P(n), U = [], G, V, I;
440
440
  for (V = 0; V < t.length; V++) {
441
441
  for (G = new C(y(t[V])), I = 0; I < R; I++)
442
442
  G.scoreOffsetAt(n[I]);
@@ -478,7 +478,7 @@ var n0 = { exports: {} };
478
478
  var a, n, R, t;
479
479
  if (!(!O || !O.length))
480
480
  for (a = 0; a < O.length; a++)
481
- t = O[a].split("|"), n = t[0].toUpperCase(), R = t[1].split(" "), c[n] = new P(
481
+ t = O[a].split("|"), n = t[0].toUpperCase(), R = t[1].split(" "), c[n] = new m(
482
482
  n,
483
483
  R
484
484
  );
@@ -1536,14 +1536,14 @@ class J0 {
1536
1536
  if (M.start_dates instanceof Array)
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
- const P = M.url[S];
1540
- this.debug && K.debug("[%s] fetch marine via %s with %j", z.requestId, P, {
1539
+ const m = M.url[S];
1540
+ this.debug && K.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 E = await z0(P, M), C = await this.parseWeatherData(E, M, z);
1546
+ const E = await z0(m, M), C = await this.parseWeatherData(E, M, z);
1547
1547
  q ? await this.mergeSegments(q, C) : q = C;
1548
1548
  }
1549
1549
  else {
@@ -1570,15 +1570,15 @@ 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(), P = u.current(), E = u.hourly(), C = u.sixHourly(), H = u.daily(), h = {};
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", P) {
1573
+ const u = M[N], B = u.utcOffsetSeconds(), S = u.timezone(), m = u.current(), E = u.hourly(), C = u.sixHourly(), H = u.daily(), h = {};
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
1575
  const g = L();
1576
1576
  h.current = {
1577
- time: L.unix(Number(P.time())).utc().format()
1577
+ time: L.unix(Number(m.time())).utc().format()
1578
1578
  };
1579
- for (let m = 0; m < P.variablesLength(); m++) {
1580
- const Z = P.variables(m).value();
1581
- h.current[z.current[m]] = isNaN(Z) ? null : Math.round(Z * c) / c;
1579
+ for (let P = 0; P < m.variablesLength(); P++) {
1580
+ const Z = m.variables(P).value();
1581
+ h.current[z.current[P]] = isNaN(Z) ? null : Math.round(Z * c) / c;
1582
1582
  }
1583
1583
  const D = L();
1584
1584
  this.debug && K.debug("[%s] fetch current variables cost: %d ms", b.requestId, D.diff(g, "ms"));
@@ -1595,8 +1595,8 @@ class J0 {
1595
1595
  const k = (d = (o = (A = E.variables(Z).valuesArray()) == null ? void 0 : A.toString()) == null ? void 0 : o.split(",")) == null ? void 0 : d.map((_) => isNaN(_) ? null : Math.round(Number(_) * c) / c);
1596
1596
  h.hourly[z.hourly[Z]] = k;
1597
1597
  }
1598
- const m = L();
1599
- this.debug && K.debug("[%s] fetch hourly variables cost: %d ms", b.requestId, m.diff(g, "ms"));
1598
+ const P = L();
1599
+ this.debug && K.debug("[%s] fetch hourly variables cost: %d ms", b.requestId, P.diff(g, "ms"));
1600
1600
  }
1601
1601
  if (C) {
1602
1602
  const g = L(), D = L.unix(Number(C.time())).add(z.fake ? 1 : 0, "year");
@@ -1610,19 +1610,19 @@ class J0 {
1610
1610
  const k = (q = (X = (Y = C.variables(Z).valuesArray()) == null ? void 0 : Y.toString()) == null ? void 0 : X.split(",")) == null ? void 0 : q.map((_) => isNaN(_) ? null : Math.round(Number(_) * c) / c);
1611
1611
  C.variables(Z), h.sixHourly[z.six_hourly[Z / (b.memberLength ?? 1)]] = k;
1612
1612
  }
1613
- const m = L();
1614
- this.debug && K.debug("[%s] fetch 6-hourly variables cost: %d ms", b.requestId, m.diff(g, "ms"));
1613
+ const P = L();
1614
+ this.debug && K.debug("[%s] fetch 6-hourly variables cost: %d ms", b.requestId, P.diff(g, "ms"));
1615
1615
  }
1616
1616
  if (H) {
1617
1617
  const g = L();
1618
1618
  h.daily = {
1619
1619
  time: this.range(Number(H.time()), Number(H.timeEnd()), H.interval()).map(
1620
- (m) => L.unix(m).add(z.fake ? 1 : 0, "year").utc().format()
1620
+ (P) => L.unix(P).add(z.fake ? 1 : 0, "year").utc().format()
1621
1621
  )
1622
1622
  };
1623
- for (let m = 0; m < H.variablesLength(); m += b.memberLength ?? 1) {
1624
- const Z = (r = (e = (f = H.variables(m).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[m / (b.memberLength ?? 1)]] = Z;
1623
+ for (let P = 0; P < H.variablesLength(); P += b.memberLength ?? 1) {
1624
+ const Z = (r = (e = (f = H.variables(P).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[P / (b.memberLength ?? 1)]] = Z;
1626
1626
  }
1627
1627
  const D = L();
1628
1628
  this.debug && K.debug("[%s] fetch daily variables cost: %d ms", b.requestId, D.diff(g, "ms"));
@@ -1791,7 +1791,7 @@ class J0 {
1791
1791
  };
1792
1792
  c && (q.daily = this.FORECAST.MARINE_VARIABLES.DAILY.split(",")), d || (A.forecastDays = A.forecastDays || 1, W = !0), W && (q.hourly = this.FORECAST.MARINE_VARIABLES.HOURLY.split(",")), await this.prepare(d == null ? void 0 : d.utc().format(), !0, q, A);
1793
1793
  let f = await this.marineForecast(q, A);
1794
- return (S = (B = (u = f[0]) == null ? void 0 : u.hourly) == null ? void 0 : B.wave_height) != null && S.every((P) => P === null) && (q.models = this.pickMarineModels("best_match,ncep_gfswave025,meteofrance_wave"), f = await this.marineForecast(q, A)), { weather: X, marine: f };
1794
+ return (S = (B = (u = f[0]) == null ? void 0 : u.hourly) == null ? void 0 : B.wave_height) != null && S.every((m) => m === null || m === 0) && (q.models = this.pickMarineModels("best_match,ncep_gfswave025,meteofrance_wave"), f = await this.marineForecast(q, A)), { weather: X, marine: f };
1795
1795
  }
1796
1796
  /**
1797
1797
  * 历史再分析数据
@@ -1941,7 +1941,7 @@ class J0 {
1941
1941
  const o = A.data, d = M0.standardWeatherModels();
1942
1942
  for (const Y of d) {
1943
1943
  const X = M0.autoPickSubCategories(Y.alias), f = o.filter((e) => X.includes(e.category)).map((e) => {
1944
- var r, N, u, B, S, P;
1944
+ var r, N, u, B, S, m;
1945
1945
  return {
1946
1946
  category: e.category,
1947
1947
  meta: {
@@ -1950,7 +1950,7 @@ class J0 {
1950
1950
  initialisationTime: L.unix((u = e.meta) == null ? void 0 : u.last_run_initialisation_time).utc().format(),
1951
1951
  modificationTime: L.unix((B = e.meta) == null ? void 0 : B.last_run_modification_time).utc().format(),
1952
1952
  temporalResolution: Math.round(((S = e.meta) == null ? void 0 : S.temporal_resolution_seconds) / 3600),
1953
- frequency: Math.round(((P = e.meta) == null ? void 0 : P.update_interval_seconds) / 3600)
1953
+ frequency: Math.round(((m = e.meta) == null ? void 0 : m.update_interval_seconds) / 3600)
1954
1954
  }
1955
1955
  };
1956
1956
  });
@@ -2143,7 +2143,7 @@ const J = class J {
2143
2143
  static async parseHistory(M) {
2144
2144
  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
2145
  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), P = T.parseWindCircle(A.c10quad4 / 1.852), E = T.parseWindCircle(A.c12quad1 / 1.852), C = T.parseWindCircle(A.c12quad2 / 1.852), H = T.parseWindCircle(A.c12quad3 / 1.852), h = T.parseWindCircle(A.c12quad4 / 1.852), { r7: g, r10: D, r12: m } = T.estimateWindRadii(q, X, d), Z = {
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), E = T.parseWindCircle(A.c12quad1 / 1.852), C = T.parseWindCircle(A.c12quad2 / 1.852), H = T.parseWindCircle(A.c12quad3 / 1.852), h = T.parseWindCircle(A.c12quad4 / 1.852), { r7: g, r10: D, r12: P } = T.estimateWindRadii(q, X, d), Z = {
2147
2147
  updated: o,
2148
2148
  lat: isNaN(d) ? null : d,
2149
2149
  lng: isNaN(Y) ? null : Y,
@@ -2160,8 +2160,8 @@ const J = class J {
2160
2160
  r10ne: u,
2161
2161
  r10nw: B,
2162
2162
  r10sw: S,
2163
- r10se: P,
2164
- r12: m,
2163
+ r10se: m,
2164
+ r12: P,
2165
2165
  r12ne: E,
2166
2166
  r12nw: C,
2167
2167
  r12sw: H,
@@ -2251,7 +2251,7 @@ let b0 = J;
2251
2251
  class j {
2252
2252
  static async parseHistory(M) {
2253
2253
  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: P, r12: E } = T.estimateWindRadii(c, W, b);
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: E } = T.estimateWindRadii(c, W, b);
2255
2255
  return {
2256
2256
  updated: L.utc(z.realTime).format(),
2257
2257
  lat: isNaN(b) ? null : b || null,
@@ -2264,7 +2264,7 @@ class j {
2264
2264
  r7nw: o,
2265
2265
  r7se: d,
2266
2266
  r7sw: Y,
2267
- r10: P,
2267
+ r10: m,
2268
2268
  r10ne: X,
2269
2269
  r10nw: q,
2270
2270
  r10se: f,
@@ -2282,7 +2282,7 @@ class j {
2282
2282
  return M.map((z) => {
2283
2283
  const b = z.currentPosition, p = z.forecastPoints, c = L.utc(b.realTime).format(), W = {};
2284
2284
  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), P = T.parseWindCircle(A.r10Se / 1.852), E = T.parseWindCircle(A.r12Ne / 1.852), C = T.parseWindCircle(A.r12Nw / 1.852), H = T.parseWindCircle(A.r12Sw / 1.852), h = T.parseWindCircle(A.r12Se / 1.852), { r7: g, r10: D, r12: m } = T.estimateWindRadii(Y, q, A.lat);
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), E = T.parseWindCircle(A.r12Ne / 1.852), C = T.parseWindCircle(A.r12Nw / 1.852), H = T.parseWindCircle(A.r12Sw / 1.852), h = T.parseWindCircle(A.r12Se / 1.852), { r7: g, r10: D, r12: P } = T.estimateWindRadii(Y, q, A.lat);
2286
2286
  W[d] = {
2287
2287
  lat: A.lat,
2288
2288
  lng: A.lon,
@@ -2301,8 +2301,8 @@ class j {
2301
2301
  r10ne: u,
2302
2302
  r10nw: B,
2303
2303
  r10sw: S,
2304
- r10se: P,
2305
- r12: m,
2304
+ r10se: m,
2305
+ r12: P,
2306
2306
  r12ne: E,
2307
2307
  r12nw: C,
2308
2308
  r12sw: H,