Giter VIP home page Giter VIP logo

Comments (6)

rafaqz avatar rafaqz commented on May 26, 2024

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.

haberdashPI avatar haberdashPI commented on May 26, 2024

Thank you! That's very helpful.

And yes, I should have thought to look at the tests. My bad.

from dimensionaldata.jl.

rafaqz avatar rafaqz commented on May 26, 2024

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.

haberdashPI avatar haberdashPI commented on May 26, 2024

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.

rafaqz avatar rafaqz commented on May 26, 2024

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.

haberdashPI avatar haberdashPI commented on May 26, 2024

from dimensionaldata.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.