9if __name__ ==
"__main__":
10 parser = argparse.ArgumentParser(
11 description=
"Peano 4 - Probe Script. Extract the values at one point over time from a Peano patch file into a csv file. The first column is the time stamp, the remaining columns are the unknowns of all data sets. There is no interpolation: we take the value of the finest cell (cell data) or nearest dof (vertex data)."
18 help=
"Coordinates of probe point (2 or 3 entries; z is ignored for 2d data)",
24 help=
"Name of the output csv file",
29 help=
"Probe only this data set (default: all data sets in file)",
36 help=
"Run in a chatty mode",
43 help=
"Input file is single snapshot (and not meta file). Time stamp is then 0",
52 help=
"Number of workers processing the snapshots in parallel",
56 "--start-snapshot-index",
59 help=
"First snapshot to probe, default is 0",
64 "--end-snapshot-index",
67 help=
"Last snapshot to probe, default is -1 (last snapshot)",
70 parser.add_argument(dest=
"filename", help=
"Input file name")
71 args = parser.parse_args()
73 if not os.path.exists(args.filename):
75 "Specified input file '{}' does not exist, exiting...".format(args.filename)
77 if len(args.point)
not in [2, 3]:
78 raise Exception(
"--point requires 2 or 3 coordinates")
79 if (args.start > args.end
and args.end != -1)
or args.start < 0
or args.end < -1:
80 raise Exception(
"Specified snapshot index is wrong, please check.")
83 file_name=args.filename,
85 output_file=args.output,
87 end=args.end
if args.end != -1
else sys.maxsize,
90 probe.identifier = args.set_identifier
93 probe.display_single_file()
95 probe.display(args.max_workers)
Probe the data within a Peano patch file at one point over time.