| ---
tgranular2img.1 (2371B)
---
1 .Dd $Mdocdate$
2 .Dt GRANULAR2IMG 1
3 .Os
4 .Sh NAME
5 .Nm granular2img
6 .Nd render granular data as image
7 .Sh SYNOPSIS
8 .Nm
9 .Op Fl f Ar field
10 .Op Fl h
11 .Op Fl l Ar label
12 .Op Fl t Ar term
13 .Sh DESCRIPTION
14 The
15 .Nm
16 utility reads
17 .Xr granular 5
18 formatted data and plots grains as an image file, pdf format by default,
19 and writes it to stdout.
20 The common use is to pipe the stdout to a file or a suitable program
21 which accepts the format as stdin.
22 .Pp
23 The options are as follows:
24 .Bl -tag -width Ds
25 .It Fl f Ar field
26 Specify the
27 .Xr awk 1
28 expression to use for grain coloring (default: '$1' (diameter)).
29 .It Fl h
30 Show help text.
31 .It Fl l Ar label
32 Set the label text for the color bar (default: 'diameter [m]').
33 .It Fl t Ar term
34 Specify the
35 .Xr gnuplot 1
36 output terminal type, for example pdf (default), png, or dumb.
37 Use the command "help term" in gnuplot
38 .Xr gnuplot 1
39 to see the available terminals.
40 .El
41 .Sh EXIT STATUS
42 .Nm
43 exits 0 on success, and >0 if a runtime error occurs:
44 .Pp
45 .Bl -tag -width Ds -compact
46 .It 0
47 successful exit
48 .It 1
49 unspecified error
50 .El
51 .Sh EXAMPLES
52 Read a file (packing.tsv) in
53 .Xr granular 5
54 format and save an image of it in pdf format:
55 .Pp
56 .Dl $ granular2img < packing.tsv > out.pdf
57 .Pp
58 Read output from
59 .Xr granularpacking 1
60 and plot it and save the result as a PNG file:
61 .Pp
62 .Dl $ granularpacking | granular2img -t png > out.png
63 .Pp
64 Color the grains according to the second field in the
65 .Xr granular 5
66 format, which is x position, set a suitable colorbar label, and open it
67 directly in the PDF viewer
68 .Xr zathura 1 :
69 .Bd -literal -offset indent
70 $ granularpacking | granular2img -f '$2' -l 'x pos. [m]' \\
71 | zathura -
72 .Ed
73 .Pp
74 Same as the previous example, but color grains according to the product
75 of x and y position:
76 .Bd -literal -offset indent
77 $ granularpacking | granular2img -f '$2*$3' -l 'x*y pos. [m]' \\
78 | zathura -
79 .Ed
80 .Pp
81 Loop over all output files from
82 .Xr granular 1
83 simulation "test", save them as images, and combine them into a video
84 animation:
85 .Bd -literal -offset indent
86 $ for f in test.grain.*.tsv; do \\
87 granular2img -t png < "$f" > "${f%.tsv}.png"; \\
88 done && \\
89 ffmpeg -framerate 5 -i test.grain.%05d.png \\
90 -c:v libx264 -r 30 -pix_fmt yuv420p test.mp4
91 .Ed
92 .Sh SEE ALSO
93 .Xr awk 1 ,
94 .Xr ffmpeg 1 ,
95 .Xr gnuplot 1 ,
96 .Xr granular2vtu 1 ,
97 .Xr granular 5
98 .Sh AUTHORS
99 .An Anders Damsgaard Aq Mt anders@adamsgaard.dk |