Skip to content
Snippets Groups Projects
Commit 8b38f395 authored by Jesse Mapel's avatar Jesse Mapel Committed by Kelvin Rodriguez
Browse files

IsisSpice now fails when it cannot find tables (#281)

* IsisSpice now fails when it cannot find tables

* Added test

* Fixed test error check
parent f7c84f3a
No related branches found
No related tags found
No related merge requests found
......@@ -205,6 +205,8 @@ class IsisSpice():
binary_data = read_table_data(table, self._file)
self._inst_pointing_table = parse_table(table, binary_data)
return self._inst_pointing_table
raise ValueError(f'Could not find InstrumentPointing table on file {self._file}')
return self._inst_pointing_table
@property
def body_orientation_table(self):
......@@ -223,6 +225,8 @@ class IsisSpice():
binary_data = read_table_data(table, self._file)
self._body_orientation_table = parse_table(table, binary_data)
return self._body_orientation_table
raise ValueError(f'Could not find BodyRotation table on file {self._file}')
return self._body_orientation_table
@property
def inst_position_table(self):
......@@ -241,6 +245,8 @@ class IsisSpice():
binary_data = read_table_data(table, self._file)
self._inst_position_table = parse_table(table, binary_data)
return self._inst_position_table
raise ValueError(f'Could not find InstrumentPosition table on file {self._file}')
return self._inst_position_table
@property
def sun_position_table(self):
......@@ -259,6 +265,8 @@ class IsisSpice():
binary_data = read_table_data(table, self._file)
self._sun_position_table = parse_table(table, binary_data)
return self._sun_position_table
raise ValueError(f'Could not find SunPosition table on file {self._file}')
return self._sun_position_table
def __enter__(self):
"""
......
......@@ -4,6 +4,7 @@ import pvl
import numpy as np
from ale.base.data_isis import IsisSpice
from conftest import get_image_label
testlabel = """
Object = IsisCube
......@@ -699,3 +700,17 @@ def test_inst_position_cache(testdata):
[[-1000, -2000*np.pi*np.sqrt(3)/9, 2000*np.pi*np.sqrt(3)/9],
[-2000*np.pi*np.sqrt(3)/9, 2000*np.pi*np.sqrt(3)/9, -1000]])
np.testing.assert_equal(sensor_times, [0, 1])
def test_no_tables():
test_file = get_image_label('B10_013341_1010_XN_79S172W')
test_mix_in = IsisSpice()
test_mix_in._file = test_file
test_mix_in.label = pvl.load(test_file)
with pytest.raises(ValueError):
test_mix_in.inst_pointing_table
with pytest.raises(ValueError):
test_mix_in.body_orientation_table
with pytest.raises(ValueError):
test_mix_in.inst_position_table
with pytest.raises(ValueError):
test_mix_in.sun_position_table
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment