Library
Documentation for SatelliteToolboxTle.jl
.
SatelliteToolboxTle.AbstractTleFetcher
— Typeabstract type AbstractTleFetcher
Abstract type for all TLE fetchers.
SatelliteToolboxTle.TLE
— Typestruct TLE
Store the elements of a TLE (two-line elemens) using the same units.
We do not have fields for the line checksum since they are only required when creating or parsing a TLE string.
Fields
name
: Name of the satellite.
First line
satellite_number
: Satellite number.classification
: Classification ('U', 'C', or 'S').international_designator
: International designator.epoch_year
: Epoch year (two digits).epoch_day
: Epoch day (day + fraction of the day).dn_o2
: 1st time derivative of mean motion / 2 [rev/day²].ddn_o6
: 2nd time derivative of mean motion / 6 [rev/day³].bstar
: B* drag term.element_set_number
: Element set number.
Second line
incliantion
: Inclination [deg].raan
: Right ascension of the ascending node [deg].eccentricity
: Eccentricity [ ].argument_of_perigee
: Argument of perigee [deg].mean_anomaly
: Mean anomaly [deg].mean_motion
: Mean motion [rev/day].revolution_number
: Revolution number at epoch [rev].
Creating TLEs
You can manually create a TLE
by calling the function TLE(; kwargs...)
, where kwargs...
are keyword arguments with the same name as the fields. In this case, the following elements are required:
epoch_year
,epoch_day
,inclination
,raan
,eccentricity
,argument_of_perigee
,mean_anomaly
andmean_motion
.
The other ones are optional and default values will be assigned if not present.
SatelliteToolboxTle._show_tle
— Method_show_tle(io::IO, tle::TLE; color::Bool = true) -> Nothing
Show the TLE tle
in the IO io
.
Keywords
color::Bool
: Iftrue
, the text will be printed using colors. (Default =true
)
SatelliteToolboxTle.create_tle_fetcher
— Methodcreate_tle_fetcher(::Type{CelestrakTleFetcher}; kwargs...) -> CelestrakTleFetcher
Create a TLE fetcher from Celestrak service.
Keywords
url::String
: Default PHP webpage address that will be used to perform the queries. (Default: "https://celestrak.org/NORAD/elements/gp.php")
SatelliteToolboxTle.create_tle_fetcher
— Methodcreate_tle_fetcher(::Type{T}, args...; kwargs...) where T <: AbstractTleFetcher -> T
Create a TLE fetcher of type T
.
SatelliteToolboxTle.fetch_tles
— Methodfetch_tles(fetcher::CelestrakTleFetcher; kwargs...) -> Union{Nothing, Vector{TLE}}
Fetch TLEs from the Celestrak using fetch
with the parameters in kwargs...
.
This function returns a Vector{TLE}
with the fetched TLEs. If an error is found, it returns nothing
.
Keywords
international_designator::Union{Nothing, AbstractString}
: International designator using the Celestrak formatYYYY-NNN
, whereYYYY
is the launch year, and theNNN
is the launch number. (Default:nothing
)satellite_number::Union{Nothing, Number}
: Satellite catalog number (NORAD). (Default =nothing
)satellite_name::Union{Nothing, AbstractString}
: Satellite name. Notice that the system will search for all satellites whose name contains this string. (Default:nothing
)
Only one search parameter is supported. If more than one is given, the precedence is: 1) satellite_number
; 2) international_designator
; and 3) and satellite_name
.
If no search parameter is provided, the function throws an error.
SatelliteToolboxTle.fetch_tles
— Methodfetch_tles(fetcher::T; kwargs...) -> Vector{TLE}
Fetch TLEs using fetcher
.
The keywords kwargs...
are used to customize the search. It depends on the fetcher type T
.
SatelliteToolboxTle.read_tle
— Methodread_tle(l1::AbstractString, l2::AbstractString; kwargs...) -> TLE
Read the TLE in which the first line is l1
and second line is l2
.
Keywords
name::AbstractString
: The satellite name in the returned TLE object. (Default = "UNDEFINED")verify_checksum::Bool
: Iftrue
, the checksum of both TLE lines will be verified. Otherwise, the checksum will not be checked. (Default =true
)
SatelliteToolboxTle.read_tle
— Methodread_tle(str::AbstractString; verify_checksum::Bool = false) -> TLE
Read the TLE in the string str
.
str
must contain only one TLE. Hence, it must have two or three non-empty lines. The lines beginning with the character #
are discarded.
Keywords
verify_checksum::Bool
: Iftrue
, the checksum of both TLE lines will be verified. Otherwise, the checksum will not be checked. (Default =true
)
SatelliteToolboxTle.read_tles
— Methodread_tles(tles::AbstractString; verify_checksum::Bool = true) -> Vector{TLE}
Parse a set of TLEs in the string tles
. This function returns a Vector{TLE}
with the parsed TLEs.
Keywords
verify_checksum::Bool
: Iftrue
, the checksum of both TLE lines will be verified. Otherwise, the checksum will not be checked. (Default =true
)
SatelliteToolboxTle.read_tles_from_file
— Methodread_tles_from_file(filename::String; verify_checksum::Bool = true) -> Vector{TLE}
Read the TLEs in the file filename
and return a Vector{TLE}
with the parsed TLEs.
Keywords
verify_checksum::Bool
: Iftrue
, the checksum of both TLE lines will be verified. Otherwise, the checksum will not be checked. (Default =true
)
SatelliteToolboxTle.tle_epoch
— Methodtle_epoch(tle::TLE) -> Float64
Return the Julian day related to the tle
epoch.
SatelliteToolboxTle.tle_epoch
— Methodtle_epoch(DateTime, tle::TLE) -> Float64
Return the DateTime
related to the tle
epoch.
SatelliteToolboxTle.tle_line_checksum
— Methodtle_line_checksum(str::AbstractString) -> Int
Compute the checksum of the line str
modulo 10.
The algorithm is simple: add all the numbers in the line, ignoring letters, spaces, periods, and plus signs, but assigning +1 to the minus signs. The checksum is the remainder of the division by 10.
SatelliteToolboxTle.@tle_nc_str
— Macro@tle_nc_str(str) -> TLE
Parse one TLE in the string `str.
This function returns the parsed TLE or nothing
, if an error occured.
This function does not verify the checksums of the TLE. If the checksum verification is desired, use @tle_str
.
str
must contain only one TLE. Hence, it must have two or three non-empty lines. The lines beginning with the character #
are discarded.
Example
julia> tles = tle_nc"""
CBERS 4
1 40336U 14079A 18166.15595376 -.00000014 00000-0 10174-4 0 9993
2 40336 98.4141 237.7928 0001694 75.7582 284.3804 14.35485112184485
"""
SatelliteToolboxTle.@tle_str
— Macro@tle_str(str) -> TLE
Parse one TLE in the string `str.
This function returns the parsed TLE or nothing
, if an error occured.
This function verifies the checksums of the TLE. If the checksum verification is not desired, use @tle_nc_str
.
str
must contain only one TLE. Hence, it must have two or three non-empty lines. The lines beginning with the character #
are discarded.
Example
julia> tle = tle"""
CBERS 4
1 40336U 14079A 18166.15595376 -.00000014 00000-0 10174-4 0 9993
2 40336 98.4141 237.7928 0001694 75.7582 284.3804 14.35485112184485
"""
SatelliteToolboxTle.@tles_nc_str
— Macro@tles_nc_str(str) -> Vector{TLE}
Parse a set of TLEs in the string str
and return them as a Vector{TLE}
.
This version does not verify the checksum of the TLE. If the checksum verification is required, use @tles_nc_str
.
Example
julia> tles = tles_nc"""
CBERS 4
1 40336U 14079A 18166.15595376 -.00000014 00000-0 10174-4 0 9993
2 40336 98.4141 237.7928 0001694 75.7582 284.3804 14.35485112184485
SCD 1
1 22490U 93009B 18165.62596833 .00000225 00000-0 11410-4 0 9991
2 22490 24.9690 231.7852 0042844 200.7311 292.7198 14.44524498338066
SCD 2
1 25504U 98060A 18165.15074951 .00000201 00000-0 55356-5 0 9994
2 25504 24.9961 80.1303 0017060 224.4822 286.6438 14.44043397 37312
"""
SatelliteToolboxTle.@tles_str
— Macro@tles_str(str) -> Vector{TLE}
Parse a set of TLEs in the string str
and return them as a Vector{TLE}
.
This function verifies the checksums of the TLE. If the checksum verification is not desired, use @tles_nc_str
.
Example
julia> tles = tles"""
CBERS 4
1 40336U 14079A 18166.15595376 -.00000014 00000-0 10174-4 0 9993
2 40336 98.4141 237.7928 0001694 75.7582 284.3804 14.35485112184485
SCD 1
1 22490U 93009B 18165.62596833 .00000225 00000-0 11410-4 0 9991
2 22490 24.9690 231.7852 0042844 200.7311 292.7198 14.44524498338066
SCD 2
1 25504U 98060A 18165.15074951 .00000201 00000-0 55356-5 0 9994
2 25504 24.9961 80.1303 0017060 224.4822 286.6438 14.44043397 37312
"""