rafaqz / DimensionalData.jl

Named dimensions and indexing for julia arrays and other data
https://rafaqz.github.io/DimensionalData.jl/stable/
MIT License
273 stars 38 forks source link

`Coord` printing should be limited #356

Open Datseris opened 2 years ago

Datseris commented 2 years ago

Because by nature the Coord dimension is typically used with vector values, its printing becomes really long. Example:

julia> dims(C)
Coord 1028-element CoordLookupArray{SVector{2, Float32}, Vector{SVector{2, Float32}}, Tuple{UnionAll, UnionAll}, NoMetadata}:
 [0.0, -86.0]
 [120.0, -86.0]
 [240.0, -86.0]
 [0.0, -82.0]
 [72.0, -82.0]
 [144.0, -82.0]
 [216.0, -82.0]
 [288.0, -82.0]
 [0.0, -78.0]
 [51.4286, -78.0]
 [102.857, -78.0]
 [154.286, -78.0]
 [205.714, -78.0]
 [257.143, -78.0]
 [308.571, -78.0]
 [0.0, -74.0]
 ⋮
 [0.0, 82.0]
 [72.0, 82.0]
 [144.0, 82.0]
 [216.0, 82.0]
 [288.0, 82.0]
 [0.0, 86.0]
 [120.0, 86.0]
 [240.0, 86.0],
Ti Sampled Date("2000-03-15"):Month(1):Date("2020-02-15") ForwardOrdered Regular Points

(I've actually significantly shortened the output)

Where in the printing pipeline is this happening? I think the solution is really a simple IOContext(limited = true).

Datseris commented 2 years ago

Furthermore I've noticed that Coord does not have the nice prinitng that the other dimensions have, and instead its entire type is simply dumped as a summary. Not sure why. I guess with 0.19 Coord is no longer an actual Dimension but rather a LookupArray?

rafaqz commented 2 years ago

Want to write a PR?

Datseris commented 2 years ago

Sure, would be happy to. I would have done it already, but I actually couldn't find where in the printing pipeline I have to intervene... give me some initial direction and I can take it from there.

rafaqz commented 2 years ago

Probably CoordLookupArray needs a show method. See the defaults in LookupArrays/show.jl