taskGNU Astronomy Utilities - Tasks: task #15193, Fits program sort many files based...


You are not allowed to post comments on this tracker with your current authentication level.

task #15193: Fits program sort many files based on keyword value

Submitted by:  Mohammad Akhlaghi <makhlaghi>
Submitted on:  Mon 25 Feb 2019 05:38:52 PM UTC  
Should Start On:  Mon 25 Feb 2019 12:00:00 AM UTC Should be Finished on:  Mon 25 Feb 2019 12:00:00 AM UTC
Category:  Fits Priority:  5 - Normal
Item Group:  Enhancement Status:  Postponed
Privacy:  Public Percent Complete:  0%
Assigned to:  None Open/Closed:  Open
Effort:  0.00

Mon 25 Feb 2019 05:38:52 PM UTC, original submission:  

Currently the Fits program only works on one file. However, in many situations, it can also be useful on many files. For example when we have a collection of FITS files that we would like to sort or select based on the values of a specific keyword.

Implementing such an operation on many files can easily be done with a shell `for' loop for example and the existing Fits program.

However, doing it internally with the FITS program is both faster and much more convenient.

What I currently have in mind is something like the commands below. The first will print the list of input file names, but sorted by the value to the KEYRING keyword. The second will only print the files that have a given `value' to the `KEYNAME' keyword, and the third will only list those files that have a value in the requested range.

astfits *.fits --sortby=KEYNAME
astfits *.fits --onlywith=KEYNAME,value
astfits *.fits --onlyrange=KEYNAME,starting_value,ending_value

Of course, we'll have to check if the value's format is a number, string, or date to define how it is sorted.

One common target for such an operation will be date-related keywords: for example to sort all the files in the given directory by observing date. CFITSIO writes the date in FITS files with its special format (`YYYY-MM-DDThh:mm:ss.ddd'). And fortunately CFITIO has functions to parse this string (in particular `fits_str2time').

Usually this scenario comes up when data come from a single source, therefore they are usually similarly formatted. So, I think the same extension (given to `--hdu') can be assumed in all the files. We have to see if its necessary to allow differing extensions in such contexts.

This task came up after a discussion with Raúl Infante-Sainz.

Mohammad Akhlaghi <makhlaghi>
Project Administrator


No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by makhlaghi (Submitted the item)
  • -email is unavailable- added by makhlaghi

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-02-25 makhlaghi Carbon-Copy- => Added infantesainz@gmail.com

    Back to the top

    Powered by Savane 3.5