Satellites over time
Tags: #celestrak #opendata #satelltes
Author: Dumorya
We analyze the number of satellites in the space from the first launch to now, and the part of them which became inactive. These data come from http://www.celestrak.com/. It provides free data as CSV files easily accessible. The CSV file we got contains many data as the name of the satellite, its owner, launch site, id, apogee and many others. What interested us the most were the status code, the launch date and the decay date, in order to create a graph with years in X axis and number of satellites in Y axis.

Input

Import librairies

1
import pandas as pd
2
import plotly.express as px
3
import plotly.graph_objects as go
4
import numpy as np
Copied!

Variables

1
URL = 'http://www.celestrak.com/pub/satcat.csv'
Copied!

Model

Recovery and processing of CSV data

1
df = pd.read_csv(URL)
2
df = df[['OPS_STATUS_CODE', 'LAUNCH_DATE', 'DECAY_DATE']]
3
df['DECAY_DATE'] = df['DECAY_DATE'].mask(df['DECAY_DATE'].isnull(), '9999')
4
df['LAUNCH_DATE'] = df['LAUNCH_DATE'].str[:4].astype(int)
5
df['DECAY_DATE'] = df['DECAY_DATE'].str[:4].astype(int)
6
years = df['LAUNCH_DATE'].unique()
7
inactive = list()
8
active = list()
9
10
for year in years:
11
active.append(len(df[
12
((df['OPS_STATUS_CODE'].isin(['+', 'P', 'B', 'S', 'X'])) & (df['LAUNCH_DATE'] <= year))
13
| ((df['DECAY_DATE'] > year) & (df['OPS_STATUS_CODE'] == 'D') & (df['LAUNCH_DATE'] <= year))
14
].index))
15
16
inactive.append(len(df[
17
((df['OPS_STATUS_CODE'] == 'D') & (df['DECAY_DATE'] <= year))
18
| ((df['OPS_STATUS_CODE'] == '-') & (df['LAUNCH_DATE'] <= year) )
19
].index))
20
Copied!

Output

Display plot of the number of satellites in space over time

1
fig = go.Figure(data=[
2
go.Bar(name='Inactive satellites', x=years, y=inactive),
3
go.Bar(name='Active satellites', x=years, y=active)
4
])
5
# Change the bar mode
6
fig.update_layout(
7
title="Number of satellites in space over time",
8
xaxis_title="Years",
9
yaxis_title="Number of satellites",
10
barmode='stack'
11
)
12
fig.show()
Copied!
Source: http://www.celestrak.com/pub/satcat.csv

Display the percentage of inactive VS active satellites from 1957 to now

1
labels = years
2
widths = [100/len(years) for year in years]
3
4
active_percentage = list()
5
inactive_percentage = list()
6
7
for index, _ in np.ndenumerate(active):
8
total = active[index[0]] + inactive[index[0]]
9
active_percentage.append(active[index[0]]/total*100)
10
inactive_percentage.append(inactive[index[0]]/total*100)
11
12
data = {
13
"Inactive": inactive_percentage,
14
"Active": active_percentage
15
}
16
17
fig = go.Figure()
18
for key in data:
19
fig.add_trace(go.Bar(
20
name=key,
21
y=data[key],
22
x=years,
23
offset=0
24
))
25
26
fig.update_xaxes(range=[years[0],years[-1]])
27
fig.update_yaxes(range=[0,100])
28
29
fig.update_layout(
30
title_text="Percentage of inactive VS active satellites from 1957 to now",
31
barmode="stack",
32
uniformtext=dict(mode="hide", minsize=10),
33
)
Copied!
Last modified 2mo ago
Copy link
Edit on GitHub