8
n8n 中文网amn8n.com

国家气象局AI分析

高级

这是一个Personal Productivity, AI Summarization领域的自动化工作流,包含 20 个节点。主要使用 Set, Code, Merge, Filter, Webhook 等节点。 基于NWS警报、雷达图像和Home Assistant的AI生成天气分析

前置要求
  • HTTP Webhook 端点(n8n 会自动生成)
  • 可能需要目标 API 的认证凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "kJfDku2rYe5QZdCO",
  "meta": {
    "instanceId": "99d73f46ce25facbb6a315b9049061902fa3a045876ce7aa2b16534051157fdd",
    "templateCredsSetupCompleted": true
  },
  "name": "国家气象局 AI 分析",
  "tags": [],
  "nodes": [
    {
      "id": "a72e2042-fd53-46b4-b366-c522ef3044ab",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -32,
        16
      ],
      "webhookId": "b74e13cd-ad2f-4ef1-8350-ff6b915e5485",
      "parameters": {
        "path": "b74e13cd-ad2f-4ef1-8350-ff6b915e5485",
        "options": {},
        "httpMethod": "POST",
        "responseData": "allEntries",
        "responseMode": "lastNode"
      },
      "typeVersion": 2
    },
    {
      "id": "31d8e7b5-c47a-42af-abb0-02f9c2482201",
      "name": "获取 NWS 警报",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        192,
        16
      ],
      "parameters": {
        "url": "https://api.weather.gov/alerts",
        "options": {
          "response": {
            "response": {
              "fullResponse": true,
              "responseFormat": "json"
            }
          }
        },
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "status",
              "value": "actual"
            },
            {
              "name": "point",
              "value": "={{ $json.body.latitude }},{{ $json.body.longitude }}"
            }
          ]
        }
      },
      "typeVersion": 4.2,
      "alwaysOutputData": false
    },
    {
      "id": "b1938edb-79be-4399-a815-dc90ffd1f240",
      "name": "拆分输出",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        384,
        16
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "body.features"
      },
      "typeVersion": 1
    },
    {
      "id": "bc5b7d6c-e2ad-43ab-aad1-d947799243e5",
      "name": "移除不相关字段",
      "type": "n8n-nodes-base.set",
      "position": [
        576,
        16
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "c1e43be8-8b6c-4eb6-a344-251473f78dbf",
              "name": "id",
              "type": "string",
              "value": "={{ $json.id }}"
            },
            {
              "id": "26551b00-b7a6-43e6-85d2-23921e5b9c75",
              "name": "properties.areaDesc",
              "type": "string",
              "value": "={{ $json.properties.areaDesc }}"
            },
            {
              "id": "d4a19262-2c9e-4b45-bb79-9aa97da77e69",
              "name": "properties.effective",
              "type": "string",
              "value": "={{ $json.properties.effective }}"
            },
            {
              "id": "40fdf9b8-e594-405c-88cc-6e8a80fcfa60",
              "name": "properties.expires",
              "type": "string",
              "value": "={{ $json.properties.expires }}"
            },
            {
              "id": "715541f6-bcdf-4152-9427-dba110a4ee9e",
              "name": "properties.severity",
              "type": "string",
              "value": "={{ $json.properties.severity }}"
            },
            {
              "id": "b4851577-2d71-4ab6-bd8c-e6bf3db412f1",
              "name": "properties.certainty",
              "type": "string",
              "value": "={{ $json.properties.certainty }}"
            },
            {
              "id": "43aba50b-4e09-4e26-8ded-328c1ead3469",
              "name": "properties.status",
              "type": "string",
              "value": "={{ $json.properties.status }}"
            },
            {
              "id": "aab46fc5-e6c3-45c6-b12f-da4d11d82b25",
              "name": "properties.headline",
              "type": "string",
              "value": "={{ $json.properties.headline }}"
            },
            {
              "id": "ab826652-b359-4047-a1fa-4da9797a54d2",
              "name": "properties.description",
              "type": "string",
              "value": "={{ $json.properties.description }}"
            },
            {
              "id": "e0ffea55-c055-44d2-952f-5785e7c7d3c2",
              "name": "properties.instruction",
              "type": "string",
              "value": "={{ $json.properties.instruction }}"
            },
            {
              "id": "205b4373-515c-40d9-8d02-e2a5e3ddc7f4",
              "name": "properties.parameters.NWSheadline",
              "type": "array",
              "value": "={{ $json.properties.parameters.NWSheadline }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "e0ce90cb-a447-4b5c-a3e7-6ea2ccfa4efe",
      "name": "按严重性过滤",
      "type": "n8n-nodes-base.filter",
      "position": [
        960,
        16
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "7dde0a87-93ff-482b-9c53-d13a191f982b",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.properties.severity }}",
              "rightValue": "Moderate"
            },
            {
              "id": "28ed779f-d676-4619-bff4-12877b696415",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.properties.severity }}",
              "rightValue": "Severe"
            },
            {
              "id": "a28503c7-f468-4cbf-800e-edfa05d405ce",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.properties.severity }}",
              "rightValue": "Extreme"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "e5272333-90a2-4bfa-969f-0cd6e2d50ad8",
      "name": "按生效时间过滤",
      "type": "n8n-nodes-base.filter",
      "position": [
        1152,
        16
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "f99f25cf-d59b-4739-be7f-269ecb07f76f",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ new Date($json.properties.effective).getTime() <= new Date().getTime() }}",
              "rightValue": "true"
            }
          ]
        },
        "looseTypeValidation": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "4b05f80a-b851-4286-9618-86dd11600faa",
      "name": "按状态过滤",
      "type": "n8n-nodes-base.filter",
      "position": [
        768,
        16
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "2b51bbc7-927f-40a5-b43b-d12e23b6ea5c",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.properties.status }}",
              "rightValue": "Actual"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "fe639674-9bfe-4344-b4dc-3141f90cbf9f",
      "name": "获取 Weather.gov 雷达循环图",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        576,
        608
      ],
      "parameters": {
        "url": "https://radar.weather.gov/ridge/standard/KAMX_loop.gif",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "7a966d42-eae1-4aaf-ad35-2dff15b62e68",
      "name": "按过期时间过滤",
      "type": "n8n-nodes-base.filter",
      "position": [
        1344,
        16
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "f99f25cf-d59b-4739-be7f-269ecb07f76f",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ new Date($json.properties.expires).getTime() >= new Date().getTime() }}",
              "rightValue": "true"
            }
          ]
        },
        "looseTypeValidation": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "a071bf45-dd82-41d0-9130-3c8ef6891ded",
      "name": "分析雷达图像",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        960,
        496
      ],
      "parameters": {
        "text": "=This is the latest weather radar animation for the monitored area. The AI should analyze precipitation patterns, storm intensity, and movement.\n\nA local weather sensor reports precipitation type: {{ $json.state }}. This sensor takes precedence over radar-based assumptions when determining real-time weather conditions.\n\nDark greens, yellows, and reds indicate stronger precipitation. If storms are present, assess their movement and potential impact on the area. When describing weather, use cautious language like \"it is likely raining\" rather than making definitive statements unless radar data is conclusive.\n\nConsider storm progression over time and estimate when precipitation may begin or end based on timestamps in the radar animation.\n\nProvide a clear, concise summary of current conditions based on the radar and local weather sensor input.",
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "GPT-4O-MINI"
        },
        "options": {},
        "resource": "image",
        "inputType": "base64",
        "operation": "analyze"
      },
      "credentials": {
        "openAiApi": {
          "id": "bDmccS2kILl6lfr2",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "ac0ae58a-1c40-421d-ad53-9f2e560319df",
      "name": "映射 JSON 响应",
      "type": "n8n-nodes-base.set",
      "position": [
        1152,
        496
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "ad4a9a05-20b8-4eda-a477-344d385b4a1e",
              "name": "radar_summary",
              "type": "string",
              "value": "={{ $json.content }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "4bea6742-c424-4250-9d1d-74b4cd46cff4",
      "name": "获取本地天气降水",
      "type": "n8n-nodes-base.homeAssistant",
      "position": [
        576,
        416
      ],
      "parameters": {
        "entityId": "sensor.local_weather_precipitation_type",
        "resource": "state"
      },
      "credentials": {
        "homeAssistantApi": {
          "id": "nhKk0HXRsf8saByq",
          "name": "Home Assistant account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "a7d3e335-a2ae-459d-829f-f0047f7c1cbb",
      "name": "合并 JSON 与图像",
      "type": "n8n-nodes-base.merge",
      "position": [
        768,
        496
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combineBy": "combineByPosition"
      },
      "typeVersion": 3.2
    },
    {
      "id": "72fe8625-4631-4912-9db7-7ca721638431",
      "name": "合并雷达分析与 NWS 数据",
      "type": "n8n-nodes-base.merge",
      "position": [
        1344,
        272
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combineBy": "combineByPosition"
      },
      "typeVersion": 3.2
    },
    {
      "id": "dd7f1b53-dba0-4532-98e3-bfcc9c0a8681",
      "name": "OpenAI 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1536,
        464
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "bDmccS2kILl6lfr2",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "90f46158-41ed-4811-baa6-efac8beff957",
      "name": "代码",
      "type": "n8n-nodes-base.code",
      "position": [
        384,
        256
      ],
      "parameters": {
        "jsCode": "let idx = 0\nlet alerts = []\n\nfor (const item of $input.all()) {\n  for (const alert of item.json.alerts) {\n    idx++\n\n      let template = `Alert ${idx}:\n  **Headline:** ${alert.properties.headline}\n  **Severity:** ${alert.properties.severity}\n  **Description:** ${alert.properties.description}\n  **Instructions:** ${alert.properties.instruction}\n`\n\n    alerts.push(template)\n  }\n\n  item.json = { nws_alerts: alerts.join('\\n\\n'), nws_alerts_count: alerts.length }\n}\n\nreturn $input.all();"
      },
      "typeVersion": 2
    },
    {
      "id": "bceccd50-f2f3-4ff4-b378-6030c8b680cd",
      "name": "聚合",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        192,
        256
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData",
        "destinationFieldName": "alerts"
      },
      "typeVersion": 1
    },
    {
      "id": "642995c2-a4f4-43a4-bc58-ed2faebe1426",
      "name": "生成摘要",
      "type": "@n8n/n8n-nodes-langchain.chainSummarization",
      "position": [
        1536,
        272
      ],
      "parameters": {
        "options": {
          "summarizationMethodAndPrompts": {
            "values": {
              "prompt": "=It is critically important to limit your response to 255 characters or less, including spaces.\n\nAI Weather Assistant Alert: A new weather alert has been issued for this location. Summarize the alert details concisely. Include only essential information, such as severe conditions, timing, and affected areas.\n\nThe number of active weather alerts is: {{ $json.nws_alerts_count }}.\n\n# Reviewing all Moderate and Severe alerts:\n\n{{  $json.nws_alerts }}\n\n# Radar Analysis:\n\n{{  $json.radar_summary }}\n",
              "summarizationMethod": "stuff"
            }
          }
        },
        "operationMode": "nodeInputBinary"
      },
      "typeVersion": 2.1
    },
    {
      "id": "73e4af91-061d-44a7-a3aa-f8efad62e8c9",
      "name": "映射 JSON 到响应",
      "type": "n8n-nodes-base.set",
      "position": [
        1920,
        272
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "e290b262-1443-43ce-8761-1131cbc2cce2",
              "name": "summary",
              "type": "string",
              "value": "={{ $json.output.text }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "25f096aa-457e-4e9e-8394-e0054dc7ed55",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -640,
        -32
      ],
      "parameters": {
        "width": 544,
        "height": 832,
        "content": "# 概述"
      },
      "typeVersion": 1
    }
  ],
  "active": true,
  "pinData": {
    "Webhook": [
      {
        "json": {
          "body": {
            "latitude": 0,
            "longitude": 0
          }
        }
      }
    ]
  },
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "77f65303-990f-4463-bc6a-0949b7cb9cf6",
  "connections": {
    "Code": {
      "main": [
        [
          {
            "node": "Get Local Weather Precipication",
            "type": "main",
            "index": 0
          },
          {
            "node": "Fetch Weather.gov Radar Loop",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge Radar Analysis with NWS Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook": {
      "main": [
        [
          {
            "node": "Get NWS Alerts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out": {
      "main": [
        [
          {
            "node": "Remove Irrelevant Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get NWS Alerts": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter by Status": {
      "main": [
        [
          {
            "node": "Filter by Severity",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter by Expired": {
      "main": [
        [
          {
            "node": "Aggregate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Map JSON Response": {
      "main": [
        [
          {
            "node": "Merge Radar Analysis with NWS Data",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Generate a Summary",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Filter by Severity": {
      "main": [
        [
          {
            "node": "Filter by Effective",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate a Summary": {
      "main": [
        [
          {
            "node": "Map JSON to Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze Radar Image": {
      "main": [
        [
          {
            "node": "Map JSON Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter by Effective": {
      "main": [
        [
          {
            "node": "Filter by Expired",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Map JSON to Response": {
      "main": [
        []
      ]
    },
    "Merge JSON with Image": {
      "main": [
        [
          {
            "node": "Analyze Radar Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Remove Irrelevant Fields": {
      "main": [
        [
          {
            "node": "Filter by Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Weather.gov Radar Loop": {
      "main": [
        [
          {
            "node": "Merge JSON with Image",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Get Local Weather Precipication": {
      "main": [
        [
          {
            "node": "Merge JSON with Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Radar Analysis with NWS Data": {
      "main": [
        [
          {
            "node": "Generate a Summary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

高级 - 个人效率, AI 摘要总结

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
高级
节点数量20
分类2
节点类型13
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

外部链接
在 n8n.io 查看

分享此工作流