Skip to content

Commit

Permalink
Add --dimension-names reencoding option to various tools
Browse files Browse the repository at this point in the history
Disable CI semver check because lib is not intended for public use and docs are hidden anyway
  • Loading branch information
LDeakin committed Jul 10, 2024
1 parent 47c3d94 commit 391d144
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ jobs:
- run: rustup component add clippy
- uses: Swatinem/rust-cache@v2
- run: cargo clippy --all-features -- -D warnings
semver:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check semver
uses: obi1kenobi/cargo-semver-checks-action@v2
# semver:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Check semver
# uses: obi1kenobi/cargo-semver-checks-action@v2
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed
- Add `--dimension-names` arg to `zarrs_filter`, `zarrs_ome`, `zarrs_reencode` to change dimension names

### Fixed
- Remove unused `http` feature from `zarrs` dependency

Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 13 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,10 @@ pub struct ZarrReencodingArgs {
#[arg(long, verbatim_doc_comment)]
pub bytes_to_bytes_codecs: Option<String>,

/// Dimension names (optional). Comma separated.
#[arg(long, verbatim_doc_comment, value_delimiter = ',')]
pub dimension_names: Option<Vec<String>>,

/// Attributes (optional).
///
/// JSON holding array attributes.
Expand Down Expand Up @@ -356,7 +360,10 @@ impl ZarrReencodingArgs {
|| self.bytes_to_bytes_codecs.is_some()
{
ZarrReEncodingChangeType::MetadataAndChunks
} else if self.attributes.is_some() || self.attributes_append.is_some() {
} else if self.dimension_names.is_some()
|| self.attributes.is_some()
|| self.attributes_append.is_some()
{
ZarrReEncodingChangeType::Metadata
} else {
ZarrReEncodingChangeType::None
Expand Down Expand Up @@ -531,6 +538,11 @@ pub fn get_array_builder_reencode<TStorage: ?Sized>(
array_builder.data_type(data_type.clone());
}

if let Some(dimension_names) = encoding_args.dimension_names.clone() {
// TODO: Remove clone with zarrs 0.15.1+
array_builder.dimension_names(dimension_names.into());
}

if let Some(fill_value) = &encoding_args.fill_value {
// An explicit fill value was supplied
let fill_value = array_builder
Expand Down

0 comments on commit 391d144

Please sign in to comment.