-
Notifications
You must be signed in to change notification settings - Fork 26
Bugfix #3164 develop slice range #3183
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
Conversation
* #3164 Fix the SonarQUbe findings * #3164 Corrected const declarations * #3164 Corrected const declarations * #3164 Fixes for SonarQube findings * #3164 Fixes for SonarQube findings * #3164 Fixes for SonarQube findings * #3164 Fixes for SonarQube findings: const --------- Co-authored-by: Howard Soh <hsoh@seneca.rap.ucar.edu>
…o bugfix_3164_slice_range
* #3164 Fix the SonarQUbe findings * #3164 Corrected const declarations * #3164 Corrected const declarations * #3164 Fixes for SonarQube findings * #3164 Fixes for SonarQube findings * #3164 Fixes for SonarQube findings * #3164 Fixes for SonarQube findings: const * Renamed error_code_bad_offset to error_code_out_of_index --------- Co-authored-by: Howard Soh <hsoh@seneca.rap.ucar.edu>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that I did propose a few minor edits for consistent formatting.
I tested in seneca /d1/projects/MET/MET_pull_requests/met-12.2.0/rc1/MET-bugfix_3164_slice_range
. With plot_data_plane
and I found slightly inconsistent behavior for handling bad inputs:
cd /d1/projects/MET/MET_pull_requests/met-12.2.0/rc1/MET-bugfix_3164_slice_range
# Bad time request results in a library ERROR
bin/plot_data_plane $MET_TEST_INPUT/model_data/nccf/gtg/latlon/gtg_obs_forecast.20130730.i00.f00.nc plot.ps 'name="edr"; level="(@20130731,@380,*,*)";'
ERROR : MetNcCFDataFile::find_time_offset() -> the requested time 20130731_000000 for "edr" variable does not exist (20130730_000000 and 20130730_000000).
# Bad level request results in a library WARNING
bin/plot_data_plane $MET_TEST_INPUT/model_data/nccf/gtg/latlon/gtg_obs_forecast.20130730.i00.f00.nc plot.ps 'name="edr"; level="(@20130730,@380,*,*)";'
WARNING: MetNcCFDataFile::find_z_offset() -> the requested vlevel 380 for "edr" variable does not exist (20000 and 45000).
Should these both be warnings? Or both be errors?
I also note:
- No differences are flagged by GHA.
- SonarQube code smells are reduced by this PR by 32 (from 15,617 to 15,585).
- Existing unit tests are modified to demonstrate that replacing the time index with
YYYYMMDD_HH
notation OR@YYYYMMDD_HH
notation produces the same result. - Manually ran a few tests to confirm that it behaves as expected with good inputs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate
It's an error and will be stopped.
It should be an error and be stopped in order to avoid to read a NetCDF variable with bad offset. It's fixed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I approve of these changes.
Thanks for updating the logic to consistently error our for bad vertical level or timestring values. I confirmed that both cases error out as expected:
ERROR : MetNcCFDataFile::find_time_offset() -> the requested time 20130731_000000 for "edr" variable does not exist (20130730_000000 and 20130730_000000).
...
ERROR : MetNcCFDataFile::find_z_offset() -> the requested vlevel 380 for "edr" variable does not exist (20000 and 45000).
Expected Differences
The main change is including upper bound for the range of indexes (0:10 ==> include 11 levels instead of 10 levels) to make the same behavior with GRIB.
Support two @ notations at time and vlevel
Other bug fixes with @Notation and range of offsets
Allow vertical level range for the plot_data_plane. It will give a log message which level was selected
Do these changes introduce new tools, command line arguments, or configuration file options? [No]
If yes, please describe:
Do these changes modify the structure of existing or add new output data types (e.g. statistic line types or NetCDF variables)? [No]
If yes, please describe:
Pull Request Testing
Describe testing already performed for these changes:
Modified plot_data_plane unitest (offset 0 to time string).
Modified
plot_data_plane_NCCF_latlon_by_value
with two @ notations:name = "edr"; level = "(@20130730_00,@20000,*,*)";'
./grid_stat wrfprs_ruc13_03.tm00_G212 wrfprs_ruc13_03.tm00_G212 GridStatConfig.test -outdir out -v 10
note: GridStatConfig.test was from /d1/projects/METplus/discussions/2970/GridStatConfig.
Other data and configuration files were from /d1/projects/METplus/discussions/2970
field = [ { name = "u"; level = "(0:10,0,*,*)"; } ];
==> to test inclusive rangefield = [ { name = "u"; level = "(0:21,0,*,*)"; } ];
==> upper bound of time is beyond time dimensionfield = [ { name = "u"; level = "(0,0-50,*,*)"; } ];
field = [ { name = "u"; level = "(0:5,@500,*,*)"; } ];
field = [ { name = "u"; level = "(@19850714:19850813,@500,*,*)"; } ];
field = [ { name = "u"; level = "(@19850115,@400-800,*,*)"; } ];
field = [ { name = "u"; level = "(@19850115,@400-@800,*,*)"; } ];
Range of vertical levels for plot_data_plane:
Recommend testing for the reviewer(s) to perform, including the location of input datasets, and any additional instructions:
Do these changes include sufficient documentation updates, ensuring that no errors or warnings exist in the build of the documentation? [No]
Do these changes include sufficient testing updates? [No]
Will this PR result in changes to the MET test suite? [No]
If yes, describe the new output and/or changes to the existing output:
Will this PR result in changes to existing METplus Use Cases? [Yes or No]
If yes, create a new Update Truth METplus issue to describe them.
Do these changes introduce new SonarQube findings? [No]
If yes, please describe:
Please complete this pull request review by [Fill in date].
Pull Request Checklist
See the METplus Workflow for details.
Select: Reviewer(s) and Development issue
Select: Milestone as the version that will include these changes
Select: METplus-X.Y Support project for bugfix releases or MET-X.Y Development project for the next coordinated release