mirror of
https://github.com/ANG13T/SatIntel.git
synced 2026-03-12 21:22:58 -07:00
fix: ConstructTLE
This commit is contained in:
@@ -91,26 +91,28 @@ func TLETextFile() {
|
||||
func ConstructTLE(one string, two string, three string) TLE {
|
||||
tle := TLE{}
|
||||
tle.CommonName = one
|
||||
firstArr := strings.Split(two, "")
|
||||
secondArr := strings.Split(three, "")
|
||||
tle.SatelliteCatalogNumber, _ = strconv.Atoi(firstArr[1])
|
||||
tle.ElsetClassificiation = firstArr[2]
|
||||
tle.InternationalDesignator = firstArr[3]
|
||||
tle.ElementSetEpoch, _ = strconv.ParseFloat(firstArr[4], 64)
|
||||
tle.FirstDerivativeMeanMotion, _ = strconv.ParseFloat(firstArr[5], 64)
|
||||
tle.SecondDerivativeMeanMotion = firstArr[6]
|
||||
tle.BDragTerm = firstArr[7]
|
||||
tle.ElementSetType, _ = strconv.Atoi(firstArr[8])
|
||||
tle.ElementNumber, _ = strconv.Atoi(firstArr[9])
|
||||
tle.ChecksumOne, _ = strconv.Atoi(firstArr[10])
|
||||
tle.OrbitInclination, _ = strconv.ParseFloat(secondArr[1], 64)
|
||||
tle.RightAscension, _ = strconv.ParseFloat(secondArr[2], 64)
|
||||
tle.Eccentrcity, _ = strconv.ParseFloat(secondArr[3], 64)
|
||||
tle.Perigee, _ = strconv.ParseFloat(secondArr[4], 64)
|
||||
tle.MeanAnamoly, _ = strconv.ParseFloat(secondArr[5], 64)
|
||||
tle.MeanMotion, _ = strconv.ParseFloat(secondArr[6], 64)
|
||||
tle.RevolutionNumber, _ = strconv.Atoi(secondArr[7])
|
||||
tle.ChecksumTwo, _ = strconv.Atoi(secondArr[8])
|
||||
firstArr := strings.Fields(two)
|
||||
secondArr := strings.Fields(three)
|
||||
tle.SatelliteCatalogNumber, _ = strconv.Atoi(firstArr[1][:len(firstArr[1])-1])
|
||||
tle.ElsetClassificiation = string(firstArr[1][len(firstArr[1])-1])
|
||||
tle.InternationalDesignator = firstArr[2]
|
||||
tle.ElementSetEpoch, _ = strconv.ParseFloat(firstArr[3], 64)
|
||||
tle.FirstDerivativeMeanMotion, _ = strconv.ParseFloat(firstArr[4], 64)
|
||||
tle.SecondDerivativeMeanMotion = firstArr[5]
|
||||
tle.BDragTerm = firstArr[6]
|
||||
tle.ElementSetType, _ = strconv.Atoi(firstArr[7])
|
||||
tle.ElementNumber, _ = strconv.Atoi(firstArr[8][:len(firstArr[8])-1])
|
||||
tle.ChecksumOne, _ = strconv.Atoi(string(firstArr[8][len(firstArr[8])-1]))
|
||||
tle.SatelliteCatalogNumber, _ = strconv.Atoi(secondArr[1])
|
||||
tle.OrbitInclination, _ = strconv.ParseFloat(secondArr[2], 64)
|
||||
tle.RightAscension, _ = strconv.ParseFloat(secondArr[3], 64)
|
||||
tle.Eccentrcity, _ = strconv.ParseFloat("0." + secondArr[4], 64)
|
||||
tle.Perigee, _ = strconv.ParseFloat(secondArr[5], 64)
|
||||
tle.MeanAnamoly, _ = strconv.ParseFloat(secondArr[6], 64)
|
||||
fmt.Println(secondArr[7])
|
||||
tle.MeanMotion, _ = strconv.ParseFloat(secondArr[7][:11], 64)
|
||||
tle.RevolutionNumber, _ = strconv.Atoi(secondArr[7][11:16])
|
||||
tle.ChecksumTwo, _ = strconv.Atoi(string(secondArr[7][len(secondArr[7])-1]))
|
||||
|
||||
return tle
|
||||
}
|
||||
@@ -146,7 +148,7 @@ func TLEPlainString(){
|
||||
// TODO: Right Ascension of Ascending Node (degrees)
|
||||
|
||||
func PrintTLE (tle TLE) {
|
||||
fmt.Println(color.Ize(color.Purple, "╔═════════════════════════════════════════════════════════════╗"))
|
||||
fmt.Println(color.Ize(color.Purple, "\n╔═════════════════════════════════════════════════════════════╗"))
|
||||
fmt.Println(color.Ize(color.Purple, GenRowString("Name", tle.CommonName)))
|
||||
fmt.Println(color.Ize(color.Purple, GenRowString("Satellite Catalog Number", fmt.Sprintf("%d", tle.SatelliteCatalogNumber))))
|
||||
fmt.Println(color.Ize(color.Purple, GenRowString("Elset Classification", tle.ElsetClassificiation)))
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
1 00005U 58002B 23124.48670449 -.00000022 00000-0 -29578-5 0 9996
|
||||
2 00005 34.2435 229.9960 1846720 42.7915 330.2528 10.85080555319419
|
||||
1 25544U 98067A 04236.56031392 .00020137 00000-0 16538-3 0 9993
|
||||
2 25544 51.6335 344.7760 0007976 126.2523 325.9359 15.70406856328906
|
||||
Reference in New Issue
Block a user