From 703136962fa3075b176d9962c15ca15b186c2c9e Mon Sep 17 00:00:00 2001 From: Tony Stork Date: Wed, 19 Mar 2025 17:09:22 -0400 Subject: [PATCH] Additional stats for considerable destructive/confirmed tornado --- flows.json | 76 ++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 68 insertions(+), 8 deletions(-) diff --git a/flows.json b/flows.json index 5ba196d..2b5b609 100644 --- a/flows.json +++ b/flows.json @@ -71,12 +71,15 @@ "f9f2f5c1415ff1be", "ca5ab0add7ccdb84", "474ea9dc63cf9b40", - "42b8b21e40f8b824" + "42b8b21e40f8b824", + "e817e217a8d0d31a", + "f42e26da028d2230", + "f683f8c961246dc7" ], "x": 14, - "y": 79, + "y": 19, "w": 1032, - "h": 142 + "h": 202 }, { "id": "b0521ee44dc796d1", @@ -191,7 +194,8 @@ "y": 120, "wires": [ [ - "f9f2f5c1415ff1be" + "f9f2f5c1415ff1be", + "f683f8c961246dc7" ] ] }, @@ -231,7 +235,7 @@ "z": "ed4ea3c2bc13d1ec", "g": "df425a30fbcfb2e9", "name": "Filter", - "func": "let alerts = msg.payload\n\n// Filter for Severe Thunderstorm Warnings\n\nlet ts = alerts.filter(function(alert) {\n if (alert.raw.properties &&\n alert.raw.properties.event === \"Severe Thunderstorm Warning\") {\n return true\n }\n})\n\n// Filter for Severe Thunderstorm Warnings with tornado detection\n// that have a tornado possible parameter\n\nlet tstp = alerts.filter(function(alert) {\n if (alert.raw.properties &&\n alert.raw.properties.event === \"Severe Thunderstorm Warning\" &&\n alert.raw.properties.parameters &&\n alert.raw.properties.parameters.tornadoDetection &&\n alert.raw.properties.parameters.tornadoDetection.length > 0) {\n let tornadoPossible = alert.raw.properties.parameters.tornadoDetection[0]\n return tornadoPossible === \"POSSIBLE\"\n }\n})\n\n// Filter for Tornado Warnings\n\nlet tornado = alerts.filter(function(alert) {\n if (alert.raw.properties &&\n alert.raw.properties.event === \"Tornado Warning\") {\n return true\n }\n})\n\n// If there are any alerts, return them\n\nlet tstormMsg = {\n \"payload\": {\n \"alerts\": ts,\n \"count\": ts.length,\n \"tornado_possible\": tstp.length\n }\n}\n\nlet tornadoWarnMsg = {\n \"payload\": {\n \"alerts\": tornado,\n \"count\": tornado.length\n }\n}\n\nnode.send([tstormMsg,tornadoWarnMsg])\nnode.status({fill:'green',shape:'dot',text:'Alerts Updated'})", + "func": "let alerts = msg.payload\n\n// Filter for Severe Thunderstorm Warnings\n\nlet ts = alerts.filter(function(alert) {\n if (alert.raw.properties &&\n (alert.raw.properties.event === \"Severe Thunderstorm Warning\" || alert.raw.properties.event === \"Considerable Destructive Severe Thunderstorm Warning\")) {\n return true\n }\n})\n\n// Filter for Severe Thunderstorm Warnings with tornado detection\n// that have a tornado possible parameter\n\nlet tstp = alerts.filter(function(alert) {\n if (alert.raw.properties &&\n (alert.raw.properties.event === \"Severe Thunderstorm Warning\" || alert.raw.properties.event === \"Considerable Destructive Severe Thunderstorm Warning\") &&\n alert.raw.properties.parameters &&\n alert.raw.properties.parameters.tornadoDetection &&\n alert.raw.properties.parameters.tornadoDetection.length > 0) {\n let tornadoPossible = alert.raw.properties.parameters.tornadoDetection[0]\n return tornadoPossible === \"POSSIBLE\"\n }\n})\n\n// Filter for considerable destructive severe thunderstorm warnings\n\nlet cdst = alerts.filter(function(alert) {\n if (alert.raw.properties &&\n alert.raw.properties.event === \"Considerable Destructive Severe Thunderstorm Warning\") {\n return true\n }\n})\n\n// Filter for Tornado Warnings\n\nlet tornado = alerts.filter(function(alert) {\n if (alert.raw.properties &&\n (alert.raw.properties.event === \"Tornado Warning\" || alert.raw.properties.event === \"Confirmed Tornado Warning\")) {\n return true\n }\n})\n\nlet confirmed_tornado = alerts.filter(function(alert) {\n if (alert.raw.properties &&\n alert.raw.properties.event === \"Confirmed Tornado Warning\") {\n return true\n }\n})\n\n// If there are any alerts, return them\n\nlet tstormMsg = {\n \"payload\": {\n \"alerts\": ts,\n \"count\": ts.length,\n \"tornado_possible\": tstp.length,\n \"considerable_destructive\": cdst.length\n }\n}\n\nlet tornadoWarnMsg = {\n \"payload\": {\n \"alerts\": tornado,\n \"count\": tornado.length,\n \"confirmed\": confirmed_tornado.length\n }\n}\n\nnode.send([tstormMsg,tornadoWarnMsg])\nnode.status({fill:'green',shape:'dot',text:'Alerts Updated'})", "outputs": 2, "timeout": 0, "noerr": 0, @@ -242,10 +246,12 @@ "y": 120, "wires": [ [ - "474ea9dc63cf9b40" + "474ea9dc63cf9b40", + "e817e217a8d0d31a" ], [ - "ca5ab0add7ccdb84" + "ca5ab0add7ccdb84", + "f42e26da028d2230" ] ], "outputLabels": [ @@ -400,7 +406,7 @@ "z": "ed4ea3c2bc13d1ec", "g": "b0521ee44dc796d1", "name": "Filter", - "func": "let alerts = msg.payload.features\nlet tornado_possible = false\n\n// Filter for Severe Thunderstorm Warnings\n\nlet ts = alerts.filter(function(alert) {\n if (alert.properties &&\n alert.properties.event === \"Severe Thunderstorm Warning\") {\n return true\n }\n})\n\n// Filter for Severe Thunderstorm Warnings with tornado detection\n// that have a tornado possible parameter\n\nlet tstp = alerts.filter(function(alert) {\n if (alert.properties &&\n alert.properties.event === \"Severe Thunderstorm Warning\" &&\n alert.properties.parameters &&\n alert.properties.parameters.tornadoDetection &&\n alert.properties.parameters.tornadoDetection.length > 0) {\n let tornadoPossible = alert.properties.parameters.tornadoDetection[0]\n return tornadoPossible === \"POSSIBLE\"\n }\n})\n\nif (tstp.length > 0) {\n tornado_possible = true\n}\n\n// Filter for Tornado Warnings\n\nlet tornado = alerts.filter(function(alert) {\n if (alert.properties &&\n alert.properties.event === \"Tornado Warning\") {\n return true\n }\n})\n\n// If there are any alerts, return them\n\nlet tstormMsg = {\n \"payload\": {\n \"alerts\": ts,\n \"count\": ts.length,\n \"tornado_possible\": tornado_possible\n }\n}\n\nlet tornadoWarnMsg = {\n \"payload\": {\n \"alerts\": tornado,\n \"count\": tornado.length\n }\n}\n\nnode.send([tstormMsg,tornadoWarnMsg])\nnode.status({fill:'green',shape:'dot',text:'Alerts Updated'})", + "func": "let alerts = msg.payload.features\nlet tornado_possible = false\nlet considerable_destructive = false\nlet confirmed = false\n\n// Filter for Severe Thunderstorm Warnings\n\nlet ts = alerts.filter(function(alert) {\n if (alert.properties &&\n (alert.properties.event === \"Severe Thunderstorm Warning\" || alert.properties.event === \"Considerable Destructive Severe Thunderstorm Warning\")) {\n return true\n }\n})\n\n// Filter for Severe Thunderstorm Warnings with tornado detection\n// that have a tornado possible parameter\n\nlet tstp = alerts.filter(function(alert) {\n if (alert.properties &&\n (alert.properties.event === \"Severe Thunderstorm Warning\" || alert.properties.event === \"Considerable Destructive Severe Thunderstorm Warning\") &&\n alert.properties.parameters &&\n alert.properties.parameters.tornadoDetection &&\n alert.properties.parameters.tornadoDetection.length > 0) {\n let tornadoPossible = alert.properties.parameters.tornadoDetection[0]\n return tornadoPossible === \"POSSIBLE\"\n }\n})\n\nif (tstp.length > 0) {\n tornado_possible = true\n}\n\n// Filter for considerable destructive severe thunderstorm warnings\n\nlet cdst = alerts.filter(function(alert) {\n if (alert.properties &&\n alert.properties.event === \"Considerable Destructive Severe Thunderstorm Warning\") {\n return true\n }\n})\n\nif (cdst.length > 0) {\n considerable_destructive = true\n}\n\n// Filter for Tornado Warnings\n\nlet tornado = alerts.filter(function(alert) {\n if (alert.properties &&\n (alert.properties.event === \"Tornado Warning\" || alert.properties.event === \"Confirmed Tornado Warning\")) {\n return true\n }\n})\n\nlet confirmed_tornado = alerts.filter(function(alert) {\n if (alert.properties &&\n alert.properties.event === \"Confirmed Tornado Warning\") {\n return true\n }\n})\n\nif (confirmed_tornado.length > 0) {\n confirmed = true\n}\n\n// If there are any alerts, return them\n\nlet tstormMsg = {\n \"payload\": {\n \"alerts\": ts,\n \"count\": ts.length,\n \"tornado_possible\": tornado_possible,\n \"considerable_destructive\": considerable_destructive\n }\n}\n\nlet tornadoWarnMsg = {\n \"payload\": {\n \"alerts\": tornado,\n \"count\": tornado.length,\n \"confirmed\": confirmed\n }\n}\n\nnode.send([tstormMsg,tornadoWarnMsg])\nnode.status({fill:'green',shape:'dot',text:'Alerts Updated'})", "outputs": 2, "timeout": 0, "noerr": 0, @@ -494,6 +500,60 @@ ] ] }, + { + "id": "e817e217a8d0d31a", + "type": "debug", + "z": "ed4ea3c2bc13d1ec", + "g": "df425a30fbcfb2e9", + "name": "STS", + "active": false, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "true", + "targetType": "full", + "statusVal": "", + "statusType": "auto", + "x": 670, + "y": 60, + "wires": [] + }, + { + "id": "f42e26da028d2230", + "type": "debug", + "z": "ed4ea3c2bc13d1ec", + "g": "df425a30fbcfb2e9", + "name": "TW", + "active": false, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "true", + "targetType": "full", + "statusVal": "", + "statusType": "auto", + "x": 860, + "y": 60, + "wires": [] + }, + { + "id": "f683f8c961246dc7", + "type": "debug", + "z": "ed4ea3c2bc13d1ec", + "g": "df425a30fbcfb2e9", + "name": "Pre-Filter", + "active": false, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "true", + "targetType": "full", + "statusVal": "", + "statusType": "auto", + "x": 500, + "y": 180, + "wires": [] + }, { "id": "a1c109993f7dd396", "type": "mqtt in",