Skip to content

Commit

Permalink
zarrs_ncvar2zarr: output size change in human readable bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
LDeakin committed Apr 26, 2024
1 parent 85f1b69 commit a1cc6e2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `zarrs_ome` also supports an `overwrite` option
- `zarrs_ncvar2zarr`:
- clear progress bars on finish
- output size change in human readable bytes

## [0.4.0] - 2024-04-20

Expand Down
9 changes: 6 additions & 3 deletions src/bin/zarrs_ncvar2zarr.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use clap::Parser;
use indicatif::{MultiProgress, ProgressBar, ProgressStyle};
use indicatif::{DecimalBytes, MultiProgress, ProgressBar, ProgressStyle};
use rayon::{iter::ParallelIterator, slice::ParallelSlice};
use std::{
path::PathBuf,
Expand Down Expand Up @@ -346,9 +346,12 @@ fn main() {

// Output stats
let duration_ms = duration_s * 1.0e3;
let gbs = (bytes_read as f32 * 1e-9) / duration_s;
let size_out = store.size().unwrap();
// let space_saving = 100.0 * (1.0 - (size_out as f32 / bytes_read as f32));
let relative_size = 100.0 * (size_out as f32 / bytes_read as f32);
println!("Output {path_out:?} in {duration_ms:.2}ms ({gbs:.2} GB/s) [{bytes_read}B -> {size_out}B ({relative_size:.2}%)]");
println!("Output {path_out:?} in {duration_ms:.2}ms ({gbs:.2} GB/s) [{bytes_read} -> {size_out} ({relative_size:.2}%)]",
gbs = (bytes_read as f32 * 1e-9) / duration_s,
bytes_read = DecimalBytes(bytes_read as u64),
size_out = DecimalBytes(size_out as u64),
);
}

0 comments on commit a1cc6e2

Please sign in to comment.