5 from __future__
import print_function
13 def DM_read_pointfile(filename):
17 imp = pyDM.Import.create(filename, pyDM.DataFormat.auto)
20 print(
"Unable to create import object for '" + filename +
"'")
24 imp.readHeaderSeparately()
25 header = imp.getHeader()
28 print(
"File {} details:".format(filename))
29 print(
"\tFile format:", str(imp.getFileFormat()))
30 print(
"\tPoint count:", str(header.getPointCount()))
31 print(
"\tCRS :", str(header.getCRS()))
33 if len(header.attributes()) > 0:
34 print(
"\tAttributes:")
35 formatStr =
"\t\t{:<25}{:<10}"
36 print(formatStr.format(
"Name",
"Type"))
37 for attr
in header.attributes():
38 print(formatStr.format(attr.getName(), str(attr.getType())))
42 overallPtCount = header.getPointCount()
43 layout = header.getDataLayout()
49 pts = pyDM.NumpyConverter.get(obj, layout)
50 rows = pts[
"x"].shape[0]
54 if ptsToOutput != -1
and ptsOutput >= ptsToOutput:
57 print(f
'\t{ptsOutput:5d} { pts["x"][i]:12.3f} {pts["y"][i]:12.3f} {pts["z"][i]:10.3f}')
68 print(
"filename parameter missing")
71 DM_read_pointfile(sys.argv[1])