Skip to content

Commit

Permalink
fix(docs): Use codec identifiers in the example for `experimental_cod…
Browse files Browse the repository at this point in the history
…ec_names` remapping
  • Loading branch information
LDeakin committed Feb 21, 2025
1 parent e35bc65 commit a146398
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Reenable broken compatibility tests since fixed in `zarr-python`/`numcodecs`
- **Breaking**: move the `zarrs::array::{data_type,fill_value}` modules into the `zarrs_data_type` crate
- Bump `lru` to 0.13
- Use codec identifiers in the example for `experimental_codec_names` remapping

## [0.19.2] - 2025-02-13

Expand Down
7 changes: 4 additions & 3 deletions zarrs/doc/status/codecs_experimental.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ This is intentional to encourage standardisation of some of these experimental c
To enable support, the `numcodecs` codec names needs to be remapped to the identifier of the `zarrs` codec:
```rust,ignore
{
use zarrs_metadata::v3::array::codec;
let mut config = crate::config::global_config_mut();
let experimental_codec_names = config.experimental_codec_names_mut();
experimental_codec_names.insert("zfp".to_string(), "numcodecs.zfpy".to_string());
experimental_codec_names.insert("pcodec".to_string(), "numcodecs.pcodec".to_string());
experimental_codec_names.insert("bz2".to_string(), "numcodecs.bz2".to_string());
experimental_codec_names.insert(codec::zfp::IDENTIFIER.to_string(), "numcodecs.zfpy".to_string());
experimental_codec_names.insert(codec::pcodec::IDENTIFIER.to_string(), "numcodecs.pcodec".to_string());
experimental_codec_names.insert(codec::bz2::IDENTIFIER.to_string(), "numcodecs.bz2".to_string());
}
```

Expand Down
16 changes: 13 additions & 3 deletions zarrs/src/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1184,11 +1184,21 @@ mod tests {
#[allow(dead_code)]
fn array_v3_numcodecs(path_in: &str) {
{
use zarrs_metadata::v3::array::codec;
let mut config = crate::config::global_config_mut();
let experimental_codec_names = config.experimental_codec_names_mut();
experimental_codec_names.insert("zfp".to_string(), "numcodecs.zfpy".to_string());
experimental_codec_names.insert("pcodec".to_string(), "numcodecs.pcodec".to_string());
experimental_codec_names.insert("bz2".to_string(), "numcodecs.bz2".to_string());
experimental_codec_names.insert(
codec::zfp::IDENTIFIER.to_string(),
"numcodecs.zfpy".to_string(),
);
experimental_codec_names.insert(
codec::pcodec::IDENTIFIER.to_string(),
"numcodecs.pcodec".to_string(),
);
experimental_codec_names.insert(
codec::bz2::IDENTIFIER.to_string(),
"numcodecs.bz2".to_string(),
);
}

let store = Arc::new(FilesystemStore::new(path_in).unwrap());
Expand Down

0 comments on commit a146398

Please sign in to comment.