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

Fix warnings and raise UserWarning as error in CI #458

Merged
merged 14 commits into from
Jan 31, 2024

Conversation

rhugonnet
Copy link
Member

@rhugonnet rhugonnet commented Jan 30, 2024

We had almost 100 warnings! Now all fixed except:

  • A RunTime warning of NumPy that needs to be silenced in Rasterio and not here:
/home/atom/miniconda3/envs/geoutils-dev/lib/python3.11/site-packages/rasterio/dtypes.py:214: RuntimeWarning: overflow encountered in cast
    return np.allclose(values, values.astype(dtype), equal_nan=True)

We stopped catching a lot of warnings when modifying warning message during the hackathon (for instance, changing dst_nodata in nodata)! A good way to keep track of them from now on would be to consider UserWarning as an error in pytest: pytest -W error::UserWarning. I've added this as a pytest option in pyproject.toml, and so it will run by default during CI and locally when just writing pytest! 😄

Several warnings allowed to fix some deeper issues, for instance the modification of a Mask's dtype without converting back in some functions! 😅

Also, I added a NeedToImplementWarning class (subclass of FutureWarning, to avoid triggering errors) to raise warning for us to remember to update the interface to GeoPandas as they add new vector methods.

And minor fixes to the API.

EDIT: Change made here instead of #462 by mistake, but doesn't change much (independent)
We mirror the script update in xDEM to parse package versions in CI to avoid failure in Windows and be more flexible in the future. See GlacioHack/xdem#439. See #462 for justification.

Resolves #460
Resolves #459
Resolves #461

@rhugonnet rhugonnet requested a review from adehecq January 30, 2024 22:49
tests/test_geoviewer.py Outdated Show resolved Hide resolved
Copy link
Member

@adehecq adehecq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks all good ! I just have a few questions.

@rhugonnet rhugonnet merged commit 14dd19d into GlacioHack:main Jan 31, 2024
13 checks passed
@rhugonnet rhugonnet deleted the fix_warnings branch January 31, 2024 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants