From b6ef8fac2c56a04a02f2173d8ba962da1e50c3b3 Mon Sep 17 00:00:00 2001 From: Lazaro Alonso Date: Wed, 11 Sep 2024 20:32:09 +0200 Subject: [PATCH] issues 413 and 76 --- docs/src/UserGuide/faq.md | 26 +++++++++++++++++++++++++- docs/src/UserGuide/write.md | 5 +++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/docs/src/UserGuide/faq.md b/docs/src/UserGuide/faq.md index d5ad6cdd..175288d6 100644 --- a/docs/src/UserGuide/faq.md +++ b/docs/src/UserGuide/faq.md @@ -29,10 +29,34 @@ dims(c) ::: info -Also, use __`DD.rebuild(ax, values)`__ instead of `axcopy(ax, values)` to copy an axes with the same name but different values. +Also, use __`DD.rebuild(c, values)`__ to copy axes from `c` and build a new cube but with different values. ::: +### rebuild +As an example let's consider the following + +````@example howdoi +using YAXArrays +using DimensionalData + +c = YAXArray(ones(Int, 10,10)) +```` + +then creating a new `c` with the same structure (axes) but different values is done by + +````@ansi howdoi +new_c = rebuild(c, rand(10,10)) +```` + +note that the type is now `Float64`. Or, we could create a new structure but using the dimensions from `yax` explicitly + +````@ansi howdoi +c_c = YAXArray(dims(c), rand(10,10)) +```` + +which achieves the same goal as `rebuild`. + ## Obtain values from axes and data from the cube There are two options to collect values from axes. In this examples the axis ranges from 1 to 10. diff --git a/docs/src/UserGuide/write.md b/docs/src/UserGuide/write.md index 9c21f5d2..3d047041 100644 --- a/docs/src/UserGuide/write.md +++ b/docs/src/UserGuide/write.md @@ -95,7 +95,7 @@ a = YAXArray(Zeros(Union{Missing, Float32}, 5, 4, 5)) Now, save to disk with ````@example write -r = savecube(a, "skeleton.zarr", driver=:zarr, skeleton=true, overwrite=true) +r = savecube(a, "skeleton.zarr", layername="skeleton", driver=:zarr, skeleton=true, overwrite=true) nothing # hide ```` @@ -105,8 +105,9 @@ nothing # hide ::: +Note also that if `layername="skeleton"` is not provided then the `default name` for the cube variable will be `layer`. -and check that all the values are `missing` +Now, we check that all the values are `missing` ````@example write all(ismissing, r[:,:,:])