diff --git a/schainpy/VERSION b/schainpy/VERSION index c2efc09..ab70055 100644 --- a/schainpy/VERSION +++ b/schainpy/VERSION @@ -70,4 +70,5 @@ properly but the next days did not. 2.2.4: -jroproc_spectra_lags.py added to schainpy --Bug fixed in schainGUI: project created the same procUnit in some cases. +-Bug fixed in schainGUI: ProcUnit was created with the same id in some cases. +-Bug fixed in jroHeaderIO: Header size validation. diff --git a/schainpy/__init__.py b/schainpy/__init__.py index 01d295a..2d51a72 100644 --- a/schainpy/__init__.py +++ b/schainpy/__init__.py @@ -4,4 +4,4 @@ Created on Feb 7, 2012 @author $Author$ @version $Id$ ''' -__version__ = "2.2.3.3" \ No newline at end of file +__version__ = "2.2.4" \ No newline at end of file diff --git a/schainpy/model/data/jroheaderIO.py b/schainpy/model/data/jroheaderIO.py index 06f54cc..c03853d 100644 --- a/schainpy/model/data/jroheaderIO.py +++ b/schainpy/model/data/jroheaderIO.py @@ -149,6 +149,9 @@ class BasicHeader(Header): self.timeZone = int(header['nTimezone'][0]) self.dstFlag = int(header['nDstflag'][0]) self.errorCount = int(header['nErrorCount'][0]) + + if self.size < 24: + return 0 return 1 @@ -213,12 +216,13 @@ class SystemHeader(Header): endFp = self.size + startFp if fp.tell() > endFp: - sys.stderr.write("Warning: System header size is lower than it has to be") + sys.stderr.write("Warning %s: Size value read from System Header is lower than it has to be\n" %fp.name) return 0 if fp.tell() < endFp: - sys.stderr.write("Warning: System header size is greater than it is considered") - + sys.stderr.write("Warning %s: Size value read from System Header size is greater than it has to be\n" %fp.name) + return 0 + return 1 def write(self, fp): @@ -356,15 +360,15 @@ class RadarControllerHeader(Header): if fp.tell() != endFp: # fp.seek(endFp) - print "Radar Controller Header is not consistent read[%d] != header[%d]" %(fp.tell()-startFp,endFp) + print "%s: Radar Controller Header size is not consistent: from data [%d] != from header field [%d]" %(fp.name, fp.tell()-startFp, size) # return 0 if fp.tell() > endFp: - sys.stderr.write("Warning: Radar Controller header size is lower than it has to be") + sys.stderr.write("Warning %s: Size value read from Radar Controller header is lower than it has to be\n" %fp.name) # return 0 if fp.tell() < endFp: - sys.stderr.write("Warning: Radar Controller header size is greater than it is considered") + sys.stderr.write("Warning %s: Size value read from Radar Controller header is greater than it has to be\n" %fp.name) return 1 diff --git a/schainpy/model/io/jroIO_base.py b/schainpy/model/io/jroIO_base.py index 28ff38d..ac89eec 100644 --- a/schainpy/model/io/jroIO_base.py +++ b/schainpy/model/io/jroIO_base.py @@ -141,9 +141,14 @@ def isFileInTimeRange(filename, startDate, endDate, startTime, endTime): print "[Reading] Skipping the file %s because it has not a valid header" %(filename) return None - sts = systemHeaderObj.read(fp) - sts = radarControllerHeaderObj.read(fp) - sts = processingHeaderObj.read(fp) + if not systemHeaderObj.read(fp): + return None + + if not radarControllerHeaderObj.read(fp): + return None + + if not processingHeaderObj.read(fp): + return None filesize = os.path.getsize(filename)