Change request #1667

Allow saving of FITS binary tables in already existing files

Added by Knödlseder Jürgen almost 9 years ago. Updated almost 9 years ago.

Status:RejectedStart date:02/14/2016
Priority:NormalDue date:
Assigned To:Knödlseder Jürgen% Done:

10%

Category:-
Target version:1.1.0
Duration:

Description

So far, not all methods that save a FITS binary table into a file allow appending the table to an existing file. An example of how the code should look like is given in the GGti::save method.

void GGti::save(const GFilename& filename, const bool& clobber) const
{
    // Open or create FITS file
    GFits fits(filename, true);

    // Write GTI to FITS object
    write(fits, filename.extname("GTI"));

    // Save to file
    fits.save(clobber);

    // Return
    return;
}

  

Recurrence

No recurrence.

History

#1 Updated by Knödlseder Jürgen almost 9 years ago

  • Status changed from New to In Progress
  • Assigned To set to Knödlseder Jürgen
  • Target version set to 1.1.0
  • % Done changed from 0 to 10

Started to implement the code. Took GGti as a reference.

#2 Updated by Knödlseder Jürgen almost 9 years ago

Note that we should remove HDUs with the same name in case they exist (to avoid duplication of HDU attachment):

void GGti::save(const GFilename& filename, const bool& clobber) const
{
    // Open or create FITS file
    GFits fits(filename, true);

    // Get extension name
    std::string extname = filename.extname("GTI");

    // Remove HDUs if they exist already
    if (fits.contains(extname)) {
        fits.remove(extname);
    }

    // Write GTI to FITS object
    write(fits, extname);

    // Save to file
    fits.save(clobber);

    // Return
    return;
}

#3 Updated by Knödlseder Jürgen almost 9 years ago

  • Status changed from In Progress to Rejected

It turned out that it is not a good idea to generalize this. There are classes which should implement a fixed format, and others where the extension name should be specified. Thus reject this issue.

Also available in: Atom PDF