Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature 1968 ens_ctrl #1969

Merged
merged 2 commits into from
Nov 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion met/docs/Users_Guide/ensemble-stat.rst
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ Optional arguments for ensemble_stat

6. To override the simple ensemble mean value of the input ensemble members for the ECNT, SSVAR, and ORANK line types, the **-ens_mean file** option specifies an ensemble mean model data file. This option replaces the **-ssvar_mean file** option from earlier versions of MET.

7. The **-ctrl file** option specifies an ensemble control member data file. The control member is included in the computation of the ensemble mean but excluded from the spread.
7. The **-ctrl file** option specifies an ensemble control member data file. The control member is included in the computation of the ensemble mean but excluded from the spread. The control file should not appear in the list of ensemble member files.

8. To filter point observations by time, use **-obs_valid_beg time** in YYYYMMDD[_HH[MMSS]] format to set the beginning of the matching observation time window.

Expand Down
2 changes: 1 addition & 1 deletion met/docs/Users_Guide/gen-ens-prod.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Required arguments gen_ens_prod
Optional arguments for gen_ens_prod
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

4. The **-ctrl file** option specifies the input file for the ensemble control member. Data for this member is included in the computation of the ensemble mean, but excluded from the spread.
4. The **-ctrl file** option specifies the input file for the ensemble control member. Data for this member is included in the computation of the ensemble mean, but excluded from the spread. The control file should not appear in the **-ens** list of ensemble member files.

5. The **-log** file outputs log messages to the specified file.

Expand Down
9 changes: 9 additions & 0 deletions met/src/tools/core/ensemble_stat/ensemble_stat.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
// 031 09/13/21 Seth Linden Changed obs_qty to obs_qty_inc.
// Added code for obs_qty_exc.
// 032 10/07/21 Halley Gotway MET #1905 Add -ctrl option.
// 032 11/15/21 Halley Gotway MET #1968 Ensemble -ctrl error check.
//
////////////////////////////////////////////////////////////////////////

Expand Down Expand Up @@ -295,6 +296,14 @@ void process_command_line(int argc, char **argv) {

// Prepend the control member, if specified
if(ctrl_file.nonempty()) {

if(ens_file_list.has(ctrl_file)) {
mlog << Error << "\nprocess_command_line() -> "
<< "the ensemble control file should not appear in the list "
<< "of ensemble member files:\n" << ctrl_file << "\n\n";
exit(1);
}

ctrl_index = 0;
ens_file_list.insert(ctrl_index, ctrl_file.c_str());
n_ens++;
Expand Down
15 changes: 12 additions & 3 deletions met/src/tools/other/gen_ens_prod/gen_ens_prod.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
//
// Description:
//
// Mod# Date Name Description
// ---- ---- ---- -----------
// 000 09/10/21 Halley Gotway Initial version (MET #1904).
// Mod# Date Name Description
// ---- ---- ---- -----------
// 000 09/10/21 Halley Gotway MET #1904 Initial version.
// 001 11/15/21 Halley Gotway MET #1968 Ensemble -ctrl error check.
//
////////////////////////////////////////////////////////////////////////

Expand Down Expand Up @@ -201,6 +202,14 @@ void process_command_line(int argc, char **argv) {
mlog << Debug(1) << "Ensemble Control: "
<< (ctrl_file.empty() ? "None" : ctrl_file.c_str()) << "\n";

// Check for control in the list of ensemble files
if(ctrl_file.nonempty() && ens_files.has(ctrl_file)) {
mlog << Error << "\nprocess_command_line() -> "
<< "the ensemble control file should not appear in the list "
<< "of ensemble member files:\n" << ctrl_file << "\n\n";
exit(1);
}

// Check for missing non-python ensemble files
for(i=0; i<ens_files.n(); i++) {
if(!file_exists(ens_files[i].c_str()) &&
Expand Down