Yet Another XArray-like Julia Package
YAXArrays.jl is a package to handle gridded data that is larger than memory. It enables the DiskArray.jl package to access the data lazily and provides map
and mapCube
to apply user defined functions on arbitrary subsets of the axes. These computations are also easily parallelized either via Distributed or via Threads.
With YAXArrays.jl 0.5 we switched the underlying data type to be a subtype of the DimensionalData.jl types. Therefore the indexing with named dimensions changed to the DimensionalData syntax. See the DimensionalData.jl docs and the `Switch to DimensionalData section in our docs.
Install the YAXArrays package:
julia>]
pkg> add YAXArrays
You may check the installed version with:
] st YAXArrays
Start using the package:
using YAXArrays
Let's assemble a YAXArray
with 3 RangeAxis
, i.e. time, x,y and a CategoricalAxis
with two variables.
axlist = [
RangeAxis("time", range(1, 20, length=20)),
RangeAxis("x", range(1, 10, length=10)),
RangeAxis("y", range(1, 5, length=15)),
CategoricalAxis("Variable", ["var1", "var2"])]
and the corresponding data.
data = rand(20, 10, 15, 2)
You might also add additional properties via a Dictionary, namely
props = Dict(
"time" => "days",
"x" => "lon",
"y" => "lat",
"var1" => "one of your variables",
"var2" => "your second variable",
)
And our first YAXArray is built with:
ds = YAXArray(axlist, data, props)
YAXArray with the following dimensions
time Axis with 20 Elements from 1.0 to 20.0
x Axis with 10 Elements from 1.0 to 10.0
y Axis with 15 Elements from 1.0 to 5.0
Variable Axis with 2 elements: var1 var2
Total size: 46.88 KB
For axis can be via .
ds.x.values
1.0:1.0:10.0
and the complete data for one of our variables, i.e. var1
can be accessed via:
ds[variable = "var1"].data
For more please take a look at the documentation.