@aguacerowx/javascript-sdk 0.0.24 → 0.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AguaceroCore.js +794 -207
- package/dist/default-colormaps.js +32 -0
- package/dist/dictionaries.js +73 -0
- package/dist/getBundleId.js +9 -20
- package/dist/getBundleId.native.js +18 -0
- package/dist/gridDecodePipeline.js +37 -0
- package/dist/gridDecodeWorker.js +31 -0
- package/dist/index.js +172 -1
- package/dist/nexradTiltCoalesce.js +95 -0
- package/dist/nexradTilts.js +129 -0
- package/dist/nexrad_level3_catalog.js +56 -0
- package/dist/nexrad_support.js +269 -0
- package/dist/satellite_support.js +395 -0
- package/package.json +7 -1
|
@@ -70,6 +70,38 @@ const DEFAULT_COLORMAPS = exports.DEFAULT_COLORMAPS = {
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
},
|
|
73
|
+
"nexrad_kdp": {
|
|
74
|
+
units: {
|
|
75
|
+
'deg/km': {
|
|
76
|
+
colormap: [-2, "#8e8e8e", -0.5, "#4c0001", 0.25, "#a3072f", 1, "#ea73b4", 1.5, "#997eb9", 2, "#68f4f4", 2.5, "#1aba34", 3, "#11f910", 4, "#f7fc00", 5, "#ff7c10", 7, "#ffc47c", 10, "#790279"],
|
|
77
|
+
breakpoints: [-2, -0.5, 0.25, 1, 1.5, 2, 2.5, 3, 4, 5, 7, 10]
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"nexrad_l3_n0h": {
|
|
82
|
+
units: {
|
|
83
|
+
None: {
|
|
84
|
+
colormap: [0, "#d0d0d0", 1, "#696969", 2, "#ffccd5", 3, "#a8d8f0", 4, "#2566d8", 5, "#b8f5b8", 6, "#1a8f1a", 7, "#f5e6b8", 8, "#ff8787", 9, "#e02020", 10, "#5c0000", 11, "#ffd700"],
|
|
85
|
+
breakpoints: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
"nexrad_l3_hhc": {
|
|
90
|
+
units: {
|
|
91
|
+
None: {
|
|
92
|
+
colormap: [0, "#d0d0d0", 1, "#696969", 2, "#ffccd5", 3, "#a8d8f0", 4, "#2566d8", 5, "#b8f5b8", 6, "#1a8f1a", 7, "#f5e6b8", 8, "#ff8787", 9, "#e02020", 10, "#5c0000", 11, "#ffd700"],
|
|
93
|
+
breakpoints: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"nexrad_l3_eet": {
|
|
98
|
+
units: {
|
|
99
|
+
kft: {
|
|
100
|
+
colormap: [5, "#737373", 10, "#818181", 15, "#919191", 20, "#a5a5a5", 25, "#49af45", 30, "#19770b", 35, "#fedd00", 40, "#fc6901", 45, "#bf0005", 50, "#800001", 55, "#cf2ad3", 60, "#b117b5", 65, "#00b6c5", 70, "#009ca9"],
|
|
101
|
+
breakpoints: [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22]
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
},
|
|
73
105
|
"rotation": {
|
|
74
106
|
units: {
|
|
75
107
|
's⁻¹': {
|
package/dist/dictionaries.js
CHANGED
|
@@ -2915,6 +2915,69 @@ const DICTIONARIES = exports.DICTIONARIES = {
|
|
|
2915
2915
|
defaultUnit: 'm/s',
|
|
2916
2916
|
description: 'Spread of velocities within a radar sample volume. High values indicate turbulence or wind shear.'
|
|
2917
2917
|
},
|
|
2918
|
+
"nexrad_kdp": {
|
|
2919
|
+
category: "NEXRAD",
|
|
2920
|
+
variable: "Specific Differential Phase",
|
|
2921
|
+
shortname: "KDP",
|
|
2922
|
+
defaultUnit: 'deg/km',
|
|
2923
|
+
description: 'Rate of change of differential phase along the radar beam; used to estimate rain rate.'
|
|
2924
|
+
},
|
|
2925
|
+
"nexrad_l3_n0k": {
|
|
2926
|
+
category: "NEXRAD",
|
|
2927
|
+
variable: "Specific Differential Phase (Level III)",
|
|
2928
|
+
shortname: "N0K",
|
|
2929
|
+
defaultUnit: 'deg/km',
|
|
2930
|
+
description: 'Level-III KDP (digital) by tilt slot.'
|
|
2931
|
+
},
|
|
2932
|
+
"nexrad_l3_dvl": {
|
|
2933
|
+
category: "NEXRAD",
|
|
2934
|
+
variable: "Vertically Integrated Liquid",
|
|
2935
|
+
shortname: "DVL",
|
|
2936
|
+
defaultUnit: 'kg/m²',
|
|
2937
|
+
description: 'Integrated liquid water content in the column above each gate.'
|
|
2938
|
+
},
|
|
2939
|
+
"nexrad_l3_eet": {
|
|
2940
|
+
category: "NEXRAD",
|
|
2941
|
+
variable: "Enhanced Echo Tops",
|
|
2942
|
+
shortname: "EET",
|
|
2943
|
+
defaultUnit: 'kft',
|
|
2944
|
+
description: 'Height of echo tops in hundreds of feet MSL (product-dependent scaling).'
|
|
2945
|
+
},
|
|
2946
|
+
"nexrad_l3_n0h": {
|
|
2947
|
+
category: "NEXRAD",
|
|
2948
|
+
variable: "Hydrometeor Classification",
|
|
2949
|
+
shortname: "N0H",
|
|
2950
|
+
defaultUnit: 'None',
|
|
2951
|
+
description: 'Digital hydrometeor classification by class index.'
|
|
2952
|
+
},
|
|
2953
|
+
"nexrad_l3_hhc": {
|
|
2954
|
+
category: "NEXRAD",
|
|
2955
|
+
variable: "Hybrid Hydrometeor Classification",
|
|
2956
|
+
shortname: "HHC",
|
|
2957
|
+
defaultUnit: 'None',
|
|
2958
|
+
description: 'Hybrid hydrometeor classification product.'
|
|
2959
|
+
},
|
|
2960
|
+
"nexrad_l3_daa": {
|
|
2961
|
+
category: "NEXRAD",
|
|
2962
|
+
variable: "1-Hour Accumulation",
|
|
2963
|
+
shortname: "DAA",
|
|
2964
|
+
defaultUnit: 'in',
|
|
2965
|
+
description: 'One-hour precipitation accumulation.'
|
|
2966
|
+
},
|
|
2967
|
+
"nexrad_l3_du3": {
|
|
2968
|
+
category: "NEXRAD",
|
|
2969
|
+
variable: "3-Hour Accumulation",
|
|
2970
|
+
shortname: "DU3",
|
|
2971
|
+
defaultUnit: 'in',
|
|
2972
|
+
description: 'Three-hour precipitation accumulation.'
|
|
2973
|
+
},
|
|
2974
|
+
"nexrad_l3_dta": {
|
|
2975
|
+
category: "NEXRAD",
|
|
2976
|
+
variable: "Storm Total Precipitation",
|
|
2977
|
+
shortname: "DTA",
|
|
2978
|
+
defaultUnit: 'in',
|
|
2979
|
+
description: 'Storm-total precipitation accumulation.'
|
|
2980
|
+
},
|
|
2918
2981
|
"MergedAzShear_0-2kmAGL_00.50": {
|
|
2919
2982
|
category: "Rotation",
|
|
2920
2983
|
variable: "Rotation Track (Instant)",
|
|
@@ -3298,6 +3361,16 @@ const DICTIONARIES = exports.DICTIONARIES = {
|
|
|
3298
3361
|
'nexrad_rho': 'MergedRhoHV_04.00',
|
|
3299
3362
|
'nexrad_vel': 'nexrad_vel',
|
|
3300
3363
|
'nexrad_sw': 'nexrad_sw',
|
|
3364
|
+
'nexrad_kdp': 'nexrad_kdp',
|
|
3365
|
+
'nexrad_l3_n0k': 'nexrad_kdp',
|
|
3366
|
+
'nexrad_l3_n0h': 'nexrad_l3_n0h',
|
|
3367
|
+
'nexrad_l3_hhc': 'nexrad_l3_hhc',
|
|
3368
|
+
'nexrad_l3_eet': 'nexrad_l3_eet',
|
|
3369
|
+
'nexrad_l3_dvl': 'vil',
|
|
3370
|
+
'nexrad_l3_nvl': 'vil',
|
|
3371
|
+
'nexrad_l3_daa': 'tp_0_1',
|
|
3372
|
+
'nexrad_l3_du3': 'tp_0_total',
|
|
3373
|
+
'nexrad_l3_dta': 'tp_0_total',
|
|
3301
3374
|
//mrms
|
|
3302
3375
|
'MergedReflectivityQCComposite_00.50': 'refc_0',
|
|
3303
3376
|
'CREF_1HR_MAX_00.50': 'refc_0',
|
package/dist/getBundleId.js
CHANGED
|
@@ -4,23 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getBundleId = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
// to the native version.
|
|
17
|
-
getBundleIdImpl = () => DeviceInfo.getBundleId();
|
|
18
|
-
} catch (e) {
|
|
19
|
-
// If require() fails, we know we are in a non-React Native environment
|
|
20
|
-
// (like the web). We set the implementation to a "dummy" function
|
|
21
|
-
// that does nothing and returns null.
|
|
22
|
-
getBundleIdImpl = () => null;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// Export the chosen implementation.
|
|
26
|
-
const getBundleId = exports.getBundleId = getBundleIdImpl;
|
|
7
|
+
/**
|
|
8
|
+
* Default implementation for web and Node bundlers (Vite, webpack).
|
|
9
|
+
* Do not import react-native-device-info here: static analysis would pull in
|
|
10
|
+
* `react-native` (Flow sources) and break esbuild.
|
|
11
|
+
*
|
|
12
|
+
* Metro resolves `getBundleId.native.js` on iOS/Android instead of this file.
|
|
13
|
+
*/
|
|
14
|
+
const getBundleId = () => null;
|
|
15
|
+
exports.getBundleId = getBundleId;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getBundleId = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* React Native (Metro picks this file over getBundleId.js on native platforms).
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
let getBundleIdImpl;
|
|
12
|
+
try {
|
|
13
|
+
const DeviceInfo = require('react-native-device-info');
|
|
14
|
+
getBundleIdImpl = () => DeviceInfo.getBundleId();
|
|
15
|
+
} catch {
|
|
16
|
+
getBundleIdImpl = () => null;
|
|
17
|
+
}
|
|
18
|
+
const getBundleId = exports.getBundleId = getBundleIdImpl;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.processCompressedGrid = processCompressedGrid;
|
|
7
|
+
var _fzstd = require("fzstd");
|
|
8
|
+
function reconstructData(decompressedDeltas, encoding) {
|
|
9
|
+
const expectedLength = encoding.length;
|
|
10
|
+
const reconstructedData = new Int8Array(expectedLength);
|
|
11
|
+
if (decompressedDeltas.length > 0 && expectedLength > 0) {
|
|
12
|
+
reconstructedData[0] = decompressedDeltas[0] > 127 ? decompressedDeltas[0] - 256 : decompressedDeltas[0];
|
|
13
|
+
for (let i = 1; i < expectedLength; i++) {
|
|
14
|
+
const delta = decompressedDeltas[i] > 127 ? decompressedDeltas[i] - 256 : decompressedDeltas[i];
|
|
15
|
+
reconstructedData[i] = reconstructedData[i - 1] + delta;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return new Uint8Array(reconstructedData.buffer);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* zstd decompress → delta reconstruction → unsigned byte offset for GPU lookup.
|
|
23
|
+
* Used on the main thread as a fallback and inside {@link ./gridDecodeWorker.js}.
|
|
24
|
+
*/
|
|
25
|
+
function processCompressedGrid(compressedData, encoding) {
|
|
26
|
+
const decompressedDeltas = (0, _fzstd.decompress)(compressedData);
|
|
27
|
+
const finalData = reconstructData(decompressedDeltas, encoding);
|
|
28
|
+
const transformedData = new Uint8Array(finalData.length);
|
|
29
|
+
for (let i = 0; i < finalData.length; i++) {
|
|
30
|
+
const signedValue = finalData[i] > 127 ? finalData[i] - 256 : finalData[i];
|
|
31
|
+
transformedData[i] = signedValue + 128;
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
data: transformedData,
|
|
35
|
+
encoding
|
|
36
|
+
};
|
|
37
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _gridDecodePipeline = require("./gridDecodePipeline.js");
|
|
4
|
+
self.onmessage = e => {
|
|
5
|
+
const {
|
|
6
|
+
id,
|
|
7
|
+
encoding,
|
|
8
|
+
compressedBuffer,
|
|
9
|
+
compressedByteOffset,
|
|
10
|
+
compressedByteLength
|
|
11
|
+
} = e.data;
|
|
12
|
+
try {
|
|
13
|
+
const compressedData = new Uint8Array(compressedBuffer, compressedByteOffset, compressedByteLength);
|
|
14
|
+
const {
|
|
15
|
+
data,
|
|
16
|
+
encoding: enc
|
|
17
|
+
} = (0, _gridDecodePipeline.processCompressedGrid)(compressedData, encoding);
|
|
18
|
+
self.postMessage({
|
|
19
|
+
id,
|
|
20
|
+
encoding: enc,
|
|
21
|
+
dataBuffer: data.buffer,
|
|
22
|
+
dataByteOffset: data.byteOffset,
|
|
23
|
+
dataByteLength: data.byteLength
|
|
24
|
+
}, [data.buffer]);
|
|
25
|
+
} catch (err) {
|
|
26
|
+
self.postMessage({
|
|
27
|
+
id,
|
|
28
|
+
error: (err === null || err === void 0 ? void 0 : err.message) || String(err)
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -3,12 +3,43 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
AguaceroCore: true,
|
|
8
|
+
EventEmitter: true,
|
|
9
|
+
THEME_CONFIGS: true,
|
|
10
|
+
DICTIONARIES: true,
|
|
11
|
+
DEFAULT_COLORMAPS: true,
|
|
12
|
+
getUnitConversionFunction: true,
|
|
13
|
+
SATELLITE_FRAMES_URL: true,
|
|
14
|
+
GOES_EAST_SATELLITE_SECTORS: true,
|
|
15
|
+
GOES_SATELLITE_CHANNELS: true,
|
|
16
|
+
GOES_SATELLITE_CHANNEL_LABELS: true,
|
|
17
|
+
SATELLITE_DURATION_CONFIG: true,
|
|
18
|
+
TIMELINE_DURATION_MAX_HOURS: true,
|
|
19
|
+
TIMELINE_DURATION_HOUR_VALUES: true,
|
|
20
|
+
formatTimelineDurationValue: true,
|
|
21
|
+
normalizeTimelineDurationValue: true,
|
|
22
|
+
parseTimelineDurationHours: true,
|
|
23
|
+
resolveSatelliteDurationOption: true,
|
|
24
|
+
getDefaultSatelliteDurationOption: true,
|
|
25
|
+
buildSatelliteTimelineForSelection: true,
|
|
26
|
+
getAllGoesEastSatelliteSelections: true,
|
|
27
|
+
calculateUnixTimeFromSatelliteKey: true,
|
|
28
|
+
resolveSatelliteS3FileName: true,
|
|
29
|
+
resolveSatelliteSectorLabel: true
|
|
30
|
+
};
|
|
6
31
|
Object.defineProperty(exports, "AguaceroCore", {
|
|
7
32
|
enumerable: true,
|
|
8
33
|
get: function () {
|
|
9
34
|
return _AguaceroCore.AguaceroCore;
|
|
10
35
|
}
|
|
11
36
|
});
|
|
37
|
+
Object.defineProperty(exports, "DEFAULT_COLORMAPS", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function () {
|
|
40
|
+
return _defaultColormaps.DEFAULT_COLORMAPS;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
12
43
|
Object.defineProperty(exports, "DICTIONARIES", {
|
|
13
44
|
enumerable: true,
|
|
14
45
|
get: function () {
|
|
@@ -21,20 +52,160 @@ Object.defineProperty(exports, "EventEmitter", {
|
|
|
21
52
|
return _events.EventEmitter;
|
|
22
53
|
}
|
|
23
54
|
});
|
|
55
|
+
Object.defineProperty(exports, "GOES_EAST_SATELLITE_SECTORS", {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
get: function () {
|
|
58
|
+
return _satellite_support.GOES_EAST_SATELLITE_SECTORS;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
Object.defineProperty(exports, "GOES_SATELLITE_CHANNELS", {
|
|
62
|
+
enumerable: true,
|
|
63
|
+
get: function () {
|
|
64
|
+
return _satellite_support.GOES_SATELLITE_CHANNELS;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
Object.defineProperty(exports, "GOES_SATELLITE_CHANNEL_LABELS", {
|
|
68
|
+
enumerable: true,
|
|
69
|
+
get: function () {
|
|
70
|
+
return _satellite_support.GOES_SATELLITE_CHANNEL_LABELS;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
Object.defineProperty(exports, "SATELLITE_DURATION_CONFIG", {
|
|
74
|
+
enumerable: true,
|
|
75
|
+
get: function () {
|
|
76
|
+
return _satellite_support.SATELLITE_DURATION_CONFIG;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
Object.defineProperty(exports, "SATELLITE_FRAMES_URL", {
|
|
80
|
+
enumerable: true,
|
|
81
|
+
get: function () {
|
|
82
|
+
return _satellite_support.SATELLITE_FRAMES_URL;
|
|
83
|
+
}
|
|
84
|
+
});
|
|
24
85
|
Object.defineProperty(exports, "THEME_CONFIGS", {
|
|
25
86
|
enumerable: true,
|
|
26
87
|
get: function () {
|
|
27
88
|
return _mapStyles.THEME_CONFIGS;
|
|
28
89
|
}
|
|
29
90
|
});
|
|
91
|
+
Object.defineProperty(exports, "TIMELINE_DURATION_HOUR_VALUES", {
|
|
92
|
+
enumerable: true,
|
|
93
|
+
get: function () {
|
|
94
|
+
return _satellite_support.TIMELINE_DURATION_HOUR_VALUES;
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
Object.defineProperty(exports, "TIMELINE_DURATION_MAX_HOURS", {
|
|
98
|
+
enumerable: true,
|
|
99
|
+
get: function () {
|
|
100
|
+
return _satellite_support.TIMELINE_DURATION_MAX_HOURS;
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
Object.defineProperty(exports, "buildSatelliteTimelineForSelection", {
|
|
104
|
+
enumerable: true,
|
|
105
|
+
get: function () {
|
|
106
|
+
return _satellite_support.buildSatelliteTimelineForSelection;
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
Object.defineProperty(exports, "calculateUnixTimeFromSatelliteKey", {
|
|
110
|
+
enumerable: true,
|
|
111
|
+
get: function () {
|
|
112
|
+
return _satellite_support.calculateUnixTimeFromSatelliteKey;
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
Object.defineProperty(exports, "formatTimelineDurationValue", {
|
|
116
|
+
enumerable: true,
|
|
117
|
+
get: function () {
|
|
118
|
+
return _satellite_support.formatTimelineDurationValue;
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
Object.defineProperty(exports, "getAllGoesEastSatelliteSelections", {
|
|
122
|
+
enumerable: true,
|
|
123
|
+
get: function () {
|
|
124
|
+
return _satellite_support.getAllGoesEastSatelliteSelections;
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
Object.defineProperty(exports, "getDefaultSatelliteDurationOption", {
|
|
128
|
+
enumerable: true,
|
|
129
|
+
get: function () {
|
|
130
|
+
return _satellite_support.getDefaultSatelliteDurationOption;
|
|
131
|
+
}
|
|
132
|
+
});
|
|
30
133
|
Object.defineProperty(exports, "getUnitConversionFunction", {
|
|
31
134
|
enumerable: true,
|
|
32
135
|
get: function () {
|
|
33
136
|
return _unitConversions.getUnitConversionFunction;
|
|
34
137
|
}
|
|
35
138
|
});
|
|
139
|
+
Object.defineProperty(exports, "normalizeTimelineDurationValue", {
|
|
140
|
+
enumerable: true,
|
|
141
|
+
get: function () {
|
|
142
|
+
return _satellite_support.normalizeTimelineDurationValue;
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
Object.defineProperty(exports, "parseTimelineDurationHours", {
|
|
146
|
+
enumerable: true,
|
|
147
|
+
get: function () {
|
|
148
|
+
return _satellite_support.parseTimelineDurationHours;
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
Object.defineProperty(exports, "resolveSatelliteDurationOption", {
|
|
152
|
+
enumerable: true,
|
|
153
|
+
get: function () {
|
|
154
|
+
return _satellite_support.resolveSatelliteDurationOption;
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
Object.defineProperty(exports, "resolveSatelliteS3FileName", {
|
|
158
|
+
enumerable: true,
|
|
159
|
+
get: function () {
|
|
160
|
+
return _satellite_support.resolveSatelliteS3FileName;
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
Object.defineProperty(exports, "resolveSatelliteSectorLabel", {
|
|
164
|
+
enumerable: true,
|
|
165
|
+
get: function () {
|
|
166
|
+
return _satellite_support.resolveSatelliteSectorLabel;
|
|
167
|
+
}
|
|
168
|
+
});
|
|
36
169
|
var _AguaceroCore = require("./AguaceroCore.js");
|
|
37
170
|
var _events = require("./events.js");
|
|
38
171
|
var _mapStyles = require("./map-styles.js");
|
|
39
172
|
var _dictionaries = require("./dictionaries.js");
|
|
40
|
-
var
|
|
173
|
+
var _defaultColormaps = require("./default-colormaps.js");
|
|
174
|
+
var _unitConversions = require("./unitConversions.js");
|
|
175
|
+
var _satellite_support = require("./satellite_support.js");
|
|
176
|
+
var _nexradTilts = require("./nexradTilts.js");
|
|
177
|
+
Object.keys(_nexradTilts).forEach(function (key) {
|
|
178
|
+
if (key === "default" || key === "__esModule") return;
|
|
179
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
180
|
+
if (key in exports && exports[key] === _nexradTilts[key]) return;
|
|
181
|
+
Object.defineProperty(exports, key, {
|
|
182
|
+
enumerable: true,
|
|
183
|
+
get: function () {
|
|
184
|
+
return _nexradTilts[key];
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
var _nexradTiltCoalesce = require("./nexradTiltCoalesce.js");
|
|
189
|
+
Object.keys(_nexradTiltCoalesce).forEach(function (key) {
|
|
190
|
+
if (key === "default" || key === "__esModule") return;
|
|
191
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
192
|
+
if (key in exports && exports[key] === _nexradTiltCoalesce[key]) return;
|
|
193
|
+
Object.defineProperty(exports, key, {
|
|
194
|
+
enumerable: true,
|
|
195
|
+
get: function () {
|
|
196
|
+
return _nexradTiltCoalesce[key];
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
var _nexrad_support = require("./nexrad_support.js");
|
|
201
|
+
Object.keys(_nexrad_support).forEach(function (key) {
|
|
202
|
+
if (key === "default" || key === "__esModule") return;
|
|
203
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
204
|
+
if (key in exports && exports[key] === _nexrad_support[key]) return;
|
|
205
|
+
Object.defineProperty(exports, key, {
|
|
206
|
+
enumerable: true,
|
|
207
|
+
get: function () {
|
|
208
|
+
return _nexrad_support[key];
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
});
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.NEXRAD_TILT_COALESCE_MAX_GAP = void 0;
|
|
7
|
+
exports.chainCoalesceToCanonical = chainCoalesceToCanonical;
|
|
8
|
+
exports.coalesceNexradTiltOptionsForDisplay = coalesceNexradTiltOptionsForDisplay;
|
|
9
|
+
exports.nexradLayerTiltToDisplayOption = nexradLayerTiltToDisplayOption;
|
|
10
|
+
/**
|
|
11
|
+
* NEXRAD tilt coalescing (matches aguacero-frontend `nexradTiltCoalesce.ts`).
|
|
12
|
+
* Adjacent manifest tilts within {@link NEXRAD_TILT_COALESCE_MAX_GAP}° are merged for UI/listings:
|
|
13
|
+
* pairs → higher tilt; runs of three or more consecutive steps merge the first two into the lower tilt.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/** Adjacent tilts (sorted) within this gap share one listing / control. */
|
|
17
|
+
const NEXRAD_TILT_COALESCE_MAX_GAP = exports.NEXRAD_TILT_COALESCE_MAX_GAP = 0.1;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @param {number[]} segment
|
|
21
|
+
* @param {Map<number, number>} map
|
|
22
|
+
*/
|
|
23
|
+
function mergeCoalesceSegment(segment, map) {
|
|
24
|
+
if (segment.length === 0) return;
|
|
25
|
+
if (segment.length === 1) {
|
|
26
|
+
map.set(segment[0], segment[0]);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
if (segment.length === 2) {
|
|
30
|
+
const canonical = Math.max(segment[0], segment[1]);
|
|
31
|
+
map.set(segment[0], canonical);
|
|
32
|
+
map.set(segment[1], canonical);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const low = segment[0];
|
|
36
|
+
map.set(segment[0], low);
|
|
37
|
+
map.set(segment[1], low);
|
|
38
|
+
mergeCoalesceSegment(segment.slice(2), map);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @param {number[]} sortedUnique
|
|
43
|
+
* @returns {Map<number, number>}
|
|
44
|
+
*/
|
|
45
|
+
function chainCoalesceToCanonical(sortedUnique) {
|
|
46
|
+
const map = new Map();
|
|
47
|
+
let i = 0;
|
|
48
|
+
while (i < sortedUnique.length) {
|
|
49
|
+
let j = i + 1;
|
|
50
|
+
while (j < sortedUnique.length && sortedUnique[j] - sortedUnique[j - 1] <= NEXRAD_TILT_COALESCE_MAX_GAP + 1e-9) {
|
|
51
|
+
j++;
|
|
52
|
+
}
|
|
53
|
+
const segment = sortedUnique.slice(i, j);
|
|
54
|
+
mergeCoalesceSegment(segment, map);
|
|
55
|
+
i = j;
|
|
56
|
+
}
|
|
57
|
+
return map;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Manifest tilt list with adjacent options merged (pairs → higher; triple+ splits per merge rules).
|
|
62
|
+
* @param {number[]} tilts
|
|
63
|
+
* @returns {number[]}
|
|
64
|
+
*/
|
|
65
|
+
function coalesceNexradTiltOptionsForDisplay(tilts) {
|
|
66
|
+
const sorted = [...new Set(tilts)].filter(t => Number.isFinite(t)).sort((a, b) => a - b);
|
|
67
|
+
if (sorted.length <= 1) return sorted;
|
|
68
|
+
const tiltToCanonical = chainCoalesceToCanonical(sorted);
|
|
69
|
+
const reps = [];
|
|
70
|
+
let prevRep;
|
|
71
|
+
for (const t of sorted) {
|
|
72
|
+
const c = tiltToCanonical.get(t);
|
|
73
|
+
if (c === undefined) continue;
|
|
74
|
+
if (c !== prevRep) {
|
|
75
|
+
reps.push(c);
|
|
76
|
+
prevRep = c;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return reps;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Map stored/clamped tilt to the coalesced elevation value (same rules as {@link coalesceNexradTiltOptionsForDisplay}).
|
|
84
|
+
* @param {number} layerTilt
|
|
85
|
+
* @param {number[]} manifestTilts raw manifest tilts (before coalescing)
|
|
86
|
+
* @returns {number}
|
|
87
|
+
*/
|
|
88
|
+
function nexradLayerTiltToDisplayOption(layerTilt, manifestTilts) {
|
|
89
|
+
const sorted = [...new Set(manifestTilts)].filter(t => Number.isFinite(t)).sort((a, b) => a - b);
|
|
90
|
+
if (sorted.length === 0) return layerTilt;
|
|
91
|
+
const tiltToCanonical = chainCoalesceToCanonical(sorted);
|
|
92
|
+
if (tiltToCanonical.has(layerTilt)) return tiltToCanonical.get(layerTilt);
|
|
93
|
+
const nearest = sorted.reduce((best, x) => Math.abs(x - layerTilt) < Math.abs(best - layerTilt) ? x : best, sorted[0]);
|
|
94
|
+
return tiltToCanonical.get(nearest) ?? layerTilt;
|
|
95
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.RADAR_TILTS_MANIFEST_URL = void 0;
|
|
7
|
+
exports.clampNexradTiltForVariable = clampNexradTiltForVariable;
|
|
8
|
+
exports.fetchRadarTiltsManifestFromNetwork = fetchRadarTiltsManifestFromNetwork;
|
|
9
|
+
exports.formatTiltForApi = formatTiltForApi;
|
|
10
|
+
exports.getDefaultRadarTilt = getDefaultRadarTilt;
|
|
11
|
+
exports.getRadarTilts = getRadarTilts;
|
|
12
|
+
exports.getRadarTiltsManifest = getRadarTiltsManifest;
|
|
13
|
+
exports.isNexradTdwrSiteId = isNexradTdwrSiteId;
|
|
14
|
+
exports.isTerminalRadar = isTerminalRadar;
|
|
15
|
+
exports.setRadarTiltsManifest = setRadarTiltsManifest;
|
|
16
|
+
/**
|
|
17
|
+
* NEXRAD tilt helpers (mirrors aguacero-frontend dictionaries + radar tilts manifest behavior).
|
|
18
|
+
* When {@link setRadarTiltsManifest} has been called with a non-empty map, per-site tilts follow it.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
const WSR88D_TILTS = [0.5, 0.9, 1.3, 1.8, 2.4, 3.1, 4.0, 5.1, 6.4];
|
|
22
|
+
const TDWR_TILTS = [0.3, 1.0, 2, 6.5, 8.8, 16.0, 21.3];
|
|
23
|
+
const WSR88D_SITE_IDS_WITH_T_PREFIX = new Set(['TJUA']);
|
|
24
|
+
|
|
25
|
+
/** @type {Record<string, { g1_tilts: number[]; g2_tilts: number[]; last_seen?: number }>} */
|
|
26
|
+
let manifestBySite = {};
|
|
27
|
+
function setRadarTiltsManifest(map) {
|
|
28
|
+
manifestBySite = map && typeof map === 'object' ? map : {};
|
|
29
|
+
}
|
|
30
|
+
function getRadarTiltsManifest() {
|
|
31
|
+
return manifestBySite;
|
|
32
|
+
}
|
|
33
|
+
function isNexradTdwrSiteId(siteId) {
|
|
34
|
+
const id = String(siteId ?? '').trim().toUpperCase();
|
|
35
|
+
if (!id) return false;
|
|
36
|
+
if (WSR88D_SITE_IDS_WITH_T_PREFIX.has(id)) return false;
|
|
37
|
+
return id.startsWith('T');
|
|
38
|
+
}
|
|
39
|
+
function isTerminalRadar(siteId) {
|
|
40
|
+
return isNexradTdwrSiteId(siteId);
|
|
41
|
+
}
|
|
42
|
+
const NEXRAD_G2_VARIABLES = new Set(['VEL', 'SW']);
|
|
43
|
+
const TDWR_DUAL_POL_CAPPED = new Set(['ZDR', 'PHI', 'RHO', 'KDP']);
|
|
44
|
+
const TDWR_DUAL_POL_MAX_TILT = 0.3;
|
|
45
|
+
function uniqSorted(nums) {
|
|
46
|
+
const arr = nums.filter(n => typeof n === 'number' && Number.isFinite(n));
|
|
47
|
+
const rounded = arr.map(n => Math.round(n * 1000) / 1000);
|
|
48
|
+
return [...new Set(rounded)].sort((a, b) => a - b);
|
|
49
|
+
}
|
|
50
|
+
function computeRadarTiltsFromManifestEntry(entry, siteId, radarVariable) {
|
|
51
|
+
const v = (radarVariable || 'REF').toUpperCase();
|
|
52
|
+
let base;
|
|
53
|
+
if (NEXRAD_G2_VARIABLES.has(v)) {
|
|
54
|
+
base = uniqSorted(entry.g2_tilts || []);
|
|
55
|
+
} else {
|
|
56
|
+
base = uniqSorted([...(entry.g1_tilts || []), ...(entry.g2_tilts || [])]);
|
|
57
|
+
}
|
|
58
|
+
if (isNexradTdwrSiteId(siteId) && TDWR_DUAL_POL_CAPPED.has(v)) {
|
|
59
|
+
return base.filter(t => t <= TDWR_DUAL_POL_MAX_TILT);
|
|
60
|
+
}
|
|
61
|
+
return base;
|
|
62
|
+
}
|
|
63
|
+
function getDefaultTiltFromManifestEntry(entry) {
|
|
64
|
+
const g1 = entry.g1_tilts;
|
|
65
|
+
if (!Array.isArray(g1) || g1.length === 0) return null;
|
|
66
|
+
const sorted = uniqSorted(g1);
|
|
67
|
+
return sorted[0] ?? null;
|
|
68
|
+
}
|
|
69
|
+
function getDefaultRadarTilt(siteId) {
|
|
70
|
+
const id = siteId === null || siteId === void 0 ? void 0 : siteId.toUpperCase();
|
|
71
|
+
const entry = id ? manifestBySite[id] : undefined;
|
|
72
|
+
if (entry) {
|
|
73
|
+
const t = getDefaultTiltFromManifestEntry(entry);
|
|
74
|
+
if (t != null) return t;
|
|
75
|
+
}
|
|
76
|
+
return isTerminalRadar(siteId) ? 0.3 : 0.5;
|
|
77
|
+
}
|
|
78
|
+
function getRadarTilts(siteId, radarVariable) {
|
|
79
|
+
const id = siteId === null || siteId === void 0 ? void 0 : siteId.toUpperCase();
|
|
80
|
+
const entry = id ? manifestBySite[id] : undefined;
|
|
81
|
+
if (entry) {
|
|
82
|
+
const fromManifest = computeRadarTiltsFromManifestEntry(entry, siteId, radarVariable);
|
|
83
|
+
if (fromManifest.length) return fromManifest;
|
|
84
|
+
}
|
|
85
|
+
const base = isTerminalRadar(siteId) ? TDWR_TILTS : WSR88D_TILTS;
|
|
86
|
+
if (!radarVariable || !isTerminalRadar(siteId)) return [...base];
|
|
87
|
+
const v = radarVariable.toUpperCase();
|
|
88
|
+
if (['ZDR', 'PHI', 'RHO'].includes(v)) {
|
|
89
|
+
return base.filter(t => t <= TDWR_DUAL_POL_MAX_TILT);
|
|
90
|
+
}
|
|
91
|
+
return [...base];
|
|
92
|
+
}
|
|
93
|
+
function clampNexradTiltForVariable(siteId, variable, tilt) {
|
|
94
|
+
if (!isTerminalRadar(siteId)) return tilt;
|
|
95
|
+
const v = (variable || 'REF').toUpperCase();
|
|
96
|
+
if (['ZDR', 'PHI', 'RHO'].includes(v)) {
|
|
97
|
+
return Math.min(tilt, TDWR_DUAL_POL_MAX_TILT);
|
|
98
|
+
}
|
|
99
|
+
return tilt;
|
|
100
|
+
}
|
|
101
|
+
function formatTiltForApi(tilt) {
|
|
102
|
+
return tilt.toFixed(2);
|
|
103
|
+
}
|
|
104
|
+
const RADAR_TILTS_MANIFEST_URL = exports.RADAR_TILTS_MANIFEST_URL = 'https://radar-tilts.s3.us-east-2.amazonaws.com/manifest.json';
|
|
105
|
+
async function fetchRadarTiltsManifestFromNetwork() {
|
|
106
|
+
try {
|
|
107
|
+
const res = await fetch(RADAR_TILTS_MANIFEST_URL, {
|
|
108
|
+
cache: 'no-store'
|
|
109
|
+
});
|
|
110
|
+
if (!res.ok) return null;
|
|
111
|
+
const raw = await res.json();
|
|
112
|
+
if (!raw || typeof raw !== 'object' || Array.isArray(raw)) return null;
|
|
113
|
+
const out = {};
|
|
114
|
+
for (const [key, val] of Object.entries(raw)) {
|
|
115
|
+
if (!val || typeof val !== 'object' || Array.isArray(val)) continue;
|
|
116
|
+
const g1 = val.g1_tilts;
|
|
117
|
+
const g2 = val.g2_tilts;
|
|
118
|
+
if (!Array.isArray(g1) || !Array.isArray(g2)) continue;
|
|
119
|
+
out[key.toUpperCase()] = {
|
|
120
|
+
g1_tilts: g1.filter(n => typeof n === 'number' && Number.isFinite(n)),
|
|
121
|
+
g2_tilts: g2.filter(n => typeof n === 'number' && Number.isFinite(n)),
|
|
122
|
+
last_seen: typeof val.last_seen === 'number' ? val.last_seen : undefined
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
return Object.keys(out).length ? out : null;
|
|
126
|
+
} catch {
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
}
|