예제 #1
0
def test_tle_parse():

    x = tle("1 25338U 98030A   19351.71640046 +.00000015 +00000-0 +24973-4 0  9993",
        "2 25338 098.7340 012.5392 0011411 075.8229 284.4218 14.25943731122932",
        "NOAA-15")

    assert x.norad == 25338
예제 #2
0
def test_tle2lines():

    x = tle("1 25338U 98030A   19351.71640046 +.00000015 +00000-0 +24973-4 0  9993",
            "2 25338 098.7340 012.5392 0011411 075.8229 284.4218 14.25943731122932")
    assert x.name == ""
    assert x.line1 == "1 25338U 98030A   19351.71640046 +.00000015 +00000-0 +24973-4 0  9993"
    assert x.line2 == "2 25338 098.7340 012.5392 0011411 075.8229 284.4218 14.25943731122932"
예제 #3
0
    def parse_tlebulk(self, file: str = None):
        """Parses loaded TLE data, as downloaded from CELESTRAK. The file is essentially a
           lot of TLE lines concatenated together."""

        cnt = 0
        with open(file) as f:
            lines = f.readlines()
        for i in range(int(len(lines) / 3) ):
            name = lines[3*i].strip()
            line1 = lines[3*i+1].strip()
            line2 = lines[3*i+2].strip()
            t = tle(line1, line2, name)
            self.tle_names[name] = t
            self.tle_norad[t.norad] = t
            cnt += 1
        print("Loaded %d TLEs." % cnt)
예제 #4
0
def test_tle_bad_init():

    with pytest.raises(TypeError):
        # without any strings
        tle()

    with pytest.raises(TypeError):
        # with just one line
        tle("1 25338U 98030A   19351.71640046 +.00000015 +00000-0 +24973-4 0  9993")

    with pytest.raises(TypeError):
        tle("NOAA-15",
            "1 25338U 98030A   19351.71640046 +.00000015 +00000-0 +24973-4 0  9993",
            "2 25338 098.7340 012.5392 0011411 075.8229 284.4218 14.25943731122932",
            "unsubstantiated nonsense")