Skip to content

BUG: PartialCorrelationClimateNetwork._calculate_correlation() throws dubious divide-by-zero warning on Windows builds only #235

Description

@fkuehlein

Warning has been showing up since Travis Windows builds were established:

tests/test_generic.py::test_init_str
C:\Users\travis\build\pik-copan\pyunicorn\src\pyunicorn\climate\partial_correlation.py:131: RuntimeWarning: divide by zero encountered in divide

    return - C_inv / norm

tests/test_generic.py::test_init_str

  C:\Users\travis\build\pik-copan\pyunicorn\src\pyunicorn\climate\partial_correlation.py:131: RuntimeWarning: invalid value encountered in divide

    return - C_inv / norm

What test_init_str() does there is basically just

from pyunicorn.climate import ClimateData, PartialCorrelationClimateNetwork

PartialCorrelationClimateNetwork(ClimateData.SmallTestData(), winter_only=False, threshold=.2)

which doesn't produce any warning on my macOS, as there are no zeros or NaNs in the denominator. This might indicate a bug on windows, a test should therefore be added to back up test_init_str() and check whether the method produces correct results on all platforms.

Metadata

Metadata

Assignees

No one assigned

    Labels

    maintenancesomething should be improved or is outdated

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions