Skip to content

Resolve numpy deprecation: using matrix subclass instead of recommended ndarray #5532

Description

@ESadek-MO

📰 Custom Issue

Written up from #5465.

Found within a couple tests. The tests seem to exist only to test a soon to be deprecated behaviour, so might just result in deleting the tests.
Relevant warnings below.

lib/iris/tests/unit/cube/test_Cube.py:78: PendingDeprecationWarning: the matrix subclass is not the recommended way to represent matrices or deal with linear algebra (see https://docs.scipy.org/doc/numpy/user/numpy-for-matlab-users.html). Please adjust your code to use regular ndarray.
    data = np.matrix([[1, 2, 3], [4, 5, 6]])

lib/iris/tests/unit/data_manager/test_DataManager.py::Test_data__setter::test_coerce_to_ndarray
lib/iris/tests/unit/data_manager/test_DataManager.py:463: PendingDeprecationWarning: the matrix subclass is not the recommended way to represent matrices or deal with linear algebra (see https://docs.scipy.org/doc/numpy/user/numpy-for-matlab-users.html). Please adjust your code to use regular ndarray.
    matrix = np.matrix(real_array)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions