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

Bugfix- agg_stat_bootstrap.py missing initialization of stat_vals list in _calc_stats.py #420

Open
2 of 24 tasks
bikegeek opened this issue Jan 6, 2025 · 0 comments · Fixed by #426
Open
2 of 24 tasks
Assignees
Labels
reporting: DTC NCAR Base NCAR Base DTC Project type: bug Fix something that is not working

Comments

@bikegeek
Copy link
Collaborator

bikegeek commented Jan 6, 2025

Replace italics below with details for this issue.

While adding error handling and logging for AF Cybersecurity, the _calc_stats.py code was slightly refactored but the stat_vals list was not initialized.

Expected Behavior

METviewer will generate an error that indicates that the stat_vals local variable is referenced before it is initialized.

Environment

Describe your runtime environment:
1. Machine: (e.g. HPC name, Linux Workstation, Mac Laptop)
2. OS: (e.g. RedHat Linux, MacOS)
3. Software version number(s)

To Reproduce

Describe the steps to reproduce the behavior:

From Command line:

use the following data and yaml config files (remove the .txt extension from files)
input.data.txt

input.yaml.txt

from METcalcpy main_v3.0 run from the command line:

Expect the following error:
UnboundLocalError: local variable 'stat_values' referenced before assignment

Post relevant sample data following these instructions:
https://dtcenter.org/community-code/model-evaluation-tools-met/met-help-desk#ftp

Relevant Deadlines

List relevant project deadlines here or state NONE.

Funding Source

2702701 NCAR Base

Define the Metadata

Assignee

  • Select engineer(s) Minna Win
  • Select scientist(s) Michelle Harrold

Labels

  • Review default alert labels
  • Select component(s)
  • Select priority
  • Select requestor(s)

Milestone and Projects

  • Select Milestone as the next bugfix version
  • Select Coordinated METplus-X.Y Support project for support of the current coordinated release
  • Select METcalcpy-X.Y.Z Development project for development toward the next official release

Define Related Issue(s)

Consider the impact to the other METplus components.

Bugfix Checklist

See the METplus Workflow for details.

  • Complete the issue definition above, including the Time Estimate and Funding Source.
  • Fork this repository or create a branch of main_<Version>.
    Branch name: bugfix_<Issue Number>_main_<Version>_<Description>
  • Fix the bug and test your changes.
  • Add/update log messages for easier debugging.
  • Add/update unit tests.
  • Add/update documentation.
  • Add any new Python packages to the METplus Components Python Requirements table.
  • Push local changes to GitHub.
  • Submit a pull request to merge into main_<Version>.
    Pull request: bugfix <Issue Number> main_<Version> <Description>
  • Define the pull request metadata, as permissions allow.
    Select: Reviewer(s) and Development issue
    Select: Milestone as the next bugfix version
    Select: Coordinated METplus-X.Y Support project for support of the current coordinated release
  • Iterate until the reviewer(s) accept and merge your changes.
  • Delete your fork or branch.
  • Complete the steps above to fix the bug on the develop branch.
    Branch name: bugfix_<Issue Number>_develop_<Description>
    Pull request: bugfix <Issue Number> develop <Description>
    Select: Reviewer(s) and Development issue
    Select: Milestone as the next official version
    Select: METcalcpy-X.Y.Z Development project for development toward the next official release
  • Close this issue.
@bikegeek bikegeek added type: bug Fix something that is not working alert: NEED ACCOUNT KEY Need to assign an account key to this issue alert: NEED MORE DEFINITION Not yet actionable, additional definition required alert: NEED CYCLE ASSIGNMENT Need to assign to a release development cycle labels Jan 6, 2025
@bikegeek bikegeek modified the milestone: METcalcpy-3.1.0 Jan 6, 2025
@github-project-automation github-project-automation bot moved this to 🩺 Needs Triage in METplus-6.1.0 Development Jan 28, 2025
@michelleharrold michelleharrold added reporting: DTC NCAR Base NCAR Base DTC Project and removed alert: NEED ACCOUNT KEY Need to assign an account key to this issue alert: NEED MORE DEFINITION Not yet actionable, additional definition required alert: NEED CYCLE ASSIGNMENT Need to assign to a release development cycle labels Jan 30, 2025
@michelleharrold michelleharrold moved this from 🩺 Needs Triage to 🟢 Ready in METplus-6.1.0 Development Jan 30, 2025
@bikegeek bikegeek moved this from 🟢 Ready to 🏗 In progress in METplus-6.1.0 Development Jan 30, 2025
@bikegeek bikegeek added this to the METcalcpy-3.1.0 milestone Feb 4, 2025
@bikegeek bikegeek linked a pull request Feb 25, 2025 that will close this issue
15 tasks
@bikegeek bikegeek moved this from 🏗 In progress to 🔎 In review in METplus-6.1.0 Development Feb 25, 2025
bikegeek added a commit that referenced this issue Mar 7, 2025
* Per dtcenter/METplus#2336, call custom GHA to trigger METplus use case tests when changes are pushed to main_vX.Y and develop branches

* added missing import (#413)

* Adding In Memoriam

* Feature 418 v3.0.0 (#419)

* Combined beta release sections under one section

* Updated version, date, author rotation

* Added 'None' to update instructions

* Update release-notes.rst

changing date to 18th since GHA are very slow and unlikely to get release done by today

* Update conf.py

changing date from 17th to 18th, unlikely release will get finished today due to slow GHAs

* Update vulnerabilities.yaml

update version to 1.1.0

* Apply suggestions from code review

Co-authored-by: Julie Prestopnik <[email protected]>

---------

Co-authored-by: Julie Prestopnik <[email protected]>

* Removing.  Superfluous since Github does this check

* Update agg_stat_bootstrap.py

replace safe.logger with safe_log.logger, to match import

* Update agg_stat_bootstrap.py

fix safe_log.logger to safe_log()

* initialize stat_values list

* return an empty stat_values list in the else

* fix append to append stat_value, not a list of stat_value

* move initialization of stat_values list to inside 'if'

* agg stat bootstrap results from R

* config file for testing agg_stat_bootstrap

* Input data generated by METviewer after SQL query.  This matches the input data used by METviewer for calculating the aggregation bootstrap statistics.

* Aggregated bootstrap stats calculated by METcalcpy

* Initial work on adding tests for agg_stat_bootstrap for bugfix #420

* Delete test/data/mode/rscript_data/mv_rscript_agg_stat_bootstrap.txt

not the correct data file

* Delete test/data/mode/rscript_data/mv_mode_input_aggregated_python.data

file does not belong here

* replacing missing content

* Fixed import

* Aggregation statistics calculated via R script in METviewer

* Input data used by both R and Python implementations to calculate aggregation bootstrap statistics

* Config file used by Python implementation of agg_stat_bootstrap.py

* Modified cleaning up of temporary files, fixed format of comments

* Forgot to clean up temp file after second test

* Fixed appending to stat_values, should append stat_value and NOT a list

* cleanup was occurring too early, moved outside of testing section

* Add back original testing content from John Sharples

* fix input data file path

* use cwd to correctly set path for data (especially for GHA)

* remove unused/unneeded files

---------

Co-authored-by: George McCabe <[email protected]>
Co-authored-by: Julie Prestopnik <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
reporting: DTC NCAR Base NCAR Base DTC Project type: bug Fix something that is not working
Projects
Status: 🔎 In review
Development

Successfully merging a pull request may close this issue.

2 participants