From 45958b7895d99e84f69373ba62c4b86a86e6eb07 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 17 Apr 2024 16:28:46 -0600 Subject: [PATCH] Update develop-ref after dtcenter/MET#2861 (#2863) * 2673 Moved dvariable declaration after include * #2673 Move down namespace below include * Feature #2395 wdir (#2820) * Per #2395, add new columns to VL1L2, VAL1L2, and VCNT line types for wind direction statistics. Work still in progress. * Per #2395, write the new VCNT columns to the output and document the additions to the VL1L2, VAL1L2, and VCNT columns. * Per #2395, add the definition of new statistics to Appendix G. * Per #2395, update file version history. * Per #2395, tweak warning message about zero wind vectors and update grid-stat and point-stat to log calls to the do_vl1l2() function. * Per #2395, refine the weights for wind direction stats, ignoring the undefined directions. * Update src/tools/core/stat_analysis/aggr_stat_line.cc * Update src/tools/core/stat_analysis/parse_stat_line.cc * Update src/tools/core/stat_analysis/aggr_stat_line.cc * Recent changes to branch protection rules for the develop branch have broken the logic of the update_truth.yml GHA workflow. Instead of submitting a PR to merge develop into develop-ref directly, use an intermediate update_truth_for_develop branch. * Feature #2280 ens_prob (#2823) * Per #2280, update to support probability threshold strings like ==8, where 8 is the number of ensemble members, to create probability bins centered on the n/8 for n = 0 ... 8. * Per #2280, update docs about probability threshold settings. * Per #2280, use a loose tolerance when checking for consistent bin widths. * Per #2280, add a new unit test for grid_stat to demonstrate processing the output from gen_ens_prod. * Per #2280, when verifying NMEP probability forecasts, smooth the obs data first. * Per #2280, only request STAT output for the PCT line type to match unit_grid_stat.xml and minimize the new output files. * Per #2280, update config option docs. * Per #2280, update config option docs. * #2673 Change 0 to nullptr * #2673 Change 0 to nullptr * #2673 Change 0 to nullptr * #2673 Change 0 to nullptr * #2673 Change 0 to nullptr * #2673 Removed the redundant parentheses with return * #2673 Removed the redundant parentheses with return * #2673 Removed the redundant parentheses with return * #2673 Removed the redundant parentheses with return * #2673 Removed the redundant parentheses with return * #2673 restored return statement * #2673 Added std namespace * #2673 Moved down 'using namespace' statement. Removed trailing spaces * #2673 Moved down 'using namespace' statement. * #2673 Moved down 'using namespace' statement. * #2673 Moved down 'using namespace' statement. * #2673 Moved down 'using namespace' statement. * #2673 Added std namespace * #2673 Added std namespace * #2673 Added std namespace * #2673 Changed literal 1 to boolean value, true * Feature #2673 enum_to_string (#2835) * Feature #2583 ecnt (#2825) * Unrelated to #2583, fix typo in code comments. * Per #2583, add hooks write 3 new ECNT columns for observation error data. * Per #2583, make error messages about mis-matched array lengths more informative. * Per #2583, switch to more concise variable naming conventions of ign_oerr_cnv, ign_oerr_cor, and dawid_seb. * Per #2583, fix typo to enable compilation * Per #2583, define the 5 new ECNT column names. * Per #2583, add 5 new columns to the ECNT table in the Ensemble-Stat chapter * Per #2583, update stat_columns.cc to write these 5 new ECNT columns * Per #2583, update ECNTInfo class to compute the 5 new ECNT statistics. * Per #2583, update stat-analysis to parse the 5 new ECNT columns. * Per #2583, update aggregate_stat logic for 5 new ECNT columns. * Per #2583, update PairDataEnsemble logic for 5 new ECNT columns * Per #2583, update vx_statistics library with obs_error handling logic for the 5 new ECNT columns * Per #2583, changes to make it compile * Per #2583, changes to make it compile * Per #2583, switch to a consistent ECNT column naming convention with OERR at the end. Using IGN_CONV_OERR and IGN_CORR_OERR. * Per #2583, define ObsErrorEntry::variance() with a call to the dist_var() utility function. * Per #2583, update PairDataEnsemble::compute_pair_vals() to compute the 5 new stats with the correct inputs. * Per #2583, add DEBUG(10) log messages about computing these new stats. * Per #2583, update Stat-Analysis to compute these 5 new stats from the ORANK line type. * Per #2583, whitespace and comments. * Per #2583, update the User's Guide. * Per #2583, remove the DS_ADD_OERR and DS_MULT_OERR ECNT columns and rename DS_OERR as DSS, since observation error is not actually involved in its computation. * Per #2583, minor update to Appendix C * Per #2583, rename ECNT line type statistic DSS to IDSS. * Per #2583, fix a couple of typos * Per #2583, more error checking. * Per #2583, remove the ECNT IDSS column since its just 2*pi*IGN, the existing ignorance score, and only provides meaningful information when combined with the other Dawid-Sebastiani statistics that have already been removed. * Per #2583, add Eric's documentation of these new stats to Appendix C. Along the way, update the DOI links in the references based on this APA style guide: https://apastyle.apa.org/style-grammar-guidelines/references/dois-urls#:~:text=Include%20a%20DOI%20for%20all,URL%2C%20include%20only%20the%20DOI. * Per #2583, fix new equations with embedded underscores for PDF by defining both html and pdf formatting options. * Per #2583, update the ign_conv_oerr equation to include a 2 *pi multiplier for consistency with the existing ignorance score. Also, fix the documented equations. * Per #2583, remove log file that was inadvertently added on this branch. * Per #2583, simplify ObsErrorEntry::variance() implementation. For the distribution type of NONE, return a variance of 0.0 rather than bad data, as discussed with @michelleharrold and @JeffBeck-NOAA on 3/8/2024. --------- Co-authored-by: MET Tools Test Account * Revert #2825 since more documentation and testing is needed (#2837) This reverts commit 108a8958b206d6712197823a083666ab039bf818. * Feature #2583 ecnt fix IGN_OERR_CORR (#2838) * Unrelated to #2583, fix typo in code comments. * Per #2583, add hooks write 3 new ECNT columns for observation error data. * Per #2583, make error messages about mis-matched array lengths more informative. * Per #2583, switch to more concise variable naming conventions of ign_oerr_cnv, ign_oerr_cor, and dawid_seb. * Per #2583, fix typo to enable compilation * Per #2583, define the 5 new ECNT column names. * Per #2583, add 5 new columns to the ECNT table in the Ensemble-Stat chapter * Per #2583, update stat_columns.cc to write these 5 new ECNT columns * Per #2583, update ECNTInfo class to compute the 5 new ECNT statistics. * Per #2583, update stat-analysis to parse the 5 new ECNT columns. * Per #2583, update aggregate_stat logic for 5 new ECNT columns. * Per #2583, update PairDataEnsemble logic for 5 new ECNT columns * Per #2583, update vx_statistics library with obs_error handling logic for the 5 new ECNT columns * Per #2583, changes to make it compile * Per #2583, changes to make it compile * Per #2583, switch to a consistent ECNT column naming convention with OERR at the end. Using IGN_CONV_OERR and IGN_CORR_OERR. * Per #2583, define ObsErrorEntry::variance() with a call to the dist_var() utility function. * Per #2583, update PairDataEnsemble::compute_pair_vals() to compute the 5 new stats with the correct inputs. * Per #2583, add DEBUG(10) log messages about computing these new stats. * Per #2583, update Stat-Analysis to compute these 5 new stats from the ORANK line type. * Per #2583, whitespace and comments. * Per #2583, update the User's Guide. * Per #2583, remove the DS_ADD_OERR and DS_MULT_OERR ECNT columns and rename DS_OERR as DSS, since observation error is not actually involved in its computation. * Per #2583, minor update to Appendix C * Per #2583, rename ECNT line type statistic DSS to IDSS. * Per #2583, fix a couple of typos * Per #2583, more error checking. * Per #2583, remove the ECNT IDSS column since its just 2*pi*IGN, the existing ignorance score, and only provides meaningful information when combined with the other Dawid-Sebastiani statistics that have already been removed. * Per #2583, add Eric's documentation of these new stats to Appendix C. Along the way, update the DOI links in the references based on this APA style guide: https://apastyle.apa.org/style-grammar-guidelines/references/dois-urls#:~:text=Include%20a%20DOI%20for%20all,URL%2C%20include%20only%20the%20DOI. * Per #2583, fix new equations with embedded underscores for PDF by defining both html and pdf formatting options. * Per #2583, update the ign_conv_oerr equation to include a 2 *pi multiplier for consistency with the existing ignorance score. Also, fix the documented equations. * Per #2583, remove log file that was inadvertently added on this branch. * Per #2583, simplify ObsErrorEntry::variance() implementation. For the distribution type of NONE, return a variance of 0.0 rather than bad data, as discussed with @michelleharrold and @JeffBeck-NOAA on 3/8/2024. * Per #2583, updates to ensemble-stat.rst recommended by @michelleharrold and @JeffBeck-NOAA. * Per #2583, implement changes to the IGN_CORR_OERR corrected as directed by @ericgilleland. --------- Co-authored-by: MET Tools Test Account * Update the pull request template to include a question about expected impacts to existing METplus Use Cases. * #2830 Changed enum Builtin to enum class * #2830 Converted enum to enum class at config_constants.h * Feature #2830 bootstrap enum (#2843) * Bugfix #2833 develop azimuth (#2840) * Per #2833, fix n-1 bug when defining the azimuth delta for range/azimuth grids. * Per #2833, when definng TcrmwData:range_max_km, divide by n_range - 1 since the range values start at 0. * Per #2833, remove max_range_km from the TC-RMW config file. Set the default rmw_scale to NA so that its not used by default. And update the documentation. Still actually need to make the logic of the code work as it should. * Per #2833, update tc_rmw to define the range as either a function of rmw or using explicit spacing in km. * Per #2833, update the TCRMW Config files to remove the max_range_km entry, and update the unit test for one call to use RMW ranges and the other to use ranges defined in kilometers. * Per #2833, just correct code comments. * Per #2833, divide by n - 1 when computing the range delta, rather than n. * Per #2833, correct the handling of the maximum range in the tc-rmw tool. For fixed delta km, need to define the max range when setting up the grid at the beginning. --------- Co-authored-by: MET Tools Test Account * #2830 Changed enum PadSize to enum class * #2830 Removed redundant parantheses * #2830 Removed commenyted out code * #2830 Use auto * #2830 Changed enum to enum class for DistType, InterpMthd, GridTemplates, and NormalizeType * #2830 Moved enum_class_as_integer from header file to cc files * #2830 Added enum_as_int.hpp * #2830 Added enum_as_int.hpp * Deleted enum_class_as_integer and renamed it to enum_class_as_int * Removed redundant paranthese * #2830 Changed enum to enumclass * #2830 Changed enum_class_as_integer to enum_class_as_int * Feature #2379 sonarqube gha (#2847) * Per #2379, testing initial GHA SonarQube setup. * Per #2379, switch to only analyzing the src directory. * Per #2379, move more config logic from sonar-project.properties into the workflow. #ci-skip-all * Per #2379, try removing + symbols * Per #2379, move projectKey into xml workflow and remove sonar-project.properties. * Per #2379, try following the instructions at https://github.com/sonarsource-cfamily-examples/linux-autotools-gh-actions-sq/blob/main/.github/workflows/build.yml ci-skip-all * Per #2379, see details of progress described in this issue comment: https://github.com/dtcenter/MET/issues/2379#issuecomment-2000242425 * Unrelated to #2379, just removing spurious space that gets flagged as a diff when re-running enum_to_string on seneca. * Per #2379, try running SonarQube through GitHub. * Per #2379, remove empty env section and also disable the testing workflow temporarily during sonarqube development. * Per #2379, fix docker image name. * Per #2379, delete unneeded script. * Per #2379, update GHA to scan Python code and push to the correct SonarQube projects. * Per #2379, update GHA SonarQube project names * Per #2379, update the build job name * Per #2379, update the comile step name * Per #2379, switch to consistent SONAR variable names. * Per #2379, fix type in sed expressions. * Per #2379, just rename the log artifact * Per #2379, use time_command wrapper instead of run_command. * Per #2379, fix bad env var name * Per #2379, switch from egrep to grep. * Per #2379, just try cat-ting the logfile * Per #2379, test whether cat-ting the log file actually works. * Per #2379, revert back * Per #2379, mention SonarQube in the PR template. Make workflow name more succinct. * Per #2379, add SONAR_REFERENCE_BRANCH setting to define the sonar.newCode.referenceBranch property. The goal is to define the comparison reference branch for each SonarQube scan. * Per #2379, have the sonarqube.yml job print the reference branch it's using * Per #2379, intentionally introduce a new code smell to see if SonarQube correctly flag it as appearing in new code. * Per #2379, trying adding the SonarQube quality gate check. * Per #2379, add logic for using the report-task.txt output files to check the quality gate status for both the python and cxx scans. * Per #2379 must use unique GHA id's * Per #2379, working on syntax for quality gate checks * Per #2379, try again. * Per #2379, try again * Per #2379, try again * Per #2379, try again * Per #2379, try again * Per #2379, try again * Per #2379, try yet again * Per #2379 * Per #2379, add more debug * Per #2379, remove -it option from docker run commands * Per #2379, again * Per #2379, now that the scan works as expected, remove the intentional SonarQube code smell as well as debug logging. * Hotfix related to #2379. The sonar.newCode.referenceBranch and sonar.branch.name cannot be set to the same string! Only add the newCode definition when they differ. * #2830 Changed enum STATJobType to enum class * #2830 Changed STATLineType to enum class * #2830 Changed Action to enum class * #2830 Changed ModeDataType to enum class * #2830 Changed StepCase to enum class * #2830 Changed enum to enum class * #2830 Changed GenesisPairCategory to enum class * #2830 Removed rediundabt parenrthese * #2830 Reduced same if checking * #2830 Cleanup * #2830 USe empty() instead of lebgth checking * #2830 Adjusted indentations * Feature #2379 develop sonarqube updates (#2850) * Per #2379, move rgb2ctable.py into the python utility scripts directory for better organization and to enable convenient SonarQube scanning. * Per #2379, remove point.py from the vx_python3_utils directory which cleary was inadvertenlty added during development 4 years ago. As far as I can tell it isn't being called by any other code and doesn't belong in the repository. Note that scripts/python/met/point.py has the same name but is entirely different. * Per #2379, update the GHA SonarQube scan to do a single one with Python and C++ combined. The nightly build script is still doing 2 separate scans for now. If this all works well, they could also be combined into a single one. * Per #2379, eliminate MET_CONFIG_OPTIONS from the SonarQube workflow since it doesn't need to be and probably shouldn't be configurable. * Per #2379, trying to copy report-task.txt out of the image * Per #2379, update build_met_sonarqube.sh to check the scan return status * Per #2379, fix bash assignment syntax * Per #2379, remove unused SCRIPT_DIR envvar * Per #2379, switch to a single SonarQube scan for MET's nightly build as well * Feature 2654 ascii2nc polar buoy support (#2846) * Added iabp data type, and modified file_handler to filter based on time range, which was added as a command line option * handle time using input year, hour, min, and doy * cleanup and switch to position day of year for time computations * Added an ascii2nc unit test for iabp data * Added utility scripts to pull iabp data from the web and find files in a time range * Modified iabp_handler to always output a placeholder 'location' observation with value 1 * added description of IABP data python utility scripts * Fixed syntax error * Fixed Another syntax error. * Slight reformat of documentation * Per #2654, update the Makefiles in scripts/python/utility to include all the python scripts that should be installed. * Per #2654, remove unused code from get_iabp_from_web.py that is getting flagged as a bug by SonarQube. * Per #2654, fix typo in docs --------- Co-authored-by: John Halley Gotway Co-authored-by: MET Tools Test Account * Feature #2786 rpss_from_prob (#2861) * Per #2786, small change to a an error message unrelated to this development. * Per #2786, add RPSInfo::set_climo_prob() function to derive the RPS line type from climatology probability bins. And update Ensemble-Stat to call it. * Per #2786, minor change to clarify error log message. * Per #2786, for is_prob = TRUE input, the RPS line type is the only output option. Still need to update docs! * Per #2786, add new call to Ensemble-Stat to test computing RPS from climo probabilities * Per #2786, use name rps_climo_bin_prob to be very explicit. * Per #2786, redefine logic of RPSInfo::set_climo_bin_prob() to match the CPC definition. Note that reliability, resolution, uncertainty, and RPSS based on the sample climatology are all set to bad data. Need to investigate whether they can be computed using these inputs. * Per #2786, remove the requirement that any fcst.prob_cat_thresh thresholds must be defined. If they are defined, pass them through to the FCST_THRESH output column. If not, write NA. Add check to make sure the event occurs in exactly 1 category. * Per #2786, don't enforce fcst.prob_cat_thresh == obs.prob_cat_thresh for probabilistic inputs. And add more is_prob checks so that only the RPS line type can be written when given probabilistic inputs. * updated documentation * Per #2786, call rescale_probability() function to convert from 0-100 probs to 0-1 probs. --------- Co-authored-by: j-opatz --------- Co-authored-by: Howard Soh Co-authored-by: John Halley Gotway Co-authored-by: Howard Soh Co-authored-by: MET Tools Test Account Co-authored-by: davidalbo Co-authored-by: j-opatz Co-authored-by: metplus-bot <97135045+metplus-bot@users.noreply.github.com> --- docs/Users_Guide/ensemble-stat.rst | 34 ++- .../EnsembleStatConfig_rps_climo_bin_prob | 223 ++++++++++++++++++ internal/test_unit/xml/unit_ensemble_stat.xml | 20 ++ src/basic/vx_util/thresh_array.cc | 4 +- src/libcode/vx_statistics/ens_stats.cc | 103 ++++++++ src/libcode/vx_statistics/ens_stats.h | 2 + src/tools/core/ensemble_stat/ensemble_stat.cc | 57 +++-- .../ensemble_stat/ensemble_stat_conf_info.cc | 11 +- 8 files changed, 429 insertions(+), 25 deletions(-) create mode 100644 internal/test_unit/config/EnsembleStatConfig_rps_climo_bin_prob diff --git a/docs/Users_Guide/ensemble-stat.rst b/docs/Users_Guide/ensemble-stat.rst index 9a5574a658..dd221dd1d2 100644 --- a/docs/Users_Guide/ensemble-stat.rst +++ b/docs/Users_Guide/ensemble-stat.rst @@ -63,6 +63,8 @@ When computing the CRPS skill score for (:ref:`Gneiting et al., 2004 + + + + &MET_BIN;/ensemble_stat + + DESC RPS_CLIMO_BIN_PROB + OUTPUT_PREFIX RPS_CLIMO_BIN_PROB + + \ + 1 \ + &DATA_DIR_MODEL;/cpc_climo_prob/gefs-00z_aer-rfcst-cal_tmean_20210101_week2_cats_33-67ptile.nc \ + &CONFIG_DIR;/EnsembleStatConfig_rps_climo_bin_prob \ + -grid_obs &DATA_DIR_MODEL;/cpc_climo_prob/tmean_07d_20210115_cats_33-67ptile.nc \ + -outdir &OUTPUT_DIR;/ensemble_stat -v 1 + + + &OUTPUT_DIR;/ensemble_stat/ensemble_stat_RPS_CLIMO_BIN_PROB_20210101_000000V.stat + + + diff --git a/src/basic/vx_util/thresh_array.cc b/src/basic/vx_util/thresh_array.cc index e315536499..4a0b421ae1 100644 --- a/src/basic/vx_util/thresh_array.cc +++ b/src/basic/vx_util/thresh_array.cc @@ -684,8 +684,8 @@ bool check_prob_thresh(const ThreshArray &ta, bool error_out) { << "select at least 3 thresholds which include the range [0, 1] " << "(current setting: " << ta.get_str() << ").\n" << "Consider using the \"==n\" shorthand notation to specify " - << "probability bins of equal width, for n < 1, or the integer " - << "number of ensemble members, for n > 1.\n\n"; + << "probability bins of equal width for n < 1, or the integer " + << "number of ensemble members for n > 1.\n\n"; exit(1); } else { diff --git a/src/libcode/vx_statistics/ens_stats.cc b/src/libcode/vx_statistics/ens_stats.cc index 782832b79f..6483e68045 100644 --- a/src/libcode/vx_statistics/ens_stats.cc +++ b/src/libcode/vx_statistics/ens_stats.cc @@ -632,6 +632,109 @@ void RPSInfo::set(const PairDataEnsemble &pd) { //////////////////////////////////////////////////////////////////////// +void RPSInfo::set_climo_bin_prob(const PairDataEnsemble &pd, + const ThreshArray &ocat_ta) { + + // Compute RPS directly from the binned probabilities rather + // than with an Nx2 probabilistic contingency table. + + // Store the dimensions + n_pair = pd.n_pair; + n_prob = pd.n_ens; + + // If no forecast thresholds are provided, store a single NA thresh + if(fthresh.n() == 0) fthresh.add(na_str); + + // Check that the number of observation category thresholds + // and bins match + if(ocat_ta.n() != pd.n_ens) { + mlog << Error << "\nRPSInfo::set_climo_bin_prob() -> " + << "the number of climatology probability bins (" + << pd.n_ens << ") must match the number of observation " + << " category thresholds (" << write_css(ocat_ta) + << ") defined by the \"" << conf_key_prob_cat_thresh + << "\" configuration file option.\n\n"; + exit(1); + } + + // Initialize RPS + rps = rpscl = 0.0; + + // Loop over the observations + for(int i_obs=0; i_obs " + << "unexpected sum of binned probabilities (" + << pfcst_sum << " != 1).\n\n"; + } + + // Increment sums for the event + if(ocat_ta[i_bin].check(pd.o_na[i_obs])) { + n_event++; + rps_obs += (1.0 - pfcst_sum)*(1.0 - pfcst_sum); + rpscl_obs += (1.0 - pclim_sum)*(1.0 - pclim_sum); + } + // Increment sums for the non-event + else { + rps_obs += (0.0 - pfcst_sum)*(0.0 - pfcst_sum); + rpscl_obs += (0.0 - pclim_sum)*(0.0 - pclim_sum); + } + + } // end for i_bin + + // Make sure the event occurs in exactly 1 bin + if(n_event != 1) { + mlog << Warning << "\nRPSInfo::set_climo_bin_prob() -> " + << "the observation value (" << pd.o_na[i_obs] + << ") met " << n_event << " of the observation " + << " category thresholds (" << write_css(ocat_ta) + << ") instead of exactly 1!\n\n"; + } + + // Divide by number of bins minus 1 + rps_obs /= (pd.n_ens - 1); + rpscl_obs /= (pd.n_ens - 1); + + // Increment running sums + rps += rps_obs / pd.n_obs ; + rpscl += rpscl_obs / pd.n_obs; + + } // end for i_obs + + // Compute RPSS relative to climatology + rpss = (!is_eq(rpscl, 0.0) ? + 1.0 - (rps / rpscl) : + bad_data_double); + + // Store other RPS statistics as bad data + rpss_smpl = bad_data_double; + rps_rel = bad_data_double; + rps_res = bad_data_double; + rps_unc = bad_data_double; + + return; +} + +//////////////////////////////////////////////////////////////////////// + double RPSInfo::rps_comp() const { return(is_bad_data(rps) ? bad_data_double : 1.0 - rps); } diff --git a/src/libcode/vx_statistics/ens_stats.h b/src/libcode/vx_statistics/ens_stats.h index 69eca9f4e1..1f5adb51b8 100644 --- a/src/libcode/vx_statistics/ens_stats.h +++ b/src/libcode/vx_statistics/ens_stats.h @@ -140,6 +140,8 @@ class RPSInfo { // Compute statistics void set(const PairDataEnsemble &); + void set_climo_bin_prob(const PairDataEnsemble &, + const ThreshArray &); // Compute the complement of the RPS double rps_comp() const; diff --git a/src/tools/core/ensemble_stat/ensemble_stat.cc b/src/tools/core/ensemble_stat/ensemble_stat.cc index f00ca74bfd..0ed6b71597 100644 --- a/src/tools/core/ensemble_stat/ensemble_stat.cc +++ b/src/tools/core/ensemble_stat/ensemble_stat.cc @@ -69,7 +69,9 @@ // 037 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main. // 038 09/06/22 Halley Gotway MET #1908 Remove ensemble processing logic. // 039 09/29/22 Halley Gotway MET #2286 Refine GRIB1 table lookup logic. -// 040 10/03/22 Prestopnik MET #2227 Remove using namespace netCDF from header files +// 040 10/03/22 Prestopnik MET #2227 Remove using namespace netCDF from +// header files +// 041 04/16/24 Halley Gotway MET #2786 Compute RPS from climo bin probs. // //////////////////////////////////////////////////////////////////////// @@ -663,6 +665,9 @@ bool get_data_plane(const char *infile, GrdFileType ftype, dp = met_regrid(dp, mtddf->grid(), grid, info->regrid()); } + // Rescale probabilities from [0, 100] to [0, 1] + if(info->is_prob()) rescale_probability(dp); + // Store the valid time, if not already set if(ens_valid_ut == (unixtime) 0) { ens_valid_ut = dp.valid(); @@ -723,6 +728,13 @@ bool get_data_plane_array(const char *infile, GrdFileType ftype, } } + // Rescale probabilities from [0, 100] to [0, 1] + if(info->is_prob()) { + for(i=0; iget_var_info()->is_prob()) { + rps_info.set_climo_bin_prob(*pd_ptr, vx_opt.ocat_ta); + } + // Compute ensemble RPS statistics from ensemble member values + else { + rps_info.set(*pd_ptr); + } // Write out RPS if(vx_opt.output_flag[i_rps] != STATOutputType::None && @@ -2053,6 +2071,9 @@ void write_txt_files(const EnsembleStatVxOpt &vx_opt, int i, j; PairDataEnsemble pd; + // Check for probabilistic input + bool is_prob = vx_opt.vx_pd.fcst_info->get_var_info()->is_prob(); + // Process each observation filtering threshold for(i=0; iget_var_info()->is_prob() && + fcat_ta.n() != ocat_ta.n()) { mlog << Error << "\nEnsembleStatVxOpt::process_config() -> " - << "The number of forecast (" << fcat_ta.n() - << ") and observation (" << ocat_ta.n() + << "The number of forecast (" << write_css(fcat_ta) + << ") and observation (" << write_css(ocat_ta) << ") probability category thresholds in \"" - << conf_key_prob_cat_thresh << "\" must match.\n\n"; + << conf_key_prob_cat_thresh << "\" must match!\n\n"; exit(1); }