Global temperature
Tags: #nasa #opendata #snippet
This graph illustrates the change in global surface temperature relative to 1951-1980 average temperatures. Nineteen of the warmest years have occurred since 2000, with the exception of 1998. The year 2020 tied with 2016 for the warmest year on record since record-keeping began in 1880 (source: NASA/GISS). This research is broadly consistent with similar constructions prepared by the Climatic Research Unit and the National Oceanic and Atmospheric Administration.
The time series below shows the five-year average variation of global surface temperatures. Dark blue indicates areas cooler than average. Dark red indicates areas warmer than average.
The “Global Temperature” figure on the home page dashboard shows global temperature change since 1880. One gets this number by subtracting the first data point in the chart from the latest data point.
Website : https://climate.nasa.gov/vital-signs/global-temperature/
Data source: NASA's Goddard Institute for Space Studies (GISS).
Credit: NASA/GISS

Input

Data source : https://data.giss.nasa.gov/gistemp/graphs/graph_data/Global_Mean_Estimates_based_on_Land_and_Ocean_Data/graph.txt

Import libraries

1
import pandas
2
import plotly.graph_objects as go
Copied!

URL

1
url_nasa_termperatures = "https://data.giss.nasa.gov/gistemp/graphs/graph_data/Global_Mean_Estimates_based_on_Land_and_Ocean_Data/graph.txt"
Copied!

Model

Get the data and create the table

1
df = pandas.read_csv(url_nasa_termperatures, sep=r' ', skiprows=5, names=["Year", "Delta", "Detla (Smoothed)"], engine="python")
2
3
df.tail(10)
Copied!
Here we can see the evolution of the average surface temperature anomaly from the last 10 years.
Now lets visualize this information with a graph using plotly.

Output

Land-Ocean Temperature Index - Visualization

1
fig = go.Figure(layout_title="<b>Land-Ocean Temperature Index (°C)</b>")
2
fig.add_trace(go.Scatter(
3
x = df["Year"],
4
y = df["Delta"],
5
name="Delta",
6
))
7
8
fig.add_trace(go.Scatter(
9
x = df["Year"],
10
y = df["Detla (Smoothed)"],
11
name="Delta (Smoothed)",
12
))
13
14
fig.update_layout(
15
autosize=False,
16
width=1300,
17
height=700,
18
plot_bgcolor='rgb(250,250,250)',
19
xaxis = dict(
20
tickmode = 'linear',
21
tick0 = 2,
22
dtick = 5,
23
),
24
)
25
fig.update_yaxes(title_text="Temperature anomaly (°C)")
26
fig.update_xaxes(title_text="Year", tickangle=60)
27
fig.add_hline(y=0.0)
28
# To add maximum Temperature Delta line : uncomment the following line
29
# fig.add_hline(y=2.0)
30
fig.update_layout(title_x=0.5)
31
32
fig.show()
Copied!
According to the Paris Agreement, the delta should not be higher than 2. As you can see here on the graph, it increasing quickly with the years specially since 1950.

Land-Ocean Temperature Index - Visualization with Industrial Revolution Dates

We can now add the dates of the three last Industrial Revolutions :
1
- Second 1910 : gaz and petrol
2
- Third 1970 : internet
3
- Forth 2000 : AI
Copied!
1
fig.add_vrect(x0="1910", x1="1911", annotation_text="2nd IR <br> 1910", annotation_position="top left",
2
annotation=dict(font_size=20, font_family="Times New Roman"),
3
fillcolor="black", opacity=0.45, line_width=0)
4
5
fig.add_vrect(x0="1970", x1="1971", annotation_text="3rd IR <br> 1970", annotation_position="top left",
6
annotation=dict(font_size=20, font_family="Times New Roman"),
7
fillcolor="yellow", opacity=0.45, line_width=0)
8
9
fig.add_vrect(x0="2000", x1="2001", annotation_text="4th IR <br> 2000", annotation_position="top left",
10
annotation=dict(font_size=20, font_family="Times New Roman"),
11
fillcolor="green", opacity=0.45, line_width=0)
12
13
fig.update_layout(title_x=0.5, title_text="<b>Land-Ocean Temperature Index (°C)</b> <br> Focused on Industrial Revolution Dates (IR)")
14
15
fig.show()
Copied!
Idea to improve :
  • Predict with machine learning the delta for the next 50 years
Last modified 2mo ago
Copy link
Edit on GitHub