Skip to content

Commit

Permalink
Per #2609, add one_time_per_file_flag config option for tc_diag. Stil…
Browse files Browse the repository at this point in the history
…l need to actually implement logic to handle this in tc_diag.
  • Loading branch information
JohnHalleyGotway committed Jul 26, 2023
1 parent 2c5b82c commit d018235
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 11 deletions.
5 changes: 5 additions & 0 deletions data/config/TCDiagConfig_default
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ vortex_removal = FALSE;

////////////////////////////////////////////////////////////////////////////////

//
// Flag to control input files
//
one_time_per_file_flag = TRUE;

//
// Flags to control output files
//
Expand Down
5 changes: 5 additions & 0 deletions internal/test_unit/config/TCDiagConfig_ian
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ vortex_removal = FALSE;

////////////////////////////////////////////////////////////////////////////////

//
// Flag to control input files
//
one_time_per_file_flag = TRUE;

//
// Flags to control output files
//
Expand Down
15 changes: 8 additions & 7 deletions src/basic/vx_config/config_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -1206,18 +1206,19 @@ static const char conf_key_radial_velocity_field_name[] = "radial_velocity_field
static const char conf_key_tangential_velocity_field_name[] = "tangential_velocity_field_name";
static const char conf_key_radial_velocity_long_field_name[] = "radial_velocity_long_field_name";
static const char conf_key_tangential_velocity_long_field_name[] = "tangential_velocity_long_field_name";
static const char conf_key_vortex_removal[] = "vortex_removal";

//
// TC-Diag specific parameter key names
//

static const char conf_key_domain_info[] = "domain_info";
static const char conf_key_domain[] = "domain";
static const char conf_key_diag_script[] = "diag_script";
static const char conf_key_nc_rng_azi_flag[] = "nc_rng_azi_flag";
static const char conf_key_nc_diag_flag[] = "nc_diag_flag";
static const char conf_key_cira_diag_flag[] = "cira_diag_flag";
static const char conf_key_domain_info[] = "domain_info";
static const char conf_key_domain[] = "domain";
static const char conf_key_diag_script[] = "diag_script";
static const char conf_key_vortex_removal[] = "vortex_removal";
static const char conf_key_one_time_per_file_flag[] = "one_time_per_file_flag";
static const char conf_key_nc_rng_azi_flag[] = "nc_rng_azi_flag";
static const char conf_key_nc_diag_flag[] = "nc_diag_flag";
static const char conf_key_cira_diag_flag[] = "cira_diag_flag";

//
// Parameter value names common to multiple tools
Expand Down
7 changes: 4 additions & 3 deletions src/tools/tc_utils/tc_diag/tc_diag.cc
Original file line number Diff line number Diff line change
Expand Up @@ -984,6 +984,8 @@ void process_fields(const TrackInfoArray &tracks,
// Read in the full set of fields required for vortex removal
// Add flag to configure which fields are used for vortex removal

// TODO: Add logic to support one_time_per_file_flag set to true.

// Loop over the VarInfo fields to be processed
for(i=0; i<di.var_info_ptr.size(); i++) {

Expand Down Expand Up @@ -1035,9 +1037,9 @@ void process_fields(const TrackInfoArray &tracks,

} // end for i

// Log missing fields
// Print warning for missing fields
if(fields_missing.n() > 0) {
mlog << Debug(2) << "For the "
mlog << Warning << "For the "
<< domain << " domain, "
<< sec_to_hhmmss(vld_ut - init_ut) << " lead time, and "
<< unix_to_yyyymmdd_hhmmss(vld_ut) << " valid time, "
Expand All @@ -1057,7 +1059,6 @@ void process_fields(const TrackInfoArray &tracks,
tmp_file_map[tmp_key_sa[i]].diag_map);

} // end for j

} // end for i

return;
Expand Down
5 changes: 5 additions & 0 deletions src/tools/tc_utils/tc_diag/tc_diag_conf_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ void TCDiagConfInfo::clear() {
domain_info.clear();

vortex_removal_flag = false;
one_time_per_file_flag = true;

nc_rng_azi_flag = false;
nc_diag_flag = false;
Expand Down Expand Up @@ -327,6 +328,10 @@ void TCDiagConfInfo::process_config(GrdFileType file_type,
vortex_removal_flag =
conf.lookup_bool(conf_key_vortex_removal);

// Conf: one_time_per_file_flag
one_time_per_file_flag =
conf.lookup_bool(conf_key_one_time_per_file_flag);

// Conf: nc_rng_azi_flag
nc_rng_azi_flag = conf.lookup_bool(conf_key_nc_rng_azi_flag);

Expand Down
5 changes: 4 additions & 1 deletion src/tools/tc_utils/tc_diag/tc_diag_conf_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,12 @@ class TCDiagConfInfo {
// Vector of DomainInfo
std::vector<DomainInfo> domain_info;

// Vortext removal settings
// Vortex removal settings
bool vortex_removal_flag;

// One time per file settings
bool one_time_per_file_flag;

// Directory for temporary files
ConcatString tmp_dir;

Expand Down

0 comments on commit d018235

Please sign in to comment.