Scroll to navigation



astscript-sort-by-night - Sort input FITS files by night


astscript-sort-by-night [OPTION] FITS-files


This script is part of GNU Astronomy Utilities 0.14.

This script will look into a HDU/extension for a header keyword in the given FITS files and interpret the value as a date. The inputs will be separated by "night"s. The definition a "nights" is set with the '--hour' option (just note that the FITS time may be recorded in UTC, not local time)! It will then print a list of all the input files along with the following two columns: night number and file number in that night (sorted by time). With '--link' a symbolic link (one for each input) will be made with names including the night classifier. With '--copy' instead of a link, a copy of the inputs will be made.

For more information, please run any of the following commands. In particular the first contains a very comprehensive explanation of this script's invocation: expected input(s), output(s), and a full description of all the options.

Inputs/Outputs and options:
$ info astscript-sort-by-night
Full Gnuastro manual/book:
$ info gnuastro

If you couldn't find your answer in the manual, you can get direct help from experienced Gnuastro users and developers. For more information, please run:

$ info help-gnuastro

astscript-sort-by-night options:

-h, --hdu=STR
HDU/extension of all input FITS files.
-k, --key=STR
Header keyword specifying date to use.
-H, --hour=FLT
Hour in next day to be included in night. Be aware of time zones with this argument!
-l, --link
list of inputs with night and file number.
-c, --copy
Copy the files, don't make symbolic links.
-p, --prefix=STR
Prefix for outputs of '--copy' and '--link'.
Operating mode:
-h, --help
Print this help list.
BibTeX citation for this program.
-q, --quiet
Don't print the list.
-V, --version
Print program version.

Mandatory or optional arguments to long options are also mandatory or optional for any corresponding short options.

GNU Astronomy Utilities home page:


Report bugs to


Copyright © 2015-2021, Free Software Foundation, Inc. License GPLv3+: GNU General public license version 3 or later.
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

Written/developed by Mohammad Akhlaghi


The full documentation for astscript-sort-by-night is maintained as a Texinfo manual. If the info and astscript-sort-by-night programs are properly installed at your site, the command
info astscript-sort-by-night

should give you access to the complete manual.

January 2021 GNU Astronomy Utilities 0.14