corteva / rioxarray

geospatial xarray extension powered by rasterio
https://corteva.github.io/rioxarray
Other
517 stars 81 forks source link

Avoiding DeprecationWarning: xr.Dataset.drop() -> xr.Dataset.drop_vars() #740

Closed xaviernogueira closed 7 months ago

xaviernogueira commented 7 months ago

Very simple PR. I was getting deprecation warnings from rioxarray that originated in xarray. Here is an example of the warning:

  /home/xavier/.pyenv/versions/3.9.7/envs/vetl_s2/lib/python3.9/site-packages/rioxarray/_io.py:870: DeprecationWarning: dropping variables using `drop` is deprecated; use drop_vars.
    open_rasterio(  # type: ignore

So I simply went in and changed it. I don't have time to recreate the full dev environment, but it should work. That said, maybe someone should probably re-run you're test suite before merging. I can do it, but most likely a few days from now.

snowman2 commented 7 months ago

Thank you @xaviernogueira! I suggested a different approach that could prevent squeezing out dimensions we don't intend while also resolving this issue. Mind testing it out and seeing if it solves the issue?