Loading data-access/engine/src/common/include/ast_frameset.hpp +1 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ class frameset overlap_ranges overlap(coordinates coord); void write(std::ostream& ostrm, std::string header); void write2(std::string fits_pathname, int hdunum); std::ostream& serialize(std::ostream& strm) const; Loading data-access/engine/src/common/src/fits_header.hpp→data-access/engine/src/common/include/fits_header.hpp +1 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ class header int read_record(int keynum, char *card, int *status); int get_nkeys(); void update(const std::vector<fits_card> additional_cards); void update(const std::string card); std::string get_header(bool apply_fixes = false); std::string read_card(std::string keyname); bool contains_card(std::string keyname); Loading data-access/engine/src/common/src/ast_frameset.cpp +24 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ #include "ast_frameset.hpp" #include "fits_header.hpp" #include "io.hpp" #include "my_assert.hpp" Loading Loading @@ -650,6 +651,29 @@ void ast::frameset::write(std::ostream& ostrm, std::string header) } void ast::frameset::write2(std::string fits_pathname, int hdunum) { LOG_trace(__func__); AstFitsChan * fchan = astFitsChan( NULL, NULL, "Encoding=FITS-WCS" ); astWrite(fchan, m_hdr_fs); if ( !astOK ) throw runtime_error(failed_with_status(__FILE__,__LINE__,"astWrite(fchan, m_hdr_fs)")); fits::header hdr(fits_pathname, hdunum, READWRITE); char card[ 81 ]; astClear( fchan, "Card" ); 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; hdr.update(card); } } Loading data-access/engine/src/common/src/fits_header.cpp +18 −0 Original line number Diff line number Diff line Loading @@ -445,6 +445,24 @@ void fits::header::update_card(const struct fits_card new_card) } void fits::header::update(const std::string card) { LOG_trace(__func__); int status = 0; int keylength; char ccard[FLEN_CARD]; char keyname[FLEN_KEYWORD]; strcpy(ccard ,card.c_str()); if(fits_get_keyname(ccard, keyname, &keylength, &status)) throw runtime_error(cfitsio_errmsg(__FILE__,__LINE__,status) + " card: " + card); if(fits_update_card(fptr, keyname, ccard, &status)) throw runtime_error(cfitsio_errmsg(__FILE__,__LINE__,status) + " card: " + card); } void fits::header::update(const vector<fits_card> additional_cards) Loading data-access/engine/src/vlkb/src/ast.cpp +12 −3 Original line number Diff line number Diff line Loading @@ -94,6 +94,15 @@ int vlkb_listbounds(const string& skysys_str, const string& specsys_str, const s const string VELOLSRK{"System=VELO,StdOfRest=LSRK,Unit=km/s"}; const string WAVEBARY{"System=WAVE,StdOfRest=Bary,Unit=m"}; */ void write_previous(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__); Loading @@ -109,20 +118,20 @@ int header_modif_coordsys(const string& skysys_str, const string& specsys_str, c 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.write(cout, hd.m_header); frm_set.write2(pathname, i+1); } return 0; } //--------------------------------------------------------------------- // overlap with area given in query-string form (name=value&...) //--------------------------------------------------------------------- Loading Loading
data-access/engine/src/common/include/ast_frameset.hpp +1 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ class frameset overlap_ranges overlap(coordinates coord); void write(std::ostream& ostrm, std::string header); void write2(std::string fits_pathname, int hdunum); std::ostream& serialize(std::ostream& strm) const; Loading
data-access/engine/src/common/src/fits_header.hpp→data-access/engine/src/common/include/fits_header.hpp +1 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ class header int read_record(int keynum, char *card, int *status); int get_nkeys(); void update(const std::vector<fits_card> additional_cards); void update(const std::string card); std::string get_header(bool apply_fixes = false); std::string read_card(std::string keyname); bool contains_card(std::string keyname); Loading
data-access/engine/src/common/src/ast_frameset.cpp +24 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ #include "ast_frameset.hpp" #include "fits_header.hpp" #include "io.hpp" #include "my_assert.hpp" Loading Loading @@ -650,6 +651,29 @@ void ast::frameset::write(std::ostream& ostrm, std::string header) } void ast::frameset::write2(std::string fits_pathname, int hdunum) { LOG_trace(__func__); AstFitsChan * fchan = astFitsChan( NULL, NULL, "Encoding=FITS-WCS" ); astWrite(fchan, m_hdr_fs); if ( !astOK ) throw runtime_error(failed_with_status(__FILE__,__LINE__,"astWrite(fchan, m_hdr_fs)")); fits::header hdr(fits_pathname, hdunum, READWRITE); char card[ 81 ]; astClear( fchan, "Card" ); 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; hdr.update(card); } } Loading
data-access/engine/src/common/src/fits_header.cpp +18 −0 Original line number Diff line number Diff line Loading @@ -445,6 +445,24 @@ void fits::header::update_card(const struct fits_card new_card) } void fits::header::update(const std::string card) { LOG_trace(__func__); int status = 0; int keylength; char ccard[FLEN_CARD]; char keyname[FLEN_KEYWORD]; strcpy(ccard ,card.c_str()); if(fits_get_keyname(ccard, keyname, &keylength, &status)) throw runtime_error(cfitsio_errmsg(__FILE__,__LINE__,status) + " card: " + card); if(fits_update_card(fptr, keyname, ccard, &status)) throw runtime_error(cfitsio_errmsg(__FILE__,__LINE__,status) + " card: " + card); } void fits::header::update(const vector<fits_card> additional_cards) Loading
data-access/engine/src/vlkb/src/ast.cpp +12 −3 Original line number Diff line number Diff line Loading @@ -94,6 +94,15 @@ int vlkb_listbounds(const string& skysys_str, const string& specsys_str, const s const string VELOLSRK{"System=VELO,StdOfRest=LSRK,Unit=km/s"}; const string WAVEBARY{"System=WAVE,StdOfRest=Bary,Unit=m"}; */ void write_previous(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__); Loading @@ -109,20 +118,20 @@ int header_modif_coordsys(const string& skysys_str, const string& specsys_str, c 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.write(cout, hd.m_header); frm_set.write2(pathname, i+1); } return 0; } //--------------------------------------------------------------------- // overlap with area given in query-string form (name=value&...) //--------------------------------------------------------------------- Loading