Skip to content

Commit 6f72c9b

Browse files
Merge pull request #75 from nsidc/59-confirm-downloads
Add `total_size_mb` property to `IceflowSearchResult` and log size when downloading
2 parents ebb2d79 + cd06227 commit 6f72c9b

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
lat/lon/elev fields.
1212
- Update data model for `IceflowDataFrame` to include `dataset`, which gives the
1313
dataset short name and version as a string (e.g., ILVIS v2 is "ILVISv2").
14+
- Add `total_size_mb` property to `IceflowSearchResult` and log size when
15+
downloading.
1416

1517
# v1.0.0
1618

src/nsidc/iceflow/data/fetch.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ def _download_iceflow_search_result(
6161

6262
logger.info(
6363
f"Downloading {len(iceflow_search_result.granules)} granules"
64+
f" (approx. {iceflow_search_result.total_size_mb} MB)"
6465
f" to {output_subdir}."
6566
)
6667

src/nsidc/iceflow/data/models.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,5 +247,10 @@ class IceflowSearchResult(pydantic.BaseModel):
247247
# this that type
248248
model_config = pydantic.ConfigDict(arbitrary_types_allowed=True)
249249

250+
@property
251+
def total_size_mb(self):
252+
granule_sizes_mb = [granule.size() for granule in self.granules]
253+
return sum(granule_sizes_mb)
254+
250255

251256
IceflowSearchResults = list[IceflowSearchResult]

0 commit comments

Comments
 (0)