Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing warnings #227

Closed
banesullivan opened this issue Feb 4, 2024 · 5 comments
Closed

Testing warnings #227

banesullivan opened this issue Feb 4, 2024 · 5 comments
Labels
PyOpenSci Review Issues related to the review for PyOpenSci

Comments

@banesullivan
Copy link
Contributor

banesullivan commented Feb 4, 2024

I'm a little concerned by the high number of warnings in the tests (~1300) from this CI run. While it appears many of these are the same warnings being thrown over and over leading to this high number, it would be good to track down each of these warnings to get a grasp on what issues are present and if any of them can be addressed directly in EOmaps.

From parsing the logs, this is the list I got (may have missed some):

  • DeprecationWarning: invalid escape sequence '*' at /home/runner/work/EOmaps/EOmaps/eomaps/ne_features.py:489.
  • DeprecationWarning: Pyarrow will become a required dependency of pandas in the next major release of pandas (pandas 3.0), (to allow more performant data types, such as the Arrow string type, and better interoperability with other libraries) but was not found to be installed on your system. If this would cause problems for you, please provide us feedback at FEEDBACK: PyArrow as a required dependency and PyArrow backed strings pandas-dev/pandas#54466 at tests/test_basic_functions.py:9.
  • DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) at /home/runner/micromamba/envs/eomaps/lib/python3.11/site-packages/pyproj/transformer.py:820.
  • UserWarning: Back azimuth is being returned by default to be compatible with inv() This is a breaking change for pyproj 3.5+. To avoid this warning, set return_back_azimuth=True. Otherwise, to restore old behaviour, set return_back_azimuth=False. This warning will be removed in future version at /home/runner/micromamba/envs/eomaps/lib/python3.11/site-packages/pyproj/geod.py:829.
  • UserWarning: Back azimuth is being returned by default to be compatible with fwd() This is a breaking change for pyproj 3.5+. To avoid this warning, set return_back_azimuth=True. Otherwise, to restore old behaviour, set return_back_azimuth=False. This warning will be removed in future version at /home/runner/micromamba/envs/eomaps/lib/python3.11/site-packages/pyproj/geod.py:681.
  • DeprecationWarning: Passing a SingleBlockManager to Series is deprecated and will raise in a future version. Use public APIs instead at /home/runner/micromamba/envs/eomaps/lib/python3.11/site-packages/geopandas/geodataframe.py:1645.
  • DeprecationWarning: Passing a BlockManager to GeoDataFrame is deprecated and will raise in a future version. Use public APIs instead at /home/runner/micromamba/envs/eomaps/lib/python3.11/site-packages/pandas/core/frame.py:706.
  • UserWarning: Geometry is in a geographic CRS. Results from 'buffer' are likely incorrect. Use 'GeoSeries.to_crs()' to re-project geometries to a projected CRS before this operation at /home/runner/work/EOmaps/EOmaps/eomaps/eomaps.py:4635.
  • DeprecationWarning: Passing a SingleBlockManager to GeoSeries is deprecated and will raise in a future version. Use public APIs instead at /home/runner/micromamba/envs/eomaps/lib/python3.11/site-packages/geopandas/geoseries.py:221.
  • DownloadWarning: Downloading: https://naturalearth.s3.amazonaws.com/110m_physical/ne_110m_coastline.zip at /home/runner/micromamba/envs/eomaps/lib/python3.11/site-packages/cartopy/io/__init__.py:241.
  • DownloadWarning: Downloading: https://naturalearth.s3.amazonaws.com/50m_physical/ne_50m_ocean.zip at /home/runner/micromamba/envs/eomaps/lib/python3.11/site-packages/cartopy/io/__init__.py:241.
  • DownloadWarning: Downloading: https://naturalearth.s3.amazonaws.com/50m_physical/ne_50m_coastline.zip at the same location as above.
  • DownloadWarning: Downloading: https://naturalearth.s3.amazonaws.com/110m_physical/ne_110m_ocean.zip at the same location as above.
  • DownloadWarning: Downloading: https://naturalearth.s3.amazonaws.com/110m_physical/ne_110m_ocean.zip at the same location as above.
  • DownloadWarning: Downloading: https://naturalearth.s3.amazonaws.com/50m_physical/ne_50m_land.zip at the same location as above.
  • DownloadWarning: Downloading: https://naturalearth.s3.amazonaws.com/50m_cultural/ne_50m_admin_0_countries.zip at the same location as above.
  • DownloadWarning: Downloading: https://naturalearth.s3.amazonaws.com/110m_cultural/ne_110m_admin_0_countries.zip at the same location as above.

One easy win might be to filter out the DownloadWarning with the following pytest configuration in the pyproject.toml (get's it down to 903 warnings for me)

[tool.pytest.ini_options]
filterwarnings = [
    "ignore:DownloadWarning",
]
@raphaelquast raphaelquast added the PyOpenSci Review Issues related to the review for PyOpenSci label Feb 5, 2024
@raphaelquast
Copy link
Owner

raphaelquast commented Feb 5, 2024

@banesullivan Thank you very much for opening this detailed issue!

I had a quick look where the extremely large number of warnings is coming from and realized that almost all warnings relate to the numpy DeprecationWarning about conversion of an array with ndim>0 to scalar.

This warning is ultimately related to the way how PyProj handles 1-element arrays as discussed here: pyproj4/pyproj#1307.

  • I'll try to figure out if the numpy-warning can be ignored or if changes in eomaps are required to ensure compatibility with upcoming numpy versions!
  • I'll implement a filter for all warnings that can savely be ignored (e.g. download warnings, warnings about in correct buffers in geographic-crs etc.)

@raphaelquast
Copy link
Owner

raphaelquast commented Feb 5, 2024

PyProj devs confirmed that the numpy-warning can safely be ignored (which will get rid of ~900 of the warnings).
I've implemented a filter for all other warnings that can be ignored and now I'm down to 81 warnings (on latest run) again!

I'll report back once I find the time to check the remaining warnings!

@yeelauren
Copy link

Pasting the latest results from my test run in case it's helpful:

=========================================== short test summary info ============================================
FAILED tests/test_plot_shapes.py::TestPlotShapes::test_contour - AttributeError: 'NoneType' object has no attribute 'dpi'
=========================== 1 failed, 93 passed, 911 warnings in 2320.22s (0:38:40) ============================

@raphaelquast
Copy link
Owner

@yeelauren this seems to be a run from an outdated dev branch?
The most recent test-suite contains 100 tests and currently finishes with 22 warnings on python 3.11 (see here)

@raphaelquast
Copy link
Owner

OK, latest test-suite is now at 123 tests and down to 17 warnings of which I consider only 1 as critical.
Therefore I've decided to close this issue for now. Feel free to re-open if you think it's still relevant!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PyOpenSci Review Issues related to the review for PyOpenSci
Projects
None yet
Development

No branches or pull requests

3 participants