Tags: #nasa #naas #opendata #analytics #plotly
Sea level rise is caused primarily by two factors related to global warming: the added water from melting ice sheets and glaciers and the expansion of seawater as it warms. The first graph tracks the change in sea level since 1993 as observed by satellites.
The second graph, derived from coastal tide gauge and satellite data, shows how much sea level changed from about 1900 to 2018. Items with pluses (+) are factors that cause global mean sea level to increase, while minuses (-) are variables that cause sea levels to decrease. These items are displayed at the time they were affecting sea level.
The data shown are the latest available, with a four- to five-month lag needed for processing.
- You now need to create an Earthdata account to access NASA's sea level data. Register for free by clicking on 'Get data : http'. Once logged in you will access the data.
Website : https://climate.nasa.gov/vital-signs/sea-level/
Data source: Satellite sea level observations. Credit: NASA's Goddard Space Flight Center
import plotly.graph_objects as go
Data source : nasa_sea_levels.txt downloaded earlier
uri_nasa_sea_level = "nasa-sea-level-data.txt"
df = pandas.read_csv(uri_nasa_sea_level, engine="python", comment='HDR',delim_whitespace=True, names=["A","B","Year + Fraction","D","E","F","G", "H","I","J","K","Smoothed GMSL (mm)",])
Now lets only get the information we want and convert year + fraction to date
new_df = pandas.DataFrame(df, columns=['Year + Fraction', 'Smoothed GMSL (mm)'])
dates = 
values = 
ref = 0
for i, row in new_df.iterrows():
date_split = str(row['Year + Fraction']).split('.')
year = date_split
fraction = '0.' + date_split
float_fraction = float(fraction)
date = year + "-1-1"
date_delta = 365 * float_fraction
value = pandas.to_datetime(date) + pandas.to_timedelta(date_delta, unit='D')
#to stay inline with the graph visible on nasa's website, we need to have 0 as our first value
if i == 0:
ref = row['Smoothed GMSL (mm)']
val = row['Smoothed GMSL (mm)'] - ref
new_df['Date'] = dates
new_df['Value'] = values
fig = go.Figure(layout_title="<b>Sea Level variation since 1993 (mm)</b>")
x = new_df["Date"],
y = new_df["Value"],
text="Data source: Satellite sea level observations.<br> Credit: NASA's Goddard Space Flight Center",
fig.update_yaxes(title_text="Sea Height Variation (mm)")