Add stats for considerable destructive t-storm, confirmed tornado
This commit is contained in:
@ -4,7 +4,7 @@ let alerts = msg.payload
|
||||
|
||||
let ts = alerts.filter(function(alert) {
|
||||
if (alert.raw.properties &&
|
||||
alert.raw.properties.event === "Severe Thunderstorm Warning") {
|
||||
(alert.raw.properties.event === "Severe Thunderstorm Warning" || alert.raw.properties.event === "Considerable Destructive Severe Thunderstorm Warning")) {
|
||||
return true
|
||||
}
|
||||
})
|
||||
@ -14,7 +14,7 @@ let ts = alerts.filter(function(alert) {
|
||||
|
||||
let tstp = alerts.filter(function(alert) {
|
||||
if (alert.raw.properties &&
|
||||
alert.raw.properties.event === "Severe Thunderstorm Warning" &&
|
||||
(alert.raw.properties.event === "Severe Thunderstorm Warning" || alert.raw.properties.event === "Considerable Destructive Severe Thunderstorm Warning") &&
|
||||
alert.raw.properties.parameters &&
|
||||
alert.raw.properties.parameters.tornadoDetection &&
|
||||
alert.raw.properties.parameters.tornadoDetection.length > 0) {
|
||||
@ -23,11 +23,27 @@ let tstp = alerts.filter(function(alert) {
|
||||
}
|
||||
})
|
||||
|
||||
// Filter for considerable destructive severe thunderstorm warnings
|
||||
|
||||
let cdst = alerts.filter(function(alert) {
|
||||
if (alert.raw.properties &&
|
||||
alert.raw.properties.event === "Considerable Destructive Severe Thunderstorm Warning") {
|
||||
return true
|
||||
}
|
||||
})
|
||||
|
||||
// Filter for Tornado Warnings
|
||||
|
||||
let tornado = alerts.filter(function(alert) {
|
||||
if (alert.raw.properties &&
|
||||
alert.raw.properties.event === "Tornado Warning") {
|
||||
(alert.raw.properties.event === "Tornado Warning" || alert.raw.properties.event === "Confirmed Tornado Warning")) {
|
||||
return true
|
||||
}
|
||||
})
|
||||
|
||||
let confirmed_tornado = alerts.filter(function(alert) {
|
||||
if (alert.raw.properties &&
|
||||
alert.raw.properties.event === "Confirmed Tornado Warning") {
|
||||
return true
|
||||
}
|
||||
})
|
||||
@ -38,14 +54,16 @@ let tstormMsg = {
|
||||
"payload": {
|
||||
"alerts": ts,
|
||||
"count": ts.length,
|
||||
"tornado_possible": tstp.length
|
||||
"tornado_possible": tstp.length,
|
||||
"considerable_destructive": cdst.length
|
||||
}
|
||||
}
|
||||
|
||||
let tornadoWarnMsg = {
|
||||
"payload": {
|
||||
"alerts": tornado,
|
||||
"count": tornado.length
|
||||
"count": tornado.length,
|
||||
"confirmed": confirmed_tornado.length
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,13 @@
|
||||
let alerts = msg.payload.features
|
||||
let tornado_possible = false
|
||||
let considerable_destructive = false
|
||||
let confirmed = false
|
||||
|
||||
// Filter for Severe Thunderstorm Warnings
|
||||
|
||||
let ts = alerts.filter(function(alert) {
|
||||
if (alert.properties &&
|
||||
alert.properties.event === "Severe Thunderstorm Warning") {
|
||||
(alert.properties.event === "Severe Thunderstorm Warning" || alert.properties.event === "Considerable Destructive Severe Thunderstorm Warning")) {
|
||||
return true
|
||||
}
|
||||
})
|
||||
@ -15,7 +17,7 @@ let ts = alerts.filter(function(alert) {
|
||||
|
||||
let tstp = alerts.filter(function(alert) {
|
||||
if (alert.properties &&
|
||||
alert.properties.event === "Severe Thunderstorm Warning" &&
|
||||
(alert.properties.event === "Severe Thunderstorm Warning" || alert.properties.event === "Considerable Destructive Severe Thunderstorm Warning") &&
|
||||
alert.properties.parameters &&
|
||||
alert.properties.parameters.tornadoDetection &&
|
||||
alert.properties.parameters.tornadoDetection.length > 0) {
|
||||
@ -28,29 +30,55 @@ if (tstp.length > 0) {
|
||||
tornado_possible = true
|
||||
}
|
||||
|
||||
// Filter for considerable destructive severe thunderstorm warnings
|
||||
|
||||
let cdst = alerts.filter(function(alert) {
|
||||
if (alert.properties &&
|
||||
alert.properties.event === "Considerable Destructive Severe Thunderstorm Warning") {
|
||||
return true
|
||||
}
|
||||
})
|
||||
|
||||
if (cdst.length > 0) {
|
||||
considerable_destructive = true
|
||||
}
|
||||
|
||||
// Filter for Tornado Warnings
|
||||
|
||||
let tornado = alerts.filter(function(alert) {
|
||||
if (alert.properties &&
|
||||
alert.properties.event === "Tornado Warning") {
|
||||
(alert.properties.event === "Tornado Warning" || alert.properties.event === "Confirmed Tornado Warning")) {
|
||||
return true
|
||||
}
|
||||
})
|
||||
|
||||
let confirmed_tornado = alerts.filter(function(alert) {
|
||||
if (alert.properties &&
|
||||
alert.properties.event === "Confirmed Tornado Warning") {
|
||||
return true
|
||||
}
|
||||
})
|
||||
|
||||
if (confirmed_tornado.length > 0) {
|
||||
confirmed = true
|
||||
}
|
||||
|
||||
// If there are any alerts, return them
|
||||
|
||||
let tstormMsg = {
|
||||
"payload": {
|
||||
"alerts": ts,
|
||||
"count": ts.length,
|
||||
"tornado_possible": tornado_possible
|
||||
"tornado_possible": tornado_possible,
|
||||
"considerable_destructive": considerable_destructive
|
||||
}
|
||||
}
|
||||
|
||||
let tornadoWarnMsg = {
|
||||
"payload": {
|
||||
"alerts": tornado,
|
||||
"count": tornado.length
|
||||
"count": tornado.length,
|
||||
"confirmed": confirmed
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user