asdf¶
The asdf command-line tool is a companion utility installed alongside
libasdf. It is a thin wrapper around the library offering a handful of
sub-commands for inspecting ASDF files and extracting their data. Its
capabilities are currently modest but will be expanded in future releases.
Each tool provided by asdf is run as a separate sub-command.
Synopsis¶
asdf COMMAND [ARGS...]
Run asdf COMMAND --help for detailed help on any sub-command. The
available sub-commands are:
Command |
Description |
|---|---|
Print a rendering of an ASDF tree |
|
Dump data from an ASDF binary block |
|
Print the event stream from the ASDF parser (for debugging) |
|
Verify binary block MD5 checksums |
The global asdf command itself accepts -h / --help and --usage.
asdf info¶
Print a human-readable rendering of an ASDF file’s YAML tree, and optionally information about its binary blocks.
asdf info [OPTIONS] FILENAME
- --no-tree¶
Do not show the tree.
- -b, --blocks¶
Show information about the file’s binary blocks.
For example, to print the tree of a file together with its block information:
asdf info --blocks observation.asdf
asdf dd¶
Dump the raw bytes of a single binary block to a file or to standard output,
named either by block index or by the tree path of an ndarray that references
it. Exactly one of --block or --ndarray must be given.
asdf dd [OPTIONS] INPUT [OUTPUT|-]
INPUT is the ASDF file to read. OUTPUT is the destination file; a
single - writes the data to standard output.
- -b N, --block N¶
Index of the block to extract (starting from
0).
- -r, --raw¶
For a compressed block, dump the raw compressed bytes rather than decompressing them first. Has no effect on uncompressed blocks.
- -c N, --chunk-size N¶
Read/write the data in chunks of
Nbytes.
- --no-lazy-decompression¶
Disable lazy (page-fault-driven) decompression; decompress eagerly instead. Intended mainly for debugging.
For example, to extract the data of the ndarray at /data into a file:
asdf dd --ndarray data observation.asdf data.bin
asdf events¶
Print the low-level event stream produced by the ASDF parser as it walks a file. This is primarily a debugging aid for libasdf itself and exposes the event-based parsing API (see libasdf - The ASDF C Library).
asdf events [OPTIONS] FILENAME
- -v, --verbose¶
Show extra information about each event.
- --no-yaml¶
Do not produce YAML stream events (emit only the ASDF-structural events).
- --cap-tree¶
Buffer the YAML tree and print it. This corresponds to the parser’s tree-buffering option and is mainly useful for debugging.
asdf verify-checksums¶
Verify the MD5 checksum recorded in each binary block header against the checksum computed from the block’s data. The exit status is non-zero if any block fails verification.
asdf verify-checksums [OPTIONS] FILENAME
- -v, --verbose¶
Print the checksum of every block, whether or not it verifies. Without this option the command is quiet on success and reports only mismatches.
Note
Checksum verification requires that libasdf was built with MD5 support
(via libbsd). Without it, blocks are always reported as valid.