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

Remove reference to rasterio.path. #1255

Merged
merged 3 commits into from May 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 1 addition & 3 deletions datacube/storage/_rio.py
Expand Up @@ -13,7 +13,6 @@
import numpy as np
from affine import Affine
import rasterio
import rasterio.path
from urllib.parse import urlparse
from typing import Optional, Iterator

Expand Down Expand Up @@ -165,8 +164,7 @@ def open(self) -> Iterator[GeoRasterReader]:

try:
_LOG.debug("opening %s", self.filename)
with rasterio.DatasetReader(rasterio.path.parse_path(str(self.filename)),
sharing=False) as src:
Copy link
Member

Choose a reason for hiding this comment

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

sharing=False is important for Dask use-case, can't just drop it. Pretty sure you can pass it on to .open. Keep in mind that .open does extra checks with respect to GDAL environment and AWS settings and in the past that caused significant slow-downs. rasterio promised to keep supporting direct access to DatasetReader, plan is to allow string inputs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added sharing=False to the .open call and everything seems to still work.

DatasetReader appears not accept string inputs as of 1.2.10.

with rasterio.open(str(self.filename), sharing=False) as src:
override = False

transform = src.transform
Expand Down
1 change: 1 addition & 0 deletions docs/about/whats_new.rst
Expand Up @@ -8,6 +8,7 @@ What's New
v1.8.next
=========

- Remove reference to `rasterio.path`. (:pull:`1255`)
- Cleaner separation of postgis and postgres drivers, and suppress SQLAlchemy cache warnings. (:pull:`1254`)
- Prevent Shapely deprecation warning. (:pull:`1253`)
- Clearer error message when local metadata file does not exist. (:pull:`1252`)
Expand Down