MetOffice / MetOffice/cube_helper

Address numpy deprecations

Open
#48 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
3
Forks
4
PR merge metrics
No merged PRs in 30d

Description

Running `pytest -vv` gives the following summary of warnings, which it would be good to address:

```
~/conda/envs/iris3/lib/python3.7/site-packages/iris/fileformats/_ff.py:819
~/conda/envs/iris3/lib/python3.7/site-packages/iris/fileformats/_ff.py:819: DeprecationWarning: `np.float` is a deprecated alias for the builtin `float`. To silence this warning, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
def _parse_binary_stream(file_like, dtype=np.float, count=-1):

~/conda/envs/iris3/lib/python3.7/site-packages/pyke/knowledge_engine.py:28
~/conda/envs/iris3/lib/python3.7/site-packages/pyke/knowledge_engine.py:28: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp

tests/test_cube_equaliser.py: 105 warnings
tests/test_cube_help.py: 243 warnings
tests/test_cube_loader.py: 79 warnings
~/conda/envs/iris3/lib/python3.7/site-packages/iris/fileformats/netcdf.py:439: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
var = variable[keys]

tests/test_cube_equaliser.py: 72 warnings
tests/test_cube_help.py: 180 warnings
tests/test_cube_loader.py: 66 warnings
~/conda/envs/iris3/lib/python3.7/site-packages/iris/fileformats/cf.py:186: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
return self.cf_data.__getitem__(key)

```

Contributor guide

Open the contributing guide

Research direction

Start by running `pytest -vv` and compare the warning summary with the locations reported in `iris/fileformats/_ff.py`, `iris/fileformats/netcdf.py`, `iris/fileformats/cf.py`, and `pyke/knowledge_engine.py`. Determine which warnings are addressed within the project and verify that the listed NumPy and import deprecation warnings no longer appear in the test output.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python
Domain
data, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.