Skip to content
Snippets Groups Projects
Commit f5e23511 authored by Robert Butora's avatar Robert Butora
Browse files

vlkb: moves header_modif_coordsys into common

parent 0df2f338
Branches
Tags
No related merge requests found
...@@ -56,5 +56,8 @@ std::vector<Bounds> calc_bounds(std::string header, std::string skysys_str, std: ...@@ -56,5 +56,8 @@ std::vector<Bounds> calc_bounds(std::string header, std::string skysys_str, std:
std::vector<uint_bounds> calc_overlap(const std::string header, const coordinates coord, int& ov_code); std::vector<uint_bounds> calc_overlap(const std::string header, const coordinates coord, int& ov_code);
int header_modif_coordsys(const std::string& skysys_str, const std::string& specsys_str,
const std::string& pathname);
#endif #endif
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
#include "math.h" // round() needed #include "math.h" // round() needed
#include "cutout_ostream.hpp" // coordinates needed #include "cutout_ostream.hpp" // coordinates needed
#include "fitsfiles.hpp" // header_modif_coordsys needs this
#include <ostream> #include <ostream>
//#include <vector> //#include <vector>
...@@ -170,3 +172,42 @@ std::vector<uint_bounds> calc_overlap(const std::string header, const coordinate ...@@ -170,3 +172,42 @@ std::vector<uint_bounds> calc_overlap(const std::string header, const coordinate
} }
void write_previous2(string header, string filename)
{
std::ofstream out(filename);
out << header;
}
int header_modif_coordsys(const string& skysys_str, const string& specsys_str, const string& pathname)
{
LOG_trace(__func__);
int maxHdu = 1;//FIXME INT_MAX; // read all HDU's
std::vector<fitsfiles::Hdu> allHdus =
fitsfiles::fname2hdrstr(pathname, maxHdu);
for(unsigned int i=0; i<allHdus.size(); i++)
{
cerr << "HDU#" << i << endl;
fitsfiles::Hdu hd = allHdus.at(i);
write_previous2(hd.m_header, "backup.fitshdu"+ to_string(i) +"header.orig");
ast::frameset frm_set(hd.m_header);
frm_set.set_skysystem(skysys_str);
if(frm_set.has_specframe())
frm_set.set_specsystem(specsys_str);
//frm_set.write(cout, hd.m_header);
frm_set.write2(pathname, i+1);
}
return 0;
}
...@@ -11,9 +11,6 @@ ...@@ -11,9 +11,6 @@
#include "io.hpp" #include "io.hpp"
#include "my_assert.hpp" #include "my_assert.hpp"
#include "ast_frameset.hpp" // FIXME temporarily was moved common/src -> common/include
#include <iostream> #include <iostream>
#include <climits> // INT_MAX needed #include <climits> // INT_MAX needed
#include <sstream> #include <sstream>
...@@ -130,35 +127,6 @@ int header_backup(const string& pathname, bool backup) ...@@ -130,35 +127,6 @@ int header_backup(const string& pathname, bool backup)
} }
int header_modif_coordsys(const string& skysys_str, const string& specsys_str, const string& pathname)
{
LOG_trace(__func__);
int maxHdu = 1;//FIXME INT_MAX; // read all HDU's
std::vector<fitsfiles::Hdu> allHdus =
fitsfiles::fname2hdrstr(pathname, maxHdu);
for(unsigned int i=0; i<allHdus.size(); i++)
{
cerr << "HDU#" << i << endl;
fitsfiles::Hdu hd = allHdus.at(i);
write_previous(hd.m_header, "backup.fitshdu"+ to_string(i) +"header.orig");
ast::frameset frm_set(hd.m_header);
frm_set.set_skysystem(skysys_str);
if(frm_set.has_specframe())
frm_set.set_specsystem(specsys_str);
//frm_set.write(cout, hd.m_header);
frm_set.write2(pathname, i+1);
}
return 0;
}
//--------------------------------------------------------------------- //---------------------------------------------------------------------
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
int vlkb_skyvertices(const std::string& pathname, const std::string& skysys_str); int vlkb_skyvertices(const std::string& pathname, const std::string& skysys_str);
int vlkb_listbounds(const std::string& skysys_str, const std::string& specsys_str, const std::string& pathname); int vlkb_listbounds(const std::string& skysys_str, const std::string& specsys_str, const std::string& pathname);
int header_backup(const std::string& pathname, bool backup = false); int header_backup(const std::string& pathname, bool backup = false);
int header_modif_coordsys(const std::string& skysys_str, const std::string& specsys_str, const std::string& pathname);
int vlkb_overlap(const std::string& pathname, const std::string& region, std::vector<uint_bounds>& bnds); int vlkb_overlap(const std::string& pathname, const std::string& region, std::vector<uint_bounds>& bnds);
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment