From a8f530f1146ede88e85d5fb4db309769be33e26e Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Mon, 5 Apr 2021 18:03:08 -0600 Subject: [PATCH] Per #1747, update MET to interpret longlong values as integers. NetCDF file attributes that have an LL suffix are read into python as numpy.int64 objects. Right now MET fails when trying to read those as integers. Update the parsing logic to interpret those as ints. --- met/src/libcode/vx_python3_utils/python3_dict.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/met/src/libcode/vx_python3_utils/python3_dict.cc b/met/src/libcode/vx_python3_utils/python3_dict.cc index 6d38599aa4..99a0d5fc93 100644 --- a/met/src/libcode/vx_python3_utils/python3_dict.cc +++ b/met/src/libcode/vx_python3_utils/python3_dict.cc @@ -164,6 +164,14 @@ if ( ! a ) { } +// If not a Long, try interpreting as LongLong for numpy.int64 values + +if ( ! PyLong_Check(a) ) { + + a = PyLong_FromLongLong(PyLong_AsLongLong(a)); + +} + if ( ! PyLong_Check(a) ) { mlog << Error << "\nPython3_Dict::lookup_int(const char *) -> "