Skip to content

Commit

Permalink
added some better logging for kernel downloading issues
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewAnnex committed Jul 27, 2016
1 parent d65f0e8 commit 604d4eb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
9 changes: 7 additions & 2 deletions spiceypy/tests/gettestkernels.py
Expand Up @@ -2,10 +2,13 @@
import time
import six.moves.urllib as urllib

# note this gets updated
currentLSK = 'naif0012.tls'

standardKernelList = ['pck00010.tpc',
'de421.bsp',
'gm_de431.tpc',
'naif0012.tls']
currentLSK ]
cwd = os.path.realpath(os.path.dirname(__file__))


Expand Down Expand Up @@ -34,6 +37,8 @@ def attemptDownload(url, kernelName, targetFileName, num_attempts):
current_attempt += 1
print("\t Attempting to Download kernel again...")
time.sleep(2 + current_attempt)
if current_attempt >= num_attempts:
raise BaseException("Error Downloading kernel: {}, check if kernel exists at url: {}".format(kernelName, url))


def getKernelNameFromURL(url):
Expand All @@ -45,7 +50,7 @@ def getStandardKernels():
kernelURLlist = ['http://naif.jpl.nasa.gov/pub/naif/generic_kernels/pck/pck00010.tpc',
'http://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/a_old_versions/de421.bsp',
'http://naif.jpl.nasa.gov/pub/naif/generic_kernels/pck/gm_de431.tpc',
'http://naif.jpl.nasa.gov/pub/naif/generic_kernels/lsk/naif0012.tls']
'http://naif.jpl.nasa.gov/pub/naif/generic_kernels/lsk/{}'.format(currentLSK)]
for kernel in kernelURLlist:
getKernel(kernel)

Expand Down
5 changes: 3 additions & 2 deletions spiceypy/tests/test_wrapper.py
Expand Up @@ -3,7 +3,7 @@
import numpy as np
import numpy.testing as npt
import os
from .gettestkernels import downloadKernels
from .gettestkernels import downloadKernels, currentLSK


cwd = os.path.realpath(os.path.dirname(__file__))
Expand All @@ -30,6 +30,7 @@
_mgsCk = os.path.join(cwd, "mgs_sc_ext26.bc")

_earthHighPerPck = os.path.join(cwd, "earth_latest_high_prec.bpc")
_naifLSK = os.path.join(cwd, currentLSK)


def setup_module(module):
Expand Down Expand Up @@ -2185,7 +2186,7 @@ def test_getelm():


def test_getfat():
arch, outtype = spice.getfat(os.path.join(cwd, 'naif0011.tls'))
arch, outtype = spice.getfat(_naifLSK)
assert arch == "KPL"
assert outtype == "LSK"

Expand Down

0 comments on commit 604d4eb

Please sign in to comment.