Skip to content
Snippets Groups Projects
Commit b3f353f9 authored by Oleg Alexandrov's avatar Oleg Alexandrov Committed by Jesse Mapel
Browse files

Print clear error messages when cannot look up things (#455)

* Print clear error messages when cannot look up things

* Spell out the failing key
parent cc01d0e3
No related branches found
No related tags found
No related merge requests found
......@@ -573,7 +573,11 @@ class LroLrocNacIsisLabelIsisSpiceDriver(LineScanner, IsisSpice, IsisLabel, Driv
: list
Radial distortion coefficients. There is only one coefficient for LROC NAC l/r
"""
return [self.naif_keywords.get('INS{}_OD_K'.format(self.ikid), None)]
key = 'INS{}_OD_K'.format(self.ikid)
ans = self.naif_keywords.get(key, None)
if ans is None:
raise Exception('Could not parse the distortion model coefficients using key: ' + key)
return [ans]
@property
def detector_center_sample(self):
......@@ -873,7 +877,6 @@ class LroLrocWacIsisLabelIsisSpiceDriver(PushFrame, IsisLabel, IsisSpice, Radial
}
return id_lookup[super().instrument_id]
@property
def sensor_name(self):
return self.label['IsisCube']['Instrument']['SpacecraftName']
......@@ -940,10 +943,13 @@ class LroLrocWacIsisLabelIsisSpiceDriver(PushFrame, IsisLabel, IsisSpice, Radial
: list
Radial distortion coefficients.
"""
coeffs = self.naif_keywords.get('INS{}_OD_K'.format(self.fikid), None)
coeffs = [x * -1 for x in coeffs]
return coeffs
key = 'INS{}_OD_K'.format(self.fikid)
ans = self.naif_keywords.get(key, None)
if ans is None:
raise Exception('Could not parse the distortion model coefficients using key: ' + key)
ans = [x * -1 for x in ans]
return ans
@property
def framelet_height(self):
......@@ -963,8 +969,11 @@ class LroLrocWacIsisLabelIsisSpiceDriver(PushFrame, IsisLabel, IsisSpice, Radial
: list<double>
detector to focal plane x
"""
return self.naif_keywords.get('INS{}_TRANSX'.format(self.fikid), None)
key = 'INS{}_TRANSX'.format(self.fikid)
ans = self.naif_keywords.get(key, None)
if ans is None:
raise Exception('Could not parse detector to focal plane x using key: ' + key)
return ans
@property
def pixel2focal_y(self):
......@@ -976,7 +985,11 @@ class LroLrocWacIsisLabelIsisSpiceDriver(PushFrame, IsisLabel, IsisSpice, Radial
: list<double>
detector to focal plane y
"""
return self.naif_keywords.get('INS{}_TRANSY'.format(self.fikid), None)
key = 'INS{}_TRANSY'.format(self.fikid)
ans = self.naif_keywords.get(key, None)
if ans is None:
raise Exception('Could not parse detector to focal plane y using key: ' + key)
return ans
@property
def focal_length(self):
......@@ -992,7 +1005,11 @@ class LroLrocWacIsisLabelIsisSpiceDriver(PushFrame, IsisLabel, IsisSpice, Radial
float :
The focal length in millimeters
"""
return self.naif_keywords.get('INS{}_FOCAL_LENGTH'.format(self.fikid), None)
key = 'INS{}_FOCAL_LENGTH'.format(self.fikid)
ans = self.naif_keywords.get(key, None)
if ans is None:
raise Exception('Could not parse the focal length using key: ' + key)
return ans
@property
def detector_center_sample(self):
......@@ -1006,7 +1023,11 @@ class LroLrocWacIsisLabelIsisSpiceDriver(PushFrame, IsisLabel, IsisSpice, Radial
list :
The center of the CCD formatted as line, sample
"""
return self.naif_keywords.get('INS{}_BORESIGHT_SAMPLE'.format(self.fikid), None)
key = 'INS{}_BORESIGHT_SAMPLE'.format(self.fikid)
ans = self.naif_keywords.get(key, None)
if ans is None:
raise Exception('Could not parse the detector center sample using key: ' + key)
return ans
@property
def detector_center_line(self):
......@@ -1020,7 +1041,11 @@ class LroLrocWacIsisLabelIsisSpiceDriver(PushFrame, IsisLabel, IsisSpice, Radial
list :
The center of the CCD formatted as line, sample
"""
return self.naif_keywords.get('INS{}_BORESIGHT_LINE'.format(self.fikid), None)
key = 'INS{}_BORESIGHT_LINE'.format(self.fikid)
ans = self.naif_keywords.get(key, None)
if ans is None:
raise Exception('Could not parse the detector center line using key: ' + key)
return ans
class LroLrocWacIsisLabelNaifSpiceDriver(PushFrame, IsisLabel, NaifSpice, RadialDistortion, Driver):
"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment