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 250 test event equalize #255

Merged
merged 6 commits into from Jan 12, 2023
Merged

Conversation

bikegeek
Copy link
Collaborator

Pull Request Testing

  • Describe testing already performed for these changes:

Create a python 3.8 conda environment with these NCO metcalcpy minimal requirements:

MetPy==1.3.1
netcdf4==1.6.2 <- NOTE: this wasn't installed on 'acorn', this needs to be included
numpy==1.22.0
pandas==1.5.1
pip==22.2.2
pytest==6.2.2
python-dateutil==2.8.2
PyYAML==5.4.1
scipy==1.8.1
xarray==2022.3.0

Run tests using this script (to run only the 'basic' tests that don't use image comparison 3rd party packages):

run_basics.sh.txt

  1. Copy the script to the METcalcpy/test/ directory
  2. Remove the .txt extension
  3. chmod 777 run_basics.sh
  4. from the METcalcpy/test directory, run sh ./run_basics.sh

Verified that the specified tests passed (some tests are skipped in test_agg_stats_and_boots.py because they take a very long time to run) .

NOTE test_scorecard.py tests will fail because there is another Github issue #251 for addressing the SettingWithCopyWarning category (that has been removed from pandas versions that are >1.3.x).

  • Recommend testing for the reviewer(s) to perform, including the location of input datasets, and any additional instructions:

Follow the steps above on 'acorn' and verify same results.

  • Do these changes include sufficient documentation updates, ensuring that no errors or warnings exist in the build of the documentation? [NA]

  • Do these changes include sufficient testing updates? [Yes ]

  • Will this PR result in changes to the test suite? [No ]

    If yes, describe the new output and/or changes to the existing output:

  • Please complete this pull request review by [Before bugfix release ].

Pull Request Checklist

See the METplus Workflow for details.

  • Review the source issue metadata (required labels, projects, and milestone).
  • Complete the PR definition above.
  • Ensure the PR title matches the feature or bugfix branch name.
  • Define the PR metadata, as permissions allow.
    Select: Reviewer(s)
    Select: Organization level software support Project or Repository level development cycle Project
    Select: Milestone as the version that will include these changes
  • After submitting the PR, select Development issue with the original issue number.
  • After the PR is approved, merge your changes. If permissions do not allow this, request that the reviewer do the merge.
  • Close the linked issue and delete your feature or bugfix branch from GitHub.

@bikegeek bikegeek added priority: high High Priority requestor: NOAA/other NOAA Laboratory, not otherwise specified component: testing Software testing issue requestor: METplus Team METplus Development Team labels Jan 11, 2023
@bikegeek bikegeek added this to the METcalcpy 2.0.0-bugfix milestone Jan 11, 2023
Copy link
Collaborator

@jprestop jprestop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @bikegeek. Unfortunately, when I checkout and run run_basic.sh on Acorn I get one failed test (test_lon_from_360_to_180) due to "AttributeError: module 'numpy' has no attribute 'float'". Do you know what might be going wrong?

================================================================================== FAILURES ===================================================================================
__________________________________________________________________________ test_lon_from_360_to_180 ___________________________________________________________________________

    def test_lon_from_360_to_180():
    
        # Verify that longitude type is maintained, ie an int isn't converted to
        # a float when converting coord values.
        i_lon = [i_lon for i_lon in range (0, 359)]
        np_lon = np.linspace(0, 359, 360)
    
        i_west_east = utils.convert_lon_360_to_180(i_lon)
        np_west_east = utils.convert_lon_360_to_180(np_lon)
    
    
        assert isinstance(i_west_east[0], np.int64)
>       assert isinstance(np_west_east[0], np.float)

test_lon_360_to_180.py:17: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

attr = 'float'

    def __getattr__(attr):
        # Warn for expired attributes, and return a dummy function
        # that always raises an exception.
        import warnings
        try:
            msg = __expired_functions__[attr]
        except KeyError:
            pass
        else:
            warnings.warn(msg, DeprecationWarning, stacklevel=2)
    
            def _expired(*args, **kwds):
                raise RuntimeError(msg)
    
            return _expired
    
        # Emit warnings for deprecated attributes
        try:
            val, msg = __deprecated_attrs__[attr]
        except KeyError:
            pass
        else:
            warnings.warn(msg, DeprecationWarning, stacklevel=2)
            return val
    
        if attr in __future_scalars__:
            # And future warnings for those that will change, but also give
            # the AttributeError
            warnings.warn(
                f"In the future `np.{attr}` will be defined as the "
                "corresponding NumPy scalar.  (This may have returned Python "
                "scalars in past versions.", FutureWarning, stacklevel=2)
    
        # Importing Tester requires importing all of UnitTest which is not a
        # cheap import Since it is mainly used in test suits, we lazy import it
        # here to save on the order of 10 ms of import time for most users
        #
        # The previous way Tester was imported also had a side effect of adding
        # the full `numpy.testing` namespace
        if attr == 'testing':
            import numpy.testing as testing
            return testing
        elif attr == 'Tester':
            from .testing import Tester
            return Tester
    
>       raise AttributeError("module {!r} has no attribute "
                             "{!r}".format(__name__, attr))
E       AttributeError: module 'numpy' has no attribute 'float'

/u/julie.prestopnik/.local/lib/python3.8/site-packages/numpy/__init__.py:284: AttributeError
=========================================================================== short test summary info ===========================================================================
FAILED test_lon_360_to_180.py::test_lon_from_360_to_180 - AttributeError: module 'numpy' has no attribute 'float'
============================================================================== 1 failed in 0.99s ==============================================================================

@bikegeek bikegeek changed the base branch from main_v2.0 to develop January 12, 2023 00:01
@bikegeek bikegeek changed the base branch from develop to main_v2.0 January 12, 2023 00:01
* Remove Python 3.8.6 and 3.8.12 and use Python 3.8 instead.  The latest version of ubuntu no longer has python 3.8.6 available.

* Update unit_tests.yml

replace 3.8.6 and 3.8.12 with 3.8 for Python because latest version of ubuntu does not have support for python 3.8.6

* Issue #250 fix the test_equalize_axis_data_no_fcst_var fixture

* Added ending asterisks for end bold to fix these warnings: WARNING: Inline strong start-string without end-string.

* #251 allow test to run check on numpy types regardless of numpy version

Co-authored-by: Julie Prestopnik <jpresto@ucar.edu>
@jprestop jprestop mentioned this pull request Jan 12, 2023
13 tasks
Copy link
Collaborator

@jprestop jprestop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am happy to report that the test no longer fails. Thank you! I approve this request.

@bikegeek bikegeek merged commit 0bcceb1 into main_v2.0 Jan 12, 2023
@bikegeek bikegeek deleted the bugfix_250_test_event_equalize branch January 12, 2023 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: testing Software testing issue priority: high High Priority requestor: METplus Team METplus Development Team requestor: NOAA/other NOAA Laboratory, not otherwise specified
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants