Yet Another XArray-like Julia Package
Install the YAXArrays package:
julia>]
pkg> add YAXArrays
You may check the installed version with:
] st YAXArrays
Start using the package:
using YAXArrays
Quick start
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
Getting data back from a YAXArray
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.