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

fix for dst read

toutatis distributions has a 7th line of zeros
now can read both correctly
parent b6b9c757
No related branches found
No related tags found
No related merge requests found
......@@ -42,15 +42,20 @@ class dst:
self.Ib=Header['Ib'][0]
self.freq=Header['freq'][0]
Table=numpy.fromfile(fin, dtype=numpy.float64, count=self.Np*6)
self._data=Table.reshape(self.Np,6)
# Some toutatis distributions has an undocumented 7th line of 0's
Table=numpy.fromfile(fin, dtype=numpy.float64, count=self.Np*7+1)
if len(Table)==self.Np*7+1:
self._data=Table[:-1].reshape(self.Np,7)
elif len(Table)==self.Np*6+1: # this is true in most cases
self._data=Table[:-1].reshape(self.Np,6)
else:
raise ValueError("Incorrect table dimensions found:",len(Table))
# convert x,y from cm to m:
self._data[:,0]*=1e-2
self._data[:,2]*=1e-2
Footer=numpy.fromfile(fin, dtype=numpy.float64, count=1)
self.mass=Footer[0]
self.mass=Table[-1]
def keys(self):
return self._columns[:]
......
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