I am trying to track the position of the moon with ephem TLE data and then store it in data.csv files. However, I can't find it!
The code below is an example on what I am trying to do, this is for the ISS, its the TLE numbers in "line 1" and "line 2" for the moon I can´t find.
import logging
import logzero
from logzero import logger
from sense_hat import SenseHat
import os
import ephem
dir_path = os.path.dirname(os.path.realpath(__file__))
sh = SenseHat()
logzero.logfile(dir_path+"/iss.csv")
name = "ISS (ZARYA)"
line1 = "1 25544U 98067A 18032.92935684 .00002966 00000-0 52197-4 0 99911 25544U 98067A 18032.92935684 .00002966 00000-0 52197-4 0 9991"
line2 = "2 25544 51.6438 332.9972 0003094 62.2964 46.0975 15.54039537 97480"
iss = ephem.readtle(name, line1, line2)
iss.compute()
formatter = logging.Formatter('%(name)s - %(asctime)-15s - %(levelname)s: %(message)s');
logzero.formatter(formatter)
sublat = iss.sublat
sublong = iss.sublong
logger.info("%s,%s", sublong, sublat, )
Welcome to Stack Overflow!
I have never seen anyone generate TLE data for the Moon. TLE files are specifically designed to describe the orbit of artificial satellites, not a large astronomical body at the distance of the Moon, so the results would probably not be very accurate, even if you could fit the Moon's motion to a TLE orbit.
PyEphem does have an ephem.Moon()
object that gives positions for the Moon, though it's not implemented using TLE, but VSOP87. Would that work? Here is the documentation on how objects like the Moon and planets work: