Artic sea ice
Tags: #naas #opendata #analytics #asset #html #png
Author: Florent Ravenel
AVERAGE SEPTEMBER MINIMUM EXTENT Data source: Satellite observations. Credit: NSIDC/NASA
What is Arctic sea ice extent? Sea ice extent is a measure of the surface area of the ocean covered by sea ice. Increases in air and ocean temperatures decrease sea ice extent; in turn, the resulting darker ocean surface absorbs more solar radiation and increases Arctic warming. Date Range: 1979 - 2020.

Get data from website

Click on Artic Sea Ice

Input

Import libraries

1
import pandas as pd
2
import plotly.graph_objects as go
3
import naas
Copied!

Variables

1
# Input
2
data_input = "https://climate.nasa.gov/system/internal_resources/details/original/2485_Sept_Arctic_extent_1979-2021.xlsx"
3
4
# Output
5
image_output = "Artic_sea_ice_extent.png"
6
html_output = "Artic_sea_ice_extent.png"
Copied!

Model

Get data

1
df = pd.read_excel(data_input)
2
df.tail(10)
Copied!

Create graph

1
def create_linechart(df, label, value):
2
# Init
3
fig = go.Figure()
4
5
# Create fig
6
fig.add_trace(
7
go.Scatter(
8
x=df[label],
9
y=df[value],
10
hoverinfo="text",
11
hovertext=df[label].astype(str) + "<br>" + df[value].astype(str) + " million square km",
12
mode="lines+text",
13
)
14
)
15
fig.update_layout(
16
title=f"<b>Arctic Sea Ice Extent</b><br><span style='font-size: 13px;'>ANNUAL SEPTEMBER MINIMUM EXTENT</span>",
17
title_font=dict(family="Arial", size=18, color="black"),
18
plot_bgcolor="#ffffff",
19
width=1200,
20
height=800,
21
paper_bgcolor="white",
22
xaxis_title="Year",
23
xaxis_title_font=dict(family="Arial", size=11, color="black"),
24
yaxis_title='million square km',
25
yaxis_title_font=dict(family="Arial", size=11, color="black"),
26
margin_pad=10,
27
)
28
fig.show()
29
return fig
30
31
fig = create_linechart(df, "year", "extent")
Copied!

Output

Save and share output

1
fig.write_html(html_output)
2
fig.write_image(image_output)
Copied!
1
naas.asset.add(html_output, params={"inline": True})
2
naas.asset.add(image_output)
3
4
#-> Uncomment lines below to remove your assets
5
# naas.asset.delete(html_output)
6
# naas.asset.delete(image_output)
Copied!
Copy link
Edit on GitHub