1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//! N-dimensional arrays as an Arrow extension type.
//!
//! - [`NdArrowArray`]: one N-dimensional array: flat values, named
//! [`Dimensions`] and [`Attributes`].
//! - [`NdArrayType`]: the `nd_arrow.array` Arrow extension type. Its storage
//! is `Struct { values, dim_names, dim_sizes, attrs }`.
//! - [`NdColumn`]: an Arrow column of the extension type. Each row is one
//! [`NdArrowArray`].
//! - [`NdRecordBatch`]: nd arrays over a shared target grid, encoded as a
//! [`RecordBatch`](arrow::record_batch::RecordBatch) of nd columns.
//! - [`compute`]: kernels with NumPy and xarray semantics (layout,
//! arithmetic, reductions, search, interpolation, CF decoding).
//! - [`tensor`]: conversion to and from the Arrow canonical tensor types.
//!
//! Features: `parallel` runs large gathers and reductions with rayon;
//! `ndarray` adds conversion to and from `ndarray::ArrayD`.
//!
//! # Example
//!
//! ```
//! use std::sync::Arc;
//!
//! use arrow::array::Float64Array;
//! use nd_arrow_array::compute::{Selector, Slice};
//! use nd_arrow_array::{Attributes, Dimensions, NdArrowArray, NdColumn};
//!
//! # fn main() -> nd_arrow_array::Result<()> {
//! let sst = NdArrowArray::try_new(
//! Arc::new(Float64Array::from(vec![10.0, 11.0, 12.0, 14.0, 15.0, 16.0])),
//! Dimensions::try_new([("time", 2), ("lat", 3)])?,
//! )?
//! .with_attributes(Attributes::new().with("units", "degC"));
//!
//! // Anomaly against the time mean: the mean broadcasts back by name.
//! let anomaly = (&sst - &sst.mean(Some(&["time"]))?)?;
//! let north = anomaly.isel(&[("lat", Selector::Slice(Slice::range(1, 3)))])?;
//! assert_eq!(north.shape(), vec![2, 2]);
//! println!("{north}");
//!
//! // One row of an Arrow column with the `nd_arrow.array` extension type.
//! let column = NdColumn::try_from_arrays([&sst])?;
//! assert_eq!(column.value(0), sst);
//! # Ok(())
//! # }
//! ```
pub use NdArrowArray;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;