@aguacerowx/react-native 0.0.53 → 0.0.54
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/LICENSE +21 -0
- package/android/src/main/java/com/aguacerowx/reactnative/NexradRadarLayerView.java +14 -2
- package/android/src/main/java/com/aguacerowx/reactnative/WeatherFrameProcessorModule.java +77 -0
- package/index.js +1 -1
- package/ios/WeatherFrameProcessorModule.m +19 -15
- package/ios/WeatherFrameProcessorModule.swift +65 -0
- package/lib/commonjs/AguaceroContext.js +0 -4
- package/lib/commonjs/AguaceroContext.js.map +1 -1
- package/lib/commonjs/GridRenderLayer.js +62 -76
- package/lib/commonjs/GridRenderLayer.js.map +1 -1
- package/lib/commonjs/MapManager.js +110 -224
- package/lib/commonjs/MapManager.js.map +1 -1
- package/lib/commonjs/MapRegistry.js +21 -33
- package/lib/commonjs/MapRegistry.js.map +1 -1
- package/lib/commonjs/NexradRadarLayer.android.js +28 -100
- package/lib/commonjs/NexradRadarLayer.android.js.map +1 -1
- package/lib/commonjs/NexradRadarLayer.ios.js +26 -97
- package/lib/commonjs/NexradRadarLayer.ios.js.map +1 -1
- package/lib/commonjs/NexradSitesMapLayer.js +41 -61
- package/lib/commonjs/NexradSitesMapLayer.js.map +1 -1
- package/lib/commonjs/SatelliteLayer.android.js +26 -38
- package/lib/commonjs/SatelliteLayer.android.js.map +1 -1
- package/lib/commonjs/SatelliteLayer.ios.js +30 -42
- package/lib/commonjs/SatelliteLayer.ios.js.map +1 -1
- package/lib/commonjs/StyleApplicator.js +129 -175
- package/lib/commonjs/StyleApplicator.js.map +1 -1
- package/lib/commonjs/WeatherLayerManager.js +995 -1646
- package/lib/commonjs/WeatherLayerManager.js.map +1 -1
- package/lib/commonjs/aguaceroCoreDebugHooks.js +58 -130
- package/lib/commonjs/aguaceroCoreDebugHooks.js.map +1 -1
- package/lib/commonjs/aguaceroRnDebug.js +147 -288
- package/lib/commonjs/aguaceroRnDebug.js.map +1 -1
- package/lib/commonjs/cdnAuthenticatedFetch.js +104 -0
- package/lib/commonjs/cdnAuthenticatedFetch.js.map +1 -0
- package/lib/commonjs/dispatchViewManagerCommandCompat.js +51 -88
- package/lib/commonjs/dispatchViewManagerCommandCompat.js.map +1 -1
- package/lib/commonjs/gridCdnAuth.js +41 -50
- package/lib/commonjs/gridCdnAuth.js.map +1 -1
- package/lib/commonjs/index.js +14 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/nexrad/nexradAndroidController.js +851 -863
- package/lib/commonjs/nexrad/nexradAndroidController.js.map +1 -1
- package/lib/commonjs/nexrad/nexradCrossSectionSampleAtLatLon.bundled.js +62 -85
- package/lib/commonjs/nexrad/nexradCrossSectionSampleAtLatLon.bundled.js.map +1 -1
- package/lib/commonjs/nexrad/nexradDiag.js +32 -148
- package/lib/commonjs/nexrad/nexradDiag.js.map +1 -1
- package/lib/commonjs/nexrad/nexradLevel2Keys.js +261 -0
- package/lib/commonjs/nexrad/nexradLevel2Keys.js.map +1 -0
- package/lib/commonjs/nexrad/nexradLutBuild.js +64 -111
- package/lib/commonjs/nexrad/nexradLutBuild.js.map +1 -1
- package/lib/commonjs/nexrad/nexradMapboxFrameOpts.bundled.js +136 -164
- package/lib/commonjs/nexrad/nexradMapboxFrameOpts.bundled.js.map +1 -1
- package/lib/commonjs/nexrad/nexradSdkImports.js +51 -0
- package/lib/commonjs/nexrad/nexradSdkImports.js.map +1 -0
- package/lib/commonjs/nexrad/radarArchiveCore.bundled.js +2848 -4455
- package/lib/commonjs/nexrad/radarArchiveCore.bundled.js.map +1 -1
- package/lib/commonjs/nexrad/radarDecode.worker.bundled.js +445 -648
- package/lib/commonjs/nexrad/radarDecode.worker.bundled.js.map +1 -1
- package/lib/commonjs/nexrad/radarFrameGpuMatch.bundled.js +52 -68
- package/lib/commonjs/nexrad/radarFrameGpuMatch.bundled.js.map +1 -1
- package/lib/commonjs/nexradNativeCommandIds.js +24 -0
- package/lib/commonjs/nexradNativeCommandIds.js.map +1 -0
- package/lib/commonjs/nws/NwsAlertsOverlay.android.js.map +1 -1
- package/lib/commonjs/nws/NwsAlertsOverlay.ios.js.map +1 -1
- package/lib/commonjs/nws/NwsAlertsOverlay.js +3 -3
- package/lib/commonjs/nws/NwsAlertsOverlay.js.map +1 -1
- package/lib/commonjs/nws/NwsAlertsOverlay.native.js +235 -361
- package/lib/commonjs/nws/NwsAlertsOverlay.native.js.map +1 -1
- package/lib/commonjs/nws/eventSourceRnPolyfill.js +92 -146
- package/lib/commonjs/nws/eventSourceRnPolyfill.js.map +1 -1
- package/lib/commonjs/nws/nwsAndroidConstants.js +2 -8
- package/lib/commonjs/nws/nwsAndroidConstants.js.map +1 -1
- package/lib/commonjs/satellite/satelliteAndroidController.js +117 -202
- package/lib/commonjs/satellite/satelliteAndroidController.js.map +1 -1
- package/lib/commonjs/satelliteBridgeDiag.js +3 -13
- package/lib/commonjs/satelliteBridgeDiag.js.map +1 -1
- package/lib/commonjs/satelliteRnDebug.js +117 -218
- package/lib/commonjs/satelliteRnDebug.js.map +1 -1
- package/lib/module/AguaceroContext.js +2 -7
- package/lib/module/AguaceroContext.js.map +1 -1
- package/lib/module/GridRenderLayer.js +66 -80
- package/lib/module/GridRenderLayer.js.map +1 -1
- package/lib/module/MapManager.js +125 -239
- package/lib/module/MapManager.js.map +1 -1
- package/lib/module/MapRegistry.js +21 -33
- package/lib/module/MapRegistry.js.map +1 -1
- package/lib/module/NexradRadarLayer.android.js +32 -104
- package/lib/module/NexradRadarLayer.android.js.map +1 -1
- package/lib/module/NexradRadarLayer.ios.js +30 -101
- package/lib/module/NexradRadarLayer.ios.js.map +1 -1
- package/lib/module/NexradSitesMapLayer.js +44 -63
- package/lib/module/NexradSitesMapLayer.js.map +1 -1
- package/lib/module/SatelliteLayer.android.js +32 -44
- package/lib/module/SatelliteLayer.android.js.map +1 -1
- package/lib/module/SatelliteLayer.ios.js +36 -48
- package/lib/module/SatelliteLayer.ios.js.map +1 -1
- package/lib/module/StyleApplicator.js +144 -191
- package/lib/module/StyleApplicator.js.map +1 -1
- package/lib/module/WeatherLayerManager.js +1024 -1675
- package/lib/module/WeatherLayerManager.js.map +1 -1
- package/lib/module/aguaceroCoreDebugHooks.js +59 -130
- package/lib/module/aguaceroCoreDebugHooks.js.map +1 -1
- package/lib/module/aguaceroRnDebug.js +151 -292
- package/lib/module/aguaceroRnDebug.js.map +1 -1
- package/lib/module/cdnAuthenticatedFetch.js +97 -0
- package/lib/module/cdnAuthenticatedFetch.js.map +1 -0
- package/lib/module/dispatchViewManagerCommandCompat.js +52 -90
- package/lib/module/dispatchViewManagerCommandCompat.js.map +1 -1
- package/lib/module/gridCdnAuth.js +38 -50
- package/lib/module/gridCdnAuth.js.map +1 -1
- package/lib/module/index.js +9 -7
- package/lib/module/index.js.map +1 -1
- package/lib/module/nexrad/nexradAndroidController.js +865 -876
- package/lib/module/nexrad/nexradAndroidController.js.map +1 -1
- package/lib/module/nexrad/nexradCrossSectionSampleAtLatLon.bundled.js +62 -85
- package/lib/module/nexrad/nexradCrossSectionSampleAtLatLon.bundled.js.map +1 -1
- package/lib/module/nexrad/nexradDiag.js +31 -145
- package/lib/module/nexrad/nexradDiag.js.map +1 -1
- package/lib/module/nexrad/nexradLevel2Keys.js +245 -0
- package/lib/module/nexrad/nexradLevel2Keys.js.map +1 -0
- package/lib/module/nexrad/nexradLutBuild.js +64 -110
- package/lib/module/nexrad/nexradLutBuild.js.map +1 -1
- package/lib/module/nexrad/nexradMapboxFrameOpts.bundled.js +136 -163
- package/lib/module/nexrad/nexradMapboxFrameOpts.bundled.js.map +1 -1
- package/lib/module/nexrad/nexradSdkImports.js +4 -0
- package/lib/module/nexrad/nexradSdkImports.js.map +1 -0
- package/lib/module/nexrad/radarArchiveCore.bundled.js +2839 -4448
- package/lib/module/nexrad/radarArchiveCore.bundled.js.map +1 -1
- package/lib/module/nexrad/radarDecode.worker.bundled.js +445 -648
- package/lib/module/nexrad/radarDecode.worker.bundled.js.map +1 -1
- package/lib/module/nexrad/radarFrameGpuMatch.bundled.js +50 -66
- package/lib/module/nexrad/radarFrameGpuMatch.bundled.js.map +1 -1
- package/lib/module/nexradNativeCommandIds.js +18 -0
- package/lib/module/nexradNativeCommandIds.js.map +1 -0
- package/lib/module/nws/NwsAlertsOverlay.android.js +1 -1
- package/lib/module/nws/NwsAlertsOverlay.android.js.map +1 -1
- package/lib/module/nws/NwsAlertsOverlay.ios.js +1 -1
- package/lib/module/nws/NwsAlertsOverlay.ios.js.map +1 -1
- package/lib/module/nws/NwsAlertsOverlay.js +5 -5
- package/lib/module/nws/NwsAlertsOverlay.js.map +1 -1
- package/lib/module/nws/NwsAlertsOverlay.native.js +248 -373
- package/lib/module/nws/NwsAlertsOverlay.native.js.map +1 -1
- package/lib/module/nws/eventSourceRnPolyfill.js +92 -146
- package/lib/module/nws/eventSourceRnPolyfill.js.map +1 -1
- package/lib/module/nws/nwsAndroidConstants.js +2 -8
- package/lib/module/nws/nwsAndroidConstants.js.map +1 -1
- package/lib/module/satellite/satelliteAndroidController.js +123 -208
- package/lib/module/satellite/satelliteAndroidController.js.map +1 -1
- package/lib/module/satelliteBridgeDiag.js +3 -13
- package/lib/module/satelliteBridgeDiag.js.map +1 -1
- package/lib/module/satelliteRnDebug.js +123 -223
- package/lib/module/satelliteRnDebug.js.map +1 -1
- package/lib/typescript/AguaceroContext.d.ts +0 -4
- package/lib/typescript/AguaceroContext.d.ts.map +1 -1
- package/lib/typescript/GridRenderLayer.d.ts.map +1 -1
- package/lib/typescript/MapManager.d.ts +0 -12
- package/lib/typescript/MapManager.d.ts.map +1 -1
- package/lib/typescript/MapRegistry.d.ts +10 -12
- package/lib/typescript/MapRegistry.d.ts.map +1 -1
- package/lib/typescript/NexradRadarLayer.android.d.ts.map +1 -1
- package/lib/typescript/NexradRadarLayer.ios.d.ts.map +1 -1
- package/lib/typescript/NexradSitesMapLayer.d.ts +4 -10
- package/lib/typescript/NexradSitesMapLayer.d.ts.map +1 -1
- package/lib/typescript/SatelliteLayer.android.d.ts.map +1 -1
- package/lib/typescript/SatelliteLayer.ios.d.ts.map +1 -1
- package/lib/typescript/StyleApplicator.d.ts +1 -1
- package/lib/typescript/StyleApplicator.d.ts.map +1 -1
- package/lib/typescript/WeatherLayerManager.d.ts.map +1 -1
- package/lib/typescript/aguaceroCoreDebugHooks.d.ts +2 -9
- package/lib/typescript/aguaceroCoreDebugHooks.d.ts.map +1 -1
- package/lib/typescript/aguaceroRnDebug.d.ts +47 -66
- package/lib/typescript/aguaceroRnDebug.d.ts.map +1 -1
- package/lib/typescript/cdnAuthenticatedFetch.d.ts +10 -0
- package/lib/typescript/cdnAuthenticatedFetch.d.ts.map +1 -0
- package/lib/typescript/dispatchViewManagerCommandCompat.d.ts +1 -17
- package/lib/typescript/dispatchViewManagerCommandCompat.d.ts.map +1 -1
- package/lib/typescript/gridCdnAuth.d.ts +16 -21
- package/lib/typescript/gridCdnAuth.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +1 -0
- package/lib/typescript/nexrad/nexradAndroidController.d.ts +39 -89
- package/lib/typescript/nexrad/nexradAndroidController.d.ts.map +1 -1
- package/lib/typescript/nexrad/nexradCrossSectionSampleAtLatLon.bundled.d.ts +2 -1
- package/lib/typescript/nexrad/nexradCrossSectionSampleAtLatLon.bundled.d.ts.map +1 -1
- package/lib/typescript/nexrad/nexradDiag.d.ts +13 -101
- package/lib/typescript/nexrad/nexradDiag.d.ts.map +1 -1
- package/lib/typescript/nexrad/nexradLevel2Keys.d.ts +36 -0
- package/lib/typescript/nexrad/nexradLevel2Keys.d.ts.map +1 -0
- package/lib/typescript/nexrad/nexradLutBuild.d.ts +3 -10
- package/lib/typescript/nexrad/nexradLutBuild.d.ts.map +1 -1
- package/lib/typescript/nexrad/nexradMapboxFrameOpts.bundled.d.ts +4 -3
- package/lib/typescript/nexrad/nexradMapboxFrameOpts.bundled.d.ts.map +1 -1
- package/lib/typescript/nexrad/nexradSdkImports.d.ts +2 -0
- package/lib/typescript/nexrad/nexradSdkImports.d.ts.map +1 -0
- package/lib/typescript/nexrad/radarArchiveCore.bundled.d.ts +12 -7
- package/lib/typescript/nexrad/radarArchiveCore.bundled.d.ts.map +1 -1
- package/lib/typescript/nexrad/radarDecode.worker.bundled.d.ts +20 -20
- package/lib/typescript/nexrad/radarDecode.worker.bundled.d.ts.map +1 -1
- package/lib/typescript/nexrad/radarFrameGpuMatch.bundled.d.ts +4 -3
- package/lib/typescript/nexrad/radarFrameGpuMatch.bundled.d.ts.map +1 -1
- package/lib/typescript/nexradNativeCommandIds.d.ts +2 -0
- package/lib/typescript/nexradNativeCommandIds.d.ts.map +1 -0
- package/lib/typescript/nws/NwsAlertsOverlay.native.d.ts +6 -17
- package/lib/typescript/nws/NwsAlertsOverlay.native.d.ts.map +1 -1
- package/lib/typescript/nws/eventSourceRnPolyfill.d.ts +0 -3
- package/lib/typescript/nws/eventSourceRnPolyfill.d.ts.map +1 -1
- package/lib/typescript/nws/nwsAndroidConstants.d.ts +0 -5
- package/lib/typescript/nws/nwsAndroidConstants.d.ts.map +1 -1
- package/lib/typescript/satellite/satelliteAndroidController.d.ts +9 -47
- package/lib/typescript/satellite/satelliteAndroidController.d.ts.map +1 -1
- package/lib/typescript/satelliteBridgeDiag.d.ts +1 -5
- package/lib/typescript/satelliteBridgeDiag.d.ts.map +1 -1
- package/lib/typescript/satelliteRnDebug.d.ts +24 -30
- package/lib/typescript/satelliteRnDebug.d.ts.map +1 -1
- package/package.json +75 -74
- package/src/AguaceroContext.js +1 -7
- package/src/GridRenderLayer.js +1 -128
- package/src/MapManager.js +1 -277
- package/src/MapRegistry.js +1 -56
- package/src/NexradRadarLayer.android.js +1 -121
- package/src/NexradRadarLayer.ios.js +1 -115
- package/src/NexradSitesMapLayer.js +1 -75
- package/src/SatelliteLayer.android.js +1 -63
- package/src/SatelliteLayer.ios.js +1 -70
- package/src/StyleApplicator.js +1 -241
- package/src/WeatherLayerManager.js +1 -2045
- package/src/aguaceroCoreDebugHooks.js +1 -142
- package/src/aguaceroRnDebug.js +1 -336
- package/src/cdnAuthenticatedFetch.js +1 -0
- package/src/dispatchViewManagerCommandCompat.js +1 -100
- package/src/gridCdnAuth.js +1 -56
- package/src/index.js +1 -27
- package/src/nexrad/nexradAndroidController.js +1 -1078
- package/src/nexrad/nexradCrossSectionSampleAtLatLon.bundled.js +1 -91
- package/src/nexrad/nexradDiag.js +1 -150
- package/src/nexrad/nexradLevel2Keys.js +1 -0
- package/src/nexrad/nexradLutBuild.js +1 -126
- package/src/nexrad/nexradMapboxFrameOpts.bundled.js +1 -245
- package/src/nexrad/nexradSdkImports.js +1 -0
- package/src/nexrad/radarArchiveCore.bundled.js +1 -7085
- package/src/nexrad/radarDecode.worker.bundled.js +1 -813
- package/src/nexrad/radarFrameGpuMatch.bundled.js +1 -79
- package/src/nexradNativeCommandIds.js +1 -0
- package/src/nws/NwsAlertsOverlay.android.js +1 -1
- package/src/nws/NwsAlertsOverlay.ios.js +1 -1
- package/src/nws/NwsAlertsOverlay.js +1 -7
- package/src/nws/NwsAlertsOverlay.native.js +1 -463
- package/src/nws/eventSourceRnPolyfill.js +7 -193
- package/src/nws/nwsAndroidConstants.js +1 -8
- package/src/satellite/satelliteAndroidController.js +1 -257
- package/src/satelliteBridgeDiag.js +1 -15
- package/src/satelliteRnDebug.js +1 -269
- package/lib/commonjs/nexrad/nexradNativeCommandIds.js +0 -51
- package/lib/commonjs/nexrad/nexradNativeCommandIds.js.map +0 -1
- package/lib/module/nexrad/nexradNativeCommandIds.js +0 -44
- package/lib/module/nexrad/nexradNativeCommandIds.js.map +0 -1
- package/lib/typescript/nexrad/nexradNativeCommandIds.d.ts +0 -9
- package/lib/typescript/nexrad/nexradNativeCommandIds.d.ts.map +0 -1
- package/src/nexrad/nexradNativeCommandIds.js +0 -44
- /package/lib/commonjs/{nexrad/nexradSitesUs.json → nexradSitesUs.json} +0 -0
- /package/lib/module/{nexrad/nexradSitesUs.json → nexradSitesUs.json} +0 -0
- /package/src/{nexrad/nexradSitesUs.json → nexradSitesUs.json} +0 -0
|
@@ -1,1024 +1,1013 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
nexradDiagBootSnapshot({
|
|
1
|
+
import { getUnitConversionFunction as O, getDefaultRadarTilt as Q, nexradBinGroupIdForKey as X, variableToNexradGroup as ee } from "./nexradSdkImports.js";
|
|
2
|
+
import { fetchAndApplyLevel2ListingToCore as te, isValidLevel2SweepObjectKey as j, level2ListingCacheNeedsRefresh as D, level2ListingEmptyHint as ae, listingContextParams as E, rebuildLevel2TimeToKeyMap as re, resolveLevel2ObjectKeyForFetch as ie } from "./nexradLevel2Keys.js";
|
|
3
|
+
import { fromByteArray as J } from "base64-js";
|
|
4
|
+
import { fetchAndParseArchive as k, getNexradArchiveAuthSnapshot as ne, objectKeyToUrl as G, setNexradArchiveApiKey as L, setNexradArchiveBundleId as R, setNexradArchiveSiteOrigin as w, setNexradArchiveUserId as $, setNexradSitesJsonUrl as se, setNexradSitesFetchAuth as B } from "./radarArchiveCore.bundled.js";
|
|
5
|
+
import { RN_DEFAULT_GRID_REQUEST_SITE_ORIGIN as I } from "../gridCdnAuth";
|
|
6
|
+
import { prepareRadarFrameForGpuReadout as oe } from "./radarFrameGpuMatch.bundled.js";
|
|
7
|
+
import { mapboxFrameUploadOptionsForNexradState as V } from "./nexradMapboxFrameOpts.bundled.js";
|
|
8
|
+
import { sampleNexradFrameAtLatLon as le } from "./nexradCrossSectionSampleAtLatLon.bundled.js";
|
|
9
|
+
import { buildNexradLutRgba as de } from "./nexradLutBuild.js";
|
|
10
|
+
import { Platform as ce } from "react-native";
|
|
11
|
+
import { nexradDiagBootSnapshot as ue, nexradDiagGateTextureSummary as he, nexradPerfSpan as h, nexradPipelineLog as y } from "./nexradDiag.js";
|
|
12
|
+
import { aguaceroDebug as z, getAguaceroAuthDiagnosticSnapshot as H, isAguaceroRnDebugEnabled as W } from "../aguaceroRnDebug";
|
|
13
|
+
ue({
|
|
15
14
|
archiveExports: {
|
|
16
|
-
setNexradArchiveApiKey: typeof
|
|
17
|
-
setNexradArchiveBundleId: typeof
|
|
18
|
-
objectKeyToUrl: typeof
|
|
19
|
-
fetchAndParseArchive: typeof
|
|
15
|
+
setNexradArchiveApiKey: typeof L,
|
|
16
|
+
setNexradArchiveBundleId: typeof R,
|
|
17
|
+
objectKeyToUrl: typeof G,
|
|
18
|
+
fetchAndParseArchive: typeof k
|
|
20
19
|
}
|
|
21
20
|
});
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
function ensureRadarArchiveBindings(label) {
|
|
25
|
-
const ok = typeof setNexradArchiveApiKey === 'function' && typeof setNexradArchiveBundleId === 'function' && typeof objectKeyToUrl === 'function' && typeof fetchAndParseArchive === 'function';
|
|
26
|
-
return ok;
|
|
21
|
+
function q(c) {
|
|
22
|
+
return typeof L == "function" && typeof R == "function" && typeof G == "function" && typeof k == "function";
|
|
27
23
|
}
|
|
28
|
-
function
|
|
29
|
-
const
|
|
30
|
-
if (
|
|
31
|
-
const
|
|
32
|
-
if (
|
|
33
|
-
let
|
|
34
|
-
|
|
35
|
-
for (const [
|
|
36
|
-
const
|
|
37
|
-
if (!Number.isFinite(
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
if (bestKey == null) return null;
|
|
45
|
-
if (bestDelta > maxDeltaSec && Number.isFinite(maxDeltaSec)) return null;
|
|
46
|
-
return bestKey;
|
|
24
|
+
function me(c, e, t = 600) {
|
|
25
|
+
const a = e[String(c)];
|
|
26
|
+
if (a) return a;
|
|
27
|
+
const n = Object.entries(e || {});
|
|
28
|
+
if (n.length === 0) return null;
|
|
29
|
+
let i = null,
|
|
30
|
+
r = 1 / 0;
|
|
31
|
+
for (const [s, l] of n) {
|
|
32
|
+
const o = Number(s);
|
|
33
|
+
if (!Number.isFinite(o)) continue;
|
|
34
|
+
const m = Math.abs(o - c);
|
|
35
|
+
m < r && (r = m, i = l);
|
|
36
|
+
}
|
|
37
|
+
return i == null || r > t && Number.isFinite(t) ? null : i;
|
|
47
38
|
}
|
|
48
|
-
function
|
|
49
|
-
return
|
|
39
|
+
function U(c) {
|
|
40
|
+
return c === "VEL" || c === "SW" || c === "N0G" || c === "N0W";
|
|
50
41
|
}
|
|
51
|
-
function
|
|
52
|
-
if (
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const toMs = getUnitConversionFunction(displayUnit, 'm/s', 'nexrad_vel');
|
|
56
|
-
if (!toMs) return [rangeMin, rangeMax];
|
|
57
|
-
return [toMs(rangeMin), toMs(rangeMax)];
|
|
42
|
+
function pe(c, e, t) {
|
|
43
|
+
if (c == null || e == null || !t || t.toLowerCase() === "m/s" || t.toLowerCase() === "ms") return [c, e];
|
|
44
|
+
const a = O(t, "m/s", "nexrad_vel");
|
|
45
|
+
return a ? [a(c), a(e)] : [c, e];
|
|
58
46
|
}
|
|
59
|
-
function
|
|
60
|
-
if (!
|
|
61
|
-
|
|
62
|
-
if (!
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
return out;
|
|
47
|
+
function ye(c, e, t) {
|
|
48
|
+
if (!c || !Array.isArray(c) || c.length < 2 || !U(e) || !t || t.toLowerCase() === "m/s" || t.toLowerCase() === "ms") return c;
|
|
49
|
+
const a = O(t, "m/s", e === "SW" || e === "N0W" ? "nexrad_sw" : "nexrad_vel");
|
|
50
|
+
if (!a) return c;
|
|
51
|
+
const n = [...c];
|
|
52
|
+
for (let i = 0; i < n.length; i += 2) {
|
|
53
|
+
const r = n[i];
|
|
54
|
+
typeof r == "number" && Number.isFinite(r) && (n[i] = a(r));
|
|
55
|
+
}
|
|
56
|
+
return n;
|
|
71
57
|
}
|
|
72
|
-
function
|
|
73
|
-
const
|
|
74
|
-
if (
|
|
75
|
-
const [
|
|
76
|
-
return [
|
|
77
|
-
}
|
|
78
|
-
if (
|
|
79
|
-
const
|
|
80
|
-
let
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
return [lo, hi];
|
|
90
|
-
}
|
|
91
|
-
return [rangeMin ?? 0, rangeMax ?? 80];
|
|
58
|
+
function ge(c, e, t, a, n) {
|
|
59
|
+
const i = (t || "").toUpperCase();
|
|
60
|
+
if (U(i)) {
|
|
61
|
+
const [r, s] = pe(c, e, a);
|
|
62
|
+
return [r ?? 0, s ?? 80];
|
|
63
|
+
}
|
|
64
|
+
if (n === "level3" && (i === "N0H" || i === "HHC")) {
|
|
65
|
+
const r = c ?? 0;
|
|
66
|
+
let s = e ?? 11;
|
|
67
|
+
return s > 11 && (s = 11), s < r && (s = r), [r, s];
|
|
68
|
+
}
|
|
69
|
+
if (i === "KDP") {
|
|
70
|
+
const r = c ?? -2;
|
|
71
|
+
let s = e ?? 8;
|
|
72
|
+
return s < r && (s = r), [r, s];
|
|
73
|
+
}
|
|
74
|
+
return [c ?? 0, e ?? 80];
|
|
92
75
|
}
|
|
93
|
-
function
|
|
94
|
-
const
|
|
95
|
-
return
|
|
76
|
+
function fe(c) {
|
|
77
|
+
const e = (c || "").toUpperCase();
|
|
78
|
+
return e === "N0H" || e === "HHC";
|
|
96
79
|
}
|
|
97
|
-
const
|
|
98
|
-
function
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
if (idx >= 0 && idx < NEXRAD_HYDROMETEOR_CLASS_LABELS.length) {
|
|
102
|
-
return NEXRAD_HYDROMETEOR_CLASS_LABELS[idx];
|
|
103
|
-
}
|
|
104
|
-
return `Class ${idx}`;
|
|
80
|
+
const Y = ["Biological", "Ground clutter", "Ice crystals", "Dry snow", "Wet snow", "Light rain", "Heavy rain", "Big drops", "Graupel", "Hail/rain", "Large hail", "Giant hail"];
|
|
81
|
+
function xe(c) {
|
|
82
|
+
const e = Math.round(Number(c));
|
|
83
|
+
return e >= 12 ? null : e >= 0 && e < Y.length ? Y[e] : `Class ${e}`;
|
|
105
84
|
}
|
|
106
|
-
function
|
|
107
|
-
if (!
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
const fromMs = getUnitConversionFunction('m/s', displayUnit, 'nexrad_vel');
|
|
111
|
-
return fromMs ? fromMs(valueMs) : valueMs;
|
|
85
|
+
function ve(c, e) {
|
|
86
|
+
if (!e || e.toLowerCase() === "m/s" || e.toLowerCase() === "ms") return c;
|
|
87
|
+
const t = O("m/s", e, "nexrad_vel");
|
|
88
|
+
return t ? t(c) : c;
|
|
112
89
|
}
|
|
113
|
-
function
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
return Math.sqrt(
|
|
90
|
+
function _e(c, e) {
|
|
91
|
+
const t = e * Math.PI / 180,
|
|
92
|
+
a = 6371e3 * 4 / (3 * 1e3),
|
|
93
|
+
n = Math.max(Math.cos(t), .05),
|
|
94
|
+
i = c / n;
|
|
95
|
+
return Math.sqrt(i * i + a * a + 2 * i * a * Math.sin(t)) - a;
|
|
119
96
|
}
|
|
120
|
-
function
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
return Number(raw.toFixed(3).replace(/\.?0+$/, ''));
|
|
125
|
-
}
|
|
126
|
-
if (vu === 'RHO' || vu === 'ZDR' || vl.includes('RhoHV') || vl.includes('Zdr')) {
|
|
127
|
-
return Number(raw.toFixed(2));
|
|
128
|
-
}
|
|
129
|
-
if (Math.abs(raw) < 10) return Number(raw.toFixed(1));
|
|
130
|
-
return Math.round(raw);
|
|
97
|
+
function Se(c, e) {
|
|
98
|
+
const t = (e || "").toUpperCase(),
|
|
99
|
+
a = e || "";
|
|
100
|
+
return t.includes("RATE") || a.toLowerCase().includes("rate") ? Number(c.toFixed(3).replace(/\.?0+$/, "")) : t === "RHO" || t === "ZDR" || a.includes("RhoHV") || a.includes("Zdr") ? Number(c.toFixed(2)) : Math.abs(c) < 10 ? Number(c.toFixed(1)) : Math.round(c);
|
|
131
101
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
const PRELOAD_CONCURRENCY = Platform.OS === 'ios' ? 2 : 1;
|
|
136
|
-
function yieldToJsEventLoop() {
|
|
137
|
-
return new Promise(resolve => setTimeout(resolve, 0));
|
|
102
|
+
const be = ce.OS === "ios" ? 2 : 1;
|
|
103
|
+
function M() {
|
|
104
|
+
return new Promise(c => setTimeout(c, 0));
|
|
138
105
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
let
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
j += 2;
|
|
157
|
-
}
|
|
158
|
-
out[outIdx++] = count & 0xFF;
|
|
159
|
-
out[outIdx++] = count >> 8 & 0xFF;
|
|
160
|
-
out[outIdx++] = val0;
|
|
161
|
-
out[outIdx++] = val1;
|
|
162
|
-
i = j;
|
|
163
|
-
}
|
|
164
|
-
return out.subarray(0, outIdx);
|
|
106
|
+
const Ne = 12;
|
|
107
|
+
function Te(c) {
|
|
108
|
+
const e = c.length,
|
|
109
|
+
t = new Uint8Array(e * 2);
|
|
110
|
+
let a = 0,
|
|
111
|
+
n = 0;
|
|
112
|
+
for (; n < e;) {
|
|
113
|
+
let i = c[n],
|
|
114
|
+
r = c[n + 1],
|
|
115
|
+
s = 1,
|
|
116
|
+
l = e - n >> 1;
|
|
117
|
+
l > 65535 && (l = 65535);
|
|
118
|
+
let o = n + 2;
|
|
119
|
+
for (; s < l && c[o] === i && c[o + 1] === r;) s++, o += 2;
|
|
120
|
+
t[a++] = s & 255, t[a++] = s >> 8 & 255, t[a++] = i, t[a++] = r, n = o;
|
|
121
|
+
}
|
|
122
|
+
return t.subarray(0, a);
|
|
165
123
|
}
|
|
166
124
|
export class NexradAndroidController {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
* @param {React.MutableRefObject<{ uploadNexradFrame?: (s: string) => void; uploadNexradStyleOnly?: (s: string) => void; clearNexrad?: () => void; activateNexradCachedFrame?: (k: string) => void } | null>} layerRef
|
|
170
|
-
* @param {object} [options]
|
|
171
|
-
*/
|
|
172
|
-
constructor(core, layerRef, options = {}) {
|
|
173
|
-
this.core = core;
|
|
174
|
-
this._layerRef = layerRef;
|
|
175
|
-
this._lastSyncKey = null;
|
|
176
|
-
this._abort = null;
|
|
177
|
-
this._interpolateColormap = options.interpolateNexradColormap !== false;
|
|
178
|
-
this._gateSmoothing = options.nexradGateSmoothing === true;
|
|
179
|
-
this._frameCache = new Map();
|
|
180
|
-
/** WeakMap: decoded frame → Map(uploadOptsKey → prepared frame). Avoids O(n²) canonical re-bin every map move. */
|
|
181
|
-
this._gpuReadoutPrep = new WeakMap();
|
|
182
|
-
this._preloadAbort = null;
|
|
183
|
-
this._preloadTimelineSig = null;
|
|
184
|
-
this._nativeFrameUploaded = false;
|
|
185
|
-
/** @type {{ valueScale: number; valueOffset: number } | null} */
|
|
186
|
-
this._lastUploadMeta = null;
|
|
187
|
-
/** @type {Map<string, { json: string; valueScale: number; valueOffset: number }>} */
|
|
188
|
-
this._nativeUploadJsonLru = new Map();
|
|
189
|
-
/** @type {Set<string>} Sync keys with gate texture registered in Android GL cache (AguaceroNexradGpuFrameReady). */
|
|
190
|
-
this._nativeGpuReadyKeys = new Set();
|
|
191
|
-
/** @type {Map<string, { valueScale: number; valueOffset: number }>} */
|
|
192
|
-
this._uploadMetaBySyncKey = new Map();
|
|
193
|
-
/** @type {{ remove: () => void } | null} */
|
|
194
|
-
this._gpuReadyEventSub = null;
|
|
125
|
+
constructor(e, t, a = {}) {
|
|
126
|
+
this.core = e, this._layerRef = t, this._lastSyncKey = null, this._abort = null, this._interpolateColormap = a.interpolateNexradColormap !== !1, this._gateSmoothing = a.nexradGateSmoothing === !0, this._frameCache = new Map(), this._gpuReadoutPrep = new WeakMap(), this._preloadAbort = null, this._preloadTimelineSig = null, this._listingRefreshPromise = null, this._nativeFrameUploaded = !1, this._lastUploadMeta = null, this._nativeUploadJsonLru = new Map(), this._nativeGpuReadyKeys = new Set(), this._uploadMetaBySyncKey = new Map(), this._gpuReadyEventSub = null;
|
|
195
127
|
try {
|
|
196
128
|
const {
|
|
197
|
-
DeviceEventEmitter
|
|
198
|
-
} = require(
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
if (typeof k === 'string' && k.length > 0) {
|
|
203
|
-
this._nativeGpuReadyKeys.add(k);
|
|
204
|
-
this._trimNativeGpuReadyKeys(96);
|
|
205
|
-
}
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
} catch (err) {
|
|
209
|
-
/* ignore */
|
|
210
|
-
}
|
|
211
|
-
const base = typeof core?.baseGridUrl === 'string' ? core.baseGridUrl.replace(/\/$/, '') : '';
|
|
212
|
-
if (base && typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {
|
|
213
|
-
setNexradSitesJsonUrl(`${base}/data/nexrad.json`);
|
|
214
|
-
setNexradSitesFetchAuth(core.apiKey || '', core.bundleId || '');
|
|
215
|
-
}
|
|
216
|
-
setNexradArchiveSiteOrigin(core.gridRequestSiteOrigin || 'https://localhost');
|
|
217
|
-
if (isAguaceroRnDebugEnabled()) {
|
|
218
|
-
aguaceroDebug('nexrad.authConfigured', getAguaceroAuthDiagnosticSnapshot(core, {
|
|
219
|
-
phase: 'NexradAndroidController.constructor'
|
|
129
|
+
DeviceEventEmitter: i
|
|
130
|
+
} = require("react-native");
|
|
131
|
+
i && typeof i.addListener == "function" && (this._gpuReadyEventSub = i.addListener("AguaceroNexradGpuFrameReady", r => {
|
|
132
|
+
const s = r && r.nativeGpuCacheKey;
|
|
133
|
+
typeof s == "string" && s.length > 0 && (this._nativeGpuReadyKeys.add(s), this._trimNativeGpuReadyKeys(96));
|
|
220
134
|
}));
|
|
221
|
-
}
|
|
135
|
+
} catch {}
|
|
136
|
+
const n = typeof e?.baseGridUrl == "string" ? e.baseGridUrl.replace(/\/$/, "") : "";
|
|
137
|
+
n && typeof navigator < "u" && navigator.product === "ReactNative" && (se(`${n}/data/nexrad.json`), B(e.apiKey || "", e.bundleId || "")), L(e.apiKey || ""), R(e.bundleId || ""), w(e.gridRequestSiteOrigin || I), $(e.nexradUserId || "sdk-user"), W() && z("nexrad.authConfigured", {
|
|
138
|
+
...ne({
|
|
139
|
+
phase: "NexradAndroidController.constructor"
|
|
140
|
+
}),
|
|
141
|
+
...H(e, {
|
|
142
|
+
phase: "NexradAndroidController.constructor"
|
|
143
|
+
})
|
|
144
|
+
});
|
|
222
145
|
}
|
|
223
|
-
_trimNativeGpuReadyKeys(
|
|
224
|
-
|
|
225
|
-
const
|
|
226
|
-
if (
|
|
227
|
-
this._nativeGpuReadyKeys.delete(
|
|
146
|
+
_trimNativeGpuReadyKeys(e) {
|
|
147
|
+
for (; this._nativeGpuReadyKeys.size > e;) {
|
|
148
|
+
const t = this._nativeGpuReadyKeys.values().next().value;
|
|
149
|
+
if (t === void 0) break;
|
|
150
|
+
this._nativeGpuReadyKeys.delete(t);
|
|
228
151
|
}
|
|
229
152
|
}
|
|
230
|
-
_rememberUploadMetaForSyncKey(
|
|
231
|
-
this._uploadMetaBySyncKey.set(
|
|
232
|
-
valueScale,
|
|
233
|
-
valueOffset
|
|
234
|
-
});
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
this._uploadMetaBySyncKey.delete(k);
|
|
153
|
+
_rememberUploadMetaForSyncKey(e, t, a) {
|
|
154
|
+
for (this._uploadMetaBySyncKey.set(e, {
|
|
155
|
+
valueScale: t,
|
|
156
|
+
valueOffset: a
|
|
157
|
+
}); this._uploadMetaBySyncKey.size > 40;) {
|
|
158
|
+
const n = this._uploadMetaBySyncKey.keys().next().value;
|
|
159
|
+
if (n === void 0) break;
|
|
160
|
+
this._uploadMetaBySyncKey.delete(n);
|
|
239
161
|
}
|
|
240
162
|
}
|
|
241
|
-
updateStyleOptions(
|
|
242
|
-
|
|
243
|
-
this._interpolateColormap = options.interpolateNexradColormap !== false;
|
|
244
|
-
}
|
|
245
|
-
if (options.nexradGateSmoothing != null) {
|
|
246
|
-
this._gateSmoothing = options.nexradGateSmoothing === true;
|
|
247
|
-
}
|
|
163
|
+
updateStyleOptions(e) {
|
|
164
|
+
e.interpolateNexradColormap != null && (this._interpolateColormap = e.interpolateNexradColormap !== !1), e.nexradGateSmoothing != null && (this._gateSmoothing = e.nexradGateSmoothing === !0);
|
|
248
165
|
}
|
|
249
166
|
destroy() {
|
|
250
167
|
try {
|
|
251
168
|
this._gpuReadyEventSub?.remove();
|
|
252
|
-
} catch
|
|
253
|
-
|
|
254
|
-
}
|
|
255
|
-
this._gpuReadyEventSub = null;
|
|
256
|
-
this._nativeGpuReadyKeys.clear();
|
|
257
|
-
this._uploadMetaBySyncKey.clear();
|
|
258
|
-
this._abort?.abort();
|
|
259
|
-
this._abort = null;
|
|
260
|
-
this._preloadAbort?.abort();
|
|
261
|
-
this._preloadAbort = null;
|
|
262
|
-
this._frameCache.clear();
|
|
263
|
-
this._gpuReadoutPrep = new WeakMap();
|
|
264
|
-
this._preloadTimelineSig = null;
|
|
265
|
-
this._lastSyncKey = null;
|
|
266
|
-
this._nativeFrameUploaded = false;
|
|
267
|
-
this._lastUploadMeta = null;
|
|
268
|
-
this._nativeUploadJsonLru.clear();
|
|
269
|
-
this._layerRef?.current?.clearNexrad?.();
|
|
169
|
+
} catch {}
|
|
170
|
+
this._gpuReadyEventSub = null, this._nativeGpuReadyKeys.clear(), this._uploadMetaBySyncKey.clear(), this._abort?.abort(), this._abort = null, this._preloadAbort?.abort(), this._preloadAbort = null, this._frameCache.clear(), this._gpuReadoutPrep = new WeakMap(), this._preloadTimelineSig = null, this._lastSyncKey = null, this._nativeFrameUploaded = !1, this._lastUploadMeta = null, this._nativeUploadJsonLru.clear(), this._layerRef?.current?.clearNexrad?.();
|
|
270
171
|
}
|
|
271
|
-
_getPreparedReadoutFrame(
|
|
272
|
-
let
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
const optKey = uploadOpts && typeof uploadOpts === 'object' ? JSON.stringify(uploadOpts) : String(uploadOpts);
|
|
278
|
-
let prepared = byOpts.get(optKey);
|
|
279
|
-
if (!prepared) {
|
|
280
|
-
prepared = prepareRadarFrameForGpuReadout(frame, uploadOpts);
|
|
281
|
-
byOpts.set(optKey, prepared);
|
|
282
|
-
}
|
|
283
|
-
return prepared;
|
|
172
|
+
_getPreparedReadoutFrame(e, t) {
|
|
173
|
+
let a = this._gpuReadoutPrep.get(e);
|
|
174
|
+
a || (a = new Map(), this._gpuReadoutPrep.set(e, a));
|
|
175
|
+
const n = t && typeof t == "object" ? JSON.stringify(t) : String(t);
|
|
176
|
+
let i = a.get(n);
|
|
177
|
+
return i || (i = oe(e, t), a.set(n, i)), i;
|
|
284
178
|
}
|
|
285
179
|
_native() {
|
|
286
180
|
return this._layerRef?.current;
|
|
287
181
|
}
|
|
288
|
-
_lutPack(
|
|
289
|
-
const
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
182
|
+
_lutPack(e) {
|
|
183
|
+
const t = (e.nexradProduct || "REF").toUpperCase(),
|
|
184
|
+
a = e.colormap,
|
|
185
|
+
n = ye(a, t, e.units),
|
|
186
|
+
[i, r] = ge(a?.[0], a?.[a.length - 2], t, e.units, e.nexradDataSource),
|
|
187
|
+
{
|
|
188
|
+
bytes: s,
|
|
189
|
+
discreteIntegerLut: l
|
|
190
|
+
} = de(n, i, r, this._interpolateColormap);
|
|
297
191
|
return {
|
|
298
|
-
lutB64:
|
|
299
|
-
lutMin:
|
|
300
|
-
lutMax:
|
|
301
|
-
discreteIntegerLut
|
|
192
|
+
lutB64: J(s),
|
|
193
|
+
lutMin: i,
|
|
194
|
+
lutMax: r,
|
|
195
|
+
discreteIntegerLut: l
|
|
302
196
|
};
|
|
303
197
|
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
* After JS decoded a frame into `_frameCache`, optionally push it through the native bridge.
|
|
339
|
-
* During timeline preload we **only** upload the **currently displayed** unix to Metal; other
|
|
340
|
-
* volumes stay in the JS cache until {@link sync} needs them (avoids 40+ full decodes on load).
|
|
341
|
-
*/
|
|
342
|
-
_primeNativeGpuUploadIfNeeded(snapshot, unix, p, frame, abortSignal) {
|
|
343
|
-
if (!frame || !p || abortSignal && abortSignal.aborted) return;
|
|
344
|
-
try {
|
|
345
|
-
const displayUx = snapshot.nexradTimestamp != null && Number.isFinite(Number(snapshot.nexradTimestamp)) ? Number(snapshot.nexradTimestamp) : NaN;
|
|
346
|
-
if (Number.isFinite(displayUx) && Number(unix) !== displayUx) {
|
|
347
|
-
return;
|
|
348
|
-
}
|
|
349
|
-
const syncKey = this._syncIdentity(snapshot, p, unix);
|
|
350
|
-
if (this._nativeGpuReadyKeys.has(syncKey)) {
|
|
351
|
-
return;
|
|
352
|
-
}
|
|
353
|
-
if (!this._native()?.uploadNexradFrame) {
|
|
354
|
-
return;
|
|
355
|
-
}
|
|
356
|
-
this._uploadFrameToNative(snapshot, frame, p, unix);
|
|
357
|
-
} catch (err) {
|
|
358
|
-
/* ignore */
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
/**
|
|
363
|
-
* @param {*} state
|
|
364
|
-
* @param {*} frame - decoded archive frame
|
|
365
|
-
* @param {{ fetchKey: string }} p - from {@link _buildFetchParamsForUnix}
|
|
366
|
-
* @param {number} unix
|
|
367
|
-
*/
|
|
368
|
-
_uploadFrameToNative(state, frame, p, unix) {
|
|
369
|
-
const uploadTotal = nexradPerfSpan(`uploadFrame.total site=${state.nexradSite} unix=${unix} var=${p?.radarVar ?? state.nexradProduct}`);
|
|
370
|
-
const n = this._native();
|
|
371
|
-
if (!n?.uploadNexradFrame) {
|
|
372
|
-
uploadTotal.end({
|
|
373
|
-
outcome: 'skippedNoNative'
|
|
198
|
+
_nativeUploadJsonLruTouch(e) {
|
|
199
|
+
const t = this._nativeUploadJsonLru.get(e);
|
|
200
|
+
return t ? (this._nativeUploadJsonLru.delete(e), this._nativeUploadJsonLru.set(e, t), t) : null;
|
|
201
|
+
}
|
|
202
|
+
_nativeUploadJsonLruPut(e, t) {
|
|
203
|
+
for (this._nativeUploadJsonLru.has(e) && this._nativeUploadJsonLru.delete(e), this._nativeUploadJsonLru.set(e, t); this._nativeUploadJsonLru.size > Ne;) {
|
|
204
|
+
const a = this._nativeUploadJsonLru.keys().next().value;
|
|
205
|
+
if (a === void 0) break;
|
|
206
|
+
this._nativeUploadJsonLru.delete(a);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
_nativeUploadLruKey(e, t) {
|
|
210
|
+
return `${t}|o:${e.opacity ?? 1}|g:${this._gateSmoothing ? 1 : 0}|i:${this._interpolateColormap ? 1 : 0}`;
|
|
211
|
+
}
|
|
212
|
+
_primeNativeGpuUploadIfNeeded(e, t, a, n, i) {
|
|
213
|
+
if (!(!n || !a || i && i.aborted)) try {
|
|
214
|
+
const r = e.nexradTimestamp != null && Number.isFinite(Number(e.nexradTimestamp)) ? Number(e.nexradTimestamp) : NaN;
|
|
215
|
+
if (Number.isFinite(r) && Number(t) !== r) return;
|
|
216
|
+
const s = this._syncIdentity(e, a, t);
|
|
217
|
+
if (this._nativeGpuReadyKeys.has(s) || !this._native()?.uploadNexradFrame) return;
|
|
218
|
+
this._uploadFrameToNative(e, n, a, t);
|
|
219
|
+
} catch {}
|
|
220
|
+
}
|
|
221
|
+
_uploadFrameToNative(e, t, a, n) {
|
|
222
|
+
const i = h(`uploadFrame.total site=${e.nexradSite} unix=${n} var=${a?.radarVar ?? e.nexradProduct}`),
|
|
223
|
+
r = this._native();
|
|
224
|
+
if (!r?.uploadNexradFrame) {
|
|
225
|
+
y("upload.skip", {
|
|
226
|
+
reason: "noNativeUploadMethod",
|
|
227
|
+
site: e.nexradSite,
|
|
228
|
+
unix: n,
|
|
229
|
+
layerRefSet: !!this._layerRef?.current
|
|
230
|
+
}), i.end({
|
|
231
|
+
outcome: "skippedNoNative"
|
|
374
232
|
});
|
|
375
233
|
return;
|
|
376
234
|
}
|
|
377
|
-
const
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
if (
|
|
381
|
-
this._lastUploadMeta = {
|
|
382
|
-
valueScale:
|
|
383
|
-
valueOffset:
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
n.activateNexradCachedFrame(syncKey);
|
|
389
|
-
tAct.end({
|
|
390
|
-
keyLen: syncKey.length
|
|
235
|
+
const s = this._syncIdentity(e, a, n),
|
|
236
|
+
l = this._nativeUploadLruKey(e, s),
|
|
237
|
+
o = this._nativeUploadJsonLruTouch(l);
|
|
238
|
+
if (o) {
|
|
239
|
+
if (this._lastUploadMeta = {
|
|
240
|
+
valueScale: o.valueScale,
|
|
241
|
+
valueOffset: o.valueOffset
|
|
242
|
+
}, this._rememberUploadMetaForSyncKey(s, o.valueScale, o.valueOffset), r.activateNexradCachedFrame && this._nativeGpuReadyKeys.has(s)) {
|
|
243
|
+
const K = h("uploadFrame.nativeGpuActivateOnly");
|
|
244
|
+
r.activateNexradCachedFrame(s), K.end({
|
|
245
|
+
keyLen: s.length
|
|
391
246
|
});
|
|
392
|
-
const
|
|
393
|
-
this.applyStyleFromState(
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
uploadTotal.end({
|
|
397
|
-
outcome: 'gpuActivateOnly',
|
|
398
|
-
jsonCharsSkipped: lruHit.json.length
|
|
247
|
+
const Z = h("uploadFrame.styleAfterGpuActivate");
|
|
248
|
+
this.applyStyleFromState(e), Z.end({}), this._nativeFrameUploaded = !0, i.end({
|
|
249
|
+
outcome: "gpuActivateOnly",
|
|
250
|
+
jsonCharsSkipped: o.json.length
|
|
399
251
|
});
|
|
400
252
|
return;
|
|
401
253
|
}
|
|
402
|
-
const
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
uploadTotal.end({
|
|
410
|
-
outcome: 'jsonLruHit',
|
|
411
|
-
jsonChars: lruHit.json.length
|
|
254
|
+
const A = h("uploadFrame.nativeJsonLru.bridgeDispatch");
|
|
255
|
+
r.uploadNexradFrame(o.json), A.end({
|
|
256
|
+
jsonChars: o.json.length,
|
|
257
|
+
path: "jsonLruHit"
|
|
258
|
+
}), this._nativeFrameUploaded = !0, i.end({
|
|
259
|
+
outcome: "jsonLruHit",
|
|
260
|
+
jsonChars: o.json.length
|
|
412
261
|
});
|
|
413
262
|
return;
|
|
414
263
|
}
|
|
415
|
-
const
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
// Skip JS sorting for Android native upload
|
|
420
|
-
// We pass the raw frame and let Android do the sorting/canonicalization
|
|
421
|
-
const rawFrame = frame;
|
|
264
|
+
const m = h("uploadFrame.mapboxFrameUploadOptions"),
|
|
265
|
+
u = V(e);
|
|
266
|
+
m.end({});
|
|
267
|
+
const d = t;
|
|
422
268
|
this._lastUploadMeta = {
|
|
423
|
-
valueScale:
|
|
424
|
-
valueOffset:
|
|
269
|
+
valueScale: d.valueScale,
|
|
270
|
+
valueOffset: d.valueOffset
|
|
425
271
|
};
|
|
426
|
-
const
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
lutB64Chars:
|
|
430
|
-
discreteIntegerLut:
|
|
431
|
-
lutMin:
|
|
432
|
-
lutMax:
|
|
272
|
+
const N = h("uploadFrame.lutPack_buildNexradLutRgba"),
|
|
273
|
+
p = this._lutPack(e);
|
|
274
|
+
N.end({
|
|
275
|
+
lutB64Chars: p.lutB64?.length ?? 0,
|
|
276
|
+
discreteIntegerLut: p.discreteIntegerLut,
|
|
277
|
+
lutMin: p.lutMin,
|
|
278
|
+
lutMax: p.lutMax
|
|
433
279
|
});
|
|
434
|
-
const
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
len:
|
|
280
|
+
const F = h("uploadFrame.rayBoundariesToJsArray"),
|
|
281
|
+
g = d.rayBoundariesDeg?.slice ? Array.from(d.rayBoundariesDeg) : [...(d.rayBoundariesDeg || [])];
|
|
282
|
+
F.end({
|
|
283
|
+
len: g.length
|
|
438
284
|
});
|
|
439
|
-
const
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
gateB64Chars:
|
|
444
|
-
rleBytes:
|
|
445
|
-
rawBytes:
|
|
285
|
+
const f = h("uploadFrame.gateData_toBase64"),
|
|
286
|
+
_ = Te(d.gateData),
|
|
287
|
+
C = J(_);
|
|
288
|
+
f.end({
|
|
289
|
+
gateB64Chars: C.length,
|
|
290
|
+
rleBytes: _.length,
|
|
291
|
+
rawBytes: d.gateData.length
|
|
446
292
|
});
|
|
447
|
-
const
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
jsonChars:
|
|
473
|
-
rayBoundaryLen:
|
|
474
|
-
});
|
|
475
|
-
const tLruPut = nexradPerfSpan('uploadFrame.nativeUploadJsonLruPut');
|
|
476
|
-
this._nativeUploadJsonLruPut(lruKey, {
|
|
477
|
-
json,
|
|
478
|
-
valueScale: rawFrame.valueScale,
|
|
479
|
-
valueOffset: rawFrame.valueOffset
|
|
293
|
+
const x = {
|
|
294
|
+
gateB64: C,
|
|
295
|
+
gateIsRle: !0,
|
|
296
|
+
nGates: d.nGates,
|
|
297
|
+
nRays: d.nRays,
|
|
298
|
+
stationLat: d.stationLat,
|
|
299
|
+
stationLon: d.stationLon,
|
|
300
|
+
firstGateKm: d.firstGateKm,
|
|
301
|
+
gateWidthKm: d.gateWidthKm,
|
|
302
|
+
rayBoundaries: g,
|
|
303
|
+
lutB64: p.lutB64,
|
|
304
|
+
valueScale: d.valueScale,
|
|
305
|
+
valueOffset: d.valueOffset,
|
|
306
|
+
lutMin: p.lutMin,
|
|
307
|
+
lutMax: p.lutMax,
|
|
308
|
+
discreteIntegerLut: p.discreteIntegerLut ? 1 : 0,
|
|
309
|
+
opacity: e.opacity ?? 1,
|
|
310
|
+
gateSmoothPolar: this._gateSmoothing ? 1 : 0,
|
|
311
|
+
interpolateLut: this._interpolateColormap ? 1 : 0,
|
|
312
|
+
nativeGpuCacheKey: s,
|
|
313
|
+
uploadOpts: u
|
|
314
|
+
},
|
|
315
|
+
S = h("uploadFrame.JSON_stringify_payload"),
|
|
316
|
+
v = JSON.stringify(x);
|
|
317
|
+
S.end({
|
|
318
|
+
jsonChars: v.length,
|
|
319
|
+
rayBoundaryLen: g.length
|
|
480
320
|
});
|
|
481
|
-
|
|
482
|
-
|
|
321
|
+
const b = h("uploadFrame.nativeUploadJsonLruPut");
|
|
322
|
+
this._nativeUploadJsonLruPut(l, {
|
|
323
|
+
json: v,
|
|
324
|
+
valueScale: d.valueScale,
|
|
325
|
+
valueOffset: d.valueOffset
|
|
326
|
+
}), b.end({
|
|
327
|
+
lruKeyTail: l.slice(-96),
|
|
483
328
|
lruSize: this._nativeUploadJsonLru.size
|
|
484
329
|
});
|
|
485
|
-
const
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
outcome: 'fullPipeline',
|
|
496
|
-
jsonChars: json.length,
|
|
497
|
-
nGates: rawFrame.nGates,
|
|
498
|
-
nRays: rawFrame.nRays
|
|
330
|
+
const T = he(d.gateData, d.nGates, d.nRays, d.valueScale, d.valueOffset, p.lutMin, p.lutMax),
|
|
331
|
+
P = h("uploadFrame.nativeBridge_uploadNexradFrame");
|
|
332
|
+
r.uploadNexradFrame(v), P.end({
|
|
333
|
+
jsonChars: v.length,
|
|
334
|
+
path: "fullRebuild"
|
|
335
|
+
}), this._rememberUploadMetaForSyncKey(s, d.valueScale, d.valueOffset), this._nativeFrameUploaded = !0, i.end({
|
|
336
|
+
outcome: "fullPipeline",
|
|
337
|
+
jsonChars: v.length,
|
|
338
|
+
nGates: d.nGates,
|
|
339
|
+
nRays: d.nRays
|
|
499
340
|
});
|
|
500
341
|
}
|
|
501
|
-
applyStyleFromState(
|
|
502
|
-
const
|
|
503
|
-
|
|
504
|
-
if (!this._nativeFrameUploaded || !this._lastUploadMeta || !
|
|
505
|
-
|
|
506
|
-
outcome:
|
|
342
|
+
applyStyleFromState(e) {
|
|
343
|
+
const t = h(`applyStyleFromState site=${e.nexradSite} product=${e.nexradProduct} tilt=${e.nexradTilt}`),
|
|
344
|
+
a = this._native();
|
|
345
|
+
if (!this._nativeFrameUploaded || !this._lastUploadMeta || !a?.uploadNexradStyleOnly) {
|
|
346
|
+
t.end({
|
|
347
|
+
outcome: "skipped",
|
|
507
348
|
nativeFrameUploaded: this._nativeFrameUploaded,
|
|
508
349
|
hasUploadMeta: !!this._lastUploadMeta,
|
|
509
|
-
hasStyleMethod: !!
|
|
350
|
+
hasStyleMethod: !!a?.uploadNexradStyleOnly
|
|
510
351
|
});
|
|
511
352
|
return;
|
|
512
353
|
}
|
|
513
|
-
const
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
lutB64Chars:
|
|
517
|
-
});
|
|
518
|
-
const payload = {
|
|
519
|
-
lutB64: style.lutB64,
|
|
520
|
-
valueScale: this._lastUploadMeta.valueScale,
|
|
521
|
-
valueOffset: this._lastUploadMeta.valueOffset,
|
|
522
|
-
lutMin: style.lutMin,
|
|
523
|
-
lutMax: style.lutMax,
|
|
524
|
-
discreteIntegerLut: style.discreteIntegerLut,
|
|
525
|
-
opacity: state.opacity ?? 1,
|
|
526
|
-
gateSmoothPolar: this._gateSmoothing ? 1 : 0,
|
|
527
|
-
interpolateLut: this._interpolateColormap ? 1 : 0
|
|
528
|
-
};
|
|
529
|
-
const tJson = nexradPerfSpan('applyStyleFromState.JSON_stringify');
|
|
530
|
-
const json = JSON.stringify(payload);
|
|
531
|
-
tJson.end({
|
|
532
|
-
jsonChars: json.length
|
|
354
|
+
const n = h("applyStyleFromState.lutPack"),
|
|
355
|
+
i = this._lutPack(e);
|
|
356
|
+
n.end({
|
|
357
|
+
lutB64Chars: i.lutB64?.length ?? 0
|
|
533
358
|
});
|
|
534
|
-
const
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
359
|
+
const r = {
|
|
360
|
+
lutB64: i.lutB64,
|
|
361
|
+
valueScale: this._lastUploadMeta.valueScale,
|
|
362
|
+
valueOffset: this._lastUploadMeta.valueOffset,
|
|
363
|
+
lutMin: i.lutMin,
|
|
364
|
+
lutMax: i.lutMax,
|
|
365
|
+
discreteIntegerLut: i.discreteIntegerLut ? 1 : 0,
|
|
366
|
+
opacity: e.opacity ?? 1,
|
|
367
|
+
gateSmoothPolar: this._gateSmoothing ? 1 : 0,
|
|
368
|
+
interpolateLut: this._interpolateColormap ? 1 : 0
|
|
369
|
+
},
|
|
370
|
+
s = h("applyStyleFromState.JSON_stringify"),
|
|
371
|
+
l = JSON.stringify(r);
|
|
372
|
+
s.end({
|
|
373
|
+
jsonChars: l.length
|
|
538
374
|
});
|
|
539
|
-
|
|
540
|
-
|
|
375
|
+
const o = h("applyStyleFromState.nativeBridge");
|
|
376
|
+
a.uploadNexradStyleOnly(l), o.end({
|
|
377
|
+
jsonChars: l.length
|
|
378
|
+
}), t.end({
|
|
379
|
+
outcome: "dispatched"
|
|
541
380
|
});
|
|
542
381
|
}
|
|
543
|
-
_resolveListingContext(
|
|
544
|
-
const
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
...
|
|
382
|
+
_resolveListingContext(e) {
|
|
383
|
+
const {
|
|
384
|
+
site: t,
|
|
385
|
+
elevNorm: a,
|
|
386
|
+
group: n
|
|
387
|
+
} = E(e),
|
|
388
|
+
i = (e?.nexradDataSource || "level2") !== "level3" && t ? `${t}_${n}_${a}` : this.core._nexradTimesCacheKey?.(),
|
|
389
|
+
r = i ? this.core.nexradTimesByStation?.[i] : null,
|
|
390
|
+
s = e?.nexradTimeToKeyMap && typeof e.nexradTimeToKeyMap == "object" ? e.nexradTimeToKeyMap : {};
|
|
391
|
+
let l = r?.timeToKeyMap && typeof r.timeToKeyMap == "object" ? {
|
|
392
|
+
...s,
|
|
393
|
+
...r.timeToKeyMap
|
|
394
|
+
} : {
|
|
395
|
+
...s
|
|
554
396
|
};
|
|
397
|
+
const o = r?.level2Clens,
|
|
398
|
+
m = Array.isArray(r?.unixTimes) && r.unixTimes.length > 0 ? r.unixTimes : Array.isArray(e?.availableNexradTimestamps) && e.availableNexradTimestamps.length > 0 ? e.availableNexradTimestamps : void 0;
|
|
399
|
+
if (this._nexradRadarSource(e) === "level2" && o && typeof o == "object" && Object.keys(o).length > 0) {
|
|
400
|
+
const d = re({
|
|
401
|
+
stationId: t,
|
|
402
|
+
elevNorm: a,
|
|
403
|
+
group: n,
|
|
404
|
+
timeToKeyMap: l,
|
|
405
|
+
level2Clens: o,
|
|
406
|
+
unixTimes: m
|
|
407
|
+
});
|
|
408
|
+
Object.keys(d).length > 0 ? l = d : Object.keys(l).length > 0 && (l = Object.fromEntries(Object.entries(l).filter(([, N]) => j(N))));
|
|
409
|
+
} else this._nexradRadarSource(e) === "level2" && (l = Object.fromEntries(Object.entries(l).filter(([, d]) => j(d))));
|
|
410
|
+
const u = r?.level3MotionTimeToKeyMap || {};
|
|
555
411
|
return {
|
|
556
|
-
nk,
|
|
557
|
-
ent,
|
|
558
|
-
timeToKeyMap,
|
|
559
|
-
motionMap
|
|
412
|
+
nk: i,
|
|
413
|
+
ent: r,
|
|
414
|
+
timeToKeyMap: l,
|
|
415
|
+
motionMap: u
|
|
560
416
|
};
|
|
561
417
|
}
|
|
562
|
-
|
|
563
|
-
const radarVar = (state.nexradProduct || 'REF').toUpperCase();
|
|
564
|
-
const radarSource = state.nexradDataSource === 'level3' ? 'level3' : 'level2';
|
|
565
|
-
const groupId = nexradBinGroupIdForKey(variableToNexradGroup(radarVar));
|
|
418
|
+
_nexradStateWithCoreListing(e) {
|
|
566
419
|
const {
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
420
|
+
site: t,
|
|
421
|
+
elevNorm: a,
|
|
422
|
+
group: n
|
|
423
|
+
} = E(e),
|
|
424
|
+
i = (e?.nexradDataSource || "level2") !== "level3" && t ? `${t}_${n}_${a}` : this.core._nexradTimesCacheKey?.(),
|
|
425
|
+
r = i ? this.core.nexradTimesByStation?.[i] : null;
|
|
426
|
+
if (!r) return e;
|
|
427
|
+
const s = Array.isArray(r.unixTimes) ? r.unixTimes : [],
|
|
428
|
+
{
|
|
429
|
+
timeToKeyMap: l
|
|
430
|
+
} = this._resolveListingContext(e),
|
|
431
|
+
o = this.core._getFilteredNexradTimestampsForVariable(s),
|
|
432
|
+
m = this._nexradRadarSource(e) === "level2" ? o.filter(d => j(l[String(d)])) : o.filter(d => typeof l[String(d)] == "string" && l[String(d)].length > 0);
|
|
433
|
+
let u = e.nexradTimestamp != null ? e.nexradTimestamp : this.core.state.nexradTimestamp != null ? this.core.state.nexradTimestamp : null;
|
|
434
|
+
return u == null && m.length > 0 && (u = m[m.length - 1]), {
|
|
435
|
+
...e,
|
|
436
|
+
availableNexradTimestamps: m,
|
|
437
|
+
nexradTimeToKeyMap: l,
|
|
438
|
+
nexradLevel3MotionTimeToKeyMap: r.level3MotionTimeToKeyMap || {},
|
|
439
|
+
nexradTimestamp: u
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
async _ensureLevel2ListingReady(e) {
|
|
443
|
+
if (this._nexradRadarSource(e) !== "level2") return;
|
|
444
|
+
if (this._listingRefreshPromise) {
|
|
445
|
+
await this._listingRefreshPromise;
|
|
446
|
+
return;
|
|
577
447
|
}
|
|
578
|
-
const
|
|
579
|
-
|
|
448
|
+
const t = () => this.core._nexradTimesCacheKey?.(),
|
|
449
|
+
a = () => t() ? this.core.nexradTimesByStation?.[t()] : null;
|
|
450
|
+
D(a()) && (this._listingRefreshPromise = (async () => {
|
|
451
|
+
try {
|
|
452
|
+
await this.core.refreshNexradTimes();
|
|
453
|
+
let n = a();
|
|
454
|
+
if (D(n)) {
|
|
455
|
+
const s = await te(this.core, this.core.state, {
|
|
456
|
+
siteOrigin: this.core.gridRequestSiteOrigin || ""
|
|
457
|
+
});
|
|
458
|
+
if (n = a(), !s) {
|
|
459
|
+
y("listing.patchFailed", {
|
|
460
|
+
site: e.nexradSite,
|
|
461
|
+
cacheKey: t()
|
|
462
|
+
});
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
465
|
+
if (n?.level2ListingEmpty) {
|
|
466
|
+
y("listing.empty", {
|
|
467
|
+
site: e.nexradSite,
|
|
468
|
+
cacheKey: t(),
|
|
469
|
+
hint: ae(e.nexradSite)
|
|
470
|
+
});
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
const i = n?.timeToKeyMap || {},
|
|
475
|
+
r = Object.values(i).find(s => typeof s == "string" && s.length > 0);
|
|
476
|
+
y("listing.refreshed", {
|
|
477
|
+
site: e.nexradSite,
|
|
478
|
+
product: e.nexradProduct,
|
|
479
|
+
tilt: e.nexradTilt,
|
|
480
|
+
cacheKey: t(),
|
|
481
|
+
clensEntries: Object.keys(n?.level2Clens || {}).length,
|
|
482
|
+
mappedTimes: Object.keys(i).length,
|
|
483
|
+
sampleKeyTail: typeof r == "string" ? r.slice(-72) : r
|
|
484
|
+
});
|
|
485
|
+
} catch (n) {
|
|
486
|
+
y("listing.refreshFailed", {
|
|
487
|
+
site: e.nexradSite,
|
|
488
|
+
message: n?.message || String(n)
|
|
489
|
+
});
|
|
490
|
+
} finally {
|
|
491
|
+
this._listingRefreshPromise = null;
|
|
492
|
+
}
|
|
493
|
+
})(), await this._listingRefreshPromise);
|
|
494
|
+
}
|
|
495
|
+
_logListingDiag(e, t, a, n = {}) {
|
|
496
|
+
const {
|
|
497
|
+
nk: i,
|
|
498
|
+
ent: r,
|
|
499
|
+
timeToKeyMap: s,
|
|
500
|
+
motionMap: l
|
|
501
|
+
} = this._resolveListingContext(t),
|
|
502
|
+
o = Object.keys(s || {}),
|
|
503
|
+
m = a != null ? s[String(a)] : void 0;
|
|
504
|
+
y(e, {
|
|
505
|
+
site: t.nexradSite,
|
|
506
|
+
product: t.nexradProduct,
|
|
507
|
+
tilt: t.nexradTilt,
|
|
508
|
+
radarSource: this._nexradRadarSource(t),
|
|
509
|
+
unix: a,
|
|
510
|
+
listingCacheKey: i,
|
|
511
|
+
coreListingPresent: !!r,
|
|
512
|
+
stateMapEntries: Object.keys(t.nexradTimeToKeyMap || {}).length,
|
|
513
|
+
mergedMapEntries: o.length,
|
|
514
|
+
motionMapEntries: Object.keys(l || {}).length,
|
|
515
|
+
availableUnixCount: Array.isArray(t.availableNexradTimestamps) ? t.availableNexradTimestamps.length : 0,
|
|
516
|
+
hasObjectKeyForUnix: a != null && Object.prototype.hasOwnProperty.call(s, String(a)),
|
|
517
|
+
objectKeyTail: typeof m == "string" ? m.slice(-72) : m,
|
|
518
|
+
sampleMapEntries: o.slice(0, 4).map(u => ({
|
|
519
|
+
unix: u,
|
|
520
|
+
keyTail: String(s[u] || "").slice(-56)
|
|
521
|
+
})),
|
|
522
|
+
nativeLayerReady: !!this._native()?.uploadNexradFrame,
|
|
523
|
+
...n
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
_nexradRadarSource(e) {
|
|
527
|
+
return e.nexradDataSource === "level3" ? "level3" : "level2";
|
|
528
|
+
}
|
|
529
|
+
_buildFetchParamsForUnix(e, t, a = {}) {
|
|
530
|
+
const n = a.logDiag !== !1,
|
|
531
|
+
i = (e.nexradProduct || "REF").toUpperCase(),
|
|
532
|
+
r = this._nexradRadarSource(e),
|
|
533
|
+
s = X(ee(i)),
|
|
534
|
+
{
|
|
535
|
+
ent: l,
|
|
536
|
+
timeToKeyMap: o,
|
|
537
|
+
motionMap: m
|
|
538
|
+
} = this._resolveListingContext(e),
|
|
539
|
+
u = o[String(t)];
|
|
540
|
+
if (!u) return n && this._logListingDiag("fetchParams.missingObjectKey", e, t, {
|
|
541
|
+
radarVar: i
|
|
542
|
+
}), null;
|
|
543
|
+
const d = r === "level2" ? ie({
|
|
544
|
+
state: e,
|
|
545
|
+
listingEntry: l,
|
|
546
|
+
unix: t,
|
|
547
|
+
radarVar: i,
|
|
548
|
+
rawKey: u
|
|
549
|
+
}) : u;
|
|
550
|
+
if (!d) return n && y("fetchParams.invalidLevel2ObjectKey", {
|
|
551
|
+
site: e.nexradSite,
|
|
552
|
+
unix: t,
|
|
553
|
+
rawKeyTail: String(u).slice(-72),
|
|
554
|
+
hasLevel2Clens: !!(l?.level2Clens && Object.keys(l.level2Clens).length)
|
|
555
|
+
}), null;
|
|
556
|
+
let N = null;
|
|
557
|
+
i === "VEL" && e.nexradStormRelative && (N = me(t, m));
|
|
558
|
+
const p = G(d, r),
|
|
559
|
+
F = `${p}|${i}|${r}|${N || ""}`;
|
|
580
560
|
return {
|
|
581
|
-
objectKey,
|
|
582
|
-
url,
|
|
583
|
-
fetchKey,
|
|
584
|
-
motionObjectKey,
|
|
585
|
-
radarVar,
|
|
586
|
-
radarSource,
|
|
587
|
-
groupId
|
|
561
|
+
objectKey: d,
|
|
562
|
+
url: p,
|
|
563
|
+
fetchKey: F,
|
|
564
|
+
motionObjectKey: N,
|
|
565
|
+
radarVar: i,
|
|
566
|
+
radarSource: r,
|
|
567
|
+
groupId: s
|
|
588
568
|
};
|
|
589
569
|
}
|
|
590
|
-
async _fetchFrame(
|
|
591
|
-
signal,
|
|
592
|
-
priority
|
|
570
|
+
async _fetchFrame(e, t, {
|
|
571
|
+
signal: a,
|
|
572
|
+
priority: n
|
|
593
573
|
}) {
|
|
594
|
-
const
|
|
595
|
-
|
|
596
|
-
if (!
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
574
|
+
const i = h(`fetchAndParseArchive priority=${n} site=${e.nexradSite} unix=${t} product=${e.nexradProduct}`),
|
|
575
|
+
r = this._buildFetchParamsForUnix(e, t);
|
|
576
|
+
if (!r) return i.end({
|
|
577
|
+
ok: !1,
|
|
578
|
+
reason: "noFetchParams"
|
|
579
|
+
}), null;
|
|
580
|
+
y("fetch.start", {
|
|
581
|
+
priority: n,
|
|
582
|
+
site: e.nexradSite,
|
|
583
|
+
unix: t,
|
|
584
|
+
radarVar: r.radarVar,
|
|
585
|
+
radarSource: r.radarSource,
|
|
586
|
+
url: r.url?.replace(/([?&])apiKey=[^&]*/gi, "$1apiKey=(redacted)"),
|
|
587
|
+
objectKeyTail: (r.objectKey || "").slice(-72),
|
|
588
|
+
motionKeyTail: (r.motionObjectKey || "").slice(-48)
|
|
589
|
+
});
|
|
603
590
|
try {
|
|
604
|
-
const
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
return
|
|
617
|
-
} catch (
|
|
618
|
-
|
|
619
|
-
ok:
|
|
620
|
-
error:
|
|
621
|
-
radarVar:
|
|
622
|
-
radarSource:
|
|
623
|
-
|
|
624
|
-
|
|
591
|
+
const s = await k(r.url, r.objectKey, r.radarVar, r.groupId, r.radarSource, {
|
|
592
|
+
signal: a,
|
|
593
|
+
priority: n,
|
|
594
|
+
level3MotionObjectKey: r.motionObjectKey
|
|
595
|
+
}),
|
|
596
|
+
l = {
|
|
597
|
+
ok: !!s,
|
|
598
|
+
radarVar: r.radarVar,
|
|
599
|
+
radarSource: r.radarSource,
|
|
600
|
+
objectKeyTail: (r.objectKey || "").slice(-48),
|
|
601
|
+
motionKeyTail: (r.motionObjectKey || "").slice(-48)
|
|
602
|
+
};
|
|
603
|
+
return s && (l.nGates = s.nGates, l.nRays = s.nRays, l.gateBytes = s.gateData?.length ?? 0), i.end(l), y(s ? "fetch.ok" : "fetch.emptyFrame", l), s;
|
|
604
|
+
} catch (s) {
|
|
605
|
+
const l = {
|
|
606
|
+
ok: !1,
|
|
607
|
+
error: s?.message || String(s),
|
|
608
|
+
radarVar: r.radarVar,
|
|
609
|
+
radarSource: r.radarSource,
|
|
610
|
+
objectKeyTail: (r.objectKey || "").slice(-48)
|
|
611
|
+
};
|
|
612
|
+
throw i.end(l), y("fetch.error", l), s;
|
|
625
613
|
}
|
|
626
614
|
}
|
|
627
|
-
_preloadTimelineSignature(
|
|
628
|
-
const
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
return `${
|
|
615
|
+
_preloadTimelineSignature(e) {
|
|
616
|
+
const t = this.core._nexradTimesCacheKey?.() || "",
|
|
617
|
+
a = [...(e.availableNexradTimestamps || [])].map(Number).filter(i => Number.isFinite(i)).sort((i, r) => i - r).join(","),
|
|
618
|
+
n = e.nexradTilt != null && Number.isFinite(Number(e.nexradTilt)) ? Number(e.nexradTilt).toFixed(3) : "";
|
|
619
|
+
return `${t}|${a}|sr:${e.nexradStormRelative ? 1 : 0}|tilt:${n}`;
|
|
632
620
|
}
|
|
633
|
-
_syncIdentity(
|
|
634
|
-
const
|
|
635
|
-
return `${
|
|
621
|
+
_syncIdentity(e, t, a) {
|
|
622
|
+
const n = e.nexradTilt != null && Number.isFinite(Number(e.nexradTilt)) ? Number(e.nexradTilt).toFixed(3) : "";
|
|
623
|
+
return `${t.fetchKey}|tilt:${n}|u:${a}`;
|
|
636
624
|
}
|
|
637
|
-
preloadAllAvailable(
|
|
638
|
-
if (!
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
// empty list must not poison the signature or wipe the LRU (see WeatherLayerManager
|
|
645
|
-
// preload kick merging subscription snapshot).
|
|
625
|
+
async preloadAllAvailable(e) {
|
|
626
|
+
if (!e.isNexrad || !e.nexradSite) {
|
|
627
|
+
y("preload.skip", {
|
|
628
|
+
reason: "notNexradOrNoSite",
|
|
629
|
+
isNexrad: e.isNexrad,
|
|
630
|
+
site: e.nexradSite
|
|
631
|
+
});
|
|
646
632
|
return;
|
|
647
633
|
}
|
|
648
|
-
|
|
649
|
-
|
|
634
|
+
if (!q("preloadAllAvailable")) {
|
|
635
|
+
y("preload.skip", {
|
|
636
|
+
reason: "missingArchiveBindings",
|
|
637
|
+
site: e.nexradSite
|
|
638
|
+
});
|
|
650
639
|
return;
|
|
651
640
|
}
|
|
652
|
-
|
|
653
|
-
this.
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
// Keep frames that are still in the new timeline (or the currently displayed one)
|
|
663
|
-
// to avoid re-fetching them when expanding the duration window.
|
|
664
|
-
const validFetchKeys = new Set();
|
|
665
|
-
for (const unix of times) {
|
|
666
|
-
const p = this._buildFetchParamsForUnix(state, unix);
|
|
667
|
-
if (p) validFetchKeys.add(p.fetchKey);
|
|
641
|
+
let t = e;
|
|
642
|
+
if ([...(t.availableNexradTimestamps || [])].length || (await this._ensureLevel2ListingReady(t), t = this._nexradStateWithCoreListing(t)), ![...(t.availableNexradTimestamps || [])].length) {
|
|
643
|
+
y("preload.skip", {
|
|
644
|
+
reason: "noAvailableTimestamps",
|
|
645
|
+
site: t.nexradSite,
|
|
646
|
+
product: t.nexradProduct,
|
|
647
|
+
hint: "Listing empty after refreshNexradTimes"
|
|
648
|
+
});
|
|
649
|
+
return;
|
|
668
650
|
}
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
651
|
+
await this._ensureLevel2ListingReady(t), t = this._nexradStateWithCoreListing(t);
|
|
652
|
+
const a = [...(t.availableNexradTimestamps || [])].map(Number).filter(g => Number.isFinite(g));
|
|
653
|
+
if (!a.length) {
|
|
654
|
+
y("preload.skip", {
|
|
655
|
+
reason: "noValidListingAfterRefresh",
|
|
656
|
+
site: e.nexradSite,
|
|
657
|
+
product: e.nexradProduct
|
|
658
|
+
});
|
|
659
|
+
return;
|
|
675
660
|
}
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
setNexradSitesFetchAuth(this.core.apiKey || '', this.core.bundleId || '');
|
|
685
|
-
if (isAguaceroRnDebugEnabled()) {
|
|
686
|
-
aguaceroDebug('nexrad.authConfigured', getAguaceroAuthDiagnosticSnapshot(this.core, {
|
|
687
|
-
phase: 'NexradAndroidController.preload',
|
|
688
|
-
site: state.nexradSite,
|
|
689
|
-
product: state.nexradProduct
|
|
690
|
-
}));
|
|
661
|
+
const n = this._preloadTimelineSignature(t);
|
|
662
|
+
if (n === this._preloadTimelineSig) {
|
|
663
|
+
y("preload.skip", {
|
|
664
|
+
reason: "sameTimelineSig",
|
|
665
|
+
site: e.nexradSite,
|
|
666
|
+
times: a.length
|
|
667
|
+
});
|
|
668
|
+
return;
|
|
691
669
|
}
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
670
|
+
this._preloadTimelineSig = n, this._preloadAbort?.abort(), this._preloadAbort = new AbortController();
|
|
671
|
+
const i = this._preloadAbort.signal;
|
|
672
|
+
let r = 0,
|
|
673
|
+
s = 0;
|
|
674
|
+
for (const g of a) this._buildFetchParamsForUnix(t, g, {
|
|
675
|
+
logDiag: !1
|
|
676
|
+
}) ? r++ : s++;
|
|
677
|
+
if (y("preload.start", {
|
|
678
|
+
site: t.nexradSite,
|
|
679
|
+
product: t.nexradProduct,
|
|
680
|
+
dataSource: t.nexradDataSource,
|
|
681
|
+
tilt: t.nexradTilt,
|
|
682
|
+
times: a.length,
|
|
683
|
+
validFetchParams: r,
|
|
684
|
+
invalidFetchParams: s,
|
|
685
|
+
displayUnix: t.nexradTimestamp,
|
|
686
|
+
timelineSigTail: n.slice(-80)
|
|
687
|
+
}), r === 0) {
|
|
688
|
+
this._logListingDiag("preload.allFetchParamsInvalid", t, t.nexradTimestamp, {
|
|
689
|
+
times: a.length
|
|
690
|
+
});
|
|
691
|
+
return;
|
|
692
|
+
}
|
|
693
|
+
const l = t.nexradTimestamp != null && Number.isFinite(Number(t.nexradTimestamp)) ? Number(t.nexradTimestamp) : NaN,
|
|
694
|
+
o = new Set();
|
|
695
|
+
for (const g of a) {
|
|
696
|
+
const f = this._buildFetchParamsForUnix(t, g);
|
|
697
|
+
f && o.add(f.fetchKey);
|
|
698
|
+
}
|
|
699
|
+
const m = Number.isFinite(l) ? this._buildFetchParamsForUnix(t, l) : null;
|
|
700
|
+
m && o.add(m.fetchKey);
|
|
701
|
+
for (const g of this._frameCache.keys()) o.has(g) || this._frameCache.delete(g);
|
|
702
|
+
L(this.core.apiKey || ""), R(this.core.bundleId || ""), w(this.core.gridRequestSiteOrigin || I), $(this.core.nexradUserId || "sdk-user"), B(this.core.apiKey || "", this.core.bundleId || ""), W() && z("nexrad.authConfigured", H(this.core, {
|
|
703
|
+
phase: "NexradAndroidController.preload",
|
|
704
|
+
site: t.nexradSite,
|
|
705
|
+
product: t.nexradProduct
|
|
706
|
+
}));
|
|
707
|
+
const u = {
|
|
708
|
+
...t
|
|
709
|
+
},
|
|
710
|
+
d = h(`preload.batch site=${t.nexradSite} times=${a.length}`);
|
|
711
|
+
let N = 0,
|
|
712
|
+
p = 0,
|
|
713
|
+
F = 0;
|
|
714
|
+
await (async () => {
|
|
715
|
+
const g = u.nexradTimestamp != null && Number.isFinite(Number(u.nexradTimestamp)) ? Number(u.nexradTimestamp) : NaN;
|
|
716
|
+
if (Number.isFinite(g)) {
|
|
717
|
+
const x = this._buildFetchParamsForUnix(u, g);
|
|
718
|
+
if (x) {
|
|
719
|
+
const S = this._frameCache.get(x.fetchKey);
|
|
720
|
+
S && (this._primeNativeGpuUploadIfNeeded(u, g, x, S, i), await M());
|
|
710
721
|
}
|
|
711
722
|
}
|
|
712
|
-
let
|
|
713
|
-
const
|
|
714
|
-
|
|
715
|
-
const
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
if (!
|
|
720
|
-
|
|
721
|
-
|
|
723
|
+
let f = 0;
|
|
724
|
+
const _ = async () => {
|
|
725
|
+
for (; f < a.length && !i.aborted;) {
|
|
726
|
+
const x = f++,
|
|
727
|
+
S = a[x],
|
|
728
|
+
v = h(`preload.slot idx=${x + 1}/${a.length} unix=${S}`),
|
|
729
|
+
b = this._buildFetchParamsForUnix(u, S);
|
|
730
|
+
if (!b || i.aborted) v.end({
|
|
731
|
+
outcome: "noParamsOrAborted"
|
|
732
|
+
});else if (this._frameCache.has(b.fetchKey)) {
|
|
733
|
+
F++;
|
|
734
|
+
const T = this._frameCache.get(b.fetchKey);
|
|
735
|
+
this._primeNativeGpuUploadIfNeeded(u, S, b, T, i), await M(), v.end({
|
|
736
|
+
outcome: "alreadyCached",
|
|
737
|
+
fetchKeyTail: b.fetchKey.slice(-64)
|
|
738
|
+
});
|
|
739
|
+
} else try {
|
|
740
|
+
const T = await this._fetchFrame(u, S, {
|
|
741
|
+
signal: i,
|
|
742
|
+
priority: "prefetch"
|
|
722
743
|
});
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
744
|
+
T && !i.aborted ? (this._frameCache.set(b.fetchKey, T), N++, this._primeNativeGpuUploadIfNeeded(u, S, b, T, i), await M(), v.end({
|
|
745
|
+
outcome: "cachedFrame",
|
|
746
|
+
fetchKeyTail: b.fetchKey.slice(-64),
|
|
747
|
+
cacheSizeAfter: this._frameCache.size
|
|
748
|
+
})) : v.end({
|
|
749
|
+
outcome: "noFrame",
|
|
750
|
+
aborted: i.aborted
|
|
751
|
+
});
|
|
752
|
+
} catch (T) {
|
|
753
|
+
p++, v.end({
|
|
754
|
+
outcome: "error",
|
|
755
|
+
message: T?.message || String(T)
|
|
731
756
|
});
|
|
732
|
-
} else {
|
|
733
|
-
try {
|
|
734
|
-
const frame = await this._fetchFrame(snapshot, unix, {
|
|
735
|
-
signal,
|
|
736
|
-
priority: 'prefetch'
|
|
737
|
-
});
|
|
738
|
-
if (frame && !signal.aborted) {
|
|
739
|
-
this._frameCache.set(p.fetchKey, frame);
|
|
740
|
-
preloadCompleted++;
|
|
741
|
-
this._primeNativeGpuUploadIfNeeded(snapshot, unix, p, frame, signal);
|
|
742
|
-
await yieldToJsEventLoop();
|
|
743
|
-
slot.end({
|
|
744
|
-
outcome: 'cachedFrame',
|
|
745
|
-
fetchKeyTail: p.fetchKey.slice(-64),
|
|
746
|
-
cacheSizeAfter: this._frameCache.size
|
|
747
|
-
});
|
|
748
|
-
} else {
|
|
749
|
-
slot.end({
|
|
750
|
-
outcome: 'noFrame',
|
|
751
|
-
aborted: signal.aborted
|
|
752
|
-
});
|
|
753
|
-
}
|
|
754
|
-
} catch (err) {
|
|
755
|
-
preloadFailed++;
|
|
756
|
-
slot.end({
|
|
757
|
-
outcome: 'error',
|
|
758
|
-
message: err?.message || String(err)
|
|
759
|
-
});
|
|
760
|
-
}
|
|
761
757
|
}
|
|
762
|
-
await
|
|
758
|
+
await M();
|
|
763
759
|
}
|
|
764
760
|
};
|
|
765
|
-
await Promise.all(Array.from({
|
|
766
|
-
length:
|
|
767
|
-
}, () =>
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
const frame = this._frameCache.get(p.fetchKey);
|
|
776
|
-
if (!frame) continue;
|
|
777
|
-
const syncKey = this._syncIdentity(snapshot, p, unix);
|
|
778
|
-
if (this._nativeGpuReadyKeys.has(syncKey)) continue;
|
|
779
|
-
this._primeNativeGpuUploadIfNeeded(snapshot, unix, p, frame, signal);
|
|
780
|
-
await yieldToJsEventLoop();
|
|
781
|
-
}
|
|
761
|
+
if (await Promise.all(Array.from({
|
|
762
|
+
length: be
|
|
763
|
+
}, () => _())), !i.aborted) for (let x = 0; x < a.length && !i.aborted; x++) {
|
|
764
|
+
const S = a[x],
|
|
765
|
+
v = this._buildFetchParamsForUnix(u, S);
|
|
766
|
+
if (!v) continue;
|
|
767
|
+
const b = this._frameCache.get(v.fetchKey);
|
|
768
|
+
if (!b) continue;
|
|
769
|
+
const T = this._syncIdentity(u, v, S);
|
|
770
|
+
this._nativeGpuReadyKeys.has(T) || (this._primeNativeGpuUploadIfNeeded(u, S, v, b, i), await M());
|
|
782
771
|
}
|
|
783
|
-
|
|
784
|
-
outcome:
|
|
785
|
-
completed:
|
|
786
|
-
failed:
|
|
787
|
-
skippedCached:
|
|
772
|
+
const C = {
|
|
773
|
+
outcome: i.aborted ? "aborted" : "complete",
|
|
774
|
+
completed: N,
|
|
775
|
+
failed: p,
|
|
776
|
+
skippedCached: F,
|
|
788
777
|
finalCacheSize: this._frameCache.size,
|
|
789
778
|
gpuReadyCount: this._nativeGpuReadyKeys.size
|
|
779
|
+
};
|
|
780
|
+
d.end(C), y("preload.done", C);
|
|
781
|
+
})();
|
|
782
|
+
}
|
|
783
|
+
async sync(e) {
|
|
784
|
+
const t = e.nexradTimestamp != null ? Number(e.nexradTimestamp) : NaN,
|
|
785
|
+
a = h(`sync.total site=${e.nexradSite} unix=${t} product=${e.nexradProduct} source=${e.nexradDataSource} tilt=${e.nexradTilt}`);
|
|
786
|
+
if (!e.isNexrad || !e.nexradSite) {
|
|
787
|
+
y("sync.skip", {
|
|
788
|
+
reason: "notNexradOrNoSite",
|
|
789
|
+
isNexrad: e.isNexrad,
|
|
790
|
+
site: e.nexradSite
|
|
791
|
+
}), this.destroy(), a.end({
|
|
792
|
+
outcome: "skippedNotNexradOrNoSite"
|
|
790
793
|
});
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
syncTotal.end({
|
|
800
|
-
outcome: 'skippedNotNexradOrMissing'
|
|
794
|
+
return;
|
|
795
|
+
}
|
|
796
|
+
if (!q("sync")) {
|
|
797
|
+
y("sync.skip", {
|
|
798
|
+
reason: "missingArchiveBindings",
|
|
799
|
+
site: e.nexradSite
|
|
800
|
+
}), a.end({
|
|
801
|
+
outcome: "skippedMissingArchiveBindings"
|
|
801
802
|
});
|
|
802
803
|
return;
|
|
803
804
|
}
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
805
|
+
await this._ensureLevel2ListingReady(e), e = this._nexradStateWithCoreListing(e);
|
|
806
|
+
let n = e.nexradTimestamp != null ? Number(e.nexradTimestamp) : NaN;
|
|
807
|
+
if (!Number.isFinite(n) && this.core.state.nexradTimestamp != null && (n = Number(this.core.state.nexradTimestamp), e = {
|
|
808
|
+
...e,
|
|
809
|
+
nexradTimestamp: n
|
|
810
|
+
}), !Number.isFinite(n) && Array.isArray(e.availableNexradTimestamps) && e.availableNexradTimestamps.length > 0 && (n = Number(e.availableNexradTimestamps[e.availableNexradTimestamps.length - 1]), e = {
|
|
811
|
+
...e,
|
|
812
|
+
nexradTimestamp: n
|
|
813
|
+
}, this.core.state.nexradTimestamp == null && (this.core.state.nexradTimestamp = n, typeof this.core._emitStateChange == "function" && this.core._emitStateChange())), !Number.isFinite(n)) {
|
|
814
|
+
y("sync.skip", {
|
|
815
|
+
reason: "noTimestampYet",
|
|
816
|
+
site: e.nexradSite,
|
|
817
|
+
availableUnixCount: Array.isArray(e.availableNexradTimestamps) ? e.availableNexradTimestamps.length : 0
|
|
818
|
+
}), a.end({
|
|
819
|
+
outcome: "skippedNoTimestampYet"
|
|
807
820
|
});
|
|
808
821
|
return;
|
|
809
822
|
}
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
const tParams = nexradPerfSpan('sync.buildFetchParams');
|
|
818
|
-
const p = this._buildFetchParamsForUnix(state, unix);
|
|
819
|
-
tParams.end({
|
|
820
|
-
ok: !!p
|
|
823
|
+
y("sync.start", {
|
|
824
|
+
site: e.nexradSite,
|
|
825
|
+
product: e.nexradProduct,
|
|
826
|
+
dataSource: e.nexradDataSource,
|
|
827
|
+
tilt: e.nexradTilt,
|
|
828
|
+
unix: e.nexradTimestamp,
|
|
829
|
+
nativeLayerReady: !!this._native()?.uploadNexradFrame
|
|
821
830
|
});
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
831
|
+
const i = h("sync.setArchiveAuth");
|
|
832
|
+
L(this.core.apiKey || ""), R(this.core.bundleId || ""), w(this.core.gridRequestSiteOrigin || I), $(this.core.nexradUserId || "sdk-user"), B(this.core.apiKey || "", this.core.bundleId || ""), i.end({});
|
|
833
|
+
const r = h("sync.buildFetchParams"),
|
|
834
|
+
s = this._buildFetchParamsForUnix(e, n);
|
|
835
|
+
if (r.end({
|
|
836
|
+
ok: !!s
|
|
837
|
+
}), !s) {
|
|
838
|
+
this._logListingDiag("sync.noFetchParams", e, n), a.end({
|
|
839
|
+
outcome: "noFetchParams"
|
|
840
|
+
}), y("sync.done", {
|
|
841
|
+
outcome: "noFetchParams",
|
|
842
|
+
site: e.nexradSite,
|
|
843
|
+
unix: n
|
|
826
844
|
});
|
|
827
845
|
return;
|
|
828
846
|
}
|
|
829
|
-
const
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
syncKeyTail:
|
|
833
|
-
lastSyncKeyMatch:
|
|
847
|
+
const l = h("sync.syncIdentity"),
|
|
848
|
+
o = this._syncIdentity(e, s, n);
|
|
849
|
+
l.end({
|
|
850
|
+
syncKeyTail: o.slice(-96),
|
|
851
|
+
lastSyncKeyMatch: o === this._lastSyncKey
|
|
834
852
|
});
|
|
835
|
-
const
|
|
836
|
-
if (
|
|
837
|
-
const
|
|
838
|
-
this.applyStyleFromState(
|
|
839
|
-
|
|
840
|
-
syncTotal.end({
|
|
841
|
-
outcome: 'styleOnlyShortCircuit'
|
|
853
|
+
const m = this._frameCache.get(s.fetchKey);
|
|
854
|
+
if (o === this._lastSyncKey && this._nativeFrameUploaded && m) {
|
|
855
|
+
const f = h("sync.shortCircuit_styleOnly");
|
|
856
|
+
this.applyStyleFromState(e), f.end({}), a.end({
|
|
857
|
+
outcome: "styleOnlyShortCircuit"
|
|
842
858
|
});
|
|
843
859
|
return;
|
|
844
860
|
}
|
|
845
|
-
const
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
hit: !!
|
|
861
|
+
const u = h("sync.memoryCacheLookup"),
|
|
862
|
+
d = this._frameCache.get(s.fetchKey);
|
|
863
|
+
u.end({
|
|
864
|
+
hit: !!d,
|
|
849
865
|
cacheSize: this._frameCache.size,
|
|
850
|
-
fetchKeyTail:
|
|
866
|
+
fetchKeyTail: s.fetchKey.slice(-80)
|
|
851
867
|
});
|
|
852
|
-
const
|
|
853
|
-
if (
|
|
854
|
-
const
|
|
855
|
-
if (
|
|
856
|
-
const
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
keyLen: syncKey.length
|
|
868
|
+
const N = h("sync.tryGpuCacheActivate");
|
|
869
|
+
if (d && this._nativeGpuReadyKeys.has(o)) {
|
|
870
|
+
const f = this._native();
|
|
871
|
+
if (f?.activateNexradCachedFrame) {
|
|
872
|
+
const _ = h("sync.dispatchActivateCachedFrame");
|
|
873
|
+
f.activateNexradCachedFrame(o), _.end({
|
|
874
|
+
keyLen: o.length
|
|
860
875
|
});
|
|
861
|
-
const
|
|
862
|
-
this.applyStyleFromState(
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
};
|
|
870
|
-
}
|
|
871
|
-
this._lastSyncKey = syncKey;
|
|
872
|
-
this._nativeFrameUploaded = true;
|
|
873
|
-
tGpuTry.end({
|
|
874
|
-
outcome: 'gpuCacheActivate',
|
|
876
|
+
const C = h("sync.applyStyleAfterGpuActivate");
|
|
877
|
+
this.applyStyleFromState(e), C.end({});
|
|
878
|
+
const x = this._uploadMetaBySyncKey.get(o);
|
|
879
|
+
x && (this._lastUploadMeta = {
|
|
880
|
+
valueScale: x.valueScale,
|
|
881
|
+
valueOffset: x.valueOffset
|
|
882
|
+
}), this._lastSyncKey = o, this._nativeFrameUploaded = !0, N.end({
|
|
883
|
+
outcome: "gpuCacheActivate",
|
|
875
884
|
gpuReadySetSize: this._nativeGpuReadyKeys.size
|
|
876
|
-
})
|
|
877
|
-
|
|
878
|
-
outcome: 'gpuCacheActivate'
|
|
885
|
+
}), a.end({
|
|
886
|
+
outcome: "gpuCacheActivate"
|
|
879
887
|
});
|
|
880
888
|
return;
|
|
881
889
|
}
|
|
882
890
|
}
|
|
883
|
-
|
|
884
|
-
outcome:
|
|
885
|
-
hasJsCachedFrame: !!
|
|
886
|
-
gpuReadyForSyncKey: this._nativeGpuReadyKeys.has(
|
|
891
|
+
if (N.end({
|
|
892
|
+
outcome: "noGpuActivate",
|
|
893
|
+
hasJsCachedFrame: !!d,
|
|
894
|
+
gpuReadyForSyncKey: this._nativeGpuReadyKeys.has(o),
|
|
887
895
|
hasActivateMethod: !!this._native()?.activateNexradCachedFrame
|
|
888
|
-
})
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
tUpload.end({});
|
|
893
|
-
this._lastSyncKey = syncKey;
|
|
894
|
-
syncTotal.end({
|
|
895
|
-
outcome: 'memoryCacheHit'
|
|
896
|
+
}), d) {
|
|
897
|
+
const f = h("sync.uploadFromMemoryCache_toNative");
|
|
898
|
+
this._uploadFrameToNative(e, d, s, n), f.end({}), this._lastSyncKey = o, a.end({
|
|
899
|
+
outcome: "memoryCacheHit"
|
|
896
900
|
});
|
|
897
901
|
return;
|
|
898
902
|
}
|
|
899
|
-
this._abort?.abort();
|
|
900
|
-
|
|
901
|
-
let frame;
|
|
903
|
+
this._abort?.abort(), this._abort = new AbortController();
|
|
904
|
+
let p;
|
|
902
905
|
try {
|
|
903
|
-
|
|
906
|
+
p = await this._fetchFrame(e, n, {
|
|
904
907
|
signal: this._abort.signal,
|
|
905
|
-
priority:
|
|
908
|
+
priority: "display"
|
|
906
909
|
});
|
|
907
|
-
} catch (
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
910
|
+
} catch (f) {
|
|
911
|
+
const _ = f?.message || String(f);
|
|
912
|
+
a.end({
|
|
913
|
+
outcome: "fetchThrew",
|
|
914
|
+
message: _
|
|
915
|
+
}), y("sync.done", {
|
|
916
|
+
outcome: "fetchThrew",
|
|
917
|
+
site: e.nexradSite,
|
|
918
|
+
unix: n,
|
|
919
|
+
message: _
|
|
911
920
|
});
|
|
912
921
|
return;
|
|
913
922
|
}
|
|
914
|
-
if (!
|
|
915
|
-
|
|
916
|
-
outcome:
|
|
923
|
+
if (!p || this._abort.signal.aborted) {
|
|
924
|
+
const f = {
|
|
925
|
+
outcome: "fetchNoFrame",
|
|
917
926
|
aborted: this._abort.signal.aborted,
|
|
918
|
-
hadFrame: !!
|
|
927
|
+
hadFrame: !!p
|
|
928
|
+
};
|
|
929
|
+
a.end(f), y("sync.done", {
|
|
930
|
+
...f,
|
|
931
|
+
site: e.nexradSite,
|
|
932
|
+
unix: n
|
|
919
933
|
});
|
|
920
934
|
return;
|
|
921
935
|
}
|
|
922
|
-
const
|
|
923
|
-
this._frameCache.set(
|
|
924
|
-
tPut.end({
|
|
936
|
+
const F = h("sync.frameCacheSet");
|
|
937
|
+
this._frameCache.set(s.fetchKey, p), F.end({
|
|
925
938
|
cacheSizeAfter: this._frameCache.size
|
|
926
939
|
});
|
|
927
|
-
const
|
|
928
|
-
this._uploadFrameToNative(
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
940
|
+
const g = h("sync.uploadFetchedFrame_toNative");
|
|
941
|
+
this._uploadFrameToNative(e, p, s, n), g.end({}), this._lastSyncKey = o, a.end({
|
|
942
|
+
outcome: "fetchedAndUploaded"
|
|
943
|
+
}), y("sync.done", {
|
|
944
|
+
outcome: "fetchedAndUploaded",
|
|
945
|
+
site: e.nexradSite,
|
|
946
|
+
unix: n,
|
|
947
|
+
nGates: p.nGates,
|
|
948
|
+
nRays: p.nRays,
|
|
949
|
+
nativeFrameUploaded: this._nativeFrameUploaded
|
|
933
950
|
});
|
|
934
951
|
}
|
|
935
|
-
getInspectPayload(
|
|
936
|
-
if (!
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
if (
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
const
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
const
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
smoothPolar: this._gateSmoothing
|
|
964
|
-
});
|
|
965
|
-
if (!sample) {
|
|
966
|
-
return null;
|
|
967
|
-
}
|
|
968
|
-
const valueMs = sample.value;
|
|
969
|
-
const isHydro = radarSource === 'level3' && nexradLevel3IsHydrometeorClassification(radarVariable);
|
|
970
|
-
let valueOut;
|
|
971
|
-
let unitOut = displayUnits || '';
|
|
972
|
-
if (isVelocityStyleRadarVar(radarVariable)) {
|
|
973
|
-
valueOut = velocityMsToDisplay(valueMs, displayUnits);
|
|
974
|
-
} else if (isHydro) {
|
|
975
|
-
const label = nexradHydrometeorLabelForClassIndex(valueMs);
|
|
976
|
-
if (label == null) {
|
|
977
|
-
return null;
|
|
978
|
-
}
|
|
979
|
-
valueOut = label;
|
|
980
|
-
unitOut = '';
|
|
981
|
-
} else {
|
|
982
|
-
valueOut = formatNexradInspectNumeric(valueMs, radarVariable);
|
|
983
|
-
const bu = state.colormapBaseUnit;
|
|
984
|
-
if (bu != null && String(bu).length > 0 && String(bu).toLowerCase() !== 'none') {
|
|
985
|
-
unitOut = bu;
|
|
986
|
-
}
|
|
987
|
-
}
|
|
988
|
-
let inRange;
|
|
989
|
-
if (isHydro) {
|
|
990
|
-
const idx = Math.round(Number(valueMs));
|
|
991
|
-
inRange = (rangeMin == null || idx >= rangeMin) && (rangeMax == null || idx <= rangeMax);
|
|
992
|
-
} else if (isVelocityStyleRadarVar(radarVariable)) {
|
|
993
|
-
inRange = (rangeMin == null || valueOut >= rangeMin) && (rangeMax == null || valueOut <= rangeMax);
|
|
952
|
+
getInspectPayload(e, t, a) {
|
|
953
|
+
if (!a?.isNexrad || !a.nexradSite || a.nexradTimestamp == null || a.visible === !1 || (a.opacity ?? 1) <= 0) return null;
|
|
954
|
+
const n = Number(a.nexradTimestamp),
|
|
955
|
+
i = this._buildFetchParamsForUnix(a, n);
|
|
956
|
+
if (!i) return null;
|
|
957
|
+
const r = this._frameCache.get(i.fetchKey);
|
|
958
|
+
if (!r) return null;
|
|
959
|
+
const s = a.colormap;
|
|
960
|
+
if (!s || s.length < 2) return null;
|
|
961
|
+
const l = s[0],
|
|
962
|
+
o = s[s.length - 2],
|
|
963
|
+
m = (a.nexradProduct || "REF").toUpperCase(),
|
|
964
|
+
u = this._nexradRadarSource(a) || "level3",
|
|
965
|
+
d = a.units && String(a.units).toLowerCase() !== "none" ? a.units : U(m) ? "m/s" : "",
|
|
966
|
+
N = V(a),
|
|
967
|
+
p = this._getPreparedReadoutFrame(r, N),
|
|
968
|
+
F = le(p, t, e, {
|
|
969
|
+
smoothPolar: this._gateSmoothing
|
|
970
|
+
});
|
|
971
|
+
if (!F) return null;
|
|
972
|
+
const g = F.value,
|
|
973
|
+
f = u === "level3" && fe(m);
|
|
974
|
+
let _,
|
|
975
|
+
C = d || "";
|
|
976
|
+
if (U(m)) _ = ve(g, d);else if (f) {
|
|
977
|
+
const K = xe(g);
|
|
978
|
+
if (K == null) return null;
|
|
979
|
+
_ = K, C = "";
|
|
994
980
|
} else {
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
}
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
const
|
|
1006
|
-
|
|
1007
|
-
|
|
981
|
+
_ = Se(g, m);
|
|
982
|
+
const K = a.colormapBaseUnit;
|
|
983
|
+
K != null && String(K).length > 0 && String(K).toLowerCase() !== "none" && (C = K);
|
|
984
|
+
}
|
|
985
|
+
let x;
|
|
986
|
+
if (f) {
|
|
987
|
+
const K = Math.round(Number(g));
|
|
988
|
+
x = (l == null || K >= l) && (o == null || K <= o);
|
|
989
|
+
} else U(m) ? x = (l == null || _ >= l) && (o == null || _ <= o) : x = o == null || _ <= o;
|
|
990
|
+
if (!x) return null;
|
|
991
|
+
const S = Number.isFinite(a.nexradTilt) ? a.nexradTilt : Q(a.nexradSite),
|
|
992
|
+
v = _e(F.groundRangeKm, S),
|
|
993
|
+
b = a.units === "metric",
|
|
994
|
+
T = b ? v : v * 3.280839895013123,
|
|
995
|
+
P = b ? "km" : "kft",
|
|
996
|
+
A = a.variable;
|
|
1008
997
|
return {
|
|
1009
998
|
lngLat: {
|
|
1010
|
-
lng,
|
|
1011
|
-
lat
|
|
999
|
+
lng: e,
|
|
1000
|
+
lat: t
|
|
1012
1001
|
},
|
|
1013
1002
|
variable: {
|
|
1014
|
-
code:
|
|
1015
|
-
name: this.core.getVariableDisplayName(
|
|
1003
|
+
code: A,
|
|
1004
|
+
name: this.core.getVariableDisplayName(A)
|
|
1016
1005
|
},
|
|
1017
|
-
value:
|
|
1018
|
-
unit:
|
|
1019
|
-
beamHeight: Number.isFinite(
|
|
1020
|
-
value:
|
|
1021
|
-
unit:
|
|
1006
|
+
value: _,
|
|
1007
|
+
unit: C,
|
|
1008
|
+
beamHeight: Number.isFinite(T) && Number.isFinite(v) ? {
|
|
1009
|
+
value: T,
|
|
1010
|
+
unit: P
|
|
1022
1011
|
} : null
|
|
1023
1012
|
};
|
|
1024
1013
|
}
|