-
Notifications
You must be signed in to change notification settings - Fork 1
/
README.Rmd
104 lines (76 loc) · 3.08 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
---
output: rmarkdown::github_document
---
`satcat` : Tools to Work with the 'CelesTrak' Satellite Catalog API
T.S. Kelso has been transcribing NORAD's "resident space object" data for decades. One component of of this is the 'SATCAT' satellite catalog (<https://celestrak.com/satcat/search.asp>), which provides data on all known satellites launched since 1957.
Data source pkg inspired by mention on [Data Is Plural](http://tinyletter.com/data-is-plural/letters/data-is-plural-2017-01-11-edition).
The following functions are implemented:
- `read_satcat`: Read in a complete SATCAT database complete with expanded status code, site code and launch source codes.
### Installation
```{r eval=FALSE}
devtools::install_github("hrbrmstr/satcat")
```
```{r message=FALSE, warning=FALSE, error=FALSE}
options(width=120)
```
### Usage
```{r message=FALSE, warning=FALSE, error=FALSE}
library(satcat)
library(dplyr)
library(ggplot2)
# current verison
packageVersion("satcat")
satcat_df <- read_satcat()
glimpse(satcat_df)
dplyr::filter(satcat_df, is_active, perigee!=0) -> df
```
```{r fig.width=9, fig.height=3.5, fig.retina=2}
ggplot() +
geom_segment(data=df,
aes(x=designator, xend=designator, y=apogee, yend=perigee),
size=0.5, alpha=5/6, position=position_jitter()) +
geom_hline(yintercept=c(100, 360000), linetype='dotted') +
geom_text(data=data_frame(),
aes(x=c(10, 10), y=c(110, 400000),
label=c("Kármán line", "Lower lunar perigee")),
vjust=0, hjust=0) +
scale_y_continuous(name="Perigee:Apogee span (km, orbit) — log scale", label=scales::comma,
expand=c(0,0), limits=c(100,600000), trans="log10") +
labs(x=NULL, title="SATCAT Orbit Ranges of Active Satellites") +
hrbrmisc::theme_hrbrmstr_msc(grid="") +
theme(axis.text.x=element_blank()) +
theme(axis.ticks.x=element_blank())
```
```{r message=FALSE}
# How many satellites launched per source (country) [top 20]
count(satcat_df, source_full_name, sort=TRUE) %>%
mutate(ct=scales::comma(n), pct=scales::percent(n/sum(n))) %>%
select(-n) %>%
print(n=20)
# How many satellites launched per source (country) that are still active? [top 20]
filter(satcat_df, is_active) %>%
count(source_full_name, sort=TRUE) %>%
mutate(ct=scales::comma(n), pct=scales::percent(n/sum(n))) %>%
select(-n) %>%
print(n=20)
# What's the most popular launch site? [top 20]
count(satcat_df, launch_site_full_name, sort=TRUE) %>%
mutate(ct=scales::comma(n), pct=scales::percent(n/sum(n))) %>%
select(-n) %>%
mutate(launch_site_full_name=abbreviate(launch_site_full_name, 80)) %>%
print(n=20)
# What's the most popular launch site this century? [top 20]
filter(satcat_df, lubridate::year(launch_date) >= 2000) %>%
count(launch_site_full_name, sort=TRUE) %>%
mutate(ct=scales::comma(n), pct=scales::percent(n/sum(n))) %>%
select(-n) %>%
mutate(launch_site_full_name=abbreviate(launch_site_full_name, 80)) %>%
print(n=20)
```
### Test Results
```{r message=FALSE, warning=FALSE, error=FALSE}
library(satcat)
library(testthat)
date()
test_dir("tests/")
```