41 auto metadata = _metadata;
42 auto modifyable =
false;
45 if (metadata->exists(
"CTYPE1") && metadata->exists(
"CTYPE2")) {
46 ctype1 = metadata->getAsString(
"CTYPE1");
47 ctype2 = metadata->getAsString(
"CTYPE2");
49 LOGL_DEBUG(
"makeWcs",
"Unable to construct valid WCS due to missing CTYPE1 or CTYPE2");
59 if (ctype1.
substr(5, 3) ==
"TAN" && (metadata->exists(
"PV1_5") || metadata->exists(
"PV2_1"))) {
63 metadata = _metadata->deepCopy();
75 if (ctype1.
substr(5, 3) ==
"TAN") {
77 }
else if (ctype1.
substr(5, 3) ==
"TPV") {
79 metadata = _metadata->deepCopy();
83 LOGL_WARN(
"makeWcs",
"Stripping PVi_j keys from projection %s/%s", ctype1.
c_str(), ctype2.
c_str());
87 metadata->set<
bool>(
"TPV_WCS",
true);
94 for (
int i = 0; i != 2; ++i) {
95 for (
int j = 1; j <= 39; ++j) {
97 sprintf(pvName,
"PV%d_%d", i, j);
98 if (metadata->exists(pvName)) {
99 metadata->remove(pvName);
112 if (metadata->exists(key)) {
113 wcs->shiftReferencePixel(-metadata->getAsDouble(key), 0);
117 if (metadata->exists(key)) {
118 wcs->shiftReferencePixel(0, -metadata->getAsDouble(key));
129 double CD21,
double CD22) {
131 CD << CD11, CD12, CD21, CD22;
lsst::afw::geom::Angle getLongitude() const
The main access method for the longitudinal coordinate.
int stripWcsKeywords(std::shared_ptr< lsst::daf::base::PropertySet > const &metadata, std::shared_ptr< Wcs const > const &wcs)
std::shared_ptr< Wcs > makeWcs(std::shared_ptr< lsst::daf::base::PropertySet > const &fitsMetadata, bool stripMetadata=false)
Create a Wcs object from a fits header.
table::PointKey< double > crval
virtual IcrsCoord toIcrs() const
Convert ourself to ICRS: RA, Dec (basically J2000)
Implementation of the WCS standard for a any projection.
table::Key< std::string > ctype2
#define LOGL_DEBUG(logger, message...)
lsst::afw::geom::Angle getLatitude() const
The main access method for the latitudinal coordinate.
#define LOGL_INFO(logger, message...)
A base class for image defects.
Implementation of the WCS standard for the special case of the Gnomonic (tangent plane) projection...
#define LOGL_WARN(logger, message...)
constexpr double asDegrees() const noexcept
Return an Angle's value in degrees.
This is the base class for spherical coordinates.
table::Key< std::string > ctype1
table::PointKey< double > crpix