Skip to content

Commit

Permalink
Merge pull request #436 from JuliaDataCubes/la/issues
Browse files Browse the repository at this point in the history
issues 413 and 76
  • Loading branch information
lazarusA authored Sep 11, 2024
2 parents b6b8d14 + b6ef8fa commit 1a38f32
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
26 changes: 25 additions & 1 deletion docs/src/UserGuide/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 3 additions & 2 deletions docs/src/UserGuide/write.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
````

Expand All @@ -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[:,:,:])
Expand Down

0 comments on commit 1a38f32

Please sign in to comment.