mostlyright 0.1.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3226,13 +3226,7 @@ var mostlyright = (() => {
3226
3226
 
3227
3227
  // ../weather/src/forecasts/iem-mos.ts
3228
3228
  var IEM_MOS_URL = "https://mesonet.agron.iastate.edu/api/1/mos.json";
3229
- var SUPPORTED_MODELS = /* @__PURE__ */ new Set([
3230
- "nbe",
3231
- "gfs",
3232
- "lav",
3233
- "met",
3234
- "ecm"
3235
- ]);
3229
+ var SUPPORTED_MODELS = /* @__PURE__ */ new Set(["nbe", "gfs", "lav", "met", "ecm"]);
3236
3230
  var KT_TO_MS2 = 0.5144444;
3237
3231
  var NBE_CYCLE_CUTOVER = Date.UTC(2026, 5 - 1, 5, 0, 0, 0);
3238
3232
  function runtimeHoursFor(model, fromDt, toDt) {
@@ -3275,9 +3269,7 @@ var mostlyright = (() => {
3275
3269
  const issuedDt = parseDate(raw.runtime ?? raw.model_runtime);
3276
3270
  const validDt = parseDate(raw.ftime ?? raw.valid_time);
3277
3271
  if (issuedDt === null || validDt === null) return null;
3278
- const forecastHour = Math.round(
3279
- (validDt.getTime() - issuedDt.getTime()) / 36e5
3280
- );
3272
+ const forecastHour = Math.round((validDt.getTime() - issuedDt.getTime()) / 36e5);
3281
3273
  return {
3282
3274
  station,
3283
3275
  model: model.toUpperCase(),
@@ -3300,9 +3292,7 @@ var mostlyright = (() => {
3300
3292
  function parseIsoDate2(iso, endOfDay) {
3301
3293
  const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(iso);
3302
3294
  if (match === null) {
3303
- throw new Error(
3304
- `iemMosForecasts: from/to dates must be ISO YYYY-MM-DD; got ${iso}`
3305
- );
3295
+ throw new Error(`iemMosForecasts: from/to dates must be ISO YYYY-MM-DD; got ${iso}`);
3306
3296
  }
3307
3297
  const [, y, m, d] = match;
3308
3298
  if (endOfDay) {
@@ -3331,15 +3321,13 @@ var mostlyright = (() => {
3331
3321
  if (rt < fromDt || rt > toDt) continue;
3332
3322
  const url = `${IEM_MOS_URL}?station=${encodeURIComponent(
3333
3323
  station
3334
- )}&model=${encodeURIComponent(model)}&runtime=${encodeURIComponent(
3324
+ )}&model=${encodeURIComponent(model.toUpperCase())}&runtime=${encodeURIComponent(
3335
3325
  rt.toISOString()
3336
3326
  )}`;
3337
3327
  const resp = await fetchFn(url);
3338
3328
  if (resp.status === 404) continue;
3339
3329
  if (!resp.ok) {
3340
- throw new Error(
3341
- `iemMosForecasts: HTTP ${resp.status} on ${url}`
3342
- );
3330
+ throw new Error(`iemMosForecasts: HTTP ${resp.status} on ${url}`);
3343
3331
  }
3344
3332
  const payload = await resp.json();
3345
3333
  for (const raw of payload.data ?? []) {