Examples of analysis that can be done with SatelliteToolbox.jl

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/

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 :slight_smile: . The idea is to eventually add all of them into the documentation.

18 Likes

Hi Ronan,

An idea. The OceanColor 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 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.

2 Likes

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

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.

1 Like

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

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.

1 Like

Thank you for this post.

However I cannot run init_space_indices()

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:

$ 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:

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

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 ?

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

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

h=100e3:1e3:1000e3

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

1 Like

Thanks! I have updated the post!

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."

1 Like

This is actually correct: Spacecraft attitude control - Wikipedia

2 Likes

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

Cheers!

1 Like

Hi @Balinus,

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

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 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

1 Like

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 in the section ELSET SEARCH.

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 ASC/EPOCH/2018-12-01–2021-08-31/format/tle

1 Like

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 on the web and my Matlab program that also uses SGP4 propagator and the results are different from the one I get with.

	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

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

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

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

Possibly, the propagator output is in an inertial frame: Orbit propagators · Satellite Toolbox

1 Like