Revise severe thunderstorm warning data

This commit is contained in:
2025-03-18 01:06:37 -04:00
parent f6bbc89951
commit 83adbb42af

View File

@ -96,18 +96,14 @@
"846ac653b993bbec",
"fc63778f17491208",
"404170ec56d4c845",
"15a570205c470b53",
"6d492df9348a35e9",
"ab2e9b884521285a",
"eff5cac2621c8c91",
"9151c0cd48bb3c45",
"1bbab6628566033e",
"67561d51aaa61dfa"
],
"x": 14,
"y": 299,
"w": 1372,
"h": 262
"w": 1032,
"h": 202
},
{
"id": "200f284a1171f0a8",
@ -506,8 +502,8 @@
"z": "ed4ea3c2bc13d1ec",
"g": "b0521ee44dc796d1",
"name": "Filter",
"func": "let alerts = msg.payload.features\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\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\nmsg.ts = ts\nmsg.ts_count = ts.length\n\nmsg.tstp = tstp\nmsg.tstp_count = tstp.length\n\nmsg.tornado = tornado\nmsg.tornado_count = tornado.length\n\nreturn msg",
"outputs": 1,
"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'})",
"outputs": 2,
"timeout": 0,
"noerr": 0,
"initialize": "",
@ -517,66 +513,15 @@
"y": 400,
"wires": [
[
"eff5cac2621c8c91",
"15a570205c470b53",
"6d492df9348a35e9"
]
]
},
{
"id": "15a570205c470b53",
"type": "change",
"z": "ed4ea3c2bc13d1ec",
"g": "b0521ee44dc796d1",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "tstp_count",
"tot": "msg"
}
"9151c0cd48bb3c45"
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 700,
"y": 460,
"wires": [
[
"1bbab6628566033e"
]
]
},
{
"id": "6d492df9348a35e9",
"type": "change",
"z": "ed4ea3c2bc13d1ec",
"g": "b0521ee44dc796d1",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "tornado_count",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 700,
"y": 520,
"wires": [
[
"ab2e9b884521285a"
]
],
"outputLabels": [
"Severe Thunderstorm Warning",
"Tornado Warning"
]
},
{
@ -594,38 +539,10 @@
"correl": "",
"expiry": "",
"broker": "200f284a1171f0a8",
"x": 1000,
"y": 520,
"x": 780,
"y": 460,
"wires": []
},
{
"id": "eff5cac2621c8c91",
"type": "change",
"z": "ed4ea3c2bc13d1ec",
"g": "b0521ee44dc796d1",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "ts_count",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 700,
"y": 400,
"wires": [
[
"9151c0cd48bb3c45"
]
]
},
{
"id": "9151c0cd48bb3c45",
"type": "mqtt out",
@ -641,29 +558,10 @@
"correl": "",
"expiry": "",
"broker": "200f284a1171f0a8",
"x": 1040,
"x": 820,
"y": 400,
"wires": []
},
{
"id": "1bbab6628566033e",
"type": "mqtt out",
"z": "ed4ea3c2bc13d1ec",
"g": "b0521ee44dc796d1",
"name": "",
"topic": "weather/alerts/defiance/severe_thunderstorm_warning/tornado_possible",
"qos": "0",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "200f284a1171f0a8",
"x": 1100,
"y": 460,
"wires": []
},
{
"id": "42b8b21e40f8b824",
"type": "link in",