pytroll / pyorbital

Orbital and astronomy computations in python
http://pyorbital.readthedocs.org/
GNU General Public License v3.0
226 stars 77 forks source link

Pyorbital fails to find TLE For some satellites #52

Closed wevonosky closed 4 years ago

wevonosky commented 4 years ago

Code Sample, a minimal, complete, and verifiable piece of code

from pyorbital.orbital import Orbital
sat_names = ['WORLDVIEW-1 (WV-1)', 'WORLDVIEW-2 (WV-2)', 'WORLDVIEW-3 (WV-3)',
             'SKYSAT-1', 'SKYSAT-2', 'SKYSAT-C1', 'SKYSAT-C2', 'SKYSAT-C3', 
             'SKYSAT-C4', 'SKYSAT-C5', 'SKYSAT-C6', 'SKYSAT-C7', 'SKYSAT-C8', 
             'SKYSAT-C9', 'SKYSAT-C10', 'SKYSAT-C11', 'SKYSAT-C12', 
             'SKYSAT-C13', 'GEOEYE 1', 'PATHFINDER 1', 'GLOBAL-1', 
             'BLACKSKY GLOBAL 2', 'GLOBAL-3', 'GLOBAL-4', 'PLEIADES 1A', 
             'PLEIADES 1B', 'DEIMOS-2', 'KOMPSAT-3A']

for sat in sat_names:
    orb = Orbital(sat)
    print (sat + ' Worked!')

Problem description

Pyorbital is having no problem finding the TLE for most of the satellites in the above list, but fails to find others. For example, it finds the TLE for all the SKYSAT-X satellites but fails for SKYSAT-C12 and SKYSAT-C13. I checked the names against the catalog in CelesTrak (https://celestrak.com/NORAD/elements/active.php) and verified the satellites are still in orbit (https://www.n2yo.com/database/?name=SKYSAT+C12#results)

It also fails for all of the GLOBAL satellites.

Expected Output

None

Actual Result, Traceback if applicable

KeyError: "Found no TLE entry for 'GLOBAL-4'"

Versions of Python, package at hand and relevant dependencies

Using Python 3.6

wevonosky commented 4 years ago

Seems some satellites included by CelesTrak are not categorized into the eight TLE_URLS checked by PyOrbital. The URL's checked by PyOrbital are:

TLE_URLS = ('http://celestrak.com/NORAD/elements/weather.txt',
            'http://celestrak.com/NORAD/elements/resource.txt',
            'https://www.celestrak.com/NORAD/elements/cubesat.txt',
            'http://celestrak.com/NORAD/elements/stations.txt',
            'https://www.celestrak.com/NORAD/elements/sarsat.txt',
            'https://www.celestrak.com/NORAD/elements/noaa.txt',
            'https://www.celestrak.com/NORAD/elements/amateur.txt',
            'https://www.celestrak.com/NORAD/elements/engineering.txt')

found at line 37 of tlefile.py

The satellites I mentioned that are not found by Pyorbital are found if you include the following CelesTrak link:

http://www.celestrak.com/NORAD/elements/active.txt

This link has a lot of redundant satellites that are found in the previous 8 links, but adding it may help with finding other satellites not categorized that are relevant to Earth science and imaging.

Edit: I modified TLE_URLS in my local copy of pyorbital with the above mentioned URL and now every satellite in my list returns a TLE.

mraspaud commented 4 years ago

@wevonosky Thanks a lot for bringing this issue to our attention. I have nothing against adding this file to the urls, so if you have the possibility send us a pull request. That would be highly appreciated !

wevonosky commented 4 years ago

@mraspaud I am pretty unfamiliar with pull requests so forgive me if I am missing something silly.

I created a clone of the repo on my local machine, then created a new branch and checked out onto it. Then I tried : git push origin add_tle_urls and got a permission error.

I was then going to make my changes, commit and push them to the branch and then create a pull request. Is there another way of doing this that I am missing?

mraspaud commented 4 years ago

@wevonosky the first thing you need to do before cloning is to create a fork of the pytroll/pyorbital repo. Then you have to clone your repo (not the pytroll one) and work on that. Then pushing should be working better. Maybe the following link could help ? https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork

wevonosky commented 4 years ago

Thanks @mraspaud

The pull request is in!