Improve filter phrases for warnings
This commit is contained in:
@ -1,10 +1,13 @@
|
|||||||
|
const severeWarningEvents = ["Severe Thunderstorm Warning","Destructive Severe Thunderstorm Warning","Considerable Destructive Severe Thunderstorm Warning"]
|
||||||
|
const tornadoWarningEvents = ["Tornado Warning","Radar Indicated Tornado Warning","Confirmed Tornado Warning","Tornado Emergency"]
|
||||||
|
|
||||||
let alerts = msg.payload
|
let alerts = msg.payload
|
||||||
|
|
||||||
// Filter for Severe Thunderstorm Warnings
|
// Filter for Severe Thunderstorm Warnings
|
||||||
|
|
||||||
let ts = alerts.filter(function(alert) {
|
let ts = alerts.filter(function(alert) {
|
||||||
if (alert.raw.properties &&
|
if (alert.raw.properties &&
|
||||||
(alert.raw.properties.event === "Severe Thunderstorm Warning" || alert.raw.properties.event === "Considerable Destructive Severe Thunderstorm Warning")) {
|
severeWarningEvents.includes(alert.raw.properties.event)) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -14,7 +17,7 @@ let ts = alerts.filter(function(alert) {
|
|||||||
|
|
||||||
let tstp = alerts.filter(function(alert) {
|
let tstp = alerts.filter(function(alert) {
|
||||||
if (alert.raw.properties &&
|
if (alert.raw.properties &&
|
||||||
(alert.raw.properties.event === "Severe Thunderstorm Warning" || alert.raw.properties.event === "Considerable Destructive Severe Thunderstorm Warning") &&
|
severeWarningEvents.includes(alert.raw.properties.event) &&
|
||||||
alert.raw.properties.parameters &&
|
alert.raw.properties.parameters &&
|
||||||
alert.raw.properties.parameters.tornadoDetection &&
|
alert.raw.properties.parameters.tornadoDetection &&
|
||||||
alert.raw.properties.parameters.tornadoDetection.length > 0) {
|
alert.raw.properties.parameters.tornadoDetection.length > 0) {
|
||||||
@ -36,7 +39,7 @@ let cdst = alerts.filter(function(alert) {
|
|||||||
|
|
||||||
let tornado = alerts.filter(function(alert) {
|
let tornado = alerts.filter(function(alert) {
|
||||||
if (alert.raw.properties &&
|
if (alert.raw.properties &&
|
||||||
(alert.raw.properties.event === "Tornado Warning" || alert.raw.properties.event === "Confirmed Tornado Warning")) {
|
tornadoWarningEvents.includes(alert.raw.properties.event)) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
const severeWarningEvents = ["Severe Thunderstorm Warning","Destructive Severe Thunderstorm Warning","Considerable Destructive Severe Thunderstorm Warning"]
|
||||||
|
const tornadoWarningEvents = ["Tornado Warning","Radar Indicated Tornado Warning","Confirmed Tornado Warning","Tornado Emergency"]
|
||||||
|
|
||||||
let alerts = msg.payload.features
|
let alerts = msg.payload.features
|
||||||
let tornado_possible = false
|
let tornado_possible = false
|
||||||
let considerable_destructive = false
|
let considerable_destructive = false
|
||||||
@ -7,7 +10,7 @@ let confirmed = false
|
|||||||
|
|
||||||
let ts = alerts.filter(function(alert) {
|
let ts = alerts.filter(function(alert) {
|
||||||
if (alert.properties &&
|
if (alert.properties &&
|
||||||
(alert.properties.event === "Severe Thunderstorm Warning" || alert.properties.event === "Considerable Destructive Severe Thunderstorm Warning")) {
|
severeWarningEvents.includes(alert.properties.event)) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -17,7 +20,7 @@ let ts = alerts.filter(function(alert) {
|
|||||||
|
|
||||||
let tstp = alerts.filter(function(alert) {
|
let tstp = alerts.filter(function(alert) {
|
||||||
if (alert.properties &&
|
if (alert.properties &&
|
||||||
(alert.properties.event === "Severe Thunderstorm Warning" || alert.properties.event === "Considerable Destructive Severe Thunderstorm Warning") &&
|
severeWarningEvents.includes(alert.properties.event) &&
|
||||||
alert.properties.parameters &&
|
alert.properties.parameters &&
|
||||||
alert.properties.parameters.tornadoDetection &&
|
alert.properties.parameters.tornadoDetection &&
|
||||||
alert.properties.parameters.tornadoDetection.length > 0) {
|
alert.properties.parameters.tornadoDetection.length > 0) {
|
||||||
@ -47,7 +50,7 @@ if (cdst.length > 0) {
|
|||||||
|
|
||||||
let tornado = alerts.filter(function(alert) {
|
let tornado = alerts.filter(function(alert) {
|
||||||
if (alert.properties &&
|
if (alert.properties &&
|
||||||
(alert.properties.event === "Tornado Warning" || alert.properties.event === "Confirmed Tornado Warning")) {
|
tornadoWarningEvents.includes(alert.properties.event)) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user