Skip to content
Snippets Groups Projects
Commit 6d763a6b authored by Destiny Kuehn's avatar Destiny Kuehn Committed by Omid Hosseini
Browse files

Fix for issue 11: Update support for mseeds with variable record

parent f8f00ab9
No related branches found
No related tags found
1 merge request!21Fix for issue 11: Update support for mseeds with variable record
......@@ -951,7 +951,23 @@ class MainWindow(QWidget):
if msfile.isMseed():
try:
# simple test to determine if correct size file
numblocks = msfile.numblocks
# numblocks = msfile.numblocks
filesize = msfile.filesize
blksize = msfile.blksize
(numblocks, odd_size) = divmod(
filesize, blksize)
if odd_size:
warn = ("WARNING: File size is not an "
"integer number of block size (4096).")
warn += " Start/End times cannot be displayed."
warn += " To fix variable record length, use fixhdr."
warn1 = "\t File:" + fullname
self.write_error(warn, "Size", "red")
self.write_error(warn1, "Size")
self.add_to_dict(
self.error_dict, "Size", directory, _file)
self.num_errors = self.num_errors + 1
except Exception:
err = ("ERROR: Cannot determine file and "
"block sizes.")
......@@ -980,12 +996,27 @@ class MainWindow(QWidget):
if not self.scan_type:
filelist = [_file]
else:
(startepoch, endepoch) = msfile.FirstLastTime()
endepoch += 1
start = lstrftime('%Y:%j:%H:%M:%S',
lgmtime(startepoch))
end = lstrftime('%Y:%j:%H:%M:%S',
lgmtime(endepoch))
if odd_size:
start, end, startepoch, endepoch = ('', '', '', '')
else:
try:
(startepoch, endepoch) = msfile.FirstLastTime()
except Exception as e:
err = ("ERROR: Cannot determine start and "
"end times.")
err1 = "\t File:" + fullname
self.write_error(err, "Read/Write", "red")
self.write_error(err1, "Read/Write")
self.add_to_dict(
self.error_dict, "Read/Write", directory, _file)
self.num_errors = self.num_errors + 1
continue
endepoch += 1
start = lstrftime('%Y:%j:%H:%M:%S',
lgmtime(startepoch))
end = lstrftime('%Y:%j:%H:%M:%S',
lgmtime(endepoch))
if self.scan_type == 1:
filelist = [_file, start, end]
else:
......@@ -999,14 +1030,18 @@ class MainWindow(QWidget):
if not self.scan_type:
self.stat_chan_loc_dict[fileid] = []
else:
try:
if startepoch < self.stat_chan_loc_dict[fileid][0][0]:
self.stat_chan_loc_dict[fileid][0][0] = startepoch
if endepoch > self.stat_chan_loc_dict[fileid][0][1]:
self.stat_chan_loc_dict[fileid][0][1] = endepoch
except KeyError:
if odd_size:
self.stat_chan_loc_dict[fileid] = []
self.stat_chan_loc_dict[fileid].append([startepoch, endepoch])
else:
try:
if startepoch < self.stat_chan_loc_dict[fileid][0][0]:
self.stat_chan_loc_dict[fileid][0][0] = startepoch
if endepoch > self.stat_chan_loc_dict[fileid][0][1]:
self.stat_chan_loc_dict[fileid][0][1] = endepoch
except KeyError:
self.stat_chan_loc_dict[fileid] = []
self.stat_chan_loc_dict[fileid].append([startepoch, endepoch])
# build endian lists
if msfile.byteorder == "big":
......@@ -1083,10 +1118,15 @@ class MainWindow(QWidget):
if not self.scan_type:
pass
else:
start = time.strftime('%Y:%j:%H:%M:%S', time.gmtime(
self.stat_chan_loc_dict[key][0][0]))
end = time.strftime('%Y:%j:%H:%M:%S', time.gmtime(
self.stat_chan_loc_dict[key][0][1]))
# variable record length
start, end = ('', '')
try:
start = time.strftime('%Y:%j:%H:%M:%S', time.gmtime(
self.stat_chan_loc_dict[key][0][0]))
end = time.strftime('%Y:%j:%H:%M:%S', time.gmtime(
self.stat_chan_loc_dict[key][0][1]))
except Exception as e:
pass
scan_info.append(start)
scan_info.append(end)
# templist = list(map(str, (start, end)))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment