FITS Archiver

FITS Archiver is a Java-based tool for compressing and decompressing FITS files using the fpack and funpack utilities from the CFITSIO library. It supports both graphical (GUI) and command-line (CLI) modes, allowing safe, parallel processing of large numbers of FITS files.

Features

  • Compress FITS files to .fz format using fpack .
  • Decompress .fz files back to FITS using funpack .
  • Parallel processing with multiple threads for faster execution.
  • Safe handling: existing files are never overwritten.
  • File integrity check: only files with non-zero size are considered valid outputs.
  • Optional deletion of source or archive files after successful processing.
  • Supports recursive directory traversal for batch operations.
  • Command-line mode with detailed logging and clear error reporting.
  • Optional GUI mode for interactive file management.

Command-Line Usage

Run the tool in CLI mode with the following options:

java -jar FitsArchiver.jar [options] <directory>

Options:

  • --recursive — Process directories recursively.
  • --delete — Delete original files after processing.
  • --pack — Compress FITS files using fpack .
  • --unpack — Decompress .fz files using funpack .
  • --nogui — Run in command-line mode without GUI.
  • --dir <directory> — Specify the directory to process (alternative to last positional argument).

Example CLI Usage

# Compress all FITS files in /data recursively and delete originals
java -jar FitsArchiver.jar --pack --recursive --delete /data
# Decompress all .fz files in /data recursively
java -jar FitsArchiver.jar --unpack --recursive /data
        

GUI Mode

If no --nogui option is specified, the application launches a GUI for interactive file selection, compression, and decompression. This mode allows users to select directories, toggle recursion, and choose whether to delete original or archive files after processing.

Requirements

  • Java 21 or higher.
  • CFITSIO utilities: fpack and funpack installed and available in $PATH .
  • Access to the directories containing FITS files to read/write files.

Notes

  • Ensure you do not specify both --pack and --unpack at the same time.
  • The tool is safe for repeated runs: files that already exist and have non-zero size will be skipped.
  • Logging output is written to the console; for large batch jobs, consider redirecting output to a file.