Skip To Content ArcGIS for Developers Sign In Dashboard

ArcGIS API for Python

Download the samples Try it live

Analyzing United States tornadoes

Tornadoes occur in many parts of the world, including Australia, Europe, Africa, Asia, and South America, but they are found most frequently in the United States. Outside the United States, two of the highest concentrations of tornadoes are found in Argentina and Bangladesh.

Tornadoes are the most violent of all atmospheric storms and in the United States alone have caused an average of more than 80 deaths and 1,400 injuries each year (based on 1950–2011 data). A tornado is a narrow, violently rotating column of air that extends from the base of a thunderstorm to the ground. Tornado formation is complex, and no two tornadoes are the same; however, they need certain conditions to form, including intense or unseasonable heat. Wind speed within a tornado can vary from just above 0 mph up to 70 mph, with an average of 30 mph (NOAA). The Fujita damage scale is used to quantify the intensity of a tornado.

Explore the map of tornadoes across the United States: Twister! United States tornadoes from 1950 to 2012. Which states have had the most tornadoes? Using tornado location data from the United States severe weather report database, provided by the National Oceanic and Atmospheric Administration (NOAA)/National Weather Service Storm Prediction Center (http://www.spc.noaa.gov/gis/svrgis/), you can find the total number of tornadoes by state.

Connect your GIS

In [1]:
from arcgis.gis import GIS

To create the GIS object, we pass in the url and our login credentials as shown below

In [2]:
gis = GIS('home')

Search for the title: tornado_lyr layer.You can search the GIS for feature layer collections by specifying the item type as 'Feature Layer Collection' or 'Feature Layer'. You can also mention the owner name of the layer to get better search results.

In [3]:
data = gis.content.search('Tornadoes_and_Tracks owner: api_data_owner',
                          'Feature layer', outside_org=True)

Display the list of results.

In [4]:
from IPython.display import display

for item in data:
    display(item)
Tornadoes_and_Tracks
Feature Layer Collection by api_data_owner
Last Modified: April 13, 2020
0 comments, 2 views

Get the first item from the results.

In [5]:
item = data[0] #tornado_lyr 

The code below cycles through the layers and print their names.

In [6]:
for lyr in item.layers:
    print(lyr.properties.name)
Tornadoes_5011
Kansas_tracks
MeanTrack_Merge
Kansas_counties10
StatePop_5011

Since the item is a Feature Layer Collection, accessing the layers property gives us a list of FeatureLayer objects. The StatePop_5011 layer is the first layer in this item.

In [7]:
#StatePop_5011
boundary = item.layers[4]
In [8]:
#Tornadoes_5011
tornado_lyr = item.layers[0]

Aggregate_points tool summarizes data from spot measurements by area. To learn more about this tool and the formula it uses, refer to the documentation here.

In [9]:
from arcgis.features.summarize_data import aggregate_points
from datetime import datetime as dt

Please change the output_name if this is not the first you run the cell below.

In [10]:
agg_points = aggregate_points(point_layer=tornado_lyr, 
                              polygon_layer=boundary, 
                              keep_boundaries_with_no_points=True,
                              output_name="agg_tornado_points" + str(dt.now().microsecond))
In [11]:
agg_points
Out[11]:
agg_tornado_points334948
Feature Layer Collection by arcgis_python
Last Modified: September 07, 2020
0 comments, 0 views
In [12]:
agg_lyr = agg_points.layers[0]

The GIS object includes a map widget for displaying geographic locations, visualizing GIS content, as well as the results of your analysis. To use the map widget, call gis.map() and assign it to a variable.

In [12]:
m1 = gis.map('US')
m1
Out[12]:
In [13]:
m1.add_layer(agg_lyr)

Who has suffered the most?

There can be many devastating effects from a tornado, including loss of life, injuries, property damage, and financial losses. To identify populations that have been affected by tornadoes, you can aggregate the number of tornadoes to the state level and normalize by population.

In [14]:
m2 = gis.map('US', zoomlevel=4)
m2
Out[14]: