# Examples of analysis that can be done with SatelliteToolbox.jl

**URL:** <https://discourse.julialang.org/t/examples-of-analysis-that-can-be-done-with-satellitetoolbox-jl/19330>\
**Category:** Astro/Space\
**Created:** [January 6, 2019, 6:15pm UTC](https://discourse.julialang.org/t/examples-of-analysis-that-can-be-done-with-satellitetoolbox-jl/19330 "2019-01-06T18:15:33Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [January 6, 2019, 6:15pm UTC](https://discourse.julialang.org/t/examples-of-analysis-that-can-be-done-with-satellitetoolbox-jl/19330/1 "2019-01-06T18:15:33Z")

</div>

Hi guys!

Just to let you know that I added to my blog a introductory post about the SatelliteToolbox.jl package: [https://ronanarraes.com/tutorials/julia/the-satellitetoolbox-for-julia/](https://www.ronanarraes.com/2019/01/the-satellite-toolbox-for-julia/)

I also provided two examples of analysis that can be done with the package:

1. Compute where the astronauts onboard the ISS were during the New Year; and
2. Compute the atmospheric density profiles with 4 different models.

If you have any suggestion of better examples, please let me know 🙂 . The idea is to eventually add all of them into the documentation.

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [January 6, 2019, 7:16pm UTC](https://discourse.julialang.org/t/examples-of-analysis-that-can-be-done-with-satellitetoolbox-jl/19330/2 "2019-01-06T19:16:15Z")

</div>

Hi Ronan,

An idea. The [OceanColor](http://oceancolor.gsfc.nasa.gov/) site serves lots of data and among them the so called L2 processing level provides almost on-time scenes corresponding approximately to 5 min of acquisition and ~2000 km of swath width. It happens that the file names are constructed with the date and time of acquisition, e.g. yyyydoyhhmm00 (year, day-of-year, hour, minutes, seconds). All fine, but if we want to access to a particular scene (or a group) one needs to go to the site and search for them. The idea is, given a date and geographic location, use the orbit propagation to compute the file name. Given that, one can automatically download the interest file because they are all located at same location (see [here](https://oceancolor.gsfc.nasa.gov/cgi/browse.pl?sub=level1or2&per=CU&day=17902&prm=CHL&set=10&mon=17866&sen=am&rad=0&frc=0&n=37.6171875&w=-8.7890625&id=1546800723.27001&cn=38.73&cs=37.13&cw=-10.34&ce=-8.74&dnm=D&file=A2019001141500.L2_LAC_OC_CHLOR_A_BRS&ndx=6&wid=170&hgt=254) for example, in case you don’t know this already).

To be honest I once started doing this using the SGP4 algorithm in Matlab but noticed that the orbit predicted with SGP4 (with an updated TLE file) started to diverge by 1 or 2 km from the scenes location. Than other things came in and I dropped this issue.

---

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [January 6, 2019, 8:01pm UTC](https://discourse.julialang.org/t/examples-of-analysis-that-can-be-done-with-satellitetoolbox-jl/19330/3 "2019-01-06T20:01:34Z")

</div>

Very good! I will try to do this and, if it works, I share with you 🙂 For how much time did you propagate the orbit to have 2 km of error?

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [January 6, 2019, 8:10pm UTC](https://discourse.julialang.org/t/examples-of-analysis-that-can-be-done-with-satellitetoolbox-jl/19330/4 "2019-01-06T20:10:19Z")

</div>

It was a couple years ago so memory is not fresh anymore, but I think it the TLE was only some months (2, 3?) old.

---

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [January 6, 2019, 9:41pm UTC](https://discourse.julialang.org/t/examples-of-analysis-that-can-be-done-with-satellitetoolbox-jl/19330/5 "2019-01-06T21:41:38Z")

</div>

I see. However, after 2 months of propagation from TLEs, it is unfortunately expected even larger errors ☹

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [January 6, 2019, 10:33pm UTC](https://discourse.julialang.org/t/examples-of-analysis-that-can-be-done-with-satellitetoolbox-jl/19330/6 "2019-01-06T22:33:17Z")

</div>

Ah, did’n know that and in fact it was also to take advantage of your knowledge that I brought up this matter. But as long as the error does not grow too much to “round up” to the neighbor patch, it should not prevent to give the right name.

---

<div class="post-metadata">

**Author:** ![Bernard\_GODARD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bernard_godard/32/4155_2.png) [@Bernard\_GODARD](https://discourse.julialang.org/u/Bernard_GODARD)\
**Post date:** [January 7, 2019, 6:09pm UTC](https://discourse.julialang.org/t/examples-of-analysis-that-can-be-done-with-satellitetoolbox-jl/19330/7 "2019-01-07T18:09:40Z")

</div>

Thank you for this post.

However I cannot run init\_space\_indices()

```julia
julia> init_space_indices()
[ Info: Downloading file 'fluxtable.txt' from 'ftp://ftp.geolab.nrcan.gc.ca/data/solar_flux/daily_flux_values/fluxtable.txt'.
┌ Warning: Download failed with error: failed process: Process(`curl -s -o /tmp/juliaTO7kCc -L ftp://ftp.geolab.nrcan.gc.ca/data/solar_flux/daily_flux_values/fluxtable.txt`, ProcessExited(13)) [13]
└ @ RemoteFiles ~/.julia/packages/RemoteFiles/2Wddl/src/download.jl:63
[ Info: Retrying in 5 seconds.

```

Using curl in the terminal:

```julia
$ curl -L ftp://ftp.geolab.nrcan.gc.ca/data/solar_flux/daily_flux_values/fluxtable.txt
curl: (13) Bad PASV/EPSV response: 502

```

This is saying that the server does not accept passive ftp connection (or this is a problem with the firewall where I am, that does not allow the client to initiate passive connections).

If I specify to curl that I want an active connection, it works:

```julia
curl -L ftp://ftp.geolab.nrcan.gc.ca/data/solar_flux/daily_flux_values/fluxtable.txt -P -

```

---

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [January 7, 2019, 6:59pm UTC](https://discourse.julialang.org/t/examples-of-analysis-that-can-be-done-with-satellitetoolbox-jl/19330/8 "2019-01-07T18:59:04Z")

</div>

Hi @Bernard_GODARD,

That is strange, it is working perfectly here, it can be your firewall. However, there is a way to circumvent the download of this file, put it on the directory: `.julia/packages/RemoteFiles/2Wddl/data`. In this case, the `init_space_indices()` will not try to download the file again.

EDIT: BTW, can you please open a bug in RemoteFiles.jl so that we can select custom flags to be passed to `curl` ?

---

<div class="post-metadata">

**Author:** ![Bernard\_GODARD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bernard_godard/32/4155_2.png) [@Bernard\_GODARD](https://discourse.julialang.org/u/Bernard_GODARD)\
**Post date:** [January 8, 2019, 10:25am UTC](https://discourse.julialang.org/t/examples-of-analysis-that-can-be-done-with-satellitetoolbox-jl/19330/9 "2019-01-08T10:25:00Z")

</div>

I have added a comment to a related issue you opened sometimes ago:  
[https://github.com/helgee/RemoteFiles.jl/issues/8#issuecomment-452247176](https://github.com/helgee/RemoteFiles.jl/issues/8#issuecomment-452247176)

In your example code on your blog, before plotting, you never define:

```julia
h=100e3:1e3:1000e3

```

and from the previous code snippets h is a scalar (ISS altitude in previous example) and the plot fails.

---

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [January 8, 2019, 12:52pm UTC](https://discourse.julialang.org/t/examples-of-analysis-that-can-be-done-with-satellitetoolbox-jl/19330/10 "2019-01-08T12:52:00Z")

</div>

Thanks! I have updated the post!

---

<div class="post-metadata">

**Author:** ![Balinus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/balinus/32/243_2.png) [@Balinus](https://discourse.julialang.org/u/Balinus)\
**Post date:** [January 8, 2019, 4:27pm UTC](https://discourse.julialang.org/t/examples-of-analysis-that-can-be-done-with-satellitetoolbox-jl/19330/11 "2019-01-08T16:27:52Z")

</div>

Nice work! Here’s some comment/suggestions. Feel free to use them or not! Just trying to be helpful. Best regards.

**Typo**  
“with the attitude and orbit control subsystem (AOCS)”

It should read:

“with the **altitude** and orbit control subsystem (AOCS)”

**Rephrasing**  
The following paragraphs should be shortened. It takes to much space and time before we actually goes into the main subject of your blog post. It’s also no longer relevant for new users of Julia. the mian informations could be included in the previous paragraph where you speak about FORTRAN.

" By that time (using v0.2 I think), Julia was a really new language. But I decided to accept the rough edges and try to code my algorithms using it. Anyway, it was just a personal side project to learn more about orbits. I did face many bugs, I had to use `master` (pre-v0.3) due to some bugs and missing features, but it was fun

After some years (and huge rewrites due to breaking changes), Julia released its v0.4. In this time, given the amount of code I had and the state of the language, I started to see that this bunch of algorithms can indeed be used for something at INPE to help in my activities. Hence, I decided to create a private package, which was called **SatToolbox.jl** , to organize everything I have done."

---

<div class="post-metadata">

**Author:** ![Bernard\_GODARD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bernard_godard/32/4155_2.png) [@Bernard\_GODARD](https://discourse.julialang.org/u/Bernard_GODARD)\
**Post date:** [January 8, 2019, 4:38pm UTC](https://discourse.julialang.org/t/examples-of-analysis-that-can-be-done-with-satellitetoolbox-jl/19330/12 "2019-01-08T16:38:35Z")

</div>

> [@Balinus](#):
>
> **Typo**  
> “with the attitude and orbit control subsystem (AOCS)”

This is actually correct: [Spacecraft attitude control - Wikipedia](https://en.wikipedia.org/wiki/Attitude_control)

---

<div class="post-metadata">

**Author:** ![Balinus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/balinus/32/243_2.png) [@Balinus](https://discourse.julialang.org/u/Balinus)\
**Post date:** [January 8, 2019, 4:48pm UTC](https://discourse.julialang.org/t/examples-of-analysis-that-can-be-done-with-satellitetoolbox-jl/19330/13 "2019-01-08T16:48:07Z")

</div>

I should have checked before! 🙂 We learn something new each day.

Cheers!

---

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [January 8, 2019, 10:43pm UTC](https://discourse.julialang.org/t/examples-of-analysis-that-can-be-done-with-satellitetoolbox-jl/19330/14 "2019-01-08T22:43:02Z")

</div>

Hi @Balinus,

Thanks for the suggestions 🙂 I am glad to you like the post!

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [August 31, 2021, 1:46pm UTC](https://discourse.julialang.org/t/examples-of-analysis-that-can-be-done-with-satellitetoolbox-jl/19330/15 "2021-08-31T13:46:08Z")

</div>

Ronan, I want to take a shot on doing this. In fact I already did it once in Matlab but only to plot the scene areas along the orbits computed with a single TLE. This time I would like to extend it to any period of the satellite life. I’ve been looking at [Space-Track.Org](https://www.space-track.org/documentation#/api) but can’t find a way of retrieving all the TLEs of a specific satellite.  
Do you know how one can do it?

Thanks  
Joaquim

---

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [August 31, 2021, 2:04pm UTC](https://discourse.julialang.org/t/examples-of-analysis-that-can-be-done-with-satellitetoolbox-jl/19330/16 "2021-08-31T14:04:58Z")

</div>

Hi @joa-quim ! Nice!

I have never tried to download all the TLEs of a specific satellite. However, I know you can download past TLEs in [space-track.org](http://space-track.org) in the section ELSET SEARCH.

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [August 31, 2021, 2:10pm UTC](https://discourse.julialang.org/t/examples-of-analysis-that-can-be-done-with-satellitetoolbox-jl/19330/17 "2021-08-31T14:10:57Z")

</div>

Cool, thanks. It even prints the API URL  
(random try for Landsat 8. Note, we must be log in to access it)

**[https://www.space-track.org/basicspacedata/query/class/gp\_history/NORAD\_CAT\_ID/39084/orderby/TLE\_LINE1](https://www.space-track.org/basicspacedata/query/class/gp_history/NORAD_CAT_ID/39084/orderby/TLE_LINE1) ASC/EPOCH/2018-12-01–2021-08-31/format/tle**

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [September 3, 2021, 12:14pm UTC](https://discourse.julialang.org/t/examples-of-analysis-that-can-be-done-with-satellitetoolbox-jl/19330/18 "2021-09-03T12:14:16Z")

</div>

Hi Ronan,  
I advanced a bit but am now stumbled on a problem. The orbit looks nice but it’s not correct. Here is a mwe of what I’m doing with the latest TLE for the AQUA satellite. I checked on the OceanColor site, a [site](https://www.n2yo.com/satellite/?s=27424) on the web and my Matlab program that also uses SGP4 propagator and the results are different from the one I get with.

```julia
	tle1 = "1 27424U 02022A 21245.83760660 .00000135 00000-0 39999-4 0 9997"
	tle2 = "2 27424 98.2123 186.0654 0002229 67.6025 313.3829 14.57107527 28342"
	tle = read_tle_from_string(tle1, tle2, true)
	orbp = SatelliteToolbox.init_orbit_propagator(Val(:sgp4), tle[1])
	
	times = DateTime("2021-09-02T13:30:00"):Second(60):DateTime("2021-09-02T14:30:00")
	n_pts = length(times)
	out = Matrix{Float64}(undef, n_pts, 4)
	for n = 1:n_pts
		t = datetime2julian(times[n])
		r, = SatelliteToolbox.propagate_to_epoch!(orbp, t)
		out[n,1], out[n,2], out[n,3], out[n, 4] = r[1], r[2], r[3], t
	end

	# Convert to lon lat. Must have GMT.jl to do this
	track = mapproject(out, E=true, I=true)

```

Do you spot any mistake in my code?

The track plots like

```julia
imshow(track, proj=:Robinson, region=:global, coast=true)

```

 ![track](https://global.discourse-cdn.com/julialang/original/3X/6/0/60d7d7c5d04a8e49e6307fcc3ce235641fa6f915.png)

From the OceanColor site (and the Matlab program too) the first point of this track should be in

 ![image](https://global.discourse-cdn.com/julialang/original/3X/8/6/8683e627163063d4ac76a83b9332739f408d8e97.jpeg)

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [September 3, 2021, 3:02pm UTC](https://discourse.julialang.org/t/examples-of-analysis-that-can-be-done-with-satellitetoolbox-jl/19330/19 "2021-09-03T15:02:39Z")

</div>

Hmm, I’m assuming the output of the propagators is in ECEF. Is that my mistake?

---

<div class="post-metadata">

**Author:** ![helgee](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/helgee/32/2022_2.png) [@helgee](https://discourse.julialang.org/u/helgee)\
**Post date:** [September 3, 2021, 3:07pm UTC](https://discourse.julialang.org/t/examples-of-analysis-that-can-be-done-with-satellitetoolbox-jl/19330/20 "2021-09-03T15:07:55Z")

</div>

Possibly, the propagator output is in an inertial frame: [Orbit propagators · Satellite Toolbox](https://juliaspace.github.io/SatelliteToolbox.jl/stable/man/orbit/propagators/#Reference-systems)

[Next page](https://discourse.julialang.org/t/examples-of-analysis-that-can-be-done-with-satellitetoolbox-jl/19330.md?page=2)
