Comments (6)
No the docs aren't amazing yet. I'm mostly trying to build functionality to support GeoData.jl and things are still changing a lot. You can always look through the tests fo more examples (for most julia packages it's usually a good idea most of it has to be in there, and it should be fairly easy to read)
But I will add some better examples for constructing DimensionalArrays
.
For your example: currently you can't construct a dimensional array with that much information. I could allow a basic type that just has dim names and no values, but currently the dims are indexes.
So in Time
you would want to put some array or range of DateTime or unitful times matching the length of the dimension, or a tuple of numbers/unitful times for the start and end points. Then you can then use them to index. Otherwise all you are getting from the package is dimension order...
So something like this (but use whatever you want for the indexes):
using Unitful
A = DimensionalArray(rand(10,2),(Time((1u"d", 10u"d")), X(10:10:20)))
julia> A[Time(At(3u"d"))]
2-element DimensionalArray{Float64,1,Tuple{X{StepRange{Int64,Int64},Nothing,Order{DimensionalData.Forward,DimensionalData.Forward}}},Tuple{Time{Quantity{Float64,𝐓,Unitful.FreeUnits{(d,),𝐓,nothing}},Nothing,Order{DimensionalData.Forward,DimensionalData.Forward}}},Array{Float64,1}}:
0.507109957352055
0.5135603136916305
from dimensionaldata.jl.
Thank you! That's very helpful.
And yes, I should have thought to look at the tests. My bad.
from dimensionaldata.jl.
No, really it is useful feedback! there should be more examples of how to actually use this, I'm just not sure when I will write them.
Honestly DimensionalArray was kind of an afterthought/placeholder - this package was built to extend more than to use directly. But I guess DimensionalArray is actually useful.
from dimensionaldata.jl.
I totally understand!
And yes, I think DimensionalArray is helpful. I see the advantage of defining one's own custom type here, but I like the idea of composing pre-made elements. For instance, I have been composing AxisArray
objects with MetaArray
which has simplified a number of patterns for me, and I could see how DimensionalArray
could make this an even better approach.
from dimensionaldata.jl.
Ok interesting. I haven't tried using it like that.
What happens to the axes when you index a slice of the MetaArray? Does it keep both the axes and your metadata?
DimensionalData is designed to be extended more than wrapped - inheriting from AbstractDimensionalArray. Adding a dims field and a rebuild method is nearly all you need to do.
They should work and rebuild in place with your metadata and updated dims, for most base or stats methods you use on it (missing a few still).
As an example, the definition of DimensionalArray is tiny and you don't even need all of that (you can choose to ignore refdims, they are just for plot labels and tracking slice history:
https://github.com/rafaqz/DimensionalData.jl/blob/master/src/array.jl#L79-L113
from dimensionaldata.jl.
from dimensionaldata.jl.
Related Issues (20)
- StackOverflow when constructing table from DimArray with single dimension HOT 2
- stable docs link is broken HOT 3
- support Julia 1.9
- error showing DimArray HOT 6
- DimensionMismatch with `cat` HOT 10
- Improvements to docstrings HOT 12
- Cannot get my own `Categorical` order to work HOT 2
- docs/stable toggle in readme returns 404 HOT 2
- broadcast_dims.(*, ..., ...) no method matching order(::Vector{Vector{Int64}}) HOT 3
- Typo in function name HOT 3
- Accessing the dimension combinations HOT 9
- add title to DimArray HOT 3
- Where and isnan issues HOT 1
- `using DimensionalData.Lookups` in docs does not work HOT 4
- can't `cat` two empty vectors HOT 1
- Dimension labels do not plot in Makie on 0.27.0
- Use DataAPI.jl metadata function HOT 1
- Optimise selectors like `Near` and `Contains` on `Regular` lookups
- Copy of Dictionary of DimArrays creates views HOT 2
- Plot of one dimensional DimArray ignores the lookup values of the dimensions HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dimensionaldata.jl.