Skip to content

DeprecationWarning in pp file saving #5492

Description

@acchamber

🐛 Bug Report

When you run the Iris pytest, the following warning appears

lib/iris/tests/system_test.py: 1 warning
lib/iris/tests/test_cdm.py: 1 warning
lib/iris/tests/test_cube_to_pp.py: 58 warnings
lib/iris/tests/test_file_save.py: 8 warnings
lib/iris/tests/test_pp_cf.py: 6 warnings
lib/iris/tests/integration/test_pp.py: 2 warnings
lib/iris/tests/integration/fast_load/test_fast_load.py: 188 warnings
lib/iris/tests/unit/fileformats/um/fast_load/test_FieldCollation.py: 16 warnings
  /net/home/h05/achamber/git/iris/lib/iris/fileformats/pp.py:1199: DeprecationWarning: NumPy will stop allowing conversion of out-of-bound Python integers to integer arrays.  The conversion of -99 to uint32 will fail in the future.
  For the old behavior, usually:
      np.array(value).astype(dtype)
  will give the desired result (the cast overflows).
    lb[index] = header_elem

Simply replacing the offending line with `lb[index] = np.array(header_elem).astype(dtype) causes new errors, and I'm not familiar enough with the PP saving functions to be aware what is and isn't a problem. Reporting this so it's recorded for future viewing by someone with better understanding of the PP format.

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

Status
No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions