Skip to content

Commit

Permalink
Cleanup print statements in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
LDeakin committed Feb 19, 2024
1 parent b365efa commit c4283f1
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
6 changes: 3 additions & 3 deletions examples/async_http_array_read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,21 @@ async fn http_array_read() -> Result<(), Box<dyn std::error::Error>> {
let data_all = array
.async_retrieve_array_subset_ndarray::<f32>(&subset_all)
.await?;
println!("The whole array is:\n{:?}\n", data_all);
println!("The whole array is:\n{data_all}\n");

// Read a chunk back from the store
let chunk_indices = vec![1, 0];
let data_chunk = array
.async_retrieve_chunk_ndarray::<f32>(&chunk_indices)
.await?;
println!("Chunk [1,0] is:\n{data_chunk:?}\n");
println!("Chunk [1,0] is:\n{data_chunk}\n");

// Read the central 4x2 subset of the array
let subset_4x2 = ArraySubset::new_with_ranges(&[2..6, 3..5]); // the center 4x2 region
let data_4x2 = array
.async_retrieve_array_subset_ndarray::<f32>(&subset_4x2)
.await?;
println!("The middle 4x2 subset is:\n{:?}\n", data_4x2);
println!("The middle 4x2 subset is:\n{data_4x2}\n");

Ok(())
}
Expand Down
6 changes: 3 additions & 3 deletions examples/http_array_read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@ fn http_array_read() -> Result<(), Box<dyn std::error::Error>> {
// Read the whole array
let subset_all = ArraySubset::new_with_shape(array.shape().to_vec());
let data_all = array.retrieve_array_subset_ndarray::<f32>(&subset_all)?;
println!("The whole array is:\n{:?}\n", data_all);
println!("The whole array is:\n{data_all}\n");

// Read a chunk back from the store
let chunk_indices = vec![1, 0];
let data_chunk = array.retrieve_chunk_ndarray::<f32>(&chunk_indices)?;
println!("Chunk [1,0] is:\n{data_chunk:?}\n");
println!("Chunk [1,0] is:\n{data_chunk}\n");

// Read the central 4x2 subset of the array
let subset_4x2 = ArraySubset::new_with_ranges(&[2..6, 3..5]); // the center 4x2 region
let data_4x2 = array.retrieve_array_subset_ndarray::<f32>(&subset_4x2)?;
println!("The middle 4x2 subset is:\n{:?}\n", data_4x2);
println!("The middle 4x2 subset is:\n{data_4x2}\n");

Ok(())
}
Expand Down
8 changes: 4 additions & 4 deletions examples/rectangular_array_write_read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,22 +108,22 @@ fn rectangular_array_write_read() -> Result<(), Box<dyn std::error::Error>> {
// Read the whole array
let subset_all = ArraySubset::new_with_shape(array.shape().to_vec());
let data_all = array.retrieve_array_subset_ndarray::<f32>(&subset_all)?;
println!("The whole array is:\n{:?}\n", data_all);
println!("The whole array is:\n{data_all}\n");

// Read a chunk back from the store
let chunk_indices = vec![1, 0];
let data_chunk = array.retrieve_chunk_ndarray::<f32>(&chunk_indices)?;
println!("Chunk [1,0] is:\n{data_chunk:?}\n");
println!("Chunk [1,0] is:\n{data_chunk}\n");

// Read the central 4x2 subset of the array
let subset_4x2 = ArraySubset::new_with_ranges(&[2..6, 3..5]); // the center 4x2 region
let data_4x2 = array.retrieve_array_subset_ndarray::<f32>(&subset_4x2)?;
println!("The middle 4x2 subset is:\n{:?}\n", data_4x2);
println!("The middle 4x2 subset is:\n{data_4x2}\n");

// Show the hierarchy
let node = Node::new(&*store, "/").unwrap();
let tree = node.hierarchy_tree();
println!("The zarr hierarchy tree is:\n{}", tree);
println!("The zarr hierarchy tree is:\n{tree}");

Ok(())
}
Expand Down
10 changes: 5 additions & 5 deletions examples/sharded_array_write_read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,22 +102,22 @@ fn sharded_array_write_read() -> Result<(), Box<dyn std::error::Error>> {
// Read the whole array
let subset_all = ArraySubset::new_with_shape(array.shape().to_vec()); // the center 4x2 region
let data_all = array.retrieve_array_subset_ndarray::<u16>(&subset_all)?;
println!("The whole array is:\n{:?}\n", data_all);
println!("The whole array is:\n{data_all}\n");

// Read a shard back from the store
let shard_indices = vec![1, 0];
let data_shard = array.retrieve_chunk_ndarray::<u16>(&shard_indices)?;
println!("Shard [1,0] is:\n{data_shard:?}\n");
println!("Shard [1,0] is:\n{data_shard}\n");

// Read an inner chunk from the store
let subset_chunk_1_0 = ArraySubset::new_with_ranges(&[4..8, 0..4]);
let data_chunk = array.retrieve_array_subset_ndarray::<u16>(&subset_chunk_1_0)?;
println!("Chunk [1,0] is:\n{data_chunk:?}\n");
println!("Chunk [1,0] is:\n{data_chunk}\n");

// Read the central 4x2 subset of the array
let subset_4x2 = ArraySubset::new_with_ranges(&[2..6, 3..5]); // the center 4x2 region
let data_4x2 = array.retrieve_array_subset_ndarray::<u16>(&subset_4x2)?;
println!("The middle 4x2 subset is:\n{:?}\n", data_4x2);
println!("The middle 4x2 subset is:\n{data_4x2}\n");

// Decode inner chunks
// In some cases, it might be preferable to decode inner chunks in a shard directly.
Expand Down Expand Up @@ -146,7 +146,7 @@ fn sharded_array_write_read() -> Result<(), Box<dyn std::error::Error>> {
for (inner_chunk_subset, decoded_inner_chunk) in
std::iter::zip(inner_chunks_to_decode, decoded_inner_chunks)
{
println!("{inner_chunk_subset:?}\n{decoded_inner_chunk:?}\n");
println!("{inner_chunk_subset}\n{decoded_inner_chunk}\n");
}

// Show the hierarchy
Expand Down
8 changes: 4 additions & 4 deletions examples/zip_array_write_read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,17 @@ fn read_array_from_store<TStorage: ReadableStorageTraits + 'static>(
// Read the whole array
let subset_all = ArraySubset::new_with_shape(array.shape().to_vec());
let data_all = array.retrieve_array_subset_ndarray::<f32>(&subset_all)?;
println!("The whole array is:\n{:?}\n", data_all);
println!("The whole array is:\n{data_all}\n");

// Read a chunk back from the store
let chunk_indices = vec![1, 0];
let data_chunk = array.retrieve_chunk_ndarray::<f32>(&chunk_indices)?;
println!("Chunk [1,0] is:\n{data_chunk:?}\n");
println!("Chunk [1,0] is:\n{data_chunk}\n");

// Read the central 4x2 subset of the array
let subset_4x2 = ArraySubset::new_with_ranges(&[2..6, 3..5]); // the center 4x2 region
let data_4x2 = array.retrieve_array_subset_ndarray::<f32>(&subset_4x2)?;
println!("The middle 4x2 subset is:\n{:?}\n", data_4x2);
println!("The middle 4x2 subset is:\n{data_4x2}\n");

Ok(())
}
Expand Down Expand Up @@ -167,7 +167,7 @@ fn zip_array_write_read() -> Result<(), Box<dyn std::error::Error>> {

let zip_key = StoreKey::new("zarr_array.zip")?;
println!(
"Create a ZipStorageAdapter for store at {:?} with {:?}",
"Create a ZipStorageAdapter for store at {:?} with {}",
path.path(),
zip_key
);
Expand Down

0 comments on commit c4283f1

Please sign in to comment.