ecmwf / eccodes-python

Python interface to the ecCodes GRIB/BUFR decoder/encoder
Apache License 2.0
113 stars 33 forks source link

data file tiggelam_cnmc_sfc.grib2 not included in released tar file eccodes-1.4.0.tar.gz #59

Closed jdkloe closed 2 years ago

jdkloe commented 2 years ago

MANIFEST.in contains the line "recursive-include tests *.grib" and therefore only includes files with extension .grib. However, currently the file below test/sample-data has extension .grib2: "tests/sample-data/tiggelam_cnmc_sfc.grib2"

Therefore this file is not included in the release tar file eccodes-1.4.0.tar.gz and this causes the 2 failures in the provided test suite when running them using the pytest-3 command: ================================ short test summary info ================================= FAILED tests/test_eccodes.py::test_count_in_file - FileNotFoundError: [Errno 2] No such... FAILED tests/test_eccodes.py::test_extract_offsets - gribapi.errors.IOProblemError: Inp... ======================== 2 failed, 58 passed, 5 warnings in 2.18s =============================

So please update your manifest file to solve this issue.

shahramn commented 2 years ago

I've just checked both the ZIP file and the TAR and they both contain the aforementioned grib file. https://github.com/ecmwf/eccodes-python/archive/refs/tags/1.4.0.zip https://github.com/ecmwf/eccodes-python/archive/refs/tags/1.4.0.tar.gz

Am I missing something?

shahramn commented 2 years ago

Looks like the one on the PyPI site:

https://pypi.org/project/eccodes/#files

does NOT have it. Thanks for pointing that out

jdkloe commented 2 years ago

Yes, I was referring to the pypi copy.

jdkloe commented 2 years ago

If I download the file and add the file manually to the tests/sample-data folder, than unfortunately it does not solve the problem. Ins tead I get the following errors:

______________________________ test_count_in_file ______________________________

    def test_count_in_file():
        with open(TEST_GRIB_DATA, "rb") as f:
>           assert eccodes.codes_count_in_file(f) == 7

tests/test_eccodes.py:123: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
gribapi/gribapi.py:432: in grib_count_in_file
    GRIB_CHECK(err)
gribapi/gribapi.py:228: in GRIB_CHECK
    errors.raise_grib_error(errid)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

errid = -64

    def raise_grib_error(errid):
        """
        Raise the GribInternalError corresponding to ``errid``.
        """
>       raise ERROR_MAP[errid](errid)
E       gribapi.errors.UnsupportedEditionError: Edition not supported.

gribapi/errors.py:382: UnsupportedEditionError
_____________________________ test_extract_offsets _____________________________
    def test_extract_offsets():
        offsets = eccodes.codes_extract_offsets(
            TEST_GRIB_DATA, eccodes.CODES_PRODUCT_ANY, is_strict=True
        )
>       offsets_list = list(offsets)

tests/test_eccodes.py:158: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
gribapi/gribapi.py:2478: in codes_extract_offsets
    GRIB_CHECK(err)
gribapi/gribapi.py:228: in GRIB_CHECK
    errors.raise_grib_error(errid)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

errid = -64

    def raise_grib_error(errid):
        """
        Raise the GribInternalError corresponding to ``errid``.
        """
>       raise ERROR_MAP[errid](errid)
E       gribapi.errors.UnsupportedEditionError: Edition not supported.

gribapi/errors.py:382: UnsupportedEditionError
----------------------------- Captured stderr call -----------------------------
ECCODES ERROR   :  codes_extract_offsets_malloc: Unable to count messages
=============================== warnings summary ===============================
../../../../usr/lib/python3.10/site-packages/_pytest/config/__init__.py:1233
  /usr/lib/python3.10/site-packages/_pytest/config/__init__.py:1233: PytestConfigWarning: Unknown config option: flakes-ignore

    self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")

../../../../usr/lib/python3.10/site-packages/_pytest/config/__init__.py:1233
  /usr/lib/python3.10/site-packages/_pytest/config/__init__.py:1233: PytestConfigWarning: Unknown config option: mccabe-complexity
      self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")

../../../../usr/lib/python3.10/site-packages/_pytest/config/__init__.py:1233
  /usr/lib/python3.10/site-packages/_pytest/config/__init__.py:1233: PytestConfigWarning: Unknown config option: pep8ignore

    self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")

../../../../usr/lib/python3.10/site-packages/_pytest/config/__init__.py:1233
  /usr/lib/python3.10/site-packages/_pytest/config/__init__.py:1233: PytestConfigWarning: Unknown config option: pep8maxlinelength

    self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")

-- Docs: https://docs.pytest.org/en/stable/warnings.html
=========================== short test summary info ============================
FAILED tests/test_eccodes.py::test_count_in_file - gribapi.errors.Unsupported...
FAILED tests/test_eccodes.py::test_extract_offsets - gribapi.errors.Unsupport...
=================== 2 failed, 58 passed, 4 warnings in 3.35s ===================
jdkloe commented 2 years ago

The versions that I used are: eccodes v2.24.0 (python) eccodes-1.4.0 python3.10 Fast bindings enabled. OS: Fedora 36 (rawhide) in a mock environment.

shahramn commented 2 years ago

I have fixed the MANIFEST file to include the correct extension

shahramn commented 2 years ago

This has now been fixed (Version 1.4.1)