Skip to content

Commit 5eb1b95

Browse files
pjonssonomad
authored andcommitted
storage: move num2numpy call
The call is already performed under the lock, so use that information instead of calling the same function again inside the constructor.
1 parent 219e593 commit 5eb1b95

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

datacube/storage/_rio.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,16 @@ class BandDataSource(GeoRasterReader):
5151
"""
5252

5353
def __init__(
54-
self, source: rasterio.Band, nodata=None, lock: RLock | None = None
54+
self,
55+
source: rasterio.Band,
56+
nodata: np.float32 | np.float64 | np.dtype | None = None,
57+
lock: RLock | None = None,
5558
) -> None:
5659
self.source = source
5760
if nodata is None:
5861
nodata = self.source.ds.nodatavals[self.source.bidx - 1]
5962

60-
self._nodata = num2numpy(nodata, source.dtype)
63+
self._nodata = nodata
6164
self._lock = lock
6265

6366
@property

0 commit comments

Comments
 (0)