voy2isis error SPICE(INVALIDTIMESTRING) The input string contains an unrecognizable substring
The file C1483440.IMQ seems to have 'UNKNOWN' for IMAGE_TIME:
$ wget http://pds-rings.seti.org/volumes/VG_0xxx/VG_0013/JUPITER/C1483XXX/C1483440.IMQ $ voy2isis from=C1483440.IMQ to=C1483440.cub **ERROR** An unknown NAIF error has been encountered. The short explanation provided by NAIF is [SPICE(INVALIDTIMESTRING)]. The Naif error is [The input string contains an unrecognizable substring beginning at the character marked by <U>: "<U>NKNOWN"]. $ cat C1483440.IMQ | tr '\0' '\n' | grep TIME IMAGE_TIME = UNKNOWN7 EARTH_RECEIVED_TIME = 1979-01-13T01:04:23Z
The PDS cleaned up some of the data for the IMG/LBL files, as the corresponding LBL file does have an image time -
IMAGE_TIME = 1979-01-12T16:17:23.00
So I guess I'll need to edit the IMQ files where this happened before importing - I've got the complete set of image times so should be able to automate it.
Does ISIS have a way to edit IMQ files?
#1 Updated by Brian Burns about 2 years ago
There turned out to be 8 of these UNKNOWN time records in VG_0013 - I assume there will be more in other volumes.
So I got this working in Python to edit the IMQ files before running voy2isis - voy2isis does create a cube file even if it throws this error, but if you use editlab to edit the time there, spiceinit will fail on the cube file due to missing reseau data.
def getNextRecord(f): "Get next variable-length record and the position of its contents in the file" low = ord(f.read(1)) high = ord(f.read(1)) nbytes = high * 256 + low startPos = f.tell() s = f.read(nbytes) if (nbytes % 2) == 1: f.read(1) # read padding byte return s, startPos def getImageTimeRecord(f): "Search through records for IMAGE_TIME and return entire record and start file position" imageTimeRecord = None startPos = None while True: s, startPos = getNextRecord(f) if s.startswith('IMAGE_TIME'): imageTimeRecord = s break if s == 'END': break return imageTimeRecord, startPos def updateImageTime(sourceFile, time): "Replace IMAGE_TIME=UNKNOWN label in the given file with a UTC time" # the record fortunately has lots of spaces in it so can # fit the new time into it f = open(sourceFile, 'rb+') imageTimeRecord, startPos = getImageTimeRecord(f) if imageTimeRecord.endswith('UNKNOWN'): newImageTimeRecord = 'IMAGE_TIME = ' + time + 'Z' nspaces = len(imageTimeRecord) - len(newImageTimeRecord) newImageTimeRecord += ' ' * nspaces f.seek(startPos) f.write(newImageTimeRecord) f.close() # ... walk over files, get time from updated PDS indexes ... # import IMQ file to CUB file # if image time is UNKNOWN, this will return nonzero, which throws an error - # **ERROR** An unknown NAIF error has been encountered. The short explanation # provided by NAIF is [SPICE(INVALIDTIMESTRING)]. The Naif error is [The input # string contains an unrecognizable substring beginning at the character marked # by <U>: "<U>NKNOWN"]. # it does create a cubefile, but if use editlab on that, spiceinit fails # due to missing reseau info, so need to edit the IMQ file. try: cmd = "voy2isis from=%s to=%s" % (sourceFile, destFile) lib.system(cmd) except: # voy2isis will return nonzero, which throws an error print print "IMQ missing image time - adding value " + time # make sure IMQ file has an IMAGE_TIME updateImageTime(sourceFile, time) # try voy2isis again lib.system(cmd)