@aguacerowx/javascript-sdk 0.0.22 → 0.0.23
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/package.json +1 -1
- package/src/AguaceroCore.js +19 -8
- package/src/nexrad_support.js +4 -3
package/package.json
CHANGED
package/src/AguaceroCore.js
CHANGED
|
@@ -228,11 +228,19 @@ export class AguaceroCore extends EventEmitter {
|
|
|
228
228
|
patch.isNexrad !== undefined ? Boolean(patch.isNexrad) : this.state.isNexrad;
|
|
229
229
|
if (willBeNexrad && 'nexradProduct' in patch && patch.nexradProduct != null) {
|
|
230
230
|
const p = (patch.nexradProduct || 'REF').toUpperCase();
|
|
231
|
+
const prevP = (this.state.nexradProduct || 'REF').toUpperCase();
|
|
231
232
|
const ds = inferNexradDataSourceForProduct(p);
|
|
232
233
|
patch.nexradProduct = p;
|
|
233
234
|
patch.nexradDataSource = ds;
|
|
234
235
|
patch.variable = nexradColormapFldKey(ds, p);
|
|
235
|
-
|
|
236
|
+
if (!('nexradStormRelative' in newState)) {
|
|
237
|
+
// Default: base radial velocity (L3 N0G only) — one fetch per time; fast scrub.
|
|
238
|
+
// SRV (N0G + N0S) is opt-in: setNexradStormRelative(true) or pass nexradStormRelative in setState.
|
|
239
|
+
// Re-selecting the same product (e.g. VEL → VEL) leaves the current SRV flag alone.
|
|
240
|
+
if (p !== 'VEL' || prevP !== 'VEL') {
|
|
241
|
+
patch.nexradStormRelative = false;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
236
244
|
}
|
|
237
245
|
if ('forecastHour' in patch && patch.forecastHour != null) {
|
|
238
246
|
patch.forecastHour = Number(patch.forecastHour);
|
|
@@ -373,13 +381,6 @@ export class AguaceroCore extends EventEmitter {
|
|
|
373
381
|
return `${site}_${group}_${elevNormUse}`;
|
|
374
382
|
}
|
|
375
383
|
|
|
376
|
-
/** Storm-relative Level-III velocity (N0G + N0S) — matches aguacero-frontend `level3StormRelative` for VEL. */
|
|
377
|
-
_nexradStormRelativeFor(nexradDataSource, nexradProduct) {
|
|
378
|
-
const ds = nexradDataSource === 'level3' ? 'level3' : 'level2';
|
|
379
|
-
const p = (nexradProduct || 'REF').toUpperCase();
|
|
380
|
-
return ds === 'level3' && p === 'VEL';
|
|
381
|
-
}
|
|
382
|
-
|
|
383
384
|
_emitStateChange() {
|
|
384
385
|
const { colormap, baseUnit } = this._getColormapForVariable(this.state.variable);
|
|
385
386
|
const toUnit = this._getTargetUnit(baseUnit, this.state.units);
|
|
@@ -1094,6 +1095,16 @@ export class AguaceroCore extends EventEmitter {
|
|
|
1094
1095
|
await this.refreshNexradTimes();
|
|
1095
1096
|
}
|
|
1096
1097
|
|
|
1098
|
+
/**
|
|
1099
|
+
* Opt-in storm-relative velocity (L3: N0G + N0S). When off (default), only base radial velocity is used (faster).
|
|
1100
|
+
* @param {boolean} enabled
|
|
1101
|
+
*/
|
|
1102
|
+
async setNexradStormRelative(enabled) {
|
|
1103
|
+
if (!this.state.isNexrad) return;
|
|
1104
|
+
await this.setState({ nexradStormRelative: Boolean(enabled) });
|
|
1105
|
+
await this.refreshNexradTimes();
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1097
1108
|
async setNexradTimestamp(ts) {
|
|
1098
1109
|
if (!this.state.isNexrad) return;
|
|
1099
1110
|
await this.setState({ nexradTimestamp: ts != null ? Number(ts) : null });
|
package/src/nexrad_support.js
CHANGED
|
@@ -277,15 +277,16 @@ export function getRawNexradTiltsForCoalesce(siteId, nexradDataSource, nexradPro
|
|
|
277
277
|
const v = (nexradProduct || 'REF').toUpperCase();
|
|
278
278
|
const ds = nexradDataSource === 'level3' ? 'level3' : 'level2';
|
|
279
279
|
const tilts = getRadarTilts(siteId, v);
|
|
280
|
+
/** L3 super-res VEL (N*G) uses the same first-N manifest slots as KDP/N0H — not the full L2 g2-only list. */
|
|
281
|
+
if (v === 'VEL') {
|
|
282
|
+
return tilts.slice(0, L3_TILT_INDEX_MANIFEST_SLOTS);
|
|
283
|
+
}
|
|
280
284
|
if (ds === 'level2') {
|
|
281
285
|
return [...tilts];
|
|
282
286
|
}
|
|
283
287
|
if (v === 'KDP' || v === 'N0H') {
|
|
284
288
|
return tilts.slice(0, L3_TILT_INDEX_MANIFEST_SLOTS);
|
|
285
289
|
}
|
|
286
|
-
if (v === 'VEL') {
|
|
287
|
-
return [...tilts];
|
|
288
|
-
}
|
|
289
290
|
return [];
|
|
290
291
|
}
|
|
291
292
|
|