Skip to content

Commit

Permalink
libs/radar/MomentsFields, apps/radar/Iq2Dsr - testing and improving a…
Browse files Browse the repository at this point in the history
…pplication of rhohv test. Adding separate thresholds, for power, vel, phase and rho fields
  • Loading branch information
mike-dixon committed Feb 18, 2024
1 parent c762f83 commit ebf8039
Show file tree
Hide file tree
Showing 9 changed files with 536 additions and 457 deletions.
364 changes: 183 additions & 181 deletions codebase/apps/radar/src/Iq2Dsr/Beam.cc

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions codebase/apps/radar/src/Iq2Dsr/Beam.hh
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,10 @@ private:
void _filterDpVOnlyFixedPrt();
void _filterDpVOnlyStagPrt();

void _conditionDpFiltFields(MomentsFields &fields,
MomentsFields &fieldsF,
MomentsFields &fieldsN);

int _specCmdInit();
void _filtSpecCmdSimHv();

Expand Down
18 changes: 11 additions & 7 deletions codebase/apps/radar/src/Iq2Dsr/Cmd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@ void Cmd::compute(int nGates, const RadarMoments *mom,
}

flds->cmd = sumInterest / sumWeights;
flds->cmd_flag = 0;

double checkThreshold = cmdThreshold;

Expand All @@ -308,13 +307,18 @@ void Cmd::compute(int nGates, const RadarMoments *mom,
}
}

flds->cmd_flag = 0;
if (flds->cmd >= checkThreshold) {
flds->cmd_flag = 1;
}

flds->rhohv_test_flag = 0;
if (_params.apply_rhohv_test_in_cmd) {
if (flds->rhohv_test_improv >= _params.rhohv_improvement_factor_threshold) {
flds->cmd_flag = 1;
if (flds->rhohv_test_improv >= _params.rhohv_improv_thresh_for_power ||
flds->rhohv_test_improv >= _params.rhohv_improv_thresh_for_vel ||
flds->rhohv_test_improv >= _params.rhohv_improv_thresh_for_phase ||
flds->rhohv_test_improv >= _params.rhohv_improv_thresh_for_rho) {
flds->rhohv_test_flag = 1;
}
}

Expand Down Expand Up @@ -1028,7 +1032,7 @@ void Cmd::_applyRegrFiltFixed(const vector<RadarComplex_t> &iq,

// apply filter

_regr.apply(iq.data(), 5, filt.data());
_regr.apply(iq.data(), 3, filt.data());

}

Expand Down Expand Up @@ -1058,8 +1062,8 @@ void Cmd::_applyRegrFiltStag(const vector<RadarComplex_t> &iq,
filtShort.resize(nSamplesHalf);
filtLong.resize(nSamplesHalf);

_regr.apply(iqShort.data(), 5, filtShort.data());
_regr.apply(iqLong.data(), 5, filtLong.data());
_regr.apply(iqShort.data(), 3, filtShort.data());
_regr.apply(iqLong.data(), 3, filtLong.data());

// copy results to filt array

Expand Down Expand Up @@ -1514,7 +1518,7 @@ void Cmd::_applyNexradSpikeFilter(int nGates)
// loop through gates

for (int ii = 2; ii < nGates - 3; ii++) {

MomentsFields *fldMinus2F = _gateData[ii - 2]->fldsF;
MomentsFields *fldMinus1F = _gateData[ii - 1]->fldsF;
MomentsFields *fldF = _gateData[ii]->fldsF;
Expand Down
2 changes: 2 additions & 0 deletions codebase/apps/radar/src/Iq2Dsr/OutputFmq.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1722,6 +1722,8 @@ int OutputFmq::_findFieldOffset(Params::field_id_t fieldId)
return (&_flds.rhohv_test_filt - start);
case Params::RHOHV_TEST_IMPROV:
return (&_flds.rhohv_test_improv - start);
case Params::RHOHV_TEST_FLAG:
return (&_flds.rhohv_test_flag - start);
case Params::TDBZ_INTEREST:
return (&_flds.tdbz_interest - start);
case Params::SPIN_INTEREST:
Expand Down
392 changes: 215 additions & 177 deletions codebase/apps/radar/src/Iq2Dsr/Params.cc

Large diffs are not rendered by default.

179 changes: 93 additions & 86 deletions codebase/apps/radar/src/Iq2Dsr/Params.hh
Original file line number Diff line number Diff line change
Expand Up @@ -327,90 +327,91 @@ public:
RHOHV_TEST_UNFILT = 109,
RHOHV_TEST_FILT = 110,
RHOHV_TEST_IMPROV = 111,
TDBZ_INTEREST = 112,
SPIN_INTEREST = 113,
CPA_INTEREST = 114,
ZDR_SDEV_INTEREST = 115,
PHIDP_SDEV_INTEREST = 116,
CLUT = 117,
CLUT_2_WX_RATIO = 118,
SPECTRAL_NOISE = 119,
SPECTRAL_SNR = 120,
REGR_FILT_POLY_ORDER = 121,
REGR_FILT_CNR_DB = 122,
AIQ_HC = 123,
NIQ_HC = 124,
AIQ_VC = 125,
NIQ_VC = 126,
SZ_TRIP_FLAG = 127,
SZ_LEAKAGE = 128,
CENSORING_FLAG = 129,
LAG0_HC_DB = 130,
LAG0_HX_DB = 131,
LAG0_VC_DB = 132,
LAG0_VX_DB = 133,
LAG0_HC_SHORT_DB = 134,
LAG0_VC_SHORT_DB = 135,
LAG0_HC_LONG_DB = 136,
LAG0_VC_LONG_DB = 137,
LAG0_VCHX_DB = 138,
LAG0_VCHX_PHASE = 139,
LAG0_HCVX_DB = 140,
LAG0_HCVX_PHASE = 141,
LAG1_HC_DB = 142,
LAG1_HC_PHASE = 143,
LAG1_VC_DB = 144,
LAG1_VC_PHASE = 145,
LAG1_HCVC_DB = 146,
LAG1_HCVC_PHASE = 147,
LAG1_VCHC_DB = 148,
LAG1_VCHC_PHASE = 149,
LAG1_VXHX_DB = 150,
LAG1_VXHX_PHASE = 151,
LAG1_HC_LONG_DB = 152,
LAG1_HC_LONG_PHASE = 153,
LAG1_VC_LONG_DB = 154,
LAG1_VC_LONG_PHASE = 155,
LAG1_HC_SHORT_DB = 156,
LAG1_HC_SHORT_PHASE = 157,
LAG1_VC_SHORT_DB = 158,
LAG1_VC_SHORT_PHASE = 159,
LAG1_HC_LONG_TO_SHORT_DB = 160,
LAG1_HC_LONG_TO_SHORT_PHASE = 161,
LAG1_VC_LONG_TO_SHORT_DB = 162,
LAG1_VC_LONG_TO_SHORT_PHASE = 163,
LAG1_HC_SHORT_TO_LONG_DB = 164,
LAG1_HC_SHORT_TO_LONG_PHASE = 165,
LAG1_VC_SHORT_TO_LONG_DB = 166,
LAG1_VC_SHORT_TO_LONG_PHASE = 167,
LAG2_HC_DB = 168,
LAG2_HC_PHASE = 169,
LAG2_VC_DB = 170,
LAG2_VC_PHASE = 171,
LAG3_HC_DB = 172,
LAG3_HC_PHASE = 173,
LAG3_VC_DB = 174,
LAG3_VC_PHASE = 175,
RVVHH0_DB = 176,
RVVHH0_PHASE = 177,
RVVHH0_LONG_DB = 178,
RVVHH0_LONG_PHASE = 179,
RVVHH0_SHORT_DB = 180,
RVVHH0_SHORT_PHASE = 181,
SDEV_VV = 182,
PRT = 183,
NUM_PULSES = 184,
TEST = 185,
TEST0 = 186,
TEST1 = 187,
TEST2 = 188,
TEST3 = 189,
TEST4 = 190,
TEST5 = 191,
TEST6 = 192,
TEST7 = 193,
TEST8 = 194,
TEST9 = 195
RHOHV_TEST_FLAG = 112,
TDBZ_INTEREST = 113,
SPIN_INTEREST = 114,
CPA_INTEREST = 115,
ZDR_SDEV_INTEREST = 116,
PHIDP_SDEV_INTEREST = 117,
CLUT = 118,
CLUT_2_WX_RATIO = 119,
SPECTRAL_NOISE = 120,
SPECTRAL_SNR = 121,
REGR_FILT_POLY_ORDER = 122,
REGR_FILT_CNR_DB = 123,
AIQ_HC = 124,
NIQ_HC = 125,
AIQ_VC = 126,
NIQ_VC = 127,
SZ_TRIP_FLAG = 128,
SZ_LEAKAGE = 129,
CENSORING_FLAG = 130,
LAG0_HC_DB = 131,
LAG0_HX_DB = 132,
LAG0_VC_DB = 133,
LAG0_VX_DB = 134,
LAG0_HC_SHORT_DB = 135,
LAG0_VC_SHORT_DB = 136,
LAG0_HC_LONG_DB = 137,
LAG0_VC_LONG_DB = 138,
LAG0_VCHX_DB = 139,
LAG0_VCHX_PHASE = 140,
LAG0_HCVX_DB = 141,
LAG0_HCVX_PHASE = 142,
LAG1_HC_DB = 143,
LAG1_HC_PHASE = 144,
LAG1_VC_DB = 145,
LAG1_VC_PHASE = 146,
LAG1_HCVC_DB = 147,
LAG1_HCVC_PHASE = 148,
LAG1_VCHC_DB = 149,
LAG1_VCHC_PHASE = 150,
LAG1_VXHX_DB = 151,
LAG1_VXHX_PHASE = 152,
LAG1_HC_LONG_DB = 153,
LAG1_HC_LONG_PHASE = 154,
LAG1_VC_LONG_DB = 155,
LAG1_VC_LONG_PHASE = 156,
LAG1_HC_SHORT_DB = 157,
LAG1_HC_SHORT_PHASE = 158,
LAG1_VC_SHORT_DB = 159,
LAG1_VC_SHORT_PHASE = 160,
LAG1_HC_LONG_TO_SHORT_DB = 161,
LAG1_HC_LONG_TO_SHORT_PHASE = 162,
LAG1_VC_LONG_TO_SHORT_DB = 163,
LAG1_VC_LONG_TO_SHORT_PHASE = 164,
LAG1_HC_SHORT_TO_LONG_DB = 165,
LAG1_HC_SHORT_TO_LONG_PHASE = 166,
LAG1_VC_SHORT_TO_LONG_DB = 167,
LAG1_VC_SHORT_TO_LONG_PHASE = 168,
LAG2_HC_DB = 169,
LAG2_HC_PHASE = 170,
LAG2_VC_DB = 171,
LAG2_VC_PHASE = 172,
LAG3_HC_DB = 173,
LAG3_HC_PHASE = 174,
LAG3_VC_DB = 175,
LAG3_VC_PHASE = 176,
RVVHH0_DB = 177,
RVVHH0_PHASE = 178,
RVVHH0_LONG_DB = 179,
RVVHH0_LONG_PHASE = 180,
RVVHH0_SHORT_DB = 181,
RVVHH0_SHORT_PHASE = 182,
SDEV_VV = 183,
PRT = 184,
NUM_PULSES = 185,
TEST = 186,
TEST0 = 187,
TEST1 = 188,
TEST2 = 189,
TEST3 = 190,
TEST4 = 191,
TEST5 = 192,
TEST6 = 193,
TEST7 = 194,
TEST8 = 195,
TEST9 = 196
} field_id_t;

typedef enum {
Expand Down Expand Up @@ -1267,7 +1268,13 @@ public:

tdrp_bool_t apply_rhohv_test_in_cmd;

double rhohv_improvement_factor_threshold;
double rhohv_improv_thresh_for_power;

double rhohv_improv_thresh_for_vel;

double rhohv_improv_thresh_for_phase;

double rhohv_improv_thresh_for_rho;

tdrp_bool_t run_spectral_cmd;

Expand Down Expand Up @@ -1385,7 +1392,7 @@ private:

void _init();

mutable TDRPtable _table[318];
mutable TDRPtable _table[321];

const char *_className;

Expand Down
31 changes: 25 additions & 6 deletions codebase/apps/radar/src/Iq2Dsr/paramdef.Iq2Dsr
Original file line number Diff line number Diff line change
Expand Up @@ -1893,21 +1893,39 @@ paramdef double {
} phidp_sdev_interest_weight;

commentdef {
p_header = "RHOHV TEST to AUGMENT CMD";
p_text = "If clutter is present the RHOHV value should increase after application of the clutter filter. We can use a RHOHV test to locate gates at which CMD fails to identify weak clutter. This allows us to improve clutter identification in cases with low clutter-to-noise ratio.";
p_header = "RHOHV TEST to AUGMENT CMD.";
p_text = "If clutter is present along with weather, RHOHV should increase after application of the clutter filter. The RHOHV improvment factor is a measure of the change in RHOHV towards 1.0. We use different improvement thresholds to decide whether the filtered spectrum should be used for power or phase related fields.";
};

paramdef boolean {
p_default = FALSE;
p_descr = "Apply the RHOHV test in CMD.";
p_help = "This allows us to identify areas of weak clutter contamination that CMD missed. Only applies to dual-pol radars for which RHOHV is available.";
p_help = "This allows us to identify areas of clutter contamination that CMD missed. Only applies to dual-pol radars for which RHOHV is available.";
} apply_rhohv_test_in_cmd;

paramdef double {
p_default = 4.0;
p_descr = "The RHOHV improvment factor is a measure of the change in RHOHV towards 1.0.";
p_help = "The RHOHV test identifies clutter if the improvement factor exceeds this value.";
} rhohv_improvement_factor_threshold;
p_descr = "RHOHV improvment factor threshold for power-based fields.";
p_help = "If the improvement exceeds this threshold, we use the filtered spectrum for power-based fields.";
} rhohv_improv_thresh_for_power;

paramdef double {
p_default = 1.5;
p_descr = "RHOHV improvment factor threshold for velocity fields.";
p_help = "If the improvement exceeds this threshold, we use the filtered spectrum for velocity-related fields.";
} rhohv_improv_thresh_for_vel;

paramdef double {
p_default = 1.0;
p_descr = "RHOHV improvment factor threshold for phase-related fields.";
p_help = "If the improvement exceeds this threshold, we use the filtered spectrum for phase-related fields, e.g. phidp.";
} rhohv_improv_thresh_for_phase;

paramdef double {
p_default = 1.0;
p_descr = "RHOHV improvment factor threshold for correlation-related fields.";
p_help = "If the improvement exceeds this threshold, we use the filtered spectrum for correlation-related fields, e.g. rhohv.";
} rhohv_improv_thresh_for_rho;

commentdef {
p_header = "SPECTRAL CMD";
Expand Down Expand Up @@ -2244,6 +2262,7 @@ typedef enum {
RHOHV_TEST_UNFILT,
RHOHV_TEST_FILT,
RHOHV_TEST_IMPROV,
RHOHV_TEST_FLAG,

TDBZ_INTEREST,
SPIN_INTEREST,
Expand Down
1 change: 1 addition & 0 deletions codebase/libs/radar/src/include/radar/MomentsFields.hh
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ public:
double rhohv_test_unfilt;
double rhohv_test_filt;
double rhohv_test_improv;
double rhohv_test_flag;

double tdbz_interest;
double spin_interest;
Expand Down
2 changes: 2 additions & 0 deletions codebase/libs/radar/src/moments/MomentsFields.cc
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ void MomentsFields::init()
rhohv_test_unfilt = missingDouble;
rhohv_test_filt = missingDouble;
rhohv_test_improv = missingDouble;
rhohv_test_flag = missingDouble;

tdbz_interest = missingDouble;
spin_interest = missingDouble;
Expand Down Expand Up @@ -556,6 +557,7 @@ void MomentsFields::initToZero()
rhohv_test_unfilt = 0.0;
rhohv_test_filt = 0.0;
rhohv_test_improv = 0.0;
rhohv_test_flag = 0.0;

tdbz_interest = 0.0;
spin_interest = 0.0;
Expand Down

0 comments on commit ebf8039

Please sign in to comment.