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 deprecation warning #58

Open
jonschwenk opened this issue Jul 22, 2021 · 4 comments
Open

Fix deprecation warning #58

jonschwenk opened this issue Jul 22, 2021 · 4 comments
Labels
good first issue Good for newcomers

Comments

@jonschwenk
Copy link
Collaborator

im_utils.regionprops() prints this warning upon each initial call:

...\rivgraph\im_utils.py:657: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray.
  out[prop] = np.array(coords)

We should fix this.

@DishaDudhal
Copy link

A newbie contributor to opensource here. Wanted to know if this issue still needs fixing and if I could help!

@elbeejay
Copy link
Member

elbeejay commented Feb 8, 2022

Hi @DishaDudhal 👋

I think there are still some deprecation warnings present in the code base. In #59 I'd noted a few which I had not resolved (although I think the test suite itself has been reorganized since then). I just ran the test suite locally and got the following warnings:

==================================== warnings summary =====================================
/home/jayh/anaconda3/envs/fullrivgraph/lib/python3.7/site-packages/osgeo/__init__.py:8
  /home/jayh/anaconda3/envs/fullrivgraph/lib/python3.7/site-packages/osgeo/__init__.py:8: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
    import imp

tests/integration/test_delta_int.py:147
  /home/jayh/Documents/RivGraph_Development/RivGraph/tests/integration/test_delta_int.py:147: PytestUnknownMarkWarning: Unknown pytest.mark.timeout - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/latest/mark.html
    @pytest.mark.timeout(180)

tests/integration/test_synthetic_int.py::test_assigning_inletshore
tests/integration/test_synthetic_int.py::test_assigning_inletshore
tests/integration/test_synthetic_int.py::test_assigning_inletshore
  /home/jayh/anaconda3/envs/fullrivgraph/lib/python3.7/site-packages/geopandas/geoseries.py:118: DeprecationWarning: The default dtype for empty Series will be 'object' instead of 'float64' in a future version. Specify a dtype explicitly to silence this warning.
    s = pd.Series(data, index=index, name=name, **kwargs)

-- Docs: https://docs.pytest.org/en/latest/warnings.html
============ 223 passed, 4 xfailed, 2 xpassed, 5 warnings in 265.99s (0:04:25) ============

To close this issue we would want the final line to say 0 warnings, so there's definitely room for improvement here. I'd suggest you create a rivgraph environment locally and run the test suite on your machine. Then you can see the warnings for yourself and figure out if they can be resolved (I'm not sure my local environment has the latest package versions).

Hope that helps, happy to have your contributions! If this response was unclear please follow up and I can try to clarify.

@jonschwenk
Copy link
Collaborator Author

Thanks @elbeejay! Interesting that the Warning that this issue was opened for doesn't show up in the tests. regionprops is tested here, so perhaps package updates resolved that particular Warning? I remember working on the VisibleDeprecationWarning of the original issue and not being able to easily solve it--the warning's suggestion to add dtype=object did not work, but I can't remember exactly why.

Anyway, @DishaDudhal, welcome! We would love your contributions. Please post here if you have questions.

@elbeejay
Copy link
Member

Easy fix to be done here, scipy is changing where the distance_transform_edt function is.

from scipy.ndimage.morphology import distance_transform_edt

DeprecationWarning: Please use `distance_transform_edt` from the `scipy.ndimage` namespace, the `scipy.ndimage.morphology` namespace is deprecated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants