9 from __future__
import print_function
11 from opals
import pyDM
17 dm = pyDM.Datamanager.load(odm,
True,
False)
19 print(
"Unable to open ODM '" + odm +
"'")
23 stat = dm.getAddInfoStatistics()
24 dmLayout = stat.layout()
27 print(
"Attribute list of the ODM:")
28 for i
in range(dmLayout.columns()):
29 name = dmLayout.name(i)
30 print(i,
"\t", dmLayout.name(i),
" "*(25-len(name)), dmLayout.type(i))
33 lf = pyDM.AddInfoLayoutFactory()
34 type, inDM = lf.addColumn(dm,
"GPSTime",
True);
assert inDM ==
True
35 type, inDM = lf.addColumn(dm,
"Amplitude",
True);
assert inDM ==
True
36 type, inDM = lf.addColumn(dm,
"EchoWidth",
True);
assert inDM ==
True
37 layout = lf.getLayout()
40 print(
"Get odm points as numpy object...")
42 numpyDict = pyDM.NumpyConverter.create(dm.sizePoint(),layout,
True)
43 pointindex = dm.getPointIndex()
47 count = float(pointindex.sizeLeaf())
48 for idx,leaf
in enumerate(pointindex.leafs()):
49 print(
"%5.1f%% finished" % (idx/count*100.) )
50 rowIdx += pyDM.NumpyConverter.fill(numpyDict,rowIdx,leaf)
52 print(
"100.0% finished.",rowIdx,
"points have been converted")
55 print(
"Output converted numpy arrays")
56 if sys.version_info >= (3, 0):
57 for attr, value
in numpyDict.items():
58 print(attr,
"->", value)
60 for attr, value
in numpyDict.iteritems():
61 print(attr,
"->", value)