5 from __future__
import print_function
10 from opals
import pyDM
14 def DM_read_pointfile(filename):
18 imp = pyDM.Import.create(filename, pyDM.DataFormat.auto)
21 print(
"Unable to create import object for '" + filename +
"'")
25 imp.readHeaderSeparately()
26 header = imp.getHeader()
29 print(
"File {} details:".format(filename))
30 print(
"\tFile format:", str(imp.getFileFormat()))
31 print(
"\tPoint count:", str(header.getPointCount()))
32 print(
"\tCRS :", str(header.getCRS()))
34 formatStr =
"\t\t{:<25}{:<10}"
35 if len(header.properties()) > 0:
37 print(
"\tFile properties:")
38 print(formatStr.format(
"Name",
"Value"))
39 for prop
in header.properties():
40 print(formatStr.format(prop, str(header.getProperty(prop))))
41 if len(header.attributeProperties()) > 0:
43 print(
"\tAttribute properties: ", list(header.attributeProperties()))
44 if len(header.attributes()) > 0:
46 print(
"\tAttributes:")
47 print(formatStr.format(
"Name",
"Type"))
48 for attr
in header.attributes():
49 print(formatStr.format(attr.getName(), str(attr.getType())))
53 overallPtCount = header.getPointCount()
58 ptsRead += obj.sizePoint()
61 for i
in range(obj.sizePoint()):
62 if ptsToOutput != -1
and ptsOutput >= ptsToOutput:
66 print(
"\t{0:5d} {1:12.3f} {2:12.3f} {3:10.3f}".format(ptsOutput, pt.x,pt.y,pt.z))
69 if ptsToOutput != -1
and ptsOutput >= ptsToOutput:
79 print(
"filename parameter missing")
82 DM_read_pointfile(sys.argv[1])