Skip to content
Snippets Groups Projects
Commit f55a255f authored by Yngve Levinsen's avatar Yngve Levinsen
Browse files

ess.TraceWin.density_file can now read version 11 as well

parent e746d08e
No related branches found
No related tags found
No related merge requests found
Pipeline #9473 failed
...@@ -625,6 +625,10 @@ class density_file: ...@@ -625,6 +625,10 @@ class density_file:
self._max = numpy.zeros((counter, 7)) self._max = numpy.zeros((counter, 7))
self._min = numpy.zeros((counter, 7)) self._min = numpy.zeros((counter, 7))
if self.version >= 11:
self.phaseF = numpy.zeros((counter))
self.phaseG = numpy.zeros((counter))
if self.version >= 10: if self.version >= 10:
self.maxR = numpy.zeros((counter, 7)) self.maxR = numpy.zeros((counter, 7))
self.minR = numpy.zeros((counter, 7)) self.minR = numpy.zeros((counter, 7))
...@@ -714,6 +718,8 @@ class density_file: ...@@ -714,6 +718,8 @@ class density_file:
numpy.fromfile(self.fin, dtype=numpy.int16, count=12352 // 2) numpy.fromfile(self.fin, dtype=numpy.int16, count=12352 // 2)
elif self.version == 10: elif self.version == 10:
numpy.fromfile(self.fin, dtype=numpy.int16, count=12408 // 2) numpy.fromfile(self.fin, dtype=numpy.int16, count=12408 // 2)
elif self.version == 11:
numpy.fromfile(self.fin, dtype=numpy.int16, count=12416 // 2)
else: else:
raise TypeError("It is not possible to read this format..") raise TypeError("It is not possible to read this format..")
...@@ -737,7 +743,8 @@ class density_file: ...@@ -737,7 +743,8 @@ class density_file:
# self._getHeader() # self._getHeader()
# no need to read the header again: # no need to read the header again:
# (though only if we are SURE about content!) # (though only if we are SURE about content!)
numpy.fromfile(self.fin, dtype=numpy.int16, count=5) ver,year,vlong = numpy.fromfile(self.fin, dtype=numpy.int16, count=3)
Nrun = numpy.fromfile(self.fin, dtype=numpy.int32, count=1)[0]
self.nelp[self.i] = numpy.fromfile(self.fin, dtype=numpy.int32, count=1)[0] self.nelp[self.i] = numpy.fromfile(self.fin, dtype=numpy.int32, count=1)[0]
self.ib[self.i] = numpy.fromfile(self.fin, dtype=numpy.float32, count=1)[0] self.ib[self.i] = numpy.fromfile(self.fin, dtype=numpy.float32, count=1)[0]
...@@ -758,6 +765,10 @@ class density_file: ...@@ -758,6 +765,10 @@ class density_file:
self._max[self.i] = numpy.fromfile(self.fin, dtype=numpy.float32, count=n)[:] self._max[self.i] = numpy.fromfile(self.fin, dtype=numpy.float32, count=n)[:]
self._min[self.i] = numpy.fromfile(self.fin, dtype=numpy.float32, count=n)[:] self._min[self.i] = numpy.fromfile(self.fin, dtype=numpy.float32, count=n)[:]
if self.version >= 11:
self.phaseF[self.i] = numpy.fromfile(self.fin, dtype=numpy.float32, count=1)[0]
self.phaseG[self.i] = numpy.fromfile(self.fin, dtype=numpy.float32, count=1)[0]
if self.version >= 10: if self.version >= 10:
self.maxR[self.i] = numpy.fromfile(self.fin, dtype=numpy.float32, count=n)[:] self.maxR[self.i] = numpy.fromfile(self.fin, dtype=numpy.float32, count=n)[:]
self.minR[self.i] = numpy.fromfile(self.fin, dtype=numpy.float32, count=n)[:] self.minR[self.i] = numpy.fromfile(self.fin, dtype=numpy.float32, count=n)[:]
......
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