diff --git a/ckMseed/ckMseed.py b/ckMseed/ckMseed.py index dd57d00a2c9889a85ccb68bbdfc3ba077e5652a2..c5afb0f1b20e481bb9e327f19d4feafa9327dc2c 100644 --- a/ckMseed/ckMseed.py +++ b/ckMseed/ckMseed.py @@ -957,15 +957,15 @@ class MainWindow(QWidget): (numblocks, odd_size) = divmod( filesize, blksize) if odd_size: - err = ("ERROR: File size is not an " - "integer number of block size (4096).") - err1 = "\t File:" + fullname - self.write_error(err, "Size", "red") - self.write_error(err1, "Size") + warn = ("WARNING: File size is not an " + "integer number of block size (4096).") + warn += " Use fixhdr to silence this warning." + 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 - continue except Exception: err = ("ERROR: Cannot determine file and " @@ -995,24 +995,27 @@ class MainWindow(QWidget): if not self.scan_type: filelist = [_file] 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 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: @@ -1026,14 +1029,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": @@ -1110,10 +1117,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)))