• Stars
    star
    256
  • Rank 153,673 (Top 4 %)
  • Language
    Julia
  • License
    MIT License
  • Created almost 5 years ago
  • Updated 8 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Named dimensions and indexing for julia arrays and other data

DimensionalData

CI Codecov Aqua.jl Quality Assurance

DimensionalData.jl provides tools and abstractions for working with datasets that have named dimensions, and optionally a lookup index. It provides no-cost abstractions for named indexing, and fast index lookups.

DimensionalData is a pluggable, generalised version of AxisArrays.jl with a cleaner syntax, and additional functionality found in NamedDims.jl. It has similar goals to pythons xarray, and is primarily written for use with spatial data in Rasters.jl.

The basic syntax is:

julia> using DimensionalData

julia> A = rand(X(50), Y(10.0:40.0))
50×31 DimArray{Float64,2} with dimensions: 
  X,
  Y Sampled{Float64} 10.0:1.0:40.0 ForwardOrdered Regular Points
 10.0         11.0       12.0       13.0       14.0        15.0       16.0        17.0       …  32.0       33.0        34.0       35.0       36.0        37.0       38.0        39.0       40.0
  0.293347     0.737456   0.986853   0.780584   0.707698    0.804148   0.632667    0.780715      0.767575   0.555214    0.872922   0.808766   0.880933    0.624759   0.803766    0.796118   0.696768
  0.199599     0.290297   0.791926   0.564099   0.0241986   0.239102   0.0169679   0.186455      0.644238   0.467091    0.524335   0.42627    0.982347    0.324083   0.0356058   0.306446   0.117187
  ⋮                                                         ⋮                                ⋱                                     ⋮                                                        ⋮
  0.720404     0.388392   0.635609   0.430277   0.943823    0.661993   0.650442    0.91391   …   0.299713   0.518607    0.411973   0.410308   0.438817    0.580232   0.751231    0.519257   0.598583
  0.00602102   0.270036   0.696129   0.139551   0.924883    0.190963   0.164888    0.13436       0.717962   0.0452556   0.230943   0.848782   0.0362465   0.363868   0.709489    0.644131   0.801824

julia> A[Y=1:10, X=1]
10-element DimArray{Float64,1} with dimensions: 
  Y Sampled{Float64} 10.0:1.0:19.0 ForwardOrdered Regular Points
and reference dimensions: X
 10.0  0.293347
 11.0  0.737456
 12.0  0.986853
 13.0  0.780584
  â‹®    
 17.0  0.780715
 18.0  0.472306
 19.0  0.20442

See the docs for more details

Some properties of DimensionalData.jl objects:

  • broadcasting and most Base methods maintain and sync dimension context.
  • comprehensive plot recipes for Plots.jl.
  • a Tables.jl interface with DimTable
  • multi-layered DimStacks that can be indexed together, and have base methods applied to all layers.
  • the Adapt.jl interface for use on GPUs, even as GPU kernel arguments.
  • traits for handling a wide range of spatial data types accurately.

Methods where dims can be used containing indices or Selectors

getindex, setindex! view

Methods where dims, dim types, or Symbols can be used to indicate the array dimension:

  • size, axes, firstindex, lastindex
  • cat, reverse, dropdims
  • reduce, mapreduce
  • sum, prod, maximum, minimum,
  • mean, median, extrema, std, var, cor, cov
  • permutedims, adjoint, transpose, Transpose
  • mapslices, eachslice

Methods where dims can be used to construct DimArrays:

  • fill, ones, zeros, falses, trues, rand

Note: recent changes have greatly reduced the exported API

Previously exported methods can me brought into global scope by using the sub-modules they have been moved to - LookupArrays and Dimensions:

using DimensionalData
using DimensionalData.LookupArrays, DimensionalData.Dimensions

Alternate Packages

There are a lot of similar Julia packages in this space. AxisArrays.jl, NamedDims.jl, NamedArrays.jl are registered alternative that each cover some of the functionality provided by DimensionalData.jl. DimensionalData.jl should be able to replicate most of their syntax and functionality.

AxisKeys.jl and AbstractIndices.jl are some other interesting developments. For more detail on why there are so many similar options and where things are headed, read this thread.

The main functionality is explained here, but the full list of features is listed at the API page.

More Repositories

1

Rasters.jl

Raster manipulation for the Julia language
Julia
195
star
2

citation.vim

Zotero and bibtex citations for Vim
Python
94
star
3

Interfaces.jl

Macros to define and implement interfaces, to ensure they are checked and correct.
Julia
67
star
4

ranger.vim

Ranger file manager for Vim
Vim Script
65
star
5

SegmentAnything.jl

segment-anything wrapped for Julia
Julia
53
star
6

ModelParameters.jl

Easy, standardised parameter get/set for heterogeneous or nested immutable models.
Julia
52
star
7

Mixers.jl

Julia mixin macros. Mixed, not stirred
Julia
37
star
8

Flatten.jl

Flatten nested Julia objects to tuples, and reconstruct them later
Julia
32
star
9

FieldMetadata.jl

Metadata for julia fields
Julia
22
star
10

UnitfulMoles.jl

Utilities for working with Mole units for the Julia language
Julia
15
star
11

Stencils.jl

Static Stencil mapping for Julia
Julia
8
star
12

DEBplant

Scripts for a Dynamic Energy Budget plant model with microclimate interaction
Julia
8
star
13

FieldDefaults.jl

Flexible, overridable default field values
Julia
7
star
14

Extents.jl

A shared Extent object for Julia spatial data, with DE-9IM spatial predicates
Julia
4
star
15

ClimateBlock

Block media that denies climate change, in your browser
JavaScript
4
star
16

Photosynthesis.jl

A dedicated photosynthesis library in Julia
Julia
4
star
17

AutoInteract.jl

A Julia package for the automatic generation of interfaces
Julia
4
star
18

MakieDraw.jl

Julia
3
star
19

LandscapeChange.jl

Julia
3
star
20

Microclimate.jl

Local microclimate data for Julia
Julia
2
star
21

FieldDocTables.jl

Tables for field documentation and metadata
Julia
2
star
22

Codify.jl

Keyword constructor code from any nested type
Julia
2
star
23

.dotfiles

Python
2
star
24

MapRasterization.jl

Turn maps into raster files
Julia
2
star
25

maespa

Fortran
2
star
26

PlotNested.jl

Plot all the arrays on a nested struct, or just the ones you select. Under development
Julia
2
star
27

GBIF2.jl

Easy and consistent GBIF quieries with Tables.jl compatible results.
Julia
2
star
28

Nested.jl

Build high performance @generated functions over nested types
Julia
2
star
29

DispersalScripts.jl

Julia
1
star
30

UnitfulConventionalMoles.jl

Definition of mol units for elements with known molecular masses.
Julia
1
star
31

DynamicEnergyBudgets.jl

Flexible Dynamic Energy Budget models in the Julia language
Julia
1
star
32

GeoData.jl

Archive of GeoData.jl, which is replaced by Rasters.jl
Julia
1
star
33

SimpleRoots.jl

Simple root finding methods in Julia
Julia
1
star
34

off_install_profile

1
star
35

TypeArrays.jl

"Julia arrays as types"
Julia
1
star