@aguacerowx/javascript-sdk 0.0.13 → 0.0.15
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 +1 -29
package/package.json
CHANGED
package/src/AguaceroCore.js
CHANGED
|
@@ -106,16 +106,13 @@ export class AguaceroCore extends EventEmitter {
|
|
|
106
106
|
availableTimestamps = [...timestamps].reverse();
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
// --- NEW CODE: Filter out hour 0 for ptypeRefl + HRRR ---
|
|
110
109
|
let availableHours = this.state.isMRMS
|
|
111
110
|
? []
|
|
112
111
|
: (this.modelStatus?.[this.state.model]?.[this.state.date]?.[this.state.run] || []);
|
|
113
112
|
|
|
114
|
-
|
|
115
|
-
if (this.state.variable === 'ptypeRefl' && this.state.model === 'hrrr' && availableHours.length > 0) {
|
|
113
|
+
if (!this.state.isMRMS && this.state.variable === 'ptypeRefl' && this.state.model === 'hrrr' && availableHours.length > 0) {
|
|
116
114
|
availableHours = availableHours.filter(hour => hour !== 0);
|
|
117
115
|
}
|
|
118
|
-
// --- END NEW CODE ---
|
|
119
116
|
|
|
120
117
|
const eventPayload = {
|
|
121
118
|
...this.state,
|
|
@@ -573,30 +570,6 @@ export class AguaceroCore extends EventEmitter {
|
|
|
573
570
|
const conversionFunc = getUnitConversionFunction(dataNativeUnit, displayUnit);
|
|
574
571
|
let displayValue = conversionFunc ? conversionFunc(nativeValue) : nativeValue;
|
|
575
572
|
|
|
576
|
-
// --- START: ADDED CODE ---
|
|
577
|
-
|
|
578
|
-
// Create a variable to hold the precipitation type, if any.
|
|
579
|
-
let precipType = null;
|
|
580
|
-
|
|
581
|
-
// Check if the current variable is one of the special ptype variables.
|
|
582
|
-
if (variable === 'ptypeRefl' || variable === 'ptypeRate') {
|
|
583
|
-
const value = nativeValue; // Use the raw, unconverted value for ptype logic
|
|
584
|
-
|
|
585
|
-
if (value >= 100 && value < 200) {
|
|
586
|
-
displayValue -= 100;
|
|
587
|
-
precipType = 'Snow';
|
|
588
|
-
} else if (value >= 200 && value < 300) {
|
|
589
|
-
displayValue -= 200;
|
|
590
|
-
precipType = 'Frzg Rain'; // Abbreviated for tooltips
|
|
591
|
-
} else if (value >= 300 && value < 400) {
|
|
592
|
-
displayValue -= 300;
|
|
593
|
-
precipType = 'Ice Pellets';
|
|
594
|
-
} else {
|
|
595
|
-
precipType = 'Rain';
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
// Return the final payload, now including the precipType.
|
|
600
573
|
return {
|
|
601
574
|
lngLat: { lng, lat },
|
|
602
575
|
variable: {
|
|
@@ -605,7 +578,6 @@ export class AguaceroCore extends EventEmitter {
|
|
|
605
578
|
},
|
|
606
579
|
value: displayValue,
|
|
607
580
|
unit: displayUnit,
|
|
608
|
-
precipType: precipType // NEW: Add this to the return object
|
|
609
581
|
};
|
|
610
582
|
} catch (error) {
|
|
611
583
|
return null;
|