DimensionalData.jl icon indicating copy to clipboard operation
DimensionalData.jl copied to clipboard

add `name` etc keywords to `DimArray` `similar`

Open haakon-e opened this issue 1 year ago • 1 comments

Currently, you can do

a = zeros(X(1:3), Y(1:2), name="hi")
# prints
╭────────────────────────────╮
│ 3×2 DimArray{Float64,2} hi │
├────────────────────────────┴──────────────────── dims ┐
  ↓ X Sampled{Int64} 1:3 ForwardOrdered Regular Points,
  → Y Sampled{Int64} 1:2 ForwardOrdered Regular Points
└───────────────────────────────────────────────────────┘
 ↓ →  1    2
 1    0.0  0.0
 2    0.0  0.0
 3    0.0  0.0

but not

similar(a, name="hello")

maybe there's other instances too that I can track down and patch. I'll try and add a PR if this seems reasonable.

haakon-e avatar Jun 25 '24 17:06 haakon-e

Ah maybe similar missed out on keywords back then, most other constructor methods e.g. rand/fill got them.

Feel free to add them.

rafaqz avatar Jun 25 '24 21:06 rafaqz