30 #define __attribute__(x) 37 #include <boost/archive/binary_iarchive.hpp> 38 #include <boost/archive/binary_oarchive.hpp> 39 #include <boost/archive/text_iarchive.hpp> 40 #include <boost/archive/text_oarchive.hpp> 43 #include "wcslib/wcs.h" 57 LOG_LOGGER _log =
LOG_GET(
"afw.WcsFormatter");
62 namespace formatters {
86 LOGL_DEBUG(_log,
"WcsFormatter write BoostStorage");
87 boost->getOArchive() & *ip;
101 LOGL_DEBUG(_log,
"WcsFormatter read BoostStorage");
102 boost->getIArchive() & *ip;
108 LOGL_DEBUG(_log,
"WcsFormatter read FitsStorage");
129 wcsProps->add(
"NAXIS", wcs.
_wcsInfo[0].naxis,
"number of data axes");
132 if (strncmp(wcs.
_wcsInfo[0].radesys,
"ICRS", 4) != 0) {
133 wcsProps->add(
"EQUINOX", wcs.
_wcsInfo[0].equinox,
"Equinox of coordinates");
135 wcsProps->add(
"RADESYS",
std::string(wcs.
_wcsInfo[0].radesys),
"Coordinate system for equinox");
136 wcsProps->add(
"CRPIX1", wcs.
_wcsInfo[0].crpix[0],
"WCS Coordinate reference pixel");
137 wcsProps->add(
"CRPIX2", wcs.
_wcsInfo[0].crpix[1],
"WCS Coordinate reference pixel");
138 wcsProps->add(
"CD1_1", wcs.
_wcsInfo[0].cd[0],
"WCS Coordinate scale matrix");
139 wcsProps->add(
"CD1_2", wcs.
_wcsInfo[0].cd[1],
"WCS Coordinate scale matrix");
140 wcsProps->add(
"CD2_1", wcs.
_wcsInfo[0].cd[2],
"WCS Coordinate scale matrix");
141 wcsProps->add(
"CD2_2", wcs.
_wcsInfo[0].cd[3],
"WCS Coordinate scale matrix");
142 wcsProps->add(
"CRVAL1", wcs.
_wcsInfo[0].crval[0],
"WCS Ref value (RA in decimal degrees)");
143 wcsProps->add(
"CRVAL2", wcs.
_wcsInfo[0].crval[1],
"WCS Ref value (DEC in decimal degrees)");
149 for (
int i = 0; i != wcs.
_wcsInfo[0].npv; ++i) {
150 auto const pv = wcs.
_wcsInfo[0].pv[i];
151 int const ii = pv.i > 0 ? pv.i : (wcs.
_wcsInfo[0].lat + 1);
153 sprintf(key,
"PV%d_%d", ii, pv.m);
154 wcsProps->add(key, pv.value);
159 wcsProps->add(
"CTYPE1", ctype1,
"WCS Coordinate type");
160 wcsProps->add(
"CTYPE2", ctype2,
"WCS Coordinate type");
165 template <
class Archive>
167 LOGL_DEBUG(_log,
"WcsFormatter delegateSerialize start");
179 if (Archive::is_loading::value) {
180 ip->
_wcsInfo =
reinterpret_cast<wcsprm*
>(malloc(ip->
_nWcsInfo *
sizeof(wcsprm)));
183 for (
int i = 0; i < ip->
_nWcsInfo; ++i) {
185 if (Archive::is_loading::value) {
211 if (Archive::is_loading::value) {
216 LOGL_DEBUG(_log,
"WcsFormatter delegateSerialize end");
Implementation of the WCS standard for a any projection.
table::Key< std::string > ctype2
#define LOGL_DEBUG(logger, message...)
std::shared_ptr< daf::base::PropertyList > readMetadata(std::string const &fileName, int hdu=DEFAULT_HDU, bool strip=false)
Read FITS header.
A base class for image defects.
T dynamic_pointer_cast(T... args)
#define LSST_EXCEPT(type,...)
int _wcshdrCtrl
Controls messages to stderr from wcshdr (0 for none); see wcshdr.h for details.
int _relax
Degree of permissiveness for wcspih (0 for strict); see wcshdr.h for details.
int _wcsfixCtrl
Do potentially unsafe translations of non-standard unit strings? 0/1 = no/yes.
table::Key< std::string > ctype1
coord::CoordSystem _coordSystem
const int DEFAULT_HDU
Specify that the default HDU should be read.