Describe the Enhancement
This issue is the result of @CPKalb observing significantly different performance for Ensemble-Stat when run with observation error logic enabled and disabled. A single call to Ensemble-Stat for 20 HAFS ensemble members with observation error logic disabled takes around 1 minute to run, but multiple hours with it enabled. This issue is to revisit and refine the implementation to make it more efficient.
Please find the example test case in seneca:/d1/projects/METplus/discussions/kalb_20260820/example.
Note that this compares a 20 member ensemble to GRIDDED CCPA analysis data for 6-hourly accumulated precipitation. Big picture, applying observation error to a CCPA analysis may not be necessary, but it provides a reasonable test case for the software.
Recommend making the following changes:
- Enhance
add_obs_error_bc() and add_obs_error_inc() by checking the observation error table to see if bias-correction and perturbation is indicated for the requested variable name (var_name). The default table applies no corrections to APCP_ data. It'd be faster to determine that before looping through all the grid points. Add functions like bool ObsErrorEntry::need_bc(), bool ObsErrorEntry::need_inc(), bool ObsErrorTable::need_bc(var_name), and bool ObsErrorTable::need_inc(var_name) to prevent unnecessary looping.
- Remove
const gsl_rng *r as an argument for add_obs_error_bc() functions since it's unused.
- Add OpenMP parallelization in
obs_error.cc. Note however that a separate random number generator is needed for each thread.
- In
obs_error.cc, replace calls to DataPlane::get() which waste time performing range checking each time with more efficient, direct looping over the points.
- Reconsider the call to
obs_error_table.lookup(). When applying to gridded data, we could subset to table to only those rows that could possibly match (e.g. add ObsErrorTable ObsErrorTable::subset(var_name)). And rather than always looking up at the first row of the table, consider starting at the row most recently matched.
- After meeting with @mpm-meto, recommend that we improve the log messages in
obs_error.cc to handle the case when an obs error table lookup finds no matching entry. This does result in a warning message from ObsErrorTable::lookup() but we should also update add_obs_error_bc() and add_obs_error_inc() to print consistent DEBUG(4) log messages similar to:
DEBUG 4: Applying no observation error bias correction to OBS value 4.32 since no table match found.
And
DEBUG 4: Applying no observation error update for FCST value 2.57 and OBS value 0 since no table match found.
Time Estimate
Estimate the amount of work required here.
Issues should represent approximately 1 to 3 days of work.
Sub-Issues
Consider breaking the enhancement down into sub-issues.
Relevant Deadlines
List relevant project deadlines here or state NONE.
Funding Source
PRJ014254 NOAA BENCHMARKING TNE
Define the Metadata
Assignee
Labels
Milestone and Projects
Define Related Issue(s)
Consider the impact to the other METplus components.
Enhancement Checklist
See the METplus Workflow for details.
Describe the Enhancement
This issue is the result of @CPKalb observing significantly different performance for Ensemble-Stat when run with observation error logic enabled and disabled. A single call to Ensemble-Stat for 20 HAFS ensemble members with observation error logic disabled takes around 1 minute to run, but multiple hours with it enabled. This issue is to revisit and refine the implementation to make it more efficient.
Please find the example test case in
seneca:/d1/projects/METplus/discussions/kalb_20260820/example.Note that this compares a 20 member ensemble to GRIDDED CCPA analysis data for 6-hourly accumulated precipitation. Big picture, applying observation error to a CCPA analysis may not be necessary, but it provides a reasonable test case for the software.
Recommend making the following changes:
add_obs_error_bc()andadd_obs_error_inc()by checking the observation error table to see if bias-correction and perturbation is indicated for the requested variable name (var_name). The default table applies no corrections toAPCP_data. It'd be faster to determine that before looping through all the grid points. Add functions likebool ObsErrorEntry::need_bc(),bool ObsErrorEntry::need_inc(),bool ObsErrorTable::need_bc(var_name), andbool ObsErrorTable::need_inc(var_name)to prevent unnecessary looping.const gsl_rng *ras an argument foradd_obs_error_bc()functions since it's unused.obs_error.cc. Note however that a separate random number generator is needed for each thread.obs_error.cc, replace calls toDataPlane::get()which waste time performing range checking each time with more efficient, direct looping over the points.obs_error_table.lookup(). When applying to gridded data, we could subset to table to only those rows that could possibly match (e.g. addObsErrorTable ObsErrorTable::subset(var_name)). And rather than always looking up at the first row of the table, consider starting at the row most recently matched.obs_error.ccto handle the case when an obs error table lookup finds no matching entry. This does result in a warning message fromObsErrorTable::lookup()but we should also update add_obs_error_bc() and add_obs_error_inc() to print consistent DEBUG(4) log messages similar to:And
Time Estimate
Estimate the amount of work required here.
Issues should represent approximately 1 to 3 days of work.
Sub-Issues
Consider breaking the enhancement down into sub-issues.
Relevant Deadlines
List relevant project deadlines here or state NONE.
Funding Source
PRJ014254 NOAA BENCHMARKING TNE
Define the Metadata
Assignee
Labels
Milestone and Projects
Define Related Issue(s)
Consider the impact to the other METplus components.
None
Enhancement Checklist
See the METplus Workflow for details.
Branch name:
feature_<Issue Number>_<Description>Pull request:
feature <Issue Number> <Description>Select: Reviewer(s) and Development issue
Select: Milestone as the next official version
Select: MET-X.Y Development project for development toward the next coordinated release