@aguacerowx/react-native 0.0.50 → 0.0.52

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.
Files changed (56) hide show
  1. package/android/src/main/java/com/aguacerowx/reactnative/SatelliteLayerView.java +11 -3
  2. package/android/src/main/java/com/aguacerowx/reactnative/WeatherFrameProcessorModule.java +315 -275
  3. package/ios/SatelliteLayerView.swift +11 -4
  4. package/ios/WeatherFrameProcessorModule.swift +222 -188
  5. package/lib/commonjs/WeatherLayerManager.js +112 -48
  6. package/lib/commonjs/WeatherLayerManager.js.map +1 -1
  7. package/lib/commonjs/aguaceroCoreDebugHooks.js +144 -0
  8. package/lib/commonjs/aguaceroCoreDebugHooks.js.map +1 -0
  9. package/lib/commonjs/aguaceroRnDebug.js +358 -0
  10. package/lib/commonjs/aguaceroRnDebug.js.map +1 -0
  11. package/lib/commonjs/gridCdnAuth.js +64 -0
  12. package/lib/commonjs/gridCdnAuth.js.map +1 -0
  13. package/lib/commonjs/index.js +50 -0
  14. package/lib/commonjs/index.js.map +1 -1
  15. package/lib/commonjs/nexrad/nexradAndroidController.js +38 -25
  16. package/lib/commonjs/nexrad/nexradAndroidController.js.map +1 -1
  17. package/lib/commonjs/nexrad/nexradDiag.js +31 -25
  18. package/lib/commonjs/nexrad/nexradDiag.js.map +1 -1
  19. package/lib/commonjs/satellite/satelliteAndroidController.js +24 -15
  20. package/lib/commonjs/satellite/satelliteAndroidController.js.map +1 -1
  21. package/lib/module/WeatherLayerManager.js +112 -48
  22. package/lib/module/WeatherLayerManager.js.map +1 -1
  23. package/lib/module/aguaceroCoreDebugHooks.js +136 -0
  24. package/lib/module/aguaceroCoreDebugHooks.js.map +1 -0
  25. package/lib/module/aguaceroRnDebug.js +341 -0
  26. package/lib/module/aguaceroRnDebug.js.map +1 -0
  27. package/lib/module/gridCdnAuth.js +56 -0
  28. package/lib/module/gridCdnAuth.js.map +1 -0
  29. package/lib/module/index.js +2 -0
  30. package/lib/module/index.js.map +1 -1
  31. package/lib/module/nexrad/nexradAndroidController.js +38 -25
  32. package/lib/module/nexrad/nexradAndroidController.js.map +1 -1
  33. package/lib/module/nexrad/nexradDiag.js +31 -25
  34. package/lib/module/nexrad/nexradDiag.js.map +1 -1
  35. package/lib/module/satellite/satelliteAndroidController.js +24 -15
  36. package/lib/module/satellite/satelliteAndroidController.js.map +1 -1
  37. package/lib/typescript/WeatherLayerManager.d.ts.map +1 -1
  38. package/lib/typescript/aguaceroCoreDebugHooks.d.ts +10 -0
  39. package/lib/typescript/aguaceroCoreDebugHooks.d.ts.map +1 -0
  40. package/lib/typescript/aguaceroRnDebug.d.ts +97 -0
  41. package/lib/typescript/aguaceroRnDebug.d.ts.map +1 -0
  42. package/lib/typescript/gridCdnAuth.d.ts +24 -0
  43. package/lib/typescript/gridCdnAuth.d.ts.map +1 -0
  44. package/lib/typescript/index.d.ts +2 -0
  45. package/lib/typescript/nexrad/nexradAndroidController.d.ts.map +1 -1
  46. package/lib/typescript/nexrad/nexradDiag.d.ts.map +1 -1
  47. package/lib/typescript/satellite/satelliteAndroidController.d.ts.map +1 -1
  48. package/package.json +1 -1
  49. package/src/WeatherLayerManager.js +2024 -1947
  50. package/src/aguaceroCoreDebugHooks.js +142 -0
  51. package/src/aguaceroRnDebug.js +335 -0
  52. package/src/gridCdnAuth.js +56 -0
  53. package/src/index.js +19 -7
  54. package/src/nexrad/nexradAndroidController.js +1078 -1068
  55. package/src/nexrad/nexradDiag.js +150 -144
  56. package/src/satellite/satelliteAndroidController.js +245 -236
@@ -1,144 +1,150 @@
1
- /**
2
- * NEXRAD pipeline diagnostics (Android / Metro).
3
- *
4
- * Verbose phases / perf: off unless {@code global.__AGUACERO_NEXRAD_DEBUG = true}
5
- * (filter {@code [Aguacero][NEXRAD]} and {@code [Aguacero][NEXRAD][PERF]}).
6
- *
7
- * Legacy pipe line-by-line bridge logs: only if {@code global.__AGUACERO_NEXRAD_PIPE_TRACE = true}.
8
- */
9
-
10
- export function nexradDiagEnabled() {
11
- return typeof globalThis !== 'undefined' && globalThis.__AGUACERO_NEXRAD_DEBUG === true;
12
- }
13
-
14
- /**
15
- * Opt-in only — line-by-line bridge logs.
16
- * @param {string} tag
17
- * @param {Record<string, unknown>} [detail]
18
- */
19
- export function nexradPipeTrace(tag, detail) {
20
- if (typeof globalThis === 'undefined' || globalThis.__AGUACERO_NEXRAD_PIPE_TRACE !== true) {
21
- return;
22
- }
23
- try {
24
- const msg =
25
- detail !== undefined && detail !== null && typeof detail === 'object'
26
- ? JSON.stringify(detail)
27
- : detail === undefined || detail === null
28
- ? ''
29
- : String(detail);
30
- console.warn(`[Aguacero][NEXRAD][PIPE] ${tag}`, msg);
31
- } catch {
32
- console.warn(`[Aguacero][NEXRAD][PIPE] ${tag}`, '(unserializable detail)');
33
- }
34
- }
35
-
36
- export function nexradDiag(phase, detail) {
37
- if (!nexradDiagEnabled()) return;
38
- if (detail !== undefined) {
39
- console.warn(`[Aguacero][NEXRAD] ${phase}`, detail);
40
- } else {
41
- console.warn(`[Aguacero][NEXRAD] ${phase}`);
42
- }
43
- }
44
-
45
- /**
46
- * @param {string} label
47
- * @returns {{ elapsedMs: () => number, end: (detail?: Record<string, unknown>) => number }}
48
- */
49
- export function nexradPerfSpan(label) {
50
- const hasPerf = typeof performance !== 'undefined' && typeof performance.now === 'function';
51
- const t0 = hasPerf ? performance.now() : Date.now();
52
- return {
53
- elapsedMs() {
54
- const t1 = hasPerf ? performance.now() : Date.now();
55
- return t1 - t0;
56
- },
57
- end(detail) {
58
- const msActual = hasPerf ? performance.now() - t0 : Date.now() - t0;
59
- if (!nexradDiagEnabled()) {
60
- return msActual;
61
- }
62
- const payload =
63
- detail !== undefined && detail !== null && typeof detail === 'object'
64
- ? { ms: msActual, ...detail }
65
- : { ms: msActual };
66
- console.warn(`[Aguacero][NEXRAD][PERF] ${label}`, payload);
67
- return msActual;
68
- },
69
- };
70
- }
71
-
72
- /**
73
- * @param {Record<string, unknown>} [extra]
74
- */
75
- export function nexradDiagBootSnapshot(extra = {}) {
76
- if (!nexradDiagEnabled()) return;
77
- const g = typeof globalThis !== 'undefined' ? globalThis : {};
78
- nexradDiag('boot.snapshot', {
79
- ...extra,
80
- workerType: typeof Worker,
81
- navigatorProduct: typeof navigator !== 'undefined' ? navigator.product : undefined,
82
- hermesInternal: typeof g.HermesInternal !== 'undefined',
83
- });
84
- }
85
-
86
- /**
87
- * @param {Uint8Array} gateData
88
- * @param {number} nGates
89
- * @param {number} nRays
90
- * @param {number} valueScale
91
- * @param {number} valueOffset
92
- * @param {number} lutMin
93
- * @param {number} lutMax
94
- */
95
- export function nexradDiagGateTextureSummary(gateData, nGates, nRays, valueScale, valueOffset, lutMin, lutMax) {
96
- if (!nexradDiagEnabled()) {
97
- return { skipped: true };
98
- }
99
- if (!gateData?.length) return { error: 'empty' };
100
- const pairCount = nGates * nRays;
101
- const expected = pairCount * 2;
102
- if (gateData.length < expected) {
103
- return { error: 'shortBuffer', len: gateData.length, expected };
104
- }
105
- let sampleN = 0;
106
- let nodataN = 0;
107
- let inLutN = 0;
108
- let minRaw = 32767;
109
- let maxRaw = -32768;
110
- let minPhys = Infinity;
111
- let maxPhys = -Infinity;
112
- const stride = Math.max(1, Math.floor(pairCount / 25000));
113
- for (let p = 0; p < pairCount; p += stride) {
114
- const o = p * 2;
115
- const lo = gateData[o];
116
- const hi = gateData[o + 1];
117
- let raw = lo + hi * 256;
118
- if (raw >= 32768) raw -= 65536;
119
- sampleN++;
120
- if (raw <= -32768) {
121
- nodataN++;
122
- continue;
123
- }
124
- if (raw < minRaw) minRaw = raw;
125
- if (raw > maxRaw) maxRaw = raw;
126
- const phys = raw * valueScale + valueOffset;
127
- if (phys < minPhys) minPhys = phys;
128
- if (phys > maxPhys) maxPhys = phys;
129
- if (phys >= lutMin && phys <= lutMax) inLutN++;
130
- }
131
- return {
132
- samples: sampleN,
133
- nodataSamples: nodataN,
134
- inLutSamples: inLutN,
135
- minRaw: minRaw <= maxRaw ? minRaw : null,
136
- maxRaw: minRaw <= maxRaw ? maxRaw : null,
137
- minPhys: Number.isFinite(minPhys) ? minPhys : null,
138
- maxPhys: Number.isFinite(maxPhys) ? maxPhys : null,
139
- lutMin,
140
- lutMax,
141
- valueScale,
142
- valueOffset,
143
- };
144
- }
1
+ /**
2
+ * NEXRAD pipeline diagnostics (Android / Metro).
3
+ *
4
+ * Verbose phases / perf: off unless {@code global.__AGUACERO_NEXRAD_DEBUG = true}
5
+ * (filter {@code [Aguacero][NEXRAD]} and {@code [Aguacero][NEXRAD][PERF]}).
6
+ *
7
+ * Legacy pipe line-by-line bridge logs: only if {@code global.__AGUACERO_NEXRAD_PIPE_TRACE = true}.
8
+ */
9
+
10
+ export function nexradDiagEnabled() {
11
+ if (typeof globalThis !== 'undefined' && globalThis.__AGUACERO_NEXRAD_DEBUG === true) {
12
+ return true;
13
+ }
14
+ if (typeof globalThis !== 'undefined' && globalThis.__AGUACERO_DEBUG__ === true) {
15
+ return true;
16
+ }
17
+ return false;
18
+ }
19
+
20
+ /**
21
+ * Opt-in only — line-by-line bridge logs.
22
+ * @param {string} tag
23
+ * @param {Record<string, unknown>} [detail]
24
+ */
25
+ export function nexradPipeTrace(tag, detail) {
26
+ if (typeof globalThis === 'undefined' || globalThis.__AGUACERO_NEXRAD_PIPE_TRACE !== true) {
27
+ return;
28
+ }
29
+ try {
30
+ const msg =
31
+ detail !== undefined && detail !== null && typeof detail === 'object'
32
+ ? JSON.stringify(detail)
33
+ : detail === undefined || detail === null
34
+ ? ''
35
+ : String(detail);
36
+ console.warn(`[Aguacero][NEXRAD][PIPE] ${tag}`, msg);
37
+ } catch {
38
+ console.warn(`[Aguacero][NEXRAD][PIPE] ${tag}`, '(unserializable detail)');
39
+ }
40
+ }
41
+
42
+ export function nexradDiag(phase, detail) {
43
+ if (!nexradDiagEnabled()) return;
44
+ if (detail !== undefined) {
45
+ console.warn(`[Aguacero][NEXRAD] ${phase}`, detail);
46
+ } else {
47
+ console.warn(`[Aguacero][NEXRAD] ${phase}`);
48
+ }
49
+ }
50
+
51
+ /**
52
+ * @param {string} label
53
+ * @returns {{ elapsedMs: () => number, end: (detail?: Record<string, unknown>) => number }}
54
+ */
55
+ export function nexradPerfSpan(label) {
56
+ const hasPerf = typeof performance !== 'undefined' && typeof performance.now === 'function';
57
+ const t0 = hasPerf ? performance.now() : Date.now();
58
+ return {
59
+ elapsedMs() {
60
+ const t1 = hasPerf ? performance.now() : Date.now();
61
+ return t1 - t0;
62
+ },
63
+ end(detail) {
64
+ const msActual = hasPerf ? performance.now() - t0 : Date.now() - t0;
65
+ if (!nexradDiagEnabled()) {
66
+ return msActual;
67
+ }
68
+ const payload =
69
+ detail !== undefined && detail !== null && typeof detail === 'object'
70
+ ? { ms: msActual, ...detail }
71
+ : { ms: msActual };
72
+ console.warn(`[Aguacero][NEXRAD][PERF] ${label}`, payload);
73
+ return msActual;
74
+ },
75
+ };
76
+ }
77
+
78
+ /**
79
+ * @param {Record<string, unknown>} [extra]
80
+ */
81
+ export function nexradDiagBootSnapshot(extra = {}) {
82
+ if (!nexradDiagEnabled()) return;
83
+ const g = typeof globalThis !== 'undefined' ? globalThis : {};
84
+ nexradDiag('boot.snapshot', {
85
+ ...extra,
86
+ workerType: typeof Worker,
87
+ navigatorProduct: typeof navigator !== 'undefined' ? navigator.product : undefined,
88
+ hermesInternal: typeof g.HermesInternal !== 'undefined',
89
+ });
90
+ }
91
+
92
+ /**
93
+ * @param {Uint8Array} gateData
94
+ * @param {number} nGates
95
+ * @param {number} nRays
96
+ * @param {number} valueScale
97
+ * @param {number} valueOffset
98
+ * @param {number} lutMin
99
+ * @param {number} lutMax
100
+ */
101
+ export function nexradDiagGateTextureSummary(gateData, nGates, nRays, valueScale, valueOffset, lutMin, lutMax) {
102
+ if (!nexradDiagEnabled()) {
103
+ return { skipped: true };
104
+ }
105
+ if (!gateData?.length) return { error: 'empty' };
106
+ const pairCount = nGates * nRays;
107
+ const expected = pairCount * 2;
108
+ if (gateData.length < expected) {
109
+ return { error: 'shortBuffer', len: gateData.length, expected };
110
+ }
111
+ let sampleN = 0;
112
+ let nodataN = 0;
113
+ let inLutN = 0;
114
+ let minRaw = 32767;
115
+ let maxRaw = -32768;
116
+ let minPhys = Infinity;
117
+ let maxPhys = -Infinity;
118
+ const stride = Math.max(1, Math.floor(pairCount / 25000));
119
+ for (let p = 0; p < pairCount; p += stride) {
120
+ const o = p * 2;
121
+ const lo = gateData[o];
122
+ const hi = gateData[o + 1];
123
+ let raw = lo + hi * 256;
124
+ if (raw >= 32768) raw -= 65536;
125
+ sampleN++;
126
+ if (raw <= -32768) {
127
+ nodataN++;
128
+ continue;
129
+ }
130
+ if (raw < minRaw) minRaw = raw;
131
+ if (raw > maxRaw) maxRaw = raw;
132
+ const phys = raw * valueScale + valueOffset;
133
+ if (phys < minPhys) minPhys = phys;
134
+ if (phys > maxPhys) maxPhys = phys;
135
+ if (phys >= lutMin && phys <= lutMax) inLutN++;
136
+ }
137
+ return {
138
+ samples: sampleN,
139
+ nodataSamples: nodataN,
140
+ inLutSamples: inLutN,
141
+ minRaw: minRaw <= maxRaw ? minRaw : null,
142
+ maxRaw: minRaw <= maxRaw ? maxRaw : null,
143
+ minPhys: Number.isFinite(minPhys) ? minPhys : null,
144
+ maxPhys: Number.isFinite(maxPhys) ? maxPhys : null,
145
+ lutMin,
146
+ lutMax,
147
+ valueScale,
148
+ valueOffset,
149
+ };
150
+ }