-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #395 from danlooo/refactor_documentation
Refactor and Simplify Documentation
- Loading branch information
Showing
26 changed files
with
748 additions
and
761 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Combine YAXArrays | ||
|
||
Data is often scattered across multiple files and corresponding arrays, e.g. one file per time step. | ||
This section describes methods on how to combine them into a single YAXArray. | ||
|
||
## `cat` along an existing dimension | ||
|
||
Here we use `cat` to combine two arrays consisting of data from the first and the second half of a year into one single array containing the whole year. | ||
We glue the arrays along the first dimension using `dims = 1`: | ||
The resulting array `whole_year` still has one dimension, i.e. time, but with 12 instead of 6 elements. | ||
|
||
````@example cat | ||
using YAXArrays | ||
first_half = YAXArray((Dim{:time}(1:6),), rand(6)) | ||
second_half = YAXArray((Dim{:time}(7:12),), rand(6)) | ||
whole_year = cat(first_half, second_half, dims = 1) | ||
```` | ||
|
||
## `concatenatecubes` to a new dimension | ||
|
||
Here we use `concatenatecubes` to combine two arrays of different variables that have the same dimensions. | ||
The resulting array `combined` has an additional dimension `variable` indicating from which array the element values originates. | ||
Note that using a `Dataset` instead is a more flexible approach in handling different variables. | ||
|
||
````@example concatenatecubes | ||
using YAXArrays | ||
temperature = YAXArray((Dim{:time}(1:6),), rand(6)) | ||
precipitation = YAXArray((Dim{:time}(1:6),), rand(6)) | ||
cubes = [temperature,precipitation] | ||
var_axis = Dim{:variable}(["temp", "prep"]) | ||
combined = concatenatecubes(cubes, var_axis) | ||
```` |
Oops, something went wrong.