Skip to content

Commit

Permalink
Per #1809, add a call to tc_gen in unit_tc_gen.xml.
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnHalleyGotway committed Nov 13, 2021
1 parent ac1045c commit 540a4f4
Show file tree
Hide file tree
Showing 3 changed files with 328 additions and 11 deletions.
23 changes: 15 additions & 8 deletions met/src/tools/tc_utils/tc_gen/tc_gen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ static int find_probgen_match (const ProbGenInfo &,
const TrackInfoArray &,
bool, double, int, int);

static void setup_txt_files (int, int);
static void setup_txt_files (int, int, int);
static void setup_table (AsciiTable &);
static void setup_nc_file ();

Expand Down Expand Up @@ -306,7 +306,7 @@ void score_track_genesis(const GenesisInfoArray &best_ga,
int n_time = (conf_info.FcstSecEnd - conf_info.FcstSecBeg) /
(conf_info.InitFreqHr*sec_per_hour) + 1;
int n_pair = best_ga.n() * n_time + fcst_ga.n();
setup_txt_files(fcst_ga.n_technique(), n_pair);
setup_txt_files(fcst_ga.n_technique(), 1, n_pair);

// If requested, setup the NetCDF output file
if(!conf_info.NcInfo.all_false()) setup_nc_file();
Expand Down Expand Up @@ -385,7 +385,7 @@ void score_track_genesis(const GenesisInfoArray &best_ga,

void score_genesis_prob(const GenesisInfoArray &best_ga,
const TrackInfoArray &oper_ta) {
int i, j;
int i, j, n, max_n_prob, n_pair;
StringArray edeck_files, edeck_files_model_suffix;
ProbInfoArray fcst_pa, empty_pa;
ConcatString model;
Expand All @@ -403,8 +403,15 @@ void score_genesis_prob(const GenesisInfoArray &best_ga,
process_edecks(edeck_files, edeck_files_model_suffix,
fcst_pa);

// Count up the total number of probabilities
for(i=0,max_n_prob=0,n_pair=0; i<fcst_pa.n_prob_gen(); i++) {
n = fcst_pa.prob_gen(i).n_prob();
if(n > max_n_prob) max_n_prob = n;
n_pair += n;
}

// Setup output files based on the number of techniques
setup_txt_files(fcst_pa.n_technique(), fcst_pa.n_prob_gen() * 3);
setup_txt_files(fcst_pa.n_technique(), max_n_prob, n_pair);

// Process each verification filter
for(i=0; i<conf_info.n_vx(); i++) {
Expand Down Expand Up @@ -1357,7 +1364,7 @@ void process_edecks(const StringArray &files,
//
////////////////////////////////////////////////////////////////////////

void setup_txt_files(int n_model, int n_pair) {
void setup_txt_files(int n_model, int max_n_prob, int n_pair) {
int i, n_rows, n_cols, stat_rows, stat_cols, n_prob;

// Check to see if the stat file stream has already been setup
Expand All @@ -1384,18 +1391,18 @@ void setup_txt_files(int n_model, int n_pair) {
break;

// Nx2 probabilistic contingency table output:
// 1 header + 1 vx method * 3 leads * # models * # filters
// 1 header + 1 vx method * # models * #probs * # filters
case(i_pct):
case(i_pstd):
case(i_pjc):
case(i_prc):
n_rows = 1 * 3 * n_model * conf_info.n_vx();
n_rows = 1 + n_model * max_n_prob * conf_info.n_vx();
break;

// For stat_genmpr:
// 1 header + 2 vx methods * # models * # filters * # pairs
default:
n_rows = 1 + n_model * conf_info.n_vx() * n_pair;
n_rows = 1 + 2 * n_model * conf_info.n_vx() * n_pair;
break;
} // end switch

Expand Down
288 changes: 288 additions & 0 deletions test/config/TCGenConfig_prob
Original file line number Diff line number Diff line change
@@ -0,0 +1,288 @@
////////////////////////////////////////////////////////////////////////////////
//
// TC-Gen configuration file.
//
// For additional information, please see the MET User's Guide.
//
////////////////////////////////////////////////////////////////////////////////

//
// ATCF file format reference:
// http://www.nrlmry.navy.mil/atcf_web/docs/database/new/abrdeck.html
//

////////////////////////////////////////////////////////////////////////////////
//
// Genesis event definition criteria
//
////////////////////////////////////////////////////////////////////////////////

//
// Model initialization frequency in hours, starting at 0
//
init_freq = 6;

//
// Valid hour frequency to be analyzed in hours, starting at 0
//
valid_freq = 6;

//
// Forecast hours to be searched for genesis events
//
fcst_hr_window = {
beg = 6;
end = 120;
}

//
// Minimum track duration for genesis event in hours
//
min_duration = 12;

//
// Forecast genesis event criteria. Defined as tracks reaching the specified
// intensity category, maximum wind speed threshold, and minimum sea-level
// pressure threshold. The forecast genesis time is the valid time of the first
// track point where all of these criteria are met.
//
fcst_genesis = {
vmax_thresh = NA;
mslp_thresh = NA;
}

//
// BEST track genesis event criteria. Defined as tracks reaching the specified
// intensity category, maximum wind speed threshold, and minimum sea-level
// pressure threshold. The BEST track genesis time is the valid time of the
// first track point where all of these criteria are met.
//
best_genesis = {
technique = "BEST";
category = [ "TD", "TS" ];
vmax_thresh = NA;
mslp_thresh = NA;
}

//
// Operational track technique name
//
oper_technique = "CARQ";

////////////////////////////////////////////////////////////////////////////////
//
// Track filtering options
// May be specified separately in each filter array entry.
//
////////////////////////////////////////////////////////////////////////////////

//
// Array of dictionaries containing the track filtering options
// If empty, a single filter is defined using the top-level settings.
//
filter = [
{
desc = "ALL";
}
];

//
// Description written to output DESC column
//
desc = "ALL";

//
// Forecast ATCF ID's
// If empty, all ATCF ID's found will be processed.
// Statistics will be generated separately for each ATCF ID.
//
model = [];

//
// BEST and operational track storm identifiers
//
storm_id = [];

//
// BEST and operational track storm names
//
storm_name = [];

//
// Forecast and operational initialization times to include or exclude
//
init_beg = "";
init_end = "";
init_inc = [];
init_exc = [];

//
// Forecast, BEST, and operational valid time window
//
valid_beg = "";
valid_end = "";

//
// Forecast and operational initialization hours
//
init_hour = [];

//
// Forecast and operational lead times in hours
//
lead = [];

//
// Spatial masking region (path to gridded data file or polyline file)
//
vx_mask = "";

//
// Spatial masking of hurricane basin names from the basin_file
//
basin_mask = [];

//
// Distance to land threshold
//
dland_thresh = NA;

////////////////////////////////////////////////////////////////////////////////
//
// Matching and scoring options
// May be specified separately in each filter array entry.
//
////////////////////////////////////////////////////////////////////////////////

//
// Genesis matching logic. Compare the forecast genesis point to all points in
// the Best track (TRUE) or the single Best track genesis point (FALSE).
//
genesis_match_point_to_track = FALSE;

//
// Radius in km to search for a matching genesis event
//
genesis_match_radius = 500;

//
// Time window in hours, relative to the model genesis time, to search for a
// matching Best track point
//
genesis_match_window = {
beg = -6;
end = 6;
}

//
// Radius in km for a development scoring method hit
//
dev_hit_radius = 500;

//
// Time window in hours, relative to the model genesis time, for a development
// scoring method hit
//
dev_hit_window = {
beg = -24;
end = 24;
}

//
// Time window in hours for the Best track genesis minus model initialization
// time difference for an operational scoring method hit
//
ops_hit_window = {
beg = 0;
end = 48;
}

//
// Discard genesis forecasts for initializations at or after the matching
// BEST track genesis time
//
discard_init_post_genesis_flag = TRUE;

//
// Scoring methods to be applied
//
dev_method_flag = TRUE;
ops_method_flag = TRUE;

////////////////////////////////////////////////////////////////////////////////
//
// Output options
// May be specified separately in each filter array entry.
//
////////////////////////////////////////////////////////////////////////////////

//
// Probability of genesis thresholds
//
prob_genesis_thresh = ==0.25;

//
// Confidence interval alpha value
//
ci_alpha = 0.05;

//
// Statistical output types
//
output_flag = {
fho = NONE;
ctc = NONE;
cts = NONE;
pct = BOTH;
pstd = BOTH;
pjc = BOTH;
prc = BOTH;
genmpr = BOTH;
}

//
// NetCDF genesis pair counts
//
nc_pairs_flag = FALSE;

//
// Specify which track points should be counted by thresholding the track point
// valid time minus genesis time difference.
//
valid_minus_genesis_diff_thresh = NA;

//
// Count unique BEST track genesis event locations (TRUE) versus counting the
// location for all pairs (FALSE).
//
best_unique_flag = TRUE;

////////////////////////////////////////////////////////////////////////////////
//
// Global settings
// May only be specified once.
//
////////////////////////////////////////////////////////////////////////////////

//
// Specify the NetCDF output of the gen_dland tool containing a gridded
// representation of the minimum distance to land.
//
dland_file = "MET_BASE/tc_data/dland_global_tenth_degree.nc";

//
// Specify the NetCDF file containing a gridded representation of the
// global basins.
//
basin_file = "MET_BASE/tc_data/basin_global_tenth_degree.nc";

//
// NetCDF genesis pairs grid
//
nc_pairs_grid = "G003";

//
// Indicate a version number for the contents of this configuration file.
// The value should generally not be modified.
//
version = "V10.1.0";
Loading

0 comments on commit 540a4f4

Please sign in to comment.