Commit 9faf87f11b2024e2bee89599472deccab28b1a98

Authored by Jürgen Knödlseder
1 parent a97eb9cd

Remove existing extension before saving in GSkyMap::save() method.

Showing 1 changed file with 6 additions and 0 deletions
src/sky/GSkyMap.cpp
... ... @@ -1874,6 +1874,12 @@ void GSkyMap::save(const GFilename& filename, bool clobber) const
1874 1874 // requested extension may not yet exist in the file)
1875 1875 GFits fits(filename.url(), true);
1876 1876  
  1877 + // If the FITS file contains already an extension with the same
  1878 + // name then remove now this extension
  1879 + if (fits.contains(filename.extname())) {
  1880 + fits.remove(filename.extname());
  1881 + }
  1882 +
1877 1883 // Append sky map to FITS file
1878 1884 fits.append(*hdu);
1879 1885  
... ...