31 namespace except = lsst::pex::exceptions;
49 auto modifyable =
false;
52 if (metadata->exists(
"CTYPE1") && metadata->exists(
"CTYPE2")) {
53 ctype1 = metadata->getAsString(
"CTYPE1");
54 ctype2 = metadata->getAsString(
"CTYPE2");
65 if (ctype1.substr(5, 3) ==
"TAN" &&
66 (metadata->exists(
"PV1_5") || metadata->exists(
"PV2_1"))) {
67 LOGL_INFO(
"makeWcs",
"Interpreting %s/%s + PVi_j as TPV", ctype1.c_str(), ctype2.c_str());
74 ctype1.replace(5, 3,
"TPV");
75 metadata->set<std::string>(
"CTYPE1",
ctype1);
77 ctype2.replace(5, 3,
"TPV");
78 metadata->set<std::string>(
"CTYPE2",
ctype2);
82 if (ctype1.substr(5, 3) ==
"TAN") {
84 }
else if (ctype1.substr(5, 3) ==
"TPV") {
90 LOGL_WARN(
"makeWcs",
"Stripping PVi_j keys from projection %s/%s", ctype1.c_str(), ctype2.c_str());
92 metadata->set<std::string>(
"CTYPE1",
"RA---TAN");
93 metadata->set<std::string>(
"CTYPE2",
"DEC--TAN");
94 metadata->set<
bool>(
"TPV_WCS",
true);
101 for (
int i = 0; i != 2; ++i) {
102 for (
int j = 1; j <= 39; ++j) {
104 sprintf(pvName,
"PV%d_%d", i, j);
105 if (metadata->exists(pvName)) {
106 metadata->remove(pvName);
118 std::string key =
"LTV1";
119 if (metadata->exists(key)) {
120 wcs->shiftReferencePixel(-metadata->getAsDouble(key), 0);
124 if (metadata->exists(key) ) {
125 wcs->shiftReferencePixel(0, -metadata->getAsDouble(key));
147 CD << CD11, CD12, CD21, CD22;
virtual Ptr deepCopy(void) const
Copy the PropertySet and all of its contents.
lsst::afw::geom::Angle getLongitude() const
The main access method for the longitudinal coordinate.
table::PointKey< double > crval
Implementation of the WCS standard for a any projection.
table::Key< std::string > ctype2
std::shared_ptr< Wcs > Ptr
table::Key< table::Array< Kernel::Pixel > > image
LSST DM logging module built on log4cxx.
#define LOGL_INFO(logger, message...)
Log a info-level message using a varargs/printf style interface.
Implementation of the WCS standard for the special case of the Gnomonic (tangent plane) projection...
#define LOGL_WARN(logger, message...)
Log a warn-level message using a varargs/printf style interface.
std::shared_ptr< afw::image::TanWcs > makeWcs(SipForwardTransform const &sipForward, SipReverseTransform const &sipReverse, afw::coord::Coord const &skyOrigin)
Create a new TAN SIP Wcs from a pair of SIP transforms and the sky origin.
Class for storing generic metadata.
virtual IcrsCoord toIcrs() const
Convert ourself to ICRS: RA, Dec (basically J2000)
lsst::afw::geom::Angle getLatitude() const
The main access method for the latitudinal coordinate.
double asDegrees() const
Return an Angle's value as a double in degrees.
int stripWcsKeywords(boost::shared_ptr< lsst::daf::base::PropertySet > const &metadata, boost::shared_ptr< Wcs const > const &wcs)
Strip keywords from the input metadata that are related to the generated Wcs.
This is the base class for spherical coordinates.
daf::base::PropertySet & _metadata
table::Key< std::string > ctype1
table::PointKey< double > crpix