Skip to content

Commit

Permalink
Address deprecation warnings from datacube and rioxarray (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
snowman2 authored Jul 6, 2020
1 parent 0426911 commit 0840e42
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
4 changes: 4 additions & 0 deletions docs/history.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
History
=======

0.0.13
------
- Address deprecation warnings from datacube and rioxarray (issue #29)

0.0.12
------
- ENH: Added :func:`geocube.show_versions` and cli `geocube --show-versions` (pull #23)
Expand Down
12 changes: 3 additions & 9 deletions geocube/vector_to_cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,7 @@
import numpy
import pandas
import xarray
from rioxarray.rioxarray import (
DEFAULT_GRID_MAP,
add_spatial_ref,
add_xy_grid_meta,
affine_to_coords,
)
from rioxarray.rioxarray import DEFAULT_GRID_MAP, affine_to_coords

from geocube.geo_utils.geobox import load_vector_data
from geocube.logger import get_logger
Expand Down Expand Up @@ -250,9 +245,8 @@ def _get_dataset(self, vector_data, measurements, group_by, interpolate_na_metho
out_xds[categorical_measurement].attrs = cat_attrs
out_xds[enum_var_name] = categoral_enums

add_xy_grid_meta(out_xds.coords)
add_spatial_ref(out_xds, self.geobox.crs.crs_str, DEFAULT_GRID_MAP)

out_xds.rio.write_crs(str(self.geobox.crs), inplace=True)
out_xds.rio.write_coordinate_system(inplace=True)
if interpolate_na_method is not None:
return out_xds.rio.interpolate_na(method=interpolate_na_method)

Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"datacube",
"geopandas>=0.6",
"rasterio",
"rioxarray>=0.0.22",
"rioxarray>=0.0.30",
"xarray",
"pyproj>=2",
]
Expand All @@ -30,7 +30,7 @@
"nbsphinx",
"sphinx_rtd_theme",
"black",
"flake8",
"flake8==3.7",
"pylint",
"isort",
"pre-commit",
Expand Down

0 comments on commit 0840e42

Please sign in to comment.