Commit 20733a0b authored by Robert Butora's avatar Robert Butora
Browse files

vlkb header: adds support for wildcards (bash expansion) on fits-file

parent d7308f66
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -668,7 +668,7 @@ void ast::frameset::write2(std::string fits_pathname, int hdunum)
   while ( astFindFits( fchan, "%f", card, 1 ) )
   {
      if(0 ==string(card).compare(0,7,"WCSAXES")) continue; // writes this key after other existing CRxxx keys, which is illegal
      cout << string(card) << endl;
      cerr << string(card) << endl;
      hdr.update(card);
   }
}
+1 −1
Original line number Diff line number Diff line
@@ -114,7 +114,7 @@ int header_modif_coordsys(const string& skysys_str, const string& specsys_str, c

   for(unsigned int i=0; i<allHdus.size(); i++)
   {
      cout << "HDU#" << i << endl;
      cerr << "HDU#" << i << endl;

      fitsfiles::Hdu hd = allHdus.at(i);

+18 −14
Original line number Diff line number Diff line
@@ -324,10 +324,10 @@ int cmd_header(int argc, char * argv[])
{
   int rc;

   if (!((argc == 2) || (argc == 3) || (argc == 4)))
   if (argc < 2)
   {
      std::cerr
         << "Usage:  header <filename.fits> <SkySystem> <SpecSystem>\n"
         << "Usage:  header --sky=<SkySystem> --spec=<SpecSystem> <filename.fits>... \n"
         << "\n"
         << "Modify header for new coord system.\n"
         << "Arguments:\n"
@@ -337,24 +337,28 @@ int cmd_header(int argc, char * argv[])
   }
   else
   {
      string pathname(argv[1]);

      string skySystem;
      string specSystem;

      if(argc >= 3)
      for(int i=1; i<argc; i++)
      {
         skySystem = argv[2];
         if(0 == (string(argv[i]).substr(0,2+3+1)).compare("--sky="))
         {
            skySystem = string(argv[i]).substr(2+3+1);
         }
      if(argc == 4)
         else if(0 == (string(argv[i]).substr(0,2+4+1)).compare("--spec="))
         {
         specSystem = argv[3];
            specSystem = string(argv[i]).substr(2+4+1);
         }

      cout << string{argv[0]} << ": " << pathname << " '" << skySystem  << "' " << specSystem << endl;

         else
         {
            string pathname(argv[i]);
            cout << to_string(i) << " : " << pathname << endl;
            rc = header_modif_coordsys(skySystem, specSystem, pathname);
            std::cout << "header_modif_coordsys rc: " << rc << std::endl;
         }
      }
      rc = EXIT_SUCCESS;
   }
   return rc;