Skip to content

JuliaDataCubes/YAXArrayBase.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YAXArrayBase.jl

Lifecycle Build Status codecov.io

YAXArrayBase

A package defining an interface to work with named dimension that might have values associated with them.

Suported backends:

  • DimensionalData
  • AxisArrays
  • AxisIndices
  • YAXArrays
  • NamedDims
  • ArchGDAL raster types

Usage

Conversion between axis array types

using AxisArrays, DimensionalData, YAXArrayBase
a = AxisArray(rand(10,2), row = 11:20, col=["One","Two"])
2-dimensional AxisArray{Float64,2,...} with axes:
    :row, 11:20
    :col, ["One", "Two"]
And data, a 10×2 Array{Float64,2}:
 0.0467821  0.116614
 0.944797   0.827642
 0.593597   0.883222
 0.365977   0.368537
 0.486696   0.591154
 0.622487   0.572724
 0.805211   0.0480554
 0.570345   0.627014
 0.687585   0.936112
 0.149575   0.237352
yaxconvert(DimensionalArray,a)
DimensionalArray with dimensions:
Dim row (type Dim): 11:20
Dim col (type Dim): String[One, Two]
and data: 10×2 Array{Float64,2}
0.0467821  0.116614
0.944797   0.827642
0.593597   0.883222
0.365977   0.368537
0.486696   0.591154
0.622487   0.572724
0.805211   0.0480554
0.570345   0.627014
0.687585   0.936112
0.149575   0.237352

The axis array interface

This is done through the axis array interface, the most important functions are dimvals and dimnames:

dimnames(a)
(:row, :col)
dimvals(a,1)
11:20

Look at src/axisinterface to get a full description of the interface.