Skip to content

Commit

Permalink
Per #1714, adding genesis_match_point_to_track config file option for…
Browse files Browse the repository at this point in the history
… TC-Gen. Note that this version of the code is close but doesn't actually compile yet. I still need to figure out exactly how to process the operational tracks. Should this logic also apply to the matching for those tracks?
  • Loading branch information
JohnHalleyGotway committed Apr 7, 2021
1 parent 2581161 commit 5cfd9d0
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 15 deletions.
6 changes: 6 additions & 0 deletions met/data/config/TCGenConfig_default
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,12 @@ dland_thresh = NA;
//
////////////////////////////////////////////////////////////////////////////////

//
// 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 = TRUE;

//
// Radius in km to search for a matching genesis event
//
Expand Down
1 change: 1 addition & 0 deletions met/src/basic/vx_config/config_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -1076,6 +1076,7 @@ static const char conf_key_category[] = "category";
static const char conf_key_vmax_thresh[] = "vmax_thresh";
static const char conf_key_mslp_thresh[] = "mslp_thresh";
static const char conf_key_basin_mask[] = "basin_mask";
static const char conf_key_genesis_match_point_to_track[] = "genesis_match_point_to_track";
static const char conf_key_genesis_match_radius[] = "genesis_match_radius";
static const char conf_key_genesis_match_window[] = "genesis_match_window";
static const char conf_key_dev_hit_radius[] = "dev_hit_radius";
Expand Down
8 changes: 8 additions & 0 deletions met/src/libcode/vx_tc_util/genesis_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,14 @@ bool GenesisInfo::is_match(const TrackPoint &p, const double rad,
gc_dist(Lat, Lon, p.lat(), p.lon()) <= rad);
}

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

bool GenesisInfo::is_match(const GenesisInfo &gi, const double rad,
const int beg, const int end) const {
return(is_bad_data(GenesisIndex) ? false :
is_match((*this)[GenesisIndex], rad, beg, end));
}

////////////////////////////////////////////////////////////////////////
//
// Code for class GenesisInfoArray
Expand Down
11 changes: 6 additions & 5 deletions met/src/libcode/vx_tc_util/genesis_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,8 @@ class GenesisInfo : public TrackInfo {

bool IsSet;

// TrackInfo for this Genesis event
TrackInfo Track;
int GenesisIndex;

// Genesis Information
int GenesisIndex;
unixtime GenesisTime;
int GenesisLead;
double Lat;
Expand Down Expand Up @@ -104,7 +101,11 @@ class GenesisInfo : public TrackInfo {
// do stuff
//

bool is_match(const TrackPoint &, const double,
bool is_match(const TrackPoint &,
const double,
const int, const int) const;
bool is_match(const GenesisInfo &,
const double,
const int, const int) const;
};

Expand Down
53 changes: 43 additions & 10 deletions met/src/tools/tc_utils/tc_gen/tc_gen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ static void do_genesis_ctc (const TCGenVxOpt &,
static int find_genesis_match (const GenesisInfo &,
const GenesisInfoArray &,
const TrackInfoArray &,
double, int, int);
bool, double, int, int);

static void setup_txt_files (int, int);
static void setup_table (AsciiTable &);
Expand Down Expand Up @@ -378,6 +378,7 @@ void get_genesis_pairs(const TCGenVxOpt &vx_opt,

// Search for a BEST track match
i_bga = find_genesis_match(fga[i], bga, ota,
vx_opt.GenesisMatchPointTrack,
vx_opt.GenesisMatchRadius,
vx_opt.GenesisMatchBeg,
vx_opt.GenesisMatchEnd);
Expand Down Expand Up @@ -594,8 +595,8 @@ void do_genesis_ctc(const TCGenVxOpt &vx_opt,
int find_genesis_match(const GenesisInfo &fcst_gi,
const GenesisInfoArray &bga,
const TrackInfoArray &ota,
const double rad,
const int beg, const int end) {
bool point2track, double rad,
int beg, int end) {
int i, j;
int i_best = bad_data_int;
int i_oper = bad_data_int;
Expand All @@ -609,15 +610,31 @@ int find_genesis_match(const GenesisInfo &fcst_gi,
<< " forecast genesis at (" << fcst_gi.lat() << ", "
<< fcst_gi.lon() << ")";

// Search the BEST track points for a match
// Search for a BEST track genesis match
for(i=0, i_best=bad_data_int;
i<bga.n() && is_bad_data(i_best);
i++) {
for(j=0; j<bga[i].n_points(); j++) {
if(fcst_gi.is_match(bga[i][j], rad, beg, end)) {

// Check all BEST track points
if(point2track) {

for(j=0; j<bga[i].n_points(); j++) {
if(fcst_gi.is_match(bga[i][j], rad, beg, end)) {
i_best = i;
mlog << Debug(4) << case_cs
<< " MATCHES BEST genesis track "
<< bga[i].storm_id() << ".\n";
break;
}
}
}
// Check only the BEST genesis points
else {

if(fcst_gi.is_match(bga[i], rad, beg, end)) {
i_best = i;
mlog << Debug(4) << case_cs
<< " MATCHES BEST track "
<< " MATCHES BEST genesis point "
<< bga[i].storm_id() << ".\n";
break;
}
Expand All @@ -630,12 +647,28 @@ int find_genesis_match(const GenesisInfo &fcst_gi,
for(i=0, i_oper=bad_data_int;
i<ota.n() && is_bad_data(i_oper);
i++) {
for(j=0; j<ota[i].n_points(); j++) {
if(fcst_gi.is_match(ota[i][j], rad, beg, end)) {

// Check all operational track points
if(point2track) {

for(j=0; j<ota[i].n_points(); j++) {
if(fcst_gi.is_match(ota[i][j], rad, beg, end)) {
i_oper = i;
mlog << Debug(4) << case_cs
<< " MATCHES operational " << ota[i].technique()
<< " genesis track " << ota[i].storm_id() << ".\n";
break;
}
}
}
// Check only the opeartional genesis points
else {

if(fcst_gi.is_match(ota[i], rad, beg, end)) {
i_oper = i;
mlog << Debug(4) << case_cs
<< " MATCHES operational " << ota[i].technique()
<< " track " << ota[i].storm_id() << ".\n";
<< " genesis point " << ota[i].storm_id() << ".\n";
break;
}
}
Expand Down
5 changes: 5 additions & 0 deletions met/src/tools/tc_utils/tc_gen/tc_gen_conf_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ void TCGenVxOpt::clear() {
VxBasinMask.clear();
VxAreaMask.clear();
DLandThresh.clear();
GenesisMatchPointTrack = false;
GenesisMatchRadius = bad_data_double;
GenesisMatchBeg = GenesisMatchEnd = bad_data_int;
DevHitRadius = bad_data_double;
Expand Down Expand Up @@ -243,6 +244,10 @@ void TCGenVxOpt::process_config(Dictionary &dict) {
// Conf: dland_thresh
DLandThresh = dict.lookup_thresh(conf_key_dland_thresh);

// Conf: genesis_match_point_to_track
GenesisMatchPointTrack =
dict.lookup_bool(conf_key_genesis_match_point_to_track);

// Conf: genesis_match_radius
GenesisMatchRadius =
dict.lookup_double(conf_key_genesis_match_radius);
Expand Down
3 changes: 3 additions & 0 deletions met/src/tools/tc_utils/tc_gen/tc_gen_conf_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ class TCGenVxOpt {
// Distance to land threshold
SingleThresh DLandThresh;

// Matching logic
bool GenesisMatchPointTrack;

// Temporal and spatial matching criteria
double GenesisMatchRadius;
int GenesisMatchBeg, GenesisMatchEnd;
Expand Down
6 changes: 6 additions & 0 deletions test/config/TCGenConfig_2016
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,12 @@ dland_thresh = NA;
//
////////////////////////////////////////////////////////////////////////////////

//
// 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 = TRUE;

//
// Radius in km to search for a matching genesis event
//
Expand Down

0 comments on commit 5cfd9d0

Please sign in to comment.