1 #ifndef MHO_PolarizationProductRelabeler_HH__
2 #define MHO_PolarizationProductRelabeler_HH__
33 fRemStationKey =
"remote_station";
34 fRefStationKey =
"reference_station";
35 fRemStationMk4IDKey =
"remote_station_mk4id";
36 fRefStationMk4IDKey =
"reference_station_mk4id";
48 if(pol1.size() == 1 && pol2.size() == 1)
58 "MHO_PolarizationProductRelabeler, only single character polarization labels are supported, ignoring."
77 return fStationIdentities.empty() ? std::string(
"") : fStationIdentities[0];
93 auto pprod_axis_ptr = &(std::get< POLPROD_AXIS >(*in));
94 std::size_t npprods = pprod_axis_ptr->GetSize();
96 for(std::size_t st_idx = 0; st_idx < 2; st_idx++)
98 if(IsApplicable(st_idx, in))
100 for(std::size_t i = 0; i < npprods; i++)
103 std::string pprod = pprod_axis_ptr->at(i);
104 if(pprod[st_idx] == fPol1[0])
106 pprod[st_idx] = fPol2[0];
108 else if(pprod[st_idx] == fPol2[0])
110 pprod[st_idx] = fPol1[0];
112 pprod_axis_ptr->at(i) = pprod;
122 std::string fStationKey;
123 std::string fRemStationKey;
124 std::string fRefStationKey;
125 std::string fRemStationMk4IDKey;
126 std::string fRefStationMk4IDKey;
129 std::vector< std::string > fStationIdentities;
135 bool IsApplicable(std::size_t st_idx,
const XArrayType* in)
137 std::string mk4id_key;
138 std::string station_code_key;
142 mk4id_key = fRefStationMk4IDKey;
143 station_code_key = fRefStationKey;
147 mk4id_key = fRemStationMk4IDKey;
148 station_code_key = fRemStationKey;
151 std::string mk4id_val, code_val;
152 in->Retrieve(mk4id_key, mk4id_val);
153 in->Retrieve(station_code_key, code_val);
155 for(
const auto&
id : fStationIdentities)
160 "station identity: " <<
id <<
" is not a recognizable mark4 or 2-character code" << eom);
163 if(
id.size() == 1 && (
id == mk4id_val ||
id ==
"?"))
167 if(
id.size() == 2 && (
id == code_val ||
id ==
"??"))
#define msg_error(xKEY, xCONTENT)
Definition: MHO_Message.hh:238
Class MHO_PolarizationProductRelabeler.
Definition: MHO_PolarizationProductRelabeler.hh:29
MHO_PolarizationProductRelabeler()
Definition: MHO_PolarizationProductRelabeler.hh:31
virtual ~MHO_PolarizationProductRelabeler()
Definition: MHO_PolarizationProductRelabeler.hh:42
void SetPolarizationSwapPair(std::string pol1, std::string pol2)
Definition: MHO_PolarizationProductRelabeler.hh:44
virtual bool ExecuteInPlace(XArrayType *in) override
Function ExecuteInPlace - attaches channel labels based on sky frequency or user specified map.
Definition: MHO_PolarizationProductRelabeler.hh:88
std::string GetStationIdentifier() const
Definition: MHO_PolarizationProductRelabeler.hh:75
void SetStationIdentifier(const std::string &id)
Setter for station identifier.
Definition: MHO_PolarizationProductRelabeler.hh:71
void SetStationIdentifiers(const std::vector< std::string > &ids)
Definition: MHO_PolarizationProductRelabeler.hh:73
Class MHO_UnaryOperator.
Definition: MHO_UnaryOperator.hh:24
Definition: MHO_AdhocFlagging.hh:18