Skip to content

Commit f1cd2e8

Browse files
Merge branch 'main' of github.com:JuliaGeo/CommonDataModel.jl
2 parents 17b3f74 + 4551720 commit f1cd2e8

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/CommonDataModel.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module CommonDataModel
22

3-
using Base.Broadcast: Broadcasted, BroadcastStyle
3+
using Base.Broadcast: Broadcasted, BroadcastStyle, DefaultArrayStyle
4+
45
using CFTime
56
using Dates
67
using Printf

src/groupby.jl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ function Base.similar(bc::Broadcasted{GroupedVariableStyle}, ::Type{ElType}) wh
264264
return A
265265
end
266266

267-
function Base.broadcasted(f::Function,A::GroupedVariable{TV,TF,TGM,TM,TG}) where {TV,TF,TGM,TM,TG}
267+
function Base.broadcasted(::GroupedVariableStyle,f::Function,A::GroupedVariable{TV,TF,TGM,TM,TG}) where {TV,TF,TGM,TM,TG}
268268
# TODO change output TG
269269

270270
map_fun = (f,A.map_fun)
@@ -457,7 +457,10 @@ defAttrib(gr::ReducedGroupedVariable,attribname::SymbolOrString,value) =
457457
gr._attrib[attribname] = value
458458

459459
struct ReducedGroupedVariableStyle <: BroadcastStyle end
460+
460461
Base.BroadcastStyle(::Type{<:ReducedGroupedVariable}) = ReducedGroupedVariableStyle()
462+
Base.BroadcastStyle(::DefaultArrayStyle,::ReducedGroupedVariableStyle) = ReducedGroupedVariableStyle()
463+
Base.BroadcastStyle(::ReducedGroupedVariableStyle,::DefaultArrayStyle) = ReducedGroupedVariableStyle()
461464

462465
function Base.similar(bc::Broadcasted{ReducedGroupedVariableStyle}, ::Type{ElType}) where ElType
463466
# Scan the inputs for the ReducedGroupedVariable:
@@ -503,12 +506,12 @@ function broadcasted_gvr!(C,f,A,B)
503506
end
504507

505508

506-
Base.broadcasted(f::Function,A,B::ReducedGroupedVariable) =
509+
Base.broadcasted(::ReducedGroupedVariableStyle,f::Function,A,B::ReducedGroupedVariable) =
507510
broadcasted_gvr!(similar(A),f,A,B)
508-
Base.broadcasted(f::Function,A::ReducedGroupedVariable,B) =
511+
Base.broadcasted(::ReducedGroupedVariableStyle,f::Function,A::ReducedGroupedVariable,B) =
509512
broadcasted_gvr!(similar(B),f,A,B)
510513

511-
function Base.broadcasted(f::Function,A::ReducedGroupedVariable,B::ReducedGroupedVariable)
514+
function Base.broadcasted(::ReducedGroupedVariableStyle,f::Function,A::ReducedGroupedVariable,B::ReducedGroupedVariable)
512515
# undecided what to do
513516
# method needs to be there to avoid ambiguities
514517
error("unimplemented");

0 commit comments

Comments
 (0)