nansencenter / DAPPER

Data Assimilation with Python: a Package for Experimental Research
https://nansencenter.github.io/DAPPER
MIT License
341 stars 119 forks source link

JOSS Review | Failing Test Case `test_HMM` #109

Closed sara-02 closed 6 months ago

sara-02 commented 6 months ago

image

Error report

_______________________________________________________________________________________ test_HMM[mods/QG/sakov2008.py] __________________________________________________________________________________________

path = PosixPath('mods/QG/sakov2008.py')

    @pytest.mark.parametrize(("path"), HMMs, ids=str)
    def test_HMM(path):
        """Test that any HMM in module can be simulated."""
        p = "." + str(path.with_suffix("")).replace(os.sep, ".")
>       module = import_module(p, root.stem)

tests/test_HMMs.py:39: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../anaconda3/envs/dapper-env/lib/python3.9/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1030: in _gcd_import
    ???
<frozen importlib._bootstrap>:1007: in _find_and_load
    ???
<frozen importlib._bootstrap>:972: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:228: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1030: in _gcd_import
    ???
<frozen importlib._bootstrap>:1007: in _find_and_load
    ???
<frozen importlib._bootstrap>:986: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:680: in _load_unlocked
    ???
<frozen importlib._bootstrap_external>:850: in exec_module
    ???
<frozen importlib._bootstrap>:228: in _call_with_frames_removed
    ???
dapper/mods/QG/__init__.py:173: in <module>
    sample = gen_sample(model_config("sample_generation", {}), 400, 700, 10)
dapper/mods/QG/__init__.py:165: in gen_sample
    sample    = simulator(np.zeros(Nx), K, 0.0, model.prms["dtout"])
dapper/mods/integration.py:143: in fun_k
    xx[i+1] = func(xx[i], *args, **kwargs)
dapper/mods/QG/__init__.py:111: in step
    return self.step_1(E, t, dt)
dapper/mods/QG/__init__.py:103: in step_1
    self.f90.step(t, psi, self.fname)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <dapper.mods.QG.model_config object at 0x7f002c56bc10>

    @property
    def f90(self):
        try:
>           from .f90.py_mod import interface_mod
E           ModuleNotFoundError: No module named 'dapper.mods.QG.f90.py_mod'
E           Have you compiled the (Fortran) model?
E           See README in dapper/mods/QG/f90

dapper/mods/QG/__init__.py:83: ModuleNotFoundError
---------------------------------------------------------------------------------------------- Captured stdout call -----------------------------------------------------------------------------------------------
Did not find sample file /home/sarah/dpr_data/samples/QG_samples.npz for experiment initialization. Generating...
============================================================================================= short test summary info =============================================================================================
FAILED tests/test_HMMs.py::test_HMM[mods/QG/sakov2008.py] - ModuleNotFoundError: No module named 'dapper.mods.QG.f90.py_mod'
patnr commented 6 months ago

Thank you for the error report. The issue should be fixed in the above referenced commit.

In short, the failing test should not have run on your system (since it requires fortran compilation, which is too much setup), but the checks for disabling it were incomplete.

sara-02 commented 6 months ago

Thanks, yes can confirm now that test is no longer an error but just a warning about Fortran.