Skip to content

Commit 8b6c0b4

Browse files
authored
Merge branch 'master' into dodam/typing
2 parents 6c0c8be + ff9c5bb commit 8b6c0b4

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

  • cloudvolume/datasource/precomputed/image

cloudvolume/datasource/precomputed/image/tx.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,17 @@ def threaded_upload_chunks(
326326
secrets: Any = None,
327327
lru_encoding: str = "same",
328328
) -> int:
329+
meta, cache, lru,
330+
img, mip, chunk_ranges,
331+
compress, cdn_cache, progress,
332+
n_threads=DEFAULT_THREADS,
333+
delete_black_uploads=False,
334+
background_color=0,
335+
green=False,
336+
compress_level=None,
337+
secrets=None,
338+
lru_encoding="same",
339+
):
329340

330341
if cache.enabled:
331342
mkdir(cache.path)
@@ -395,10 +406,10 @@ def do_upload(i: int, imgchunk: np.ndarray, cloudpath: str) -> None:
395406
else:
396407
remote_encoded = encoded
397408

398-
cache_encoded = remote_encoded
399-
400409
if cache.enabled and remote_compress != cache_compress:
401410
cache_encoded = compression.compress(encoded, cache_compress)
411+
else:
412+
cache_encoded = remote_encoded
402413

403414
del encoded
404415

@@ -447,7 +458,11 @@ def process(i: int, startpt: Vec, endpt: Vec, spt: Vec, ept: Vec) -> None:
447458
cloudpath = meta.join(meta.key(mip), filename)
448459

449460
if delete_black_uploads:
450-
if np.any(imgchunk != background_color):
461+
if background_color == 0:
462+
has_data = np.any(imgchunk)
463+
else:
464+
has_data = not np.array_equal(imgchunk, background_color)
465+
if has_data:
451466
do_upload(i, imgchunk, cloudpath)
452467
else:
453468
do_delete(cloudpath)

0 commit comments

Comments
 (0)