Skip to content

Commit

Permalink
Feature 1315 tcrmw, third try (#1379)
Browse files Browse the repository at this point in the history
* Per #1315, add header block and move the file list parsing further up in the logic (to match series_analysis) and test to confirm that using a file list actually works.

* Per #1315, remove unused BDECK variables and replace nm_to_km with constant from the vx_math library.

* Per #1315, remove reference to an adeck.nc file that was left over from development.

* Per #1315, add TrackPoint::valid_hour() function.

* Per #1315, committing many changes to tc_rmw.  Rename command line option from -adeck to just -deck but still silently support -adeck. Add several track filtering and subsetting options to the config file and update the code to parse the options and apply them.

* Remove commented out and unused code.

* Per #1315, minor edits to comments in the default TCRMW configuration file.

* Changing calls to n_elements() with n() to make the code more concise.

* No real changes here, just tweaking config file comments for consistency.

* Per #1315, update the tc-rmw.rst User's Guide information: the usage statement and new track and point filtering options.

* Per #1315, switch tc_rmw command line option from -adeck to -deck.

* Per #1351, had to rename TC-RMW init_time config file option to be init_inc. Using init_time was problematic since that's used to parse model data. So when parsing the field array, the init_time setting would have been found at the higher level of context and applied to the model data.

* Per #1351, edits to the log messages that are printed for the tc_rmw tool to make them for descriptive and useful.

* Per #1351, update the TC-RMW init_time to init_inc and modify log messages to make them more concise and useful.

* Per #1351, update tc-rmw.rst changing init_time to init_inc.

* Per #1351, list the track file being read at debug level 1.

* Per #1351, add _FillValue variable attribute to the output tc_rmw so that ncview displays the output better.

* Per #1351, work on log messages.

* Per #1351, add a second unit test for tc_rmw which filters 2 input tracks down to 1 and subsets that long track down to 5 points based on lead time.

* Add TCRMW config file for new unit test.

* Per #1315, add ATCFLineBase::valid_hour() function so that lines can be filtered by valid hour.

* Per #1315, remove storm_name as a config file option for tc_rmw. This is the only filter that must be applied to the whole track rather than individual points. Removing the option is much easier than having code to support a seldom-used filtering option. Checked with DTC scientists to confirm this was the preferred approach.

* Per #1315, no longer parse the storm_name option from the tc_rmw config file.

* Per #1315, updating the logic of tc_rmw. I had merged to develop but the changes broke the NB. Specifically, the track lines were no longer included in the NetCDF output file. They were omitted because they didn't survive the subset_tracks() function which stepped through and filtered track point by track point. However, the track lines are stored in one array for the whole track, and not separately for each track point. To simplify the logic, eliminate the subset_tracks() function and move the filtering by valid time, valid hour, and lead time to the is_keeper() function. This simplifies the logic and fixes the track lines problem.

* Per #1315, working on debug messages from vx_tc_nc_util.cc to make them consistent with the rest of the tools.

* Per #1315, change default in TCRMW config file from model = GFS to model = ''. Also add debug level 3 messages listing why each individual track line was skipped.

* Per #1315, switching the skipping log message from debug 3 to 4.
  • Loading branch information
JohnHalleyGotway committed Jun 18, 2020
1 parent b5d5649 commit 147d8ef
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 15 deletions.
2 changes: 1 addition & 1 deletion met/data/config/TCRMWConfig_default
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//
// Model
//
model = "GFS";
model = "";

//
// Storm identifier
Expand Down
2 changes: 1 addition & 1 deletion met/docs/Users_Guide/tc-rmw.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Optional arguments for tc_rmw
The default configuration file for the TC-RMW tool named 'TCRMWConfig_default' can be found in the installed share/met/config/ directory. It is encouraged for users to copy these default files before modifying their contents. The contents of the configuration file are described in the subsections below.


model = "GFS";
model = "";

storm_id = "";

Expand Down
47 changes: 35 additions & 12 deletions met/src/tools/tc_utils/tc_rmw/tc_rmw.cc
Original file line number Diff line number Diff line change
Expand Up @@ -407,31 +407,43 @@ void process_track_files(const StringArray& files,

bool is_keeper(const ATCFLineBase * line) {
bool keep = true;
ConcatString cs;

// Check model
if(conf_info.Model.nonempty() &&
conf_info.Model != line->technique())
conf_info.Model != line->technique()) {
cs << "model " << line->technique() << " != " << conf_info.Model;
keep = false;
}

// Check storm id
else if(conf_info.StormId.nonempty() &&
conf_info.StormId != line->storm_id())
conf_info.StormId != line->storm_id()) {
cs << "storm_id " << line->storm_id() << " != " << conf_info.StormId;
keep = false;
}

// Check basin
else if(conf_info.Basin.nonempty() &&
conf_info.Basin != line->basin())
conf_info.Basin != line->basin()) {
cs << "basin " << line->basin() << " != " << conf_info.Basin;
keep = false;
}

// Check cyclone
else if(conf_info.Cyclone.nonempty() &&
conf_info.Cyclone != line->cyclone_number())
conf_info.Cyclone != line->cyclone_number()) {
cs << "cyclone " << line->cyclone_number() << " != " << conf_info.Cyclone;
keep = false;
}

// Check initialization time
else if(conf_info.InitInc != (unixtime) 0 &&
conf_info.InitInc != line->warning_time())
conf_info.InitInc != line->warning_time()) {
cs << "init_inc " << unix_to_yyyymmddhh(line->warning_time())
<< " != " << unix_to_yyyymmdd_hhmmss(conf_info.InitInc);
keep = false;
}

// Check valid time
else if((conf_info.ValidBeg > 0 &&
Expand All @@ -441,18 +453,29 @@ bool is_keeper(const ATCFLineBase * line) {
(conf_info.ValidInc.n() > 0 &&
!conf_info.ValidInc.has(line->valid())) ||
(conf_info.ValidExc.n() > 0 &&
conf_info.ValidExc.has(line->valid())))
keep = false;
conf_info.ValidExc.has(line->valid()))) {
cs << "valid_time " << unix_to_yyyymmddhh(line->valid());
keep = false;
}

// Check valid hour
else if (conf_info.ValidHour.n() > 0 &&
!conf_info.ValidHour.has(line->valid_hour()))
keep = false;
// Check valid hour
else if(conf_info.ValidHour.n() > 0 &&
!conf_info.ValidHour.has(line->valid_hour())) {
cs << "valid_hour " << line->valid_hour();
keep = false;
}

// Check lead time
else if(conf_info.LeadTime.n() > 0 &&
!conf_info.LeadTime.has(line->lead()))
!conf_info.LeadTime.has(line->lead())){
cs << "lead_time " << sec_to_hhmmss(line->lead());
keep = false;
}

if(!keep) {
mlog << Debug(4) << "Skipping track line for " << cs << ":\n"
<< line->get_line() << "\n";
}

// Return the keep status
return(keep);
Expand Down
2 changes: 1 addition & 1 deletion met/src/tools/tc_utils/tc_rmw/tc_rmw_conf_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ void TCRMWConfInfo::process_config(GrdFileType ftype) {
// Conf: lead
sa = Conf.lookup_string_array(conf_key_lead);
for(i=0; i<sa.n(); i++) {
LeadTime.add(timestring_to_sec(sa[i].c_str()));
LeadTime.add(timestring_to_sec(sa[i].c_str()));
}

// Conf: n_range
Expand Down

0 comments on commit 147d8ef

Please sign in to comment.