Skip to content

Commit

Permalink
Merge pull request #445 from JuliaDataCubes/continue_compression
Browse files Browse the repository at this point in the history
Continue compression
  • Loading branch information
lazarusA authored Sep 22, 2024
2 parents f73d520 + e3d1cd0 commit 53bc71c
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions docs/src/UserGuide/write.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ Save an entire Dataset to a directory:
savedataset(ds, path="ds.zarr", driver=:zarr)
nothing # hide
````
### zarr compression
Save a dataset to Zarr format with compression:

````@example write
n = 9 # compression level, number between 0 (no compression) and 9 (max compression)
compression = Zarr.BloscCompressor(; clevel=n)
savedataset(ds; path="ds_c.zarr", driver=:zarr, compressor=compression)
nothing # hide
````

More on [Zarr Compressors](https://juliaio.github.io/Zarr.jl/latest/reference/#Compressors). Also, if you use this option and don't notice a significant improvement, please feel free to open an issue or start a discussion.

## Write NetCDF

Expand All @@ -45,6 +57,23 @@ savedataset(ds, path="ds.nc", driver=:netcdf)
nothing # hide
````

### netcdf compression
Save a dataset to NetCDF format with compression:

````@example write
n = 7 # compression level, number between 0 (no compression) and 9 (max compression)
savedataset(ds, path="ds_c.nc", driver=:netcdf, compress=n)
nothing # hide
````

Comparing it to the default saved file

````@example write
ds_info = stat("ds.nc")
ds_c_info = stat("ds_c.nc")
println("File size: ", "default: ", ds_info.size, " bytes", ", compress: ", ds_c_info.size, " bytes")
````

## Overwrite a Dataset
If a path already exists, an error will be thrown. Set `overwrite=true` to delete the existing dataset

Expand Down

0 comments on commit 53bc71c

Please sign in to comment.