Merge fixes
This merge contains:
- New docker image with updated dependencies; anaconda removed
- Fix to gebco bathymetry
- Fix numpy deprecation warnings
- PEP8 formatting
- Refactored ocean module
- Docstrings and formatting in index module
- Updated install documentation as anaconda is no longer used
- Updated gitlab CI (downloaded testing data and resulting database should be cached if all tests are passing)
To be added:
- Deployment of documentation website to gitlab pages
requested review from @kirsebom
@kirsebom the test_transmission_loss_real_world_env is failing, do you know whats going wrong here?
I may have broken something by changing the ocean module functions 'bathy()' and 'temp()' to 'bathymetry()' and 'temperature()'
========================================================== FAILURES =========================================================== ____________________________________________ test_transmission_loss_real_world_env ____________________________________________ kadlu/tests/sound/test_geophony.py:156: in test_transmission_loss_real_world_env transm_loss, ocean = transmission_loss(seafloor=seafloor, kadlu/sound/geophony.py:143: in transmission_loss ss = SoundSpeed(ssp=k['ssp']) if 'ssp' in k.keys() else SoundSpeed( kadlu/sound/sound_speed.py:95: in __init__ depths = self._depth_coordinates(ocean, kadlu/sound/sound_speed.py:185: in _depth_coordinates indices, _ = interp_grid_1d(y=c, kadlu/utils.py:335: in interp_grid_1d norm = np.max(y) - np.min(y) <__array_function__ internals>:180: in amax ??? ../env_kadlu/lib/python3.10/site-packages/numpy/core/fromnumeric.py:2791: in amax return _wrapreduction(a, np.maximum, 'max', axis, None, out, ../env_kadlu/lib/python3.10/site-packages/numpy/core/fromnumeric.py:86: in _wrapreduction return ufunc.reduce(obj, axis, dtype, out, **passkwargs) E ValueError: zero-size array to reduction operation maximum which has no identity =================================================== short test summary info =================================================== FAILED kadlu/tests/sound/test_geophony.py::test_transmission_loss_real_world_env - ValueError: zero-size array to reduction ... ========================================= 1 failed, 5 passed, 73 deselected in 1.72s ==========================================
added 1 commit
- ba7b3cc7 - convert elevation to depths in load_from_file.py plotting
Result of running
pytest kadlu/ --doctest-modules
after fresh clone of kadlu on this branch:============================================================================== short test summary info =============================================================================== FAILED kadlu/index.py::kadlu.index.index FAILED kadlu/tests/geospatial/test_ocean.py::test_small_full_ocean - requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='tds.hycom.org', port=443): Read timed out. (read ti... FAILED kadlu/tests/geospatial/test_ocean.py::test_wind_water_uv - requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='tds.hycom.org', port=443): Read timed out. (read timeo... FAILED kadlu/tests/geospatial/data_sources/test_hycom.py::test_load_water_uv - requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='tds.hycom.org', port=443): Read timed out... FAILED kadlu/tests/geospatial/data_sources/test_hycom.py::test_load_water_v - requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='tds.hycom.org', port=443): Read timed out.... FAILED kadlu/tests/sound/test_geophony.py::test_transmission_loss_real_world_env - AttributeError: 'Ocean' object has no attribute 'bathy'
I will investigate the failing test in the geophony module. Can you take a look at the others, @matt_s ?
It might be fixed by the change in 741eacf5 but I will do more thorough testing on the issue later
added 2 commits
I have updated the Ocean class method names in the
test_transmission_loss_real_world_env
test that was causing problems. However, the test still fails because the interpolated bathymetry values differ from the expected values. The expected values were based on the GEBCO 2020 NetCDF bathymetry data. I would like to run this test using the GEBCO 2021 NetCDF data instead of the Geotiff data in order to understand if the difference in bathy values is due 1) a difference between using NetCDF or Geotiff data, or 2) a difference between the GEBCO 2021 and 2020 datasets. The differences are quite substantial so I doubt that 2) is the reason but I would like to check. @matt_s , How do I go about loading from NetCDF instead of Geotiff? Is the NetCDF loading function still available and working?> np.testing.assert_array_almost_equal(seafloor_depth, answ_seafloor_depth, decimal=2) E AssertionError: E Arrays are not almost equal to 2 decimals E E Mismatched elements: 9 / 9 (100%) E Max absolute difference: 98.22117791 E Max relative difference: 0.26499711 E x: array([[ 267.21, 594.1 , 1470.33], E [ 99.98, 279.2 , 1661.36], E [ 83.73, 468.87, 1304.41]]) E y: array([[ 267.75, 606.44, 1398.15], E [ 99.94, 273.12, 1651.99], E [ 80.17, 370.65, 1307.41]])
added 1 commit
- 1818f5b7 - update install instructions explaining how to install GCC
Re-running the test with Gebco NetCDF instead of Geotiff, I still get an error, but the numerical deviations are different:
> np.testing.assert_array_almost_equal(seafloor_depth, answ_seafloor_depth, decimal=2) E AssertionError: E Arrays are not almost equal to 2 decimals E E Mismatched elements: 9 / 9 (100%) E Max absolute difference: 127.73378904 E Max relative difference: 0.13175636 E x: array([[ 269.1 , 616.11, 1466.31], E [ 101.66, 268.88, 1595.38], E [ 85.25, 419.49, 1435.14]]) E y: array([[ 267.75, 606.44, 1398.15], E [ 99.94, 273.12, 1651.99], E [ 80.17, 370.65, 1307.41]])
So, to summarize:
- there are differences between the two formats
- and there are differences between the two years
The situation is a little confusing, to say the least. I may do a bit more digging ...
added 1 commit
- 574c9ca9 - testing kadlu docs website deployment in CI for gitlab pages
added 1 commit
- 204ed62a - reduce number of tests requiring downloaded data
added 1 commit
- 0012b63a - resolve absolute path when determining kadlu storage configuration
added 2 commits
mentioned in commit 4a8673b1