From 11e9f02761fa07a35b29f7b184d8f483aec04866 Mon Sep 17 00:00:00 2001 From: achaochao Date: Mon, 16 Dec 2024 21:33:15 +0800 Subject: [PATCH] fix the bug when progress = True --- src/rasterstats/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rasterstats/main.py b/src/rasterstats/main.py index a263e06..11e50f2 100644 --- a/src/rasterstats/main.py +++ b/src/rasterstats/main.py @@ -46,7 +46,7 @@ def zonal_stats(*args, **kwargs): "You specified progress=True, but tqdm is not installed in the environment. You can do pip install rasterstats[progress] to install tqdm!" ) stats = gen_zonal_stats(*args, **kwargs) - total = sum(1 for _ in stats) + total = len(args[0]) return [stat for stat in tqdm(stats, total=total)] else: return list(gen_zonal_stats(*args, **kwargs))