ARPA-SIMC / arkimet

A set of tools to organize, archive and distribute data files.
Other
14 stars 5 forks source link

Float to int issues in scanning ODIM heights #283

Closed spanezz closed 2 years ago

spanezz commented 2 years ago

Now that I enabled more warnings during Python tests, I get a couple in ODIM scanning code:

$ ARGS="tests.test_scan_odimh5" meson test -vC t python  
test_comp_cappi (tests.test_scan_odimh5.TestScanODIMH5) ... /home/enrico/lavori/arpa/arkimet/conf/scan/odimh5.py:196: DeprecationWarning: an integer is required (got type numpy.float64).  Implicit conversion to integers using __int__ is deprecated, and may be removed in a future version of Python.
  md["level"] = {"style": "GRIB1", "level_type": 105, "l1": height}
ok
test_comp_vil (tests.test_scan_odimh5.TestScanODIMH5) ... /home/enrico/lavori/arpa/arkimet/conf/scan/odimh5.py:217: DeprecationWarning: an integer is required (got type float).  Implicit conversion to integers using __int__ is deprecated, and may be removed in a future version of Python.
  md["level"] = {"style": "GRIB1", "level_type": 106, "l1": top / 100, "l2": bottom / 100}
ok

Python is complaining that it's getting floats when it expects integer. I guess it all works now, with valued rounded down. If that is intentional, values should be wrapped with int(). If proper rounding is needed, then values should be wrapped with round().

My expertise with ODIM scanning is limited, so I leave it up to you to decide how it should be and fix the scanning scripts

virginiapoli commented 2 years ago

Le altezze dei prodotti radar (quota del CAPPI e quote di top/bottom del livello di integrazione per la VIL) nell'ODIM sono definite convenzionalmente come double. Direi, quindi, che sia da usarsi round() e non int().

spanezz commented 2 years ago

Perfetto, grazie!