mostlyright 1.0.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.
- package/dist/index.bundle.mjs +5 -17
- package/dist/index.bundle.mjs.map +1 -1
- package/dist/index.global.js +5 -17
- package/dist/index.global.js.map +1 -1
- package/package.json +4 -4
package/dist/index.bundle.mjs
CHANGED
|
@@ -886,13 +886,7 @@ async function* stream(station, opts = {}) {
|
|
|
886
886
|
|
|
887
887
|
// ../weather/src/forecasts/iem-mos.ts
|
|
888
888
|
var IEM_MOS_URL = "https://mesonet.agron.iastate.edu/api/1/mos.json";
|
|
889
|
-
var SUPPORTED_MODELS = /* @__PURE__ */ new Set([
|
|
890
|
-
"nbe",
|
|
891
|
-
"gfs",
|
|
892
|
-
"lav",
|
|
893
|
-
"met",
|
|
894
|
-
"ecm"
|
|
895
|
-
]);
|
|
889
|
+
var SUPPORTED_MODELS = /* @__PURE__ */ new Set(["nbe", "gfs", "lav", "met", "ecm"]);
|
|
896
890
|
var KT_TO_MS = 0.5144444;
|
|
897
891
|
var NBE_CYCLE_CUTOVER = Date.UTC(2026, 5 - 1, 5, 0, 0, 0);
|
|
898
892
|
function runtimeHoursFor(model, fromDt, toDt) {
|
|
@@ -935,9 +929,7 @@ function parseRow(raw, station, model, retrievedAt) {
|
|
|
935
929
|
const issuedDt = parseDate(raw.runtime ?? raw.model_runtime);
|
|
936
930
|
const validDt = parseDate(raw.ftime ?? raw.valid_time);
|
|
937
931
|
if (issuedDt === null || validDt === null) return null;
|
|
938
|
-
const forecastHour = Math.round(
|
|
939
|
-
(validDt.getTime() - issuedDt.getTime()) / 36e5
|
|
940
|
-
);
|
|
932
|
+
const forecastHour = Math.round((validDt.getTime() - issuedDt.getTime()) / 36e5);
|
|
941
933
|
return {
|
|
942
934
|
station,
|
|
943
935
|
model: model.toUpperCase(),
|
|
@@ -960,9 +952,7 @@ function parseRow(raw, station, model, retrievedAt) {
|
|
|
960
952
|
function parseIsoDate(iso, endOfDay) {
|
|
961
953
|
const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(iso);
|
|
962
954
|
if (match === null) {
|
|
963
|
-
throw new Error(
|
|
964
|
-
`iemMosForecasts: from/to dates must be ISO YYYY-MM-DD; got ${iso}`
|
|
965
|
-
);
|
|
955
|
+
throw new Error(`iemMosForecasts: from/to dates must be ISO YYYY-MM-DD; got ${iso}`);
|
|
966
956
|
}
|
|
967
957
|
const [, y, m, d] = match;
|
|
968
958
|
if (endOfDay) {
|
|
@@ -991,15 +981,13 @@ async function iemMosForecasts(station, fromDate, toDate, opts = {}) {
|
|
|
991
981
|
if (rt < fromDt || rt > toDt) continue;
|
|
992
982
|
const url = `${IEM_MOS_URL}?station=${encodeURIComponent(
|
|
993
983
|
station
|
|
994
|
-
)}&model=${encodeURIComponent(model)}&runtime=${encodeURIComponent(
|
|
984
|
+
)}&model=${encodeURIComponent(model.toUpperCase())}&runtime=${encodeURIComponent(
|
|
995
985
|
rt.toISOString()
|
|
996
986
|
)}`;
|
|
997
987
|
const resp = await fetchFn(url);
|
|
998
988
|
if (resp.status === 404) continue;
|
|
999
989
|
if (!resp.ok) {
|
|
1000
|
-
throw new Error(
|
|
1001
|
-
`iemMosForecasts: HTTP ${resp.status} on ${url}`
|
|
1002
|
-
);
|
|
990
|
+
throw new Error(`iemMosForecasts: HTTP ${resp.status} on ${url}`);
|
|
1003
991
|
}
|
|
1004
992
|
const payload = await resp.json();
|
|
1005
993
|
for (const raw of payload.data ?? []) {
|