Skip to content

Commit

Permalink
Merge branch 'main' into tutorial1
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander-Barth committed Dec 19, 2023
2 parents 82d7966 + cf0b814 commit 7f80bef
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 1 addition & 4 deletions src/groupby.jl
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,11 @@ function Base.broadcasted(f,A::GroupedVariable{TV,TF,TClass,TM,TG}) where {TV,TF
A.v,A.coordname,A.group_fun,A.class,A.unique_class,A.dim,map_fun)
end



function GroupedVariable(v::TV,coordname,group_fun::TF,class,unique_class,dim,map_fun::TM) where TV <: AbstractVariable where {TF,TM}
TClass = eltype(class)

#TG = Base.return_types(selectdim,(TV,Int,Int,))[1]
TG = Base.return_types(_array_selectdim,(TV,))[1]
TG = Base.return_types(_array_selectdim,(TV,Int,Vector{Int}))[1]

@debug "inferred types" TV TF TClass TM TG
GroupedVariable{TV,TF,TClass,TM,TG}(
Expand Down Expand Up @@ -395,7 +393,6 @@ end
Base.broadcasted(f,A,B::ReducedGroupedVariable) = broadcasted_gvr!(similar(A),f,A,B)
Base.broadcasted(f,A::ReducedGroupedVariable,B) = broadcasted_gvr!(similar(B),f,A,B)

_array_selectdim(x) = Array(selectdim(x,1,[1]))

function Base.Array(gr::ReducedGroupedVariable)
gr[ntuple(i -> Colon(),ndims(gr))...]
Expand Down
5 changes: 4 additions & 1 deletion test/test_groupby.jl
Original file line number Diff line number Diff line change
Expand Up @@ -202,5 +202,8 @@ io = IOBuffer()
show(io,"text/plain",gv)
@test occursin("array", String(take!(io)))

@test eltype(gv) == Array{Float32,3}
if VERSION > v"1.7"
# type inference does not work in julia 1.6
@test eltype(gv) == Array{Float32,3}
end
@test name(gr) == "data"

0 comments on commit 7f80bef

Please sign in to comment.