Tomorrow.io's Resilience Platform is Here. Learn More.

X
Kelly Peters
By Kelly Peters
Kelly Peters
Kelly Peters
Currently Tomorrow.io's Director of Marketing, Kelly Peters is a growth-focused marketing leader with 10+ years of experience driving strategic communications and demand-focused initiatives for brands like CNBC, NBCUniversal, Dicks Sporting Goods, and JazzHR. At Tomorrow.io, she leads a dynamic team of growth and AI marketers in driving revenue with bold storytelling, radical creativity, and, above all else, human connection. Kelly graduated from Syracuse University and lives in Pittsburgh, PA.
Mar 8, 2022ยท 10 min, 3 sec

Weather Alert API: Emergency Assistant in Severe Situations

Learn how to build entire alert systems based on calls to the Tomorrow.io weather API.

Weather catastrophes are devastating for communities for both businesses and individuals. The impact from a massive tornado, fire, flood, hurricane and many more severe weather conditions can destroy homes, cost people their lives, and leave businesses unproductive for days affecting their revenue. Using a weather alert API, you can get much more accurate and predictable weather forecasts, which will help people better prepare for disaster, and emergency assistance personnel can take the necessary steps to be ready for a quick response.

Preparing for Weather Conditions and Natural Disasters

FEMA details the response protocols after a natural disaster. From their documentation, youโ€™ll notice that local authorities are responsible for being the primary first responders to a disaster. If you look at the steps involved, phase one of emergency response is to prepare for an upcoming natural disaster.ย 

Before response teams prepare, they must know the severity of the situations. For example, a Category 3 hurricane will generally cause far less damage than a Category 5 hurricane. Before emergency assistance can assess the number of people and resources needed to respond, they need to know the severity of hurricane winds, where the hurricane will hit land, and the number of residents and businesses that will be affected.

In 2021, a massive snow storm hit Texas and caused a power crisis across Houston and surrounding areas. Texas was unprepared for the snow storm, which unfortunately cost lives. Residents were left without power and heat with no warning that a power outage would be possible so that they could prepare and protect themselves. The snowy weather was unprecedented in Houston, but it gave officials a new benchmark for emergency preparedness.

Now in 2022, freezing weather was tracked better to give residents time to prepare. They reported that temperatures could be as cold as the mid -20s Feirenheit in some areas, so residents and emergency responders could better prepare this time. Most importantly, power companies prepared utility lines so that they would resist severe weather conditions similar to the previous year.

Local and federal assistance are there for residents shortly after any disaster, but they first need to have the resources to help affected areas. This requires the right vehicles, food and water resources, first aid, and the ability to offer shelter to people who need it. In some cases, itโ€™s necessary for emergency responders to travel to other locations to help other US cities in a time of need.

How Can You Help Your Local Community Protect Themselves?

Using a weather API, you can help facilitate emergency assistance in severe situations. Your applications can be used to alert your local community of upcoming weather emergencies, and you can publish your data publicly so that local authorities and emergency responders can get updates. These government agencies usually have their own data, but communication channels are often cut in severe weather. For example, itโ€™s not uncommon for the phone systems to go out during a hurricane and take days for it to recover after the hurricane weather passes.

Local news stations report the weather, but cable may go out in severe weather conditions. Provided that you keep the internet up and connected, you can have your own weather app to track the status of a severe storm. Before the storm reaches, you can help your local community by monitoring weather conditions to warn them. For our example, weโ€™ll use hurricane weather to track wind speeds so that your local community knows when weather conditions are at their worst.

Before getting into code, a little bit about hurricanes โ€“ a common reason for deaths during a hurricane is the eye. When a hurricane passes over an east coast state, the state gets the โ€œleftโ€ side of the storm first. Next, the eye passes over the state. The eye of the storm is completely calm, especially if there is a well-formed distinct eye. After the eye passes, the โ€œrightโ€ side of the storm hits. The wind from this side blows in a different direction than the first phase of the storm, which means buildings are pummeled in a new way. When people unfamiliar with the way hurricanes hit see the eye pass over their house, they will often think the storm is over and go outside.

The storm returns quickly after the eye passes, and anyone who stays outside risks flying debris that could harm them or threaten their life. Residents used to hurricane weather know not to go outside right away, even if the storm has officially passed. Instead, the right protocol is to stay indoors until cleanup crews fix power lines, remove dangerous debris, and repair roadways. With a weather API, you can help communities better prepare before, during, and after severe weather conditions, including a hurricane.

Capturing Wind Data During a Hurricane

Now, letโ€™s take an example of wind events during a hurricane. You can build event queries based on a premade โ€œwindโ€ insight category. There are several pre-made insight categories that collect data for extreme weather events, such as hurricanes (wind). You can use these insight categories for most weather events that could damage your community and threaten lives. It can then be used in emergency assistance situations to prepare for the worst.

Notice from the insight categories that they respond with โ€œlevelโ€ data. This data tells you if the wind conditions are at an emergency level (among other stages during a hurricane). There is also a โ€œstatementโ€ level that occurs after the event and warns users of the dangerous aftermath of a hurricane, and there is an โ€œoutlookโ€ level to warn users of the impending dangerous conditions about to affect their area. These levels, along with the others, can be used to provide minute by minute (or hour by hour) information to emergency responders.

Notice in the wind insight category documentation, that an event is returned if wind speeds match specific values. A storm is considered a hurricane when wind speeds reach 74mph, but other dangerous storms have sustained winds at slower speeds, so this is why the weather API reports warnings for wind speeds starting at 40mph and higher. Extreme wind speeds of 115mph and higher can seriously impact a community, and you can use this information to warn residents. The Route API endpoint is a premium option, but it can be used to map a path for a hurricane to determine the communities most affected, but note that some hurricanes have historically changed their path drastically without warning. For example, Hurricane Ivan in 2004 made a loop in an unexpected return to land that threatened Florida after already impacting other adjacent states.

Capturing Wind Data During a Hurricane

Hurricane Ivan from 2004 took a very unusual and unexpected path across several US states.

Now letโ€™s take a look at a small snippet of Python code that pulls data from the wind insight category.

import requests

url = “https://api.tomorrow.io/v4/events?location=607f3e4188a6a60007947b82&insights=wind&buffer=1&apikey=YOUR_KEY”

headers = {“Accept”: “application/json”}
response = requests.request(“GET”, url, headers=headers)
print(response.text)

 

For this particular query, no data will be returned because there is currently no severe wind conditions in this area, but here is a sample JSON response that would be returned should the location currently experience hurricane conditions:

 

{
ย  “data”: {
ย  ย  “events”: [
ย  ย  ย  {
ย  ย  ย  ย  “insight”: “wind”,
ย  ย  ย  ย  “startTime”: “2020-10-13T18:12:00Z”,
ย  ย  ย  ย  “endTime”: “2020-10-14T15:06:26.261668224Z”,
ย  ย  ย  ย  “updateTime”: “2020-10-13T18:12:00Z”,
ย  ย  ย  ย  “severity”: “extreme”,
ย  ย  ย  ย  “certainty”: “likely”,
ย  ย  ย  ย  “urgency”: “immediate”,
ย  ย  ย  ย  “response”: “shelter”,
ย  ย  ย  ย  “eventValues”: {
ย  ย  ย  ย  ย  “title”: “Hurricane winds”,
ย  ย  ย  ย  ย  “distance”: 0.156,
ย  ย  ย  ย  ย  “direction”: -7.481822
ย  ย  ย  ย  }
ย  ย  ย  },
ย  ย  ย  {
ย  ย  ย  ย  “insight”: “38f689d83c264eb0b084ba095f2ea772”,
ย  ย  ย  ย  “startTime”: “2020-05-10T07:49:34+0000”,
ย  ย  ย  ย  “endTime”: “2020-05-10T07:49:34+0000”,
ย  ย  ย  ย  “eventValues”: {
ย  ย  ย  ย  ย  “precipitationIntensity”: 1,
ย  ย  ย  ย  ย  “mepIndex”: 300
ย  ย  ย  ย  }
ย  ย  ย  },
ย  ย  ย  “…”
ย  ย  ]
ย  }
}

 

The โ€œeventsโ€ section is where you identify if the threat is immediate, the likelihood that severe wind conditions will affect your location, and the severity of the threat. These three data points are important in emergency assistance when tracking weather. The response code defines suggestions for residents. In this example, the suggestion is to shelter, but it will also tell residents to prepare, monitor, assess, evacuate and several more.

In an emergency response situation, the severity indicates the possibility of life-threatening events. The certainty data point gives you a sense of the likelihood of experiencing the event. In this example, the value is set to โ€œlikely,โ€ which indicates a very strong possibility that residents at the given location will experience extreme weather conditions.ย 

The final value to pay attention to is the โ€œurgencyโ€ data point. The โ€œimmediateโ€ value indicates that the event is happening now or in the immediate future, but the API offers information on past events or indicates if it will happen in the future.ย  The โ€œurgencyโ€ data point works well with the response and severity data to indicate if an emergency response will be necessary after the event.

Alerts and Notifications from Events and Insights

Once you have the query set up to detect and monitor severe events, you can then create alerts and notifications that you can send to key people. The key people in your application could be organizational personnel, emergency responders, family members, or anyone else that needs to know when the threat is ongoing and when it is over.ย 

You can write your own code to use the alerts and notification endpoints to send messages to key people when severe weather passes through your location. An alert is a record that contains information when a threshold is reached. For example, you can create an alert when hurricane conditions reach extreme severity.

Here is sample Python code that creates can alert:

import requests

url = “https://api.tomorrow.io/v4/alerts?apikey=YOUR_KEY”

payload = {“isActive”: True, “insight”: “wind”, “notifications”: [ “type”: “PUBLISH” ]}
headers = {
ย  ย  “Accept”: “application/json”,
ย  ย  “Content-Type”: “application/json”
}

response = requests.request(“POST”, url, json=payload, headers=headers)
print(response.text)

 

This Python code sets up an alert for wind conditions.ย 

 

The response is:

 

{
ย  ย  “data”: {
ย  ย  ย  ย  “alert”: {
ย  ย  ย  ย  ย  ย  “id”: “38f689d83c264eb0b084ba095f2ea743”,
ย  ย  ย  ย  ย  ย  “insight”: “38f689d83c264eb0b084ba095f2ea332”,
ย  ย  ย  ย  ย  ย  “name”: “Hurricane Winds Alert”,
ย  ย  ย  ย  ย  ย  “isActive”: true,
ย  ย  ย  ย  ย  ย  “notifications”: [“…notifications”],
ย  ย  ย  ย  ย  ย  “createdAt”: “2020-05-10T06:49:34+0000”
ย  ย  ย  ย  },
ย  ย  }
}

 

Notice that the alert ties in with a notification object with the type โ€œPUBLISHโ€ set. This setting will send a notification when severe weather conditions are reached. Alerts tie into notifications by sending a notification when an alert is triggered from the given insight. In this example, wind conditions must be severe to trigger the alert, and then it will send notifications.

You can see a list of your notifications using the notification endpoint. Here is a small Python example that returns notifications:

 

import requests

url = “https://api.tomorrow.io/v4/notifications?apikey=YOUR_KEY”

headers = {“Accept”: “application/json”}
response = requests.request(“GET”, url, headers=headers)
print(response.text)

 

Of course, this example is very simplistic, but you can build entire alert systems based on calls to the Tomorrow.io weather API. The people you alert can be anyone, including emergency response and assistant organizations. The benefit of using your own custom application versus standard web applications is that a custom application can be used for specific geo-locations and events, and it can be used to notify people instead of relying on them to monitor weather websites.

Because a weather API also gives you predicted weather conditions, it can help emergency responders and the community prepare for the worst. Using the Tomorrow.io API, you can more quickly build an application that fits your specific needs rather than use standard weather tools that only report basic weather information such as temperature, rain, and current events.ย 

In addition to being more customizable, your application gets access to numerous data points that can be used for better predictions and more granular access to specific events. You have access to data around the globe, and you can use it to help emergency responders in any location at any time of the day or night.

With the right weather API, you can help your community save lives and respond more efficiently to dangerous weather. The Tomorrow.io API will help you accomplish your goals.

Sign Up for the Tomorrow.io Weather API for Free

Try Now