diff --git a/README.md b/README.md index f6dae575..878ab9e0 100644 --- a/README.md +++ b/README.md @@ -112,15 +112,15 @@ using YAXArrays: YAXArrays as YAX axlist = ( YAX.time(range(1, 20, length=20)), - X(range(1, 10, length=10)), - Y(range(1, 5, length=15)), + lon(range(1, 10, length=10)), + lat(range(1, 5, length=15)), Variables(["var1", "var2"])) ``` ``` ↓ time 1.0:1.0:20.0, -→ X 1.0:1.0:10.0, -↗ Y 1.0:0.2857142857142857:5.0, -⬔ Variable ["var1", "var2"] +→ lon 1.0:1.0:10.0, +↗ lat 1.0:0.2857142857142857:5.0, +⬔ Variables ["var1", "var2"] ``` and the corresponding data. @@ -150,8 +150,8 @@ ds = YAXArray(axlist, data, props) │ 20×10×15×2 YAXArray{Float64,4} │ ├────────────────────────────────┴─────────────────────────────────────────────── dims ┐ ↓ time Sampled{Float64} 1.0:1.0:20.0 ForwardOrdered Regular Points, - → X Sampled{Float64} 1.0:1.0:10.0 ForwardOrdered Regular Points, - ↗ Y Sampled{Float64} 1.0:0.2857142857142857:5.0 ForwardOrdered Regular Points, + → lon Sampled{Float64} 1.0:1.0:10.0 ForwardOrdered Regular Points, + ↗ lat Sampled{Float64} 1.0:0.2857142857142857:5.0 ForwardOrdered Regular Points, ⬔ Variable Categorical{String} ["var1", "var2"] ForwardOrdered ├──────────────────────────────────────────────────────────────────────────── metadata ┤ Dict{String, String} with 5 entries: @@ -170,17 +170,17 @@ ds = YAXArray(axlist, data, props) For axis can be via `.` ```julia -ds.X +ds.lon ``` ``` -X Sampled{Float64} ForwardOrdered Regular Points +lon Sampled{Float64} ForwardOrdered Regular Points wrapping: 1.0:1.0:10.0 ``` or better yet via `lookup` ```julia -lookup(ds, :X) +lookup(ds, :lon) ``` ``` Sampled{Float64} ForwardOrdered Regular Points @@ -189,7 +189,7 @@ wrapping: 1.0:1.0:10.0 note that also the `.data` field can be use ```julia -lookup(ds, :X).data +lookup(ds, :lon).data ``` ``` 1.0:1.0:10.0 @@ -198,15 +198,15 @@ lookup(ds, :X).data The data for one variables, i.e. `var1` can be accessed via: ```julia -ds[Variable=At("var1")] +ds[Variables=At("var1")] ``` ``` ╭──────────────────────────────╮ │ 20×10×15 YAXArray{Float64,3} │ ├──────────────────────────────┴────────────────────────────────────────────── dims ┐ ↓ time Sampled{Float64} 1.0:1.0:20.0 ForwardOrdered Regular Points, - → X Sampled{Float64} 1.0:1.0:10.0 ForwardOrdered Regular Points, - ↗ Y Sampled{Float64} 1.0:0.2857142857142857:5.0 ForwardOrdered Regular Points + → lon Sampled{Float64} 1.0:1.0:10.0 ForwardOrdered Regular Points, + ↗ lat Sampled{Float64} 1.0:0.2857142857142857:5.0 ForwardOrdered Regular Points ├───────────────────────────────────────────────────────────────────────── metadata ┤ Dict{String, String} with 5 entries: "var1" => "one of your variables" diff --git a/docs/src/UserGuide/combine.md b/docs/src/UserGuide/combine.md index 71a8e306..01df2e6b 100644 --- a/docs/src/UserGuide/combine.md +++ b/docs/src/UserGuide/combine.md @@ -31,6 +31,6 @@ using YAXArrays: YAXArrays as YAX temperature = YAXArray((YAX.time(1:6),), rand(6)) precipitation = YAXArray((YAX.time(1:6),), rand(6)) cubes = [temperature,precipitation] -var_axis = Dim{:variable}(["temp", "prep"]) +var_axis = Variables(["temp", "prep"]) combined = concatenatecubes(cubes, var_axis) ```` diff --git a/docs/src/UserGuide/compute.md b/docs/src/UserGuide/compute.md index 66bbb090..f9e033df 100644 --- a/docs/src/UserGuide/compute.md +++ b/docs/src/UserGuide/compute.md @@ -132,15 +132,15 @@ Note the `.` after `f`, this is because we will slice across time, namely, the f Here, we do create `YAXArrays` only with the desired dimensions as ````@ansi mapCube -lon = YAXArray(lon(range(1, 15))) -lat = YAXArray(lat(range(1, 10))) +lon_yax = YAXArray(lon(range(1, 15))) +lat_yax = YAXArray(lat(range(1, 10))) ```` And a time Cube's Axis ````@example mapCube tspan = Date("2022-01-01"):Day(1):Date("2022-01-30") -time = YAXArray(YAX.time(tspan)) +time_yax = YAXArray(YAX.time(tspan)) ```` note that the following can be extended to arbitrary `YAXArrays` with additional data and dimensions. @@ -148,7 +148,7 @@ note that the following can be extended to arbitrary `YAXArrays` with additional Let's generate a new `cube` using `mapCube` and saving the output directly into disk. ````@ansi mapCube -gen_cube = mapCube(g, (lon, lat, time); +gen_cube = mapCube(g, (lon_yax, lat_yax, time_yax); indims = (InDims(), InDims(), InDims("time")), outdims = OutDims("time", overwrite=true, path="my_gen_cube.zarr", backend=:zarr, outtype = Float32) @@ -172,7 +172,7 @@ gen_cube.data[1, :, :] but, we can generate a another cube with a different `output order` as follows ````@ansi mapCube -gen_cube = mapCube(g, (lon, lat, time); +gen_cube = mapCube(g, (lon_yax, lat_yax, time_yax); indims = (InDims("lon"), InDims(), InDims()), outdims = OutDims("lon", overwrite=true, path="my_gen_cube.zarr", backend=:zarr, outtype = Float32) @@ -209,7 +209,7 @@ axlist = ( YAX.time(Date("2022-01-01"):Day(1):Date("2022-01-05")), lon(range(1, 4, length=4)), lat(range(1, 3, length=3)), - Dim{:variables}(["a", "b"]) + Variables(["a", "b"]) ) Random.seed!(123) diff --git a/docs/src/UserGuide/faq.md b/docs/src/UserGuide/faq.md index 59f0d0a1..81402892 100644 --- a/docs/src/UserGuide/faq.md +++ b/docs/src/UserGuide/faq.md @@ -338,7 +338,7 @@ d_keys = keys(stocks) currently there is not direct support to obtain `dims` from a `TimeArray`, but we can code a function for it ````@example howdoi -getTArrayAxes(ta::TimeArray) = (YAX.time(timestamp(ta)), Dim{:variable}(colnames(ta)), ); +getTArrayAxes(ta::TimeArray) = (YAX.time(timestamp(ta)), Variables(colnames(ta)), ); nothing # hide ```` then, we create the `YAXArrays` as diff --git a/docs/src/get_started.md b/docs/src/get_started.md index 51cb70fc..2af42a7c 100644 --- a/docs/src/get_started.md +++ b/docs/src/get_started.md @@ -28,14 +28,12 @@ a = YAXArray(rand(2,3)) Assemble a more complex `YAXArray` with 4 dimensions, i.e. time, x, y and a variable type: ```@example quickstart -using DimensionalData - # axes or dimensions with name and tick values axlist = ( YAX.time(range(1, 20, length=20)), - X(range(1, 10, length=10)), - Y(range(1, 5, length=15)), - Dim{:variable}(["temperature", "precipitation"]) + lon(range(1, 10, length=10)), + lat(range(1, 5, length=15)), + Variables(["temperature", "precipitation"]) ) # the actual data matching the dimensions defined in axlist @@ -54,7 +52,7 @@ a2 = YAXArray(axlist, data, props) Get the temperature map at the first point in time: ```@example quickstart -a2[variable=At("temperature"), time=1].data +a2[Variables=At("temperature"), time=1].data ``` ## Updates