コード例 #1
0
ファイル: example3.py プロジェクト: molinav/python-sat

# Define a conversion array from [rad, rad, m] into [deg, deg, km].
FACTOR = np.array([180/np.pi, 180/np.pi, 1/1000])
# Define output folder.
FOLDER = "./example3"

# Create output folder if it does not exist.
if not os.path.exists(FOLDER):
    os.mkdir(FOLDER)

# Open TLE file and extract its lines.
path_tle = "example3.tle"
with open(path_tle, "r") as file_tle:
    tle_list = [text_type(row.strip("\n")) for row in file_tle.readlines()]
ephem = Ephemeris.from_tle(*tle_list)

for case in ["day", "night"]:

    # Open MetOp-B Scene instance.
    path_img = text_type("example3_{}.l1b".format(case))
    scen = Scene(path_img, ephem)

    # Show time and TLE information.
    print("\n{}\n{}".format(path_img, 72*"-"))
    print("\nMetOp-B scene datetime information\n")
    print("  {:35} {}".format("Scene start datetime:    ", scen.start_datetime))
    print("  {:35} {}".format("Scene end datetime:      ", scen.end_datetime))
    print("  {:35} {}".format("Scene timedelta per scan:", scen.scan_timedelta))
    print(scen.orbit.ephemeris)
コード例 #2
0
ファイル: example1.py プロジェクト: molinav/python-sat
"""Example file where an Ephemeris instance is created using a TLE file."""

from __future__ import print_function
from six import text_type
from sat.Ephemeris import Ephemeris


path_tle = "example1.tle"

with open(path_tle, "r") as file_tle:

    # Read TLE text, create Ephemeris instance and export again to TLE text.
    tle_list1 = [text_type(row.strip("\n")) for row in file_tle.readlines()]
    obj = Ephemeris.from_tle(*tle_list1)
    tle_list2 = obj.to_tle()

    # Check that the original TLE and the new one are equivalent.
    flag = (tle_list1 == tle_list2)

    # Print TLE information.
    print("\n{}\n{}\n{}".format(*tle_list1))
    print(obj)
    print("\nImported and exported TLE sets are equivalent: {}".format(flag))