Skip to content

Commit

Permalink
Changing so that input fields are already qualified with short and long
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-dixon committed Dec 8, 2024
1 parent 8566927 commit 500843d
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 66 deletions.
42 changes: 21 additions & 21 deletions codebase/apps/radar/src/HcrShortLongCombine/HcrShortLongCombine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -787,16 +787,16 @@ int HcrShortLongCombine::_readNextDwell()

for (size_t ii = 0; ii < _dwellRaysShort.size(); ii++) {
RadxRay *ray = _dwellRaysShort[ii];
RadxField *velCorr = ray->getField(_params.input_vel_corr_field_name);
RadxField *velCorr = ray->getField(_params.input_vel_corr_field_name_short);
if (velCorr != NULL) {
ray->removeField(_params.input_vel_corr_field_name);
ray->removeField(_params.input_vel_corr_field_name_short);
}
}
for (size_t ii = 0; ii < _dwellRaysLong.size(); ii++) {
RadxRay *ray = _dwellRaysLong[ii];
RadxField *velCorr = ray->getField(_params.input_vel_corr_field_name);
RadxField *velCorr = ray->getField(_params.input_vel_corr_field_name_long);
if (velCorr != NULL) {
ray->removeField(_params.input_vel_corr_field_name);
ray->removeField(_params.input_vel_corr_field_name_long);
}
}

Expand Down Expand Up @@ -932,20 +932,20 @@ RadxRay *HcrShortLongCombine::_combineDwellRays()

// rename short fields

vector<RadxField *> fieldsShort = rayCombined->getFields();
for (size_t ifield = 0; ifield < fieldsShort.size(); ifield++) {
RadxField *fld = fieldsShort[ifield];
string newName = fld->getName() + _params.suffix_to_add_for_short_pulse_fields;
fld->setName(newName);
}
// vector<RadxField *> fieldsShort = rayCombined->getFields();
// for (size_t ifield = 0; ifield < fieldsShort.size(); ifield++) {
// RadxField *fld = fieldsShort[ifield];
// string newName = fld->getName() + _params.suffix_to_add_for_short_pulse_fields;
// fld->setName(newName);
// }

// add long fields to short ray

vector<RadxField *> fieldsLong = rayLong->getFields();
for (size_t ifield = 0; ifield < fieldsLong.size(); ifield++) {
RadxField *fld = new RadxField(*fieldsLong[ifield]);
string newName = fld->getName() + _params.suffix_to_add_for_long_pulse_fields;
fld->setName(newName);
// string newName = fld->getName() + _params.suffix_to_add_for_long_pulse_fields;
// fld->setName(newName);
rayCombined->addField(fld);
}
delete rayLong;
Expand Down Expand Up @@ -1003,11 +1003,11 @@ void HcrShortLongCombine::_unfoldVel(RadxRay *rayCombined)

{

string velRawShortName = _params.input_vel_raw_field_name;
velRawShortName += _params.suffix_to_add_for_short_pulse_fields;
string velRawLongName = _params.input_vel_raw_field_name;
velRawLongName += _params.suffix_to_add_for_long_pulse_fields;

string velRawShortName = _params.input_vel_raw_field_name_short;
// velRawShortName += _params.suffix_to_add_for_short_pulse_fields;
string velRawLongName = _params.input_vel_raw_field_name_long;
// velRawLongName += _params.suffix_to_add_for_long_pulse_fields;
RadxField *velShort = rayCombined->getField(velRawShortName);
RadxField *velLong = rayCombined->getField(velRawLongName);

Expand Down Expand Up @@ -1079,10 +1079,10 @@ void HcrShortLongCombine::_unfoldVel(RadxRay *rayCombined)

// rename vel fields

string velCorrShortName = _params.output_vel_corr_field_name;
velCorrShortName += _params.suffix_to_add_for_short_pulse_fields;
string velCorrLongName = _params.output_vel_corr_field_name;
velCorrLongName += _params.suffix_to_add_for_long_pulse_fields;
string velCorrShortName = _params.output_vel_corr_field_name_short;
// velCorrShortName += _params.suffix_to_add_for_short_pulse_fields;
string velCorrLongName = _params.output_vel_corr_field_name_long;
// velCorrLongName += _params.suffix_to_add_for_long_pulse_fields;

velShort->setName(velCorrShortName);
velLong->setName(velCorrLongName);
Expand Down
60 changes: 36 additions & 24 deletions codebase/apps/radar/src/HcrShortLongCombine/Params.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1134,64 +1134,76 @@
tt->single_val.b = pTRUE;
tt++;

// Parameter 'input_vel_raw_field_name'
// Parameter 'input_vel_raw_field_name_short'
// ctype is 'char*'

memset(tt, 0, sizeof(TDRPtable));
tt->ptype = STRING_TYPE;
tt->param_name = tdrpStrDup("input_vel_raw_field_name");
tt->param_name = tdrpStrDup("input_vel_raw_field_name_short");
tt->descr = tdrpStrDup("This is the name for the raw velocity field in the input data. The raw velocity has not been corrected for platform motion.");
tt->help = tdrpStrDup("The field name must be the same for the short- and long-prt rays.");
tt->val_offset = (char *) &input_vel_raw_field_name - &_start_;
tt->single_val.s = tdrpStrDup("VEL_RAW");
tt->val_offset = (char *) &input_vel_raw_field_name_short - &_start_;
tt->single_val.s = tdrpStrDup("VEL_RAW_short");
tt++;

// Parameter 'input_vel_corr_field_name'
// Parameter 'input_vel_raw_field_name_long'
// ctype is 'char*'

memset(tt, 0, sizeof(TDRPtable));
tt->ptype = STRING_TYPE;
tt->param_name = tdrpStrDup("input_vel_corr_field_name");
tt->param_name = tdrpStrDup("input_vel_raw_field_name_long");
tt->descr = tdrpStrDup("This is the name for the raw velocity field in the input data. The raw velocity has not been corrected for platform motion.");
tt->help = tdrpStrDup("The field name must be the same for the short- and long-prt rays.");
tt->val_offset = (char *) &input_vel_raw_field_name_long - &_start_;
tt->single_val.s = tdrpStrDup("VEL_RAW_long");
tt++;

// Parameter 'input_vel_corr_field_name_short'
// ctype is 'char*'

memset(tt, 0, sizeof(TDRPtable));
tt->ptype = STRING_TYPE;
tt->param_name = tdrpStrDup("input_vel_corr_field_name_short");
tt->descr = tdrpStrDup("This is the name for the velocity field in the input data, corrected for platform motion.");
tt->help = tdrpStrDup("If this field exists in the input data, it is deleted and replaced with the values computed by this application.");
tt->val_offset = (char *) &input_vel_corr_field_name - &_start_;
tt->single_val.s = tdrpStrDup("VEL");
tt->val_offset = (char *) &input_vel_corr_field_name_short - &_start_;
tt->single_val.s = tdrpStrDup("VEL_short");
tt++;

// Parameter 'suffix_to_add_for_short_pulse_fields'
// Parameter 'input_vel_corr_field_name_long'
// ctype is 'char*'

memset(tt, 0, sizeof(TDRPtable));
tt->ptype = STRING_TYPE;
tt->param_name = tdrpStrDup("suffix_to_add_for_short_pulse_fields");
tt->descr = tdrpStrDup("This suffix is added to the input fields for short-prt moments.");
tt->help = tdrpStrDup("For each incoming short-pulse field, we add this suffix to the incoming field name.");
tt->val_offset = (char *) &suffix_to_add_for_short_pulse_fields - &_start_;
tt->single_val.s = tdrpStrDup("_short");
tt->param_name = tdrpStrDup("input_vel_corr_field_name_long");
tt->descr = tdrpStrDup("This is the name for the velocity field in the input data, corrected for platform motion.");
tt->help = tdrpStrDup("If this field exists in the input data, it is deleted and replaced with the values computed by this application.");
tt->val_offset = (char *) &input_vel_corr_field_name_long - &_start_;
tt->single_val.s = tdrpStrDup("VEL_long");
tt++;

// Parameter 'suffix_to_add_for_long_pulse_fields'
// Parameter 'output_vel_corr_field_name_short'
// ctype is 'char*'

memset(tt, 0, sizeof(TDRPtable));
tt->ptype = STRING_TYPE;
tt->param_name = tdrpStrDup("suffix_to_add_for_long_pulse_fields");
tt->descr = tdrpStrDup("This suffix is added to the input fields for long-prt moments.");
tt->help = tdrpStrDup("For each incoming long-pulse field, we add this suffix to the incoming field name.");
tt->val_offset = (char *) &suffix_to_add_for_long_pulse_fields - &_start_;
tt->single_val.s = tdrpStrDup("_long");
tt->param_name = tdrpStrDup("output_vel_corr_field_name_short");
tt->descr = tdrpStrDup("Name for the corrected velocity on output.");
tt->help = tdrpStrDup("The name of the output fields for velocity corrected for platform motion.");
tt->val_offset = (char *) &output_vel_corr_field_name_short - &_start_;
tt->single_val.s = tdrpStrDup("VEL_short");
tt++;

// Parameter 'output_vel_corr_field_name'
// Parameter 'output_vel_corr_field_name_long'
// ctype is 'char*'

memset(tt, 0, sizeof(TDRPtable));
tt->ptype = STRING_TYPE;
tt->param_name = tdrpStrDup("output_vel_corr_field_name");
tt->param_name = tdrpStrDup("output_vel_corr_field_name_long");
tt->descr = tdrpStrDup("Name for the corrected velocity on output.");
tt->help = tdrpStrDup("The name of the output fields for velocity corrected for platform motion.");
tt->val_offset = (char *) &output_vel_corr_field_name - &_start_;
tt->single_val.s = tdrpStrDup("VEL");
tt->val_offset = (char *) &output_vel_corr_field_name_long - &_start_;
tt->single_val.s = tdrpStrDup("VEL_long");
tt++;

// Parameter 'output_vel_unfolded_field_name'
Expand Down
14 changes: 8 additions & 6 deletions codebase/apps/radar/src/HcrShortLongCombine/Params.hh
Original file line number Diff line number Diff line change
Expand Up @@ -483,15 +483,17 @@ public:

tdrp_bool_t perform_velocity_unfolding;

char* input_vel_raw_field_name;
char* input_vel_raw_field_name_short;

char* input_vel_corr_field_name;
char* input_vel_raw_field_name_long;

char* suffix_to_add_for_short_pulse_fields;
char* input_vel_corr_field_name_short;

char* suffix_to_add_for_long_pulse_fields;
char* input_vel_corr_field_name_long;

char* output_vel_corr_field_name;
char* output_vel_corr_field_name_short;

char* output_vel_corr_field_name_long;

char* output_vel_unfolded_field_name;

Expand All @@ -514,7 +516,7 @@ private:

void _init();

mutable TDRPtable _table[51];
mutable TDRPtable _table[52];

const char *_className;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,34 +297,52 @@ paramdef boolean {
} perform_velocity_unfolding;

paramdef string {
p_default = "VEL_RAW";
p_default = "VEL_RAW_short";
p_descr = "This is the name for the raw velocity field in the input data. The raw velocity has not been corrected for platform motion.";
p_help = "The field name must be the same for the short- and long-prt rays.";
} input_vel_raw_field_name;
} input_vel_raw_field_name_short;

paramdef string {
p_default = "VEL";
p_default = "VEL_RAW_long";
p_descr = "This is the name for the raw velocity field in the input data. The raw velocity has not been corrected for platform motion.";
p_help = "The field name must be the same for the short- and long-prt rays.";
} input_vel_raw_field_name_long;

paramdef string {
p_default = "VEL_short";
p_descr = "This is the name for the velocity field in the input data, corrected for platform motion.";
p_help = "If this field exists in the input data, it is deleted and replaced with the values computed by this application.";
} input_vel_corr_field_name;
} input_vel_corr_field_name_short;

paramdef string {
p_default = "_short";
p_descr = "This suffix is added to the input fields for short-prt moments.";
p_help = "For each incoming short-pulse field, we add this suffix to the incoming field name.";
} suffix_to_add_for_short_pulse_fields;
p_default = "VEL_long";
p_descr = "This is the name for the velocity field in the input data, corrected for platform motion.";
p_help = "If this field exists in the input data, it is deleted and replaced with the values computed by this application.";
} input_vel_corr_field_name_long;

// paramdef string {
// p_default = "_short";
// p_descr = "This suffix is added to the input fields for short-prt moments.";
// p_help = "For each incoming short-pulse field, we add this suffix to the incoming field name.";
// } suffix_to_add_for_short_pulse_fields;

// paramdef string {
// p_default = "_long";
// p_descr = "This suffix is added to the input fields for long-prt moments.";
// p_help = "For each incoming long-pulse field, we add this suffix to the incoming field name.";
// } suffix_to_add_for_long_pulse_fields;

paramdef string {
p_default = "_long";
p_descr = "This suffix is added to the input fields for long-prt moments.";
p_help = "For each incoming long-pulse field, we add this suffix to the incoming field name.";
} suffix_to_add_for_long_pulse_fields;
p_default = "VEL_short";
p_descr = "Name for the corrected velocity on output.";
p_help = "The name of the output fields for velocity corrected for platform motion.";
} output_vel_corr_field_name_short;

paramdef string {
p_default = "VEL";
p_default = "VEL_long";
p_descr = "Name for the corrected velocity on output.";
p_help = "The name of the output fields for velocity corrected for platform motion.";
} output_vel_corr_field_name;
} output_vel_corr_field_name_long;

paramdef string {
p_default = "VEL_unfold_short";
Expand Down
Loading

0 comments on commit 500843d

Please sign in to comment.