telemetry-cli 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- telemetry_cli/__init__.py +8 -0
- telemetry_cli/_cli.py +18 -0
- telemetry_cli/_getopt.py +114 -0
- telemetry_cli/_msg.py +39 -0
- telemetry_cli/_pack.py +183 -0
- telemetry_cli/_perl.py +183 -0
- telemetry_cli/pick/__init__.py +1 -0
- telemetry_cli/pick/__main__.py +7 -0
- telemetry_cli/pick/cli.py +157 -0
- telemetry_cli/pick/commandline.py +219 -0
- telemetry_cli/pick/fields.py +166 -0
- telemetry_cli/pick/formats.py +191 -0
- telemetry_cli/pick/help.py +536 -0
- telemetry_cli/pick/symbols/airmoc +24 -0
- telemetry_cli/pick/symbols/aux +28 -0
- telemetry_cli/pick/symbols/corr +31 -0
- telemetry_cli/pick/symbols/corrOld +29 -0
- telemetry_cli/pick/symbols/hw +16 -0
- telemetry_cli/pick/symbols/moc +42 -0
- telemetry_cli/pick/symbols/subcom +83 -0
- telemetry_cli/pick/symbols/subcom_2002 +111 -0
- telemetry_cli/recl/__init__.py +1 -0
- telemetry_cli/recl/__main__.py +7 -0
- telemetry_cli/recl/cli.py +214 -0
- telemetry_cli/recl/corr.py +83 -0
- telemetry_cli/recs/__init__.py +1 -0
- telemetry_cli/recs/__main__.py +7 -0
- telemetry_cli/recs/cli.py +182 -0
- telemetry_cli/recs/extract.py +399 -0
- telemetry_cli/tgen/__init__.py +1 -0
- telemetry_cli/tgen/__main__.py +7 -0
- telemetry_cli/tgen/cli.py +128 -0
- telemetry_cli/tgen/cmdfile.py +68 -0
- telemetry_cli/tgen/convert.py +278 -0
- telemetry_cli/tgen/examples/arb_data.tgen +15 -0
- telemetry_cli/tgen/examples/calsweep.tgen +32 -0
- telemetry_cli/tgen/examples/cond_fill.tgen +17 -0
- telemetry_cli/tgen/examples/counter.tgen +11 -0
- telemetry_cli/tgen/examples/null_data.tgen +11 -0
- telemetry_cli/tgen/examples/random_size.tgen +20 -0
- telemetry_cli/tgen/examples/subcom.tgen +14 -0
- telemetry_cli/tgen/examples/valueV_value.tgen +20 -0
- telemetry_cli/tgen/runtime.py +390 -0
- telemetry_cli-1.0.0.dist-info/METADATA +106 -0
- telemetry_cli-1.0.0.dist-info/RECORD +48 -0
- telemetry_cli-1.0.0.dist-info/WHEEL +4 -0
- telemetry_cli-1.0.0.dist-info/entry_points.txt +5 -0
- telemetry_cli-1.0.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,536 @@
|
|
|
1
|
+
"""pick's built-in help (``pick ?``, ``pick ?p``, ...).
|
|
2
|
+
|
|
3
|
+
The text is the Perl original's, with corrections noted in the CHANGELOG.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from .. import __version__
|
|
9
|
+
|
|
10
|
+
USAGE = """
|
|
11
|
+
pick Usage:
|
|
12
|
+
|
|
13
|
+
pick filename recordLength -options parameters fields
|
|
14
|
+
cat datafile | pick recordLength -options parameters fields
|
|
15
|
+
|
|
16
|
+
The filename must be the first command line argument if specified.
|
|
17
|
+
The record length (bytes, or specify data type units) must be the
|
|
18
|
+
next command line argument. See ?p for alternatives.
|
|
19
|
+
|
|
20
|
+
Detailed Help available:
|
|
21
|
+
'pick ?p' for help on parameters
|
|
22
|
+
'pick ?r' for help on field requests
|
|
23
|
+
'pick ?f' for help on printFormatLists
|
|
24
|
+
'pick ?t' for help on data types
|
|
25
|
+
'pick ?m' for help on move requests
|
|
26
|
+
'pick ?o' for help on options
|
|
27
|
+
'pick ?g' for help on groupings and multiplers
|
|
28
|
+
'pick ?x' for some examples
|
|
29
|
+
'pick ?q' for help on symbol files
|
|
30
|
+
'pick ?v' for version and author
|
|
31
|
+
'pick ??' for all help available
|
|
32
|
+
(Pipe the output to more, i.e., 'pick ?? | more' for readability.)
|
|
33
|
+
|
|
34
|
+
In zsh, quote the question mark ('pick "?p"'), or use 'pick --help p'.
|
|
35
|
+
The full manual is at
|
|
36
|
+
https://github.com/donalgrant/telemetry-cli/blob/main/docs/pick.md
|
|
37
|
+
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
PARAMETERS = """
|
|
41
|
+
|
|
42
|
+
The parameters are of the form:
|
|
43
|
+
key1 = val1 key2 = val2 ...
|
|
44
|
+
|
|
45
|
+
The available parameter keywords are listed below.
|
|
46
|
+
The value is a number of records for the start, stop,
|
|
47
|
+
skip, nrecs, rec and every keys, a number of bytes
|
|
48
|
+
or data type words (see data type help) for the head,
|
|
49
|
+
length and size keys. The file key takes an ascii filename.
|
|
50
|
+
|
|
51
|
+
file: alternative way to specify filename.
|
|
52
|
+
(filename is a synonym for file)
|
|
53
|
+
size: alternative way to specify recordLength.
|
|
54
|
+
(length is a synonym)
|
|
55
|
+
|
|
56
|
+
start: First record to extract (zero offset), default 0
|
|
57
|
+
stop: Last record to extract, default is '-1', indicating EOF.
|
|
58
|
+
skip: Number of records to skip between each extract.
|
|
59
|
+
(default is zero; extract every record)
|
|
60
|
+
head: Number of bytes or data words to skip before
|
|
61
|
+
counting records. E.g., head=256 ignores a
|
|
62
|
+
256-byte header, head=4z ignores a header of
|
|
63
|
+
four single-precision complexes. (32 bytes)
|
|
64
|
+
|
|
65
|
+
rec: Extract a single record (same as start=stop=rec)
|
|
66
|
+
nrecs: Use instead of specifying both start and stop;
|
|
67
|
+
determines number of records to extract. I.e,
|
|
68
|
+
start=0 nrecs=11 is the same as start=0, stop=10
|
|
69
|
+
every: Use instead of skip; every=10 gets every 10th record.
|
|
70
|
+
(i.e., same as skip=9)
|
|
71
|
+
|
|
72
|
+
order: Byte order of the data: big, little, or native (the
|
|
73
|
+
default, this machine's order). The -r option
|
|
74
|
+
reverses whichever order is in effect.
|
|
75
|
+
|
|
76
|
+
"""
|
|
77
|
+
|
|
78
|
+
OPTIONS = """
|
|
79
|
+
|
|
80
|
+
The options are of the form -opt1opt2... or -opt1 -opt2:
|
|
81
|
+
|
|
82
|
+
l: print a line number for every output line.
|
|
83
|
+
n: print a record number for every output line.
|
|
84
|
+
m: print the byte location in the file for every output line.
|
|
85
|
+
r: reverse the order of the bytes.
|
|
86
|
+
u: all output is in binary format only; ignore print requests
|
|
87
|
+
b: fast version of 'u' option: no bit masking or byte reversal
|
|
88
|
+
q: quiet output; turn off diagnostic messages, which are sent to STDERR
|
|
89
|
+
s: suppress c/r after printing for each record
|
|
90
|
+
|
|
91
|
+
For example,
|
|
92
|
+
'pick file.dat 20f -nlr ...'
|
|
93
|
+
would print each line with the line number, then
|
|
94
|
+
the record number, followed by whatever data were
|
|
95
|
+
requested in the command line (represented by '...').
|
|
96
|
+
These data would be interpreted in reverse byte order
|
|
97
|
+
before printing.
|
|
98
|
+
|
|
99
|
+
"""
|
|
100
|
+
|
|
101
|
+
FIELDS = """
|
|
102
|
+
|
|
103
|
+
There are two kinds of field requests: moves and prints.
|
|
104
|
+
A print request will also move the current location in
|
|
105
|
+
the record. A move request generates no output.
|
|
106
|
+
|
|
107
|
+
Type 'pick ?m' for help on move requests.
|
|
108
|
+
|
|
109
|
+
A print request has the format:
|
|
110
|
+
|
|
111
|
+
N'type'Offset:bitOffset:nBits'printFormatList'
|
|
112
|
+
|
|
113
|
+
and must be separated by spaces from every other
|
|
114
|
+
command line argument. The components are defined as:
|
|
115
|
+
|
|
116
|
+
N: Number of sequential fields of this data type
|
|
117
|
+
to extract and print. N is optional, with a
|
|
118
|
+
default value of 1. It must not have a sign
|
|
119
|
+
prefixed ('+' or '-').
|
|
120
|
+
|
|
121
|
+
type: The data type of the fields to extract and print.
|
|
122
|
+
Type 'pick ?t' for information on data types.
|
|
123
|
+
|
|
124
|
+
Offset: The 'Offset' has the form:
|
|
125
|
+
dataOffset(+|-)byteOffset
|
|
126
|
+
where dataOffset is the absolute location
|
|
127
|
+
of this item in the record in numbers of items
|
|
128
|
+
of type 'type', and the byteOffset is the
|
|
129
|
+
the desired offset in bytes from this location.
|
|
130
|
+
'Offset' is an optional parameter, if not
|
|
131
|
+
specified, the next item in the record will be
|
|
132
|
+
selected. The 'byteOffset' is an optional
|
|
133
|
+
component of the 'Offset'. However, if it
|
|
134
|
+
is used, then the 'dataOffset' must also be
|
|
135
|
+
specified, even if '0'. The sign must be
|
|
136
|
+
included as part of the byteOffset.
|
|
137
|
+
For example, the field
|
|
138
|
+
z60-2
|
|
139
|
+
selects the 61st single-precision complex item (z0 is the first),
|
|
140
|
+
offset towards the beginning of the record by
|
|
141
|
+
two bytes. A common convenient way to specify
|
|
142
|
+
an absolute byte location within a record is to
|
|
143
|
+
specify the dataOffset as zero with a positive
|
|
144
|
+
byte offset. For example, the request above
|
|
145
|
+
could also be written:
|
|
146
|
+
z0+478
|
|
147
|
+
which selects the complex number at an offset
|
|
148
|
+
of 478 bytes from the beginning of the record.
|
|
149
|
+
The counting for byte and data offsets, as with
|
|
150
|
+
all other counting in pick, is zero-offset.
|
|
151
|
+
|
|
152
|
+
bitOffset: (Not available for data types with more than 4 bytes.)
|
|
153
|
+
An optional field which specifies the first
|
|
154
|
+
bit of the data field to use. 'bitOffset'
|
|
155
|
+
is zero offset. For example, the field
|
|
156
|
+
i:7
|
|
157
|
+
selects the next integer, and only uses
|
|
158
|
+
the eighth through 32nd bits (7--31)
|
|
159
|
+
for printing. Bit zero is the LSB.
|
|
160
|
+
|
|
161
|
+
nBits: (Not available for data types with more than 4 bytes.)
|
|
162
|
+
If a 'bitOffset' is specified, 'nBits' may
|
|
163
|
+
be used to to select the number of bits,
|
|
164
|
+
starting from the 'bitOffset', to be printed.
|
|
165
|
+
For example, the field
|
|
166
|
+
w5:1:7
|
|
167
|
+
selects the second through eighth bits (1-7)
|
|
168
|
+
of the sixth unsigned short in the record (w0 is the first).
|
|
169
|
+
|
|
170
|
+
printFormatList: Zero or more print formats used to
|
|
171
|
+
specify the format of the output for
|
|
172
|
+
this field request.
|
|
173
|
+
Type 'pick ?f' for detailed help.
|
|
174
|
+
|
|
175
|
+
"""
|
|
176
|
+
|
|
177
|
+
FORMATS = """
|
|
178
|
+
|
|
179
|
+
printFormatList: The printing formats available are:
|
|
180
|
+
|
|
181
|
+
Available to all Data Types:
|
|
182
|
+
'x' hex 'o' octal
|
|
183
|
+
'b' binary 'c' ascii
|
|
184
|
+
|
|
185
|
+
'S' ascii, with no space between items.
|
|
186
|
+
'A' ascii, won't print non-printing characters.
|
|
187
|
+
|
|
188
|
+
'U' unformatted (binary bytes) output
|
|
189
|
+
|
|
190
|
+
Available to Integral Data Types Only:
|
|
191
|
+
'd' decimal 'u' unsigned decimal
|
|
192
|
+
|
|
193
|
+
Available to Floating Data Types Only:
|
|
194
|
+
'g' floating (For complex types, equivalent to RI format.)
|
|
195
|
+
'G' same as 'g', but with lots of digits.
|
|
196
|
+
'D' degrees; assumes the data value is in
|
|
197
|
+
radians, and performs the conversion to
|
|
198
|
+
output degrees.
|
|
199
|
+
|
|
200
|
+
Available to Complex Data Types Only:
|
|
201
|
+
'R' real component 'I' imaginary component
|
|
202
|
+
'M' magnitude 'P' phase in radians
|
|
203
|
+
'D' phase in degrees
|
|
204
|
+
|
|
205
|
+
Non-data print formats for all types:
|
|
206
|
+
'n' insert CR/LF 's' insert <sp>
|
|
207
|
+
|
|
208
|
+
A 'printFormatList' is composed of zero or more
|
|
209
|
+
printing formats. If none is specified, the
|
|
210
|
+
defaults will be used:
|
|
211
|
+
Data Type Default Printformat
|
|
212
|
+
A A
|
|
213
|
+
S S
|
|
214
|
+
c c
|
|
215
|
+
b x
|
|
216
|
+
s d
|
|
217
|
+
w u
|
|
218
|
+
i d
|
|
219
|
+
u u
|
|
220
|
+
f g
|
|
221
|
+
d g
|
|
222
|
+
z RI
|
|
223
|
+
Z RI
|
|
224
|
+
|
|
225
|
+
For example:
|
|
226
|
+
f wb zMPn i0+57osss Z b5:1:7bdx
|
|
227
|
+
Prints a single precision floating point in 'g'
|
|
228
|
+
format, an unsigned short in binary, a single-
|
|
229
|
+
precision complex's magnitude and phase followed
|
|
230
|
+
by a newline, the integer at byte offset 57 in
|
|
231
|
+
octal followed by three extra spaces, a
|
|
232
|
+
double-precision complex's real and imaginary
|
|
233
|
+
component, and bits 1-7 of the sixth unsigned
|
|
234
|
+
char interpreted first as binary, then decimal
|
|
235
|
+
and finally hexadecimal.
|
|
236
|
+
|
|
237
|
+
"""
|
|
238
|
+
|
|
239
|
+
MOVES = """
|
|
240
|
+
|
|
241
|
+
A move request has the format:
|
|
242
|
+
(+|-)N'type'
|
|
243
|
+
where the '+' or '-' specifies the move direction,
|
|
244
|
+
N is the number of data words to move (bytes if no
|
|
245
|
+
'type' identifier is specified). See below for 'type'
|
|
246
|
+
specifiers.
|
|
247
|
+
Examples: +2 -237 +5z -3i
|
|
248
|
+
these move the current location in the record by
|
|
249
|
+
forward 2 bytes, back 237 bytes, forward 40 bytes
|
|
250
|
+
and back 12 bytes, respectively.
|
|
251
|
+
|
|
252
|
+
"""
|
|
253
|
+
|
|
254
|
+
TYPES = """
|
|
255
|
+
|
|
256
|
+
The following data types are supported by pick:
|
|
257
|
+
(Sizes in bytes are listed in brackets.)
|
|
258
|
+
|
|
259
|
+
Integral Data Types:
|
|
260
|
+
'c' [1] signed char; 'b' [1] unsigned char
|
|
261
|
+
's' [2] signed short; 'w' [2] unsigned short
|
|
262
|
+
'i' [4] signed int; 'u' [4] unsigned int
|
|
263
|
+
|
|
264
|
+
whether or not an integral data type is signed only
|
|
265
|
+
really matters to the default output printformat.
|
|
266
|
+
The printformat used determines whether the data are
|
|
267
|
+
interpreted as signed or unsigned.
|
|
268
|
+
|
|
269
|
+
'S' [1] is a synonym for 'c', but uses
|
|
270
|
+
the 'S' printFormat as default.
|
|
271
|
+
'A' [1] is a synonym for 'c', but uses
|
|
272
|
+
the 'A' printFormat as default.
|
|
273
|
+
|
|
274
|
+
Floating Types:
|
|
275
|
+
'f' [4] single float; 'd' [8] double float
|
|
276
|
+
'z' [8] float complex; 'Z' [16] double complex
|
|
277
|
+
|
|
278
|
+
"""
|
|
279
|
+
|
|
280
|
+
GROUPS = """
|
|
281
|
+
|
|
282
|
+
Groups and group multipliers:
|
|
283
|
+
|
|
284
|
+
Any number of fields may be enclosed in brackets
|
|
285
|
+
to form a group. For example:
|
|
286
|
+
[ 4f i ]
|
|
287
|
+
requests a group of four floats followed by an integer.
|
|
288
|
+
|
|
289
|
+
In order to avoid being interpreted by the shell, one
|
|
290
|
+
may need to escape the '[]'s with a backslash '\\' or by
|
|
291
|
+
enclosing the string within single quotes:
|
|
292
|
+
'[ 4f i ]'
|
|
293
|
+
This is a syntax quite like the Unix awk command line.
|
|
294
|
+
|
|
295
|
+
A numerical prefix to the group designates a repetition
|
|
296
|
+
factor for the group. For example:
|
|
297
|
+
20[ f +99f i -100f ]
|
|
298
|
+
requests 20 pairs of floats and integers, where each
|
|
299
|
+
integer starts 400 bytes after its float, but
|
|
300
|
+
the floats and the integers themselves are sequential.
|
|
301
|
+
There must be no space between the prefix and the opening
|
|
302
|
+
bracket.
|
|
303
|
+
"""
|
|
304
|
+
|
|
305
|
+
SYMBOLS = """
|
|
306
|
+
|
|
307
|
+
pick Symbol Files:
|
|
308
|
+
|
|
309
|
+
As a convenience for dealing with standard file formats,
|
|
310
|
+
such as the ifproc mocomp file, the AIRSAR mocomp file,
|
|
311
|
+
SRTM telemetry, AIRSAR headers and subcommutated headers,
|
|
312
|
+
TOPEX/Poseidon SDR's and GDR's, GeoSAR time-dependent parameter
|
|
313
|
+
files, etc, one may define a symbol file as a set of
|
|
314
|
+
(possibly recursive) key = value definitions mapping more
|
|
315
|
+
easily remembered mnemonics onto admittedly less-obvious pick
|
|
316
|
+
commands. For example, to define the ifproc mocomp symbol file,
|
|
317
|
+
the following file is created:
|
|
318
|
+
|
|
319
|
+
; This is the symbol table for .moc files, which
|
|
320
|
+
; are the radar motion compensation files for section 334.
|
|
321
|
+
|
|
322
|
+
length=21d ; length is 21 double-precision (8 byte) numbers
|
|
323
|
+
|
|
324
|
+
; these are the components of the file
|
|
325
|
+
|
|
326
|
+
xRec = d0G
|
|
327
|
+
xrec = d0G
|
|
328
|
+
time = d1G
|
|
329
|
+
utc = d1G
|
|
330
|
+
prf = d2 ; actually 1/prf...
|
|
331
|
+
tprf = d2
|
|
332
|
+
posS = d3
|
|
333
|
+
posC = d4
|
|
334
|
+
posH = d5
|
|
335
|
+
pos = posS posC posH
|
|
336
|
+
velS = d6
|
|
337
|
+
velC = d7
|
|
338
|
+
velH = d8
|
|
339
|
+
vel = velS velC velH
|
|
340
|
+
af1S = d9
|
|
341
|
+
af1C = d10
|
|
342
|
+
af1H = d11
|
|
343
|
+
af1 = 3d9
|
|
344
|
+
af2 = 3d12
|
|
345
|
+
af3 = 3d15
|
|
346
|
+
az = d18
|
|
347
|
+
yaw = d18
|
|
348
|
+
pitch = d19
|
|
349
|
+
roll = d20
|
|
350
|
+
orient = 3d18
|
|
351
|
+
azD = d18D
|
|
352
|
+
yawD = d18D
|
|
353
|
+
pitchd = d19D
|
|
354
|
+
rollD = d20D
|
|
355
|
+
orientD = 3d18D
|
|
356
|
+
all = 21d0
|
|
357
|
+
af = af1 af2 af3
|
|
358
|
+
angles = posS orientD
|
|
359
|
+
velocities = posS vel
|
|
360
|
+
tube = pos
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
Note that the file is very similar to RDF (though pre-dating
|
|
364
|
+
it by a couple of years), with comment fields delimited by
|
|
365
|
+
semi-colons. However, the values are interpreted recursively:
|
|
366
|
+
the 'af' key's value, 'af1 af2 af3' is defined elsewhere in the
|
|
367
|
+
file.
|
|
368
|
+
|
|
369
|
+
Note also that the symbols 'length', 'size' and 'head' are reserved
|
|
370
|
+
for pick; in a symbol file they do not define new symbols
|
|
371
|
+
but rather serve as parameter definitions. For example, in
|
|
372
|
+
this mocomp file, the record length is set at the beginning of
|
|
373
|
+
the file to be 21 doubles long.
|
|
374
|
+
|
|
375
|
+
If this file is in the present-working directory, named 'moc',
|
|
376
|
+
and a mocomp file named test.moc is available, then one could
|
|
377
|
+
use commands like:
|
|
378
|
+
|
|
379
|
+
pick sym=moc test.moc velocities every=100
|
|
380
|
+
|
|
381
|
+
to print out the velocities as a function of along-track position
|
|
382
|
+
for every hundredth entry in the file. A nice shortcut is to
|
|
383
|
+
use an environmental variable, recognized by pick: PICKPATH,
|
|
384
|
+
to specify a folder of such symbol files. If the filename specified
|
|
385
|
+
by the sym parameter isn't in the present-working directory, then
|
|
386
|
+
pick will search the folder specified by PICKPATH. For example,
|
|
387
|
+
add the lines to the .zshenv file:
|
|
388
|
+
|
|
389
|
+
export PICKPATH=/users/imel/.pick
|
|
390
|
+
alias pickMocomp='pick sym=moc'
|
|
391
|
+
|
|
392
|
+
and put a copy of the moc file listed above in that folder.
|
|
393
|
+
Now, the above command is:
|
|
394
|
+
|
|
395
|
+
pickMocomp test.moc velocities skip=100 | xmgr -nxy -source stdin &
|
|
396
|
+
|
|
397
|
+
where we've piped the output to xmgr for display.
|
|
398
|
+
|
|
399
|
+
"""
|
|
400
|
+
|
|
401
|
+
EXAMPLES = """
|
|
402
|
+
|
|
403
|
+
Example Field Requests:
|
|
404
|
+
|
|
405
|
+
4d0+30 2z 5i
|
|
406
|
+
|
|
407
|
+
Extract, starting at byte 30 in the record, four
|
|
408
|
+
double-precision floats, print in floating point format,
|
|
409
|
+
two single-precision complex's, print real followed
|
|
410
|
+
by imaginary components for each, and five 4-byte
|
|
411
|
+
signed integers, printing in signed decimal format.
|
|
412
|
+
|
|
413
|
+
6[ f i ]
|
|
414
|
+
|
|
415
|
+
From the present position in the record,
|
|
416
|
+
extract a series of 6 4-byte float and
|
|
417
|
+
4-byte integer pairs, printing the
|
|
418
|
+
floats in floating point format and the
|
|
419
|
+
integers in signed decimal format.
|
|
420
|
+
|
|
421
|
+
Z20 +1280Z ZMP
|
|
422
|
+
|
|
423
|
+
Extract the twenty-first double-precision complex
|
|
424
|
+
in the record, print in floating point format
|
|
425
|
+
(real <sp> imaginary), move forward 1280 double
|
|
426
|
+
precision complexes (1280*16 bytes) and extract
|
|
427
|
+
another double precision complex, printing the
|
|
428
|
+
magnitude followed by the phase in radians.
|
|
429
|
+
|
|
430
|
+
20[ f 3[ wx cb ] +1000 i:27d -1091 ]
|
|
431
|
+
|
|
432
|
+
Extract a 4-byte float (print in floating point),
|
|
433
|
+
3 unsigned short-signed char pairs, printing the
|
|
434
|
+
short in hex and the char in binary, move forward
|
|
435
|
+
1000 bytes, extract a four-byte signed integer,
|
|
436
|
+
printing only the 5 most significant bits
|
|
437
|
+
in decimal format, and move back 1091 bytes.
|
|
438
|
+
Repeat this operation 20 times for each record.
|
|
439
|
+
(Each repetition moves back 74 bytes overall, so from
|
|
440
|
+
the second one on, reads start before the beginning of
|
|
441
|
+
the record, and come from the end of the record.)
|
|
442
|
+
|
|
443
|
+
Note that for moves, the current position in the record
|
|
444
|
+
is the location after the most recent request. For example,
|
|
445
|
+
in the above, the +1000 byte move is referenced from the
|
|
446
|
+
position after the third short/byte pair.
|
|
447
|
+
|
|
448
|
+
Complete Examples
|
|
449
|
+
|
|
450
|
+
pick file1.dat 256 20c100c rec=1
|
|
451
|
+
|
|
452
|
+
Prints twenty characters in ascii format starting
|
|
453
|
+
at byte 100 for the second (256-byte) record only
|
|
454
|
+
in file1.dat.
|
|
455
|
+
|
|
456
|
+
pick file2.dat 5120f 10f500 head=5i start=500
|
|
457
|
+
|
|
458
|
+
Prints in floating point format ten consecutive
|
|
459
|
+
single-precision floats starting at the 501st
|
|
460
|
+
float in the record, for every record starting
|
|
461
|
+
with record number 500 (the 501'st 5120*4=20480 byte
|
|
462
|
+
record in file2.dat). The record count begins after a
|
|
463
|
+
5 integer (20 byte) header.
|
|
464
|
+
|
|
465
|
+
pick file3.dat 80 40[ cc +1 ] skip=1
|
|
466
|
+
|
|
467
|
+
Prints every other character in each record
|
|
468
|
+
(ascii format), skipping every other record.
|
|
469
|
+
(The first character in the file is printed.)
|
|
470
|
+
|
|
471
|
+
pick gold225-1.laux 128 +90 32b -b \\
|
|
472
|
+
start=`pick gold225-1.laux 128 +88 w -n \\
|
|
473
|
+
| awk '{ if ($2==0) { print $1 ; exit;}}'` \\
|
|
474
|
+
| pick 4096 +439 50A
|
|
475
|
+
|
|
476
|
+
This command line actually launches three pick processes
|
|
477
|
+
in order to extract a field from an AIRSAR subcommutated
|
|
478
|
+
header. The first 'pick' command extracts the subcommutated
|
|
479
|
+
header, starting with the record specified by the result
|
|
480
|
+
of the second pick command, which extracts the index field
|
|
481
|
+
from the header. When the index field reaches zero, a new
|
|
482
|
+
subcommutated header begins. So the output of the second
|
|
483
|
+
pick command is sent to awk to look for the record corresponding
|
|
484
|
+
to an index value of zero. The output of the first pick command
|
|
485
|
+
is now a set of subcommutated headers (in their original binary
|
|
486
|
+
format) which is piped to the third pick command, which selects
|
|
487
|
+
the desired field: 50 Ascii characters starting at an offset
|
|
488
|
+
from the beginning of the record by 439 bytes.
|
|
489
|
+
|
|
490
|
+
"""
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
def version() -> str:
|
|
494
|
+
return f"""
|
|
495
|
+
This is pick (Python), from telemetry-cli {__version__}.
|
|
496
|
+
It is a port of pick (perl) Revision 3.6, 4 October 2012.
|
|
497
|
+
|
|
498
|
+
Written by David A. Imel.
|
|
499
|
+
Please report problems at:
|
|
500
|
+
https://github.com/donalgrant/telemetry-cli/issues
|
|
501
|
+
|
|
502
|
+
"""
|
|
503
|
+
|
|
504
|
+
|
|
505
|
+
ALL = [OPTIONS, PARAMETERS, FIELDS, TYPES, FORMATS, MOVES, GROUPS, SYMBOLS, EXAMPLES]
|
|
506
|
+
|
|
507
|
+
# (pattern test, texts) in the order the Perl original checked them
|
|
508
|
+
TOPICS = {"r": FIELDS, "t": TYPES, "p": PARAMETERS, "m": MOVES, "o": OPTIONS}
|
|
509
|
+
TOPICS |= {"f": FORMATS, "x": EXAMPLES, "g": GROUPS, "q": SYMBOLS}
|
|
510
|
+
|
|
511
|
+
|
|
512
|
+
def help_text(text: str, symbols: dict[str, str] | None = None, symbol_file: str = "") -> str:
|
|
513
|
+
"""The help pick prints for a command line ``text`` that asked for help.
|
|
514
|
+
|
|
515
|
+
As in the Perl, every topic whose marker appears is printed, in a fixed order.
|
|
516
|
+
"""
|
|
517
|
+
out = []
|
|
518
|
+
if not text or text in ("0",) or "help" in text or "-h" in text or "?h" in text:
|
|
519
|
+
out.append(USAGE)
|
|
520
|
+
if "??" in text:
|
|
521
|
+
out += ALL
|
|
522
|
+
out.append(version())
|
|
523
|
+
if text.endswith("?"):
|
|
524
|
+
out.append(USAGE)
|
|
525
|
+
for letter in "rtpmof":
|
|
526
|
+
if "?" + letter in text:
|
|
527
|
+
out.append(TOPICS[letter])
|
|
528
|
+
if "?v" in text:
|
|
529
|
+
out.append(version())
|
|
530
|
+
for letter in "xgq":
|
|
531
|
+
if "?" + letter in text:
|
|
532
|
+
out.append(TOPICS[letter])
|
|
533
|
+
if symbols is not None:
|
|
534
|
+
out.append(f"Symbols defined in {symbol_file}:\n")
|
|
535
|
+
out += [f"{k}={symbols[k]}\n" for k in sorted(symbols)]
|
|
536
|
+
return "".join(out)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
; This is the symbol table for AIRSAR mocomp files
|
|
2
|
+
|
|
3
|
+
length=104 ; 104 bytes: a real*8 time followed by 24 floats
|
|
4
|
+
|
|
5
|
+
; these are the components of the file
|
|
6
|
+
|
|
7
|
+
time = d0G
|
|
8
|
+
|
|
9
|
+
; d0 is the same as f0 and f1 in terms of data offset
|
|
10
|
+
|
|
11
|
+
tprf = f2
|
|
12
|
+
tgs = f3
|
|
13
|
+
xc = f4
|
|
14
|
+
xv0 = f5
|
|
15
|
+
xv = f6
|
|
16
|
+
lat = f7G
|
|
17
|
+
lon = f8G
|
|
18
|
+
hdg = f9
|
|
19
|
+
trc = f10
|
|
20
|
+
pitch = f11
|
|
21
|
+
roll = f12
|
|
22
|
+
trc0 = f13
|
|
23
|
+
|
|
24
|
+
atens = 12f14
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
;
|
|
2
|
+
; symtable for AIRSAR aux file (the main headers)
|
|
3
|
+
;
|
|
4
|
+
length=128
|
|
5
|
+
;
|
|
6
|
+
pn=u0x
|
|
7
|
+
f_size = w0+4u
|
|
8
|
+
h_size = b0+6u
|
|
9
|
+
flag = b0+7b
|
|
10
|
+
f_cnt = u0+8u
|
|
11
|
+
prf_div = w0+12u
|
|
12
|
+
f_control = u0+14b
|
|
13
|
+
status = w0+18b
|
|
14
|
+
|
|
15
|
+
gmt_ms = w0+18:0:10d
|
|
16
|
+
|
|
17
|
+
gmt_bin = 2u0+20b
|
|
18
|
+
gmt_acc = w0+22:0:2u
|
|
19
|
+
gmt_sec = w0+22:2:7u
|
|
20
|
+
gmt_min = w0+22:9:7u
|
|
21
|
+
gmt_hrs = w0+20:0:7u
|
|
22
|
+
gmt_day = w0+20:7:9u
|
|
23
|
+
|
|
24
|
+
egi_time = u0+82u
|
|
25
|
+
ins_time_tag = w0+86u
|
|
26
|
+
|
|
27
|
+
index = w0+88u
|
|
28
|
+
mux_dat = 32b0+90x
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
### i should be able to insert these with whatever comment delimeter i
|
|
2
|
+
### want, as long as it's nothing that would show up on the command line.
|
|
3
|
+
### This is the symTable file for the corrData file put out by the ATI
|
|
4
|
+
### processor. It's length is 92 bytes.
|
|
5
|
+
length = 116
|
|
6
|
+
### ###
|
|
7
|
+
centerRecord = i0d
|
|
8
|
+
ready = i0+4d
|
|
9
|
+
rangeToPixel = d1
|
|
10
|
+
doppler = d2
|
|
11
|
+
theta = d3
|
|
12
|
+
range = d4
|
|
13
|
+
phaseDiff = d5
|
|
14
|
+
correlation = d6
|
|
15
|
+
mag = d7
|
|
16
|
+
losS = d8
|
|
17
|
+
losC = d9
|
|
18
|
+
losH = d10
|
|
19
|
+
perp = d11
|
|
20
|
+
par = d12
|
|
21
|
+
rangeCell = i0+104d
|
|
22
|
+
azCell = i0+108d
|
|
23
|
+
azGroup = i0+112d
|
|
24
|
+
record = centerRecord
|
|
25
|
+
r0 = rangeToPixel
|
|
26
|
+
az = theta
|
|
27
|
+
phase = phaseDiff
|
|
28
|
+
corr = correlation
|
|
29
|
+
los = losS losC losH
|
|
30
|
+
|
|
31
|
+
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
### i should be able to insert these with whatever comment delimeter i
|
|
2
|
+
### want, as long as it's nothing that would show up on the command line.
|
|
3
|
+
### This is the symTable file for the corrData file put out by the ATI
|
|
4
|
+
### processor. It's length is 92 bytes.
|
|
5
|
+
length = 100
|
|
6
|
+
### ###
|
|
7
|
+
centerRecord = i0d
|
|
8
|
+
ready = i0+4d
|
|
9
|
+
rangeToPixel = d1
|
|
10
|
+
doppler = d2
|
|
11
|
+
theta = d3
|
|
12
|
+
range = d4
|
|
13
|
+
phaseDiff = d5
|
|
14
|
+
correlation = d6
|
|
15
|
+
mag = d7
|
|
16
|
+
losS = d8
|
|
17
|
+
losC = d9
|
|
18
|
+
losH = d10
|
|
19
|
+
rangeCell = i0+88d
|
|
20
|
+
azCell = i0+92d
|
|
21
|
+
azGroup = i0+96d
|
|
22
|
+
record = centerRecord
|
|
23
|
+
r0 = rangeToPixel
|
|
24
|
+
az = theta
|
|
25
|
+
phase = phaseDiff
|
|
26
|
+
corr = correlation
|
|
27
|
+
los = losS losC losH
|
|
28
|
+
|
|
29
|
+
|