Skip to content

Commit 420b468

Browse files
committed
feat: Base.get for AbstractDataVariable
1 parent b18a8f2 commit 420b468

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/variable.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ for f in (:getindex,)
2323
@eval Base.$f(var::AbstractDataVariable, I::Vararg{Int}) = $f(parent(var), I...)
2424
end
2525

26+
Base.get(var::AbstractDataVariable, s, d=nothing) = get(meta(var), s, d)
27+
Base.get(f::Function, var::AbstractDataVariable, s) = get(f, meta(var), s)
28+
2629
tmin(v) = minimum(times(v))
2730
tmax(v) = maximum(times(v))
2831

@@ -53,9 +56,6 @@ function Base.show(io::IO, m::MIME"text/plain", var::T) where {T<:AbstractDataVa
5356
println(io, " Size: ", size(var))
5457
println(io, " Memory Usage: ", Base.format_bytes(Base.summarysize(var)))
5558
if (m = meta(var)) !== nothing
56-
println(io, " Metadata:")
57-
for (key, value) in sort(collect(m), by=x -> x[1])
58-
println(io, " ", key, ": ", value)
59-
end
59+
show_field(io, "Metadata", m)
6060
end
6161
end

0 commit comments

Comments
 (0)