I test your code and I can run it with no problems. I also attempted to make the same but creating a Raster instead of a DimensionalData array:
using Rasters, DimensionalData, Dates, Statistics, OhMyThreads
tempo = range(DateTime(2000); step=Hour(1), length=365*24*2)
B = Raster(rand(Float64,101,length(tempo)), (X(1:0.01:2), Ti(tempo)))
groups = groupby(B, Ti => month)
tmean(g) = mean(g; dims=:Ti)
tmap(tmean, groups)
And it runs too without any problem. I think that the key can be in the type:
Type that runs (type of groups
, the grouped raster B
):
julia> typeof(groups)
DimensionalData.DimGroupByArray{Raster{Float64, 1, Tuple{X{DimensionalData.Dimensions.Lookups.Sampled{Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, DimensionalData.Dimensions.Lookups.ForwardOrdered, DimensionalData.Dimensions.Lookups.Regular{Float64}, DimensionalData.Dimensions.Lookups.Points, DimensionalData.Dimensions.Lookups.NoMetadata}}}, Tuple{Ti{DimensionalData.Dimensions.Lookups.Sampled{DateTime, StepRangeLen{DateTime, DateTime, Hour, Int64}, DimensionalData.Dimensions.Lookups.ForwardOrdered, DimensionalData.Dimensions.Lookups.Regular{Hour}, DimensionalData.Dimensions.Lookups.Points, DimensionalData.Dimensions.Lookups.NoMetadata}}}, SubArray{Float64, 1, Matrix{Float64}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, true}, Symbol, DimensionalData.Dimensions.Lookups.NoMetadata, Nothing}, 1, Tuple{Ti{DimensionalData.Dimensions.Lookups.Sampled{Int64, Vector{Int64}, DimensionalData.Dimensions.Lookups.ForwardOrdered, DimensionalData.Dimensions.Lookups.Irregular{Tuple{Nothing, Nothing}}, DimensionalData.Dimensions.Lookups.Points, DimensionalData.Dimensions.Lookups.NoMetadata}}}, Tuple{}, DimensionalData.OpaqueArray{Raster{Float64, 1, Tuple{X{DimensionalData.Dimensions.Lookups.Sampled{Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, DimensionalData.Dimensions.Lookups.ForwardOrdered, DimensionalData.Dimensions.Lookups.Regular{Float64}, DimensionalData.Dimensions.Lookups.Points, DimensionalData.Dimensions.Lookups.NoMetadata}}}, Tuple{Ti{DimensionalData.Dimensions.Lookups.Sampled{DateTime, StepRangeLen{DateTime, DateTime, Hour, Int64}, DimensionalData.Dimensions.Lookups.ForwardOrdered, DimensionalData.Dimensions.Lookups.Regular{Hour}, DimensionalData.Dimensions.Lookups.Points, DimensionalData.Dimensions.Lookups.NoMetadata}}}, SubArray{Float64, 1, Matrix{Float64}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, true}, Symbol, DimensionalData.Dimensions.Lookups.NoMetadata, Nothing}, 1, DimensionalData.DimSlices{Raster{Float64, 1, Tuple{X{DimensionalData.Dimensions.Lookups.Sampled{Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, DimensionalData.Dimensions.Lookups.ForwardOrdered, DimensionalData.Dimensions.Lookups.Regular{Float64}, DimensionalData.Dimensions.Lookups.Points, DimensionalData.Dimensions.Lookups.NoMetadata}}}, Tuple{Ti{DimensionalData.Dimensions.Lookups.Sampled{DateTime, StepRangeLen{DateTime, DateTime, Hour, Int64}, DimensionalData.Dimensions.Lookups.ForwardOrdered, DimensionalData.Dimensions.Lookups.Regular{Hour}, DimensionalData.Dimensions.Lookups.Points, DimensionalData.Dimensions.Lookups.NoMetadata}}}, SubArray{Float64, 1, Matrix{Float64}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, true}, Symbol, DimensionalData.Dimensions.Lookups.NoMetadata, Nothing}, 1, Tuple{Ti{Vector{Vector{Int64}}}}, Raster{Float64, 2, Tuple{X{DimensionalData.Dimensions.Lookups.Sampled{Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, DimensionalData.Dimensions.Lookups.ForwardOrdered, DimensionalData.Dimensions.Lookups.Regular{Float64}, DimensionalData.Dimensions.Lookups.Points, DimensionalData.Dimensions.Lookups.NoMetadata}}, Ti{DimensionalData.Dimensions.Lookups.Sampled{DateTime, StepRangeLen{DateTime, DateTime, Hour, Int64}, DimensionalData.Dimensions.Lookups.ForwardOrdered, DimensionalData.Dimensions.Lookups.Regular{Hour}, DimensionalData.Dimensions.Lookups.Points, DimensionalData.Dimensions.Lookups.NoMetadata}}}, Tuple{}, Matrix{Float64}, Symbol, DimensionalData.Dimensions.Lookups.NoMetadata, Nothing}}}, Symbol, Dict{Symbol, Any}}
Type that does not run (type of datavar_grouped
, the grouped raster datavar
):
julia> typeof(datavar_grouped)
DimensionalData.DimGroupByArray{Raster{Union{Missing, Float64}, 1, Tuple{Dim{:values, DimensionalData.Dimensions.Lookups.NoLookup{SubArray{Int64, 1, Base.OneTo{Int64}, Tuple{Vector{Int64}}, false}}}}, Tuple{Ti{DimensionalData.Dimensions.Lookups.Sampled{DateTimeNoLeap, SubArray{DateTimeNoLeap, 1, Vector{DateTimeNoLeap}, Tuple{UnitRange{Int64}}, true}, DimensionalData.Dimensions.Lookups.ForwardOrdered, DimensionalData.Dimensions.Lookups.Irregular{Tuple{DateTimeNoLeap, DateTimeNoLeap}}, DimensionalData.Dimensions.Lookups.Points, DimensionalData.Dimensions.Lookups.NoMetadata}}}, SubArray{Union{Missing, Float64}, 1, Matrix{Union{Missing, Float64}}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, true}, Symbol, DimensionalData.Dimensions.Lookups.Metadata{Rasters.GRIBsource, Dict{String, Any}}, Missing}, 1, Tuple{Ti{DimensionalData.Dimensions.Lookups.Sampled{Int64, Vector{Int64}, DimensionalData.Dimensions.Lookups.ForwardOrdered, DimensionalData.Dimensions.Lookups.Irregular{Tuple{Nothing, Nothing}}, DimensionalData.Dimensions.Lookups.Points, DimensionalData.Dimensions.Lookups.NoMetadata}}}, Tuple{}, DimensionalData.OpaqueArray{Raster{Union{Missing, Float64}, 1, Tuple{Dim{:values, DimensionalData.Dimensions.Lookups.NoLookup{SubArray{Int64, 1, Base.OneTo{Int64}, Tuple{Vector{Int64}}, false}}}}, Tuple{Ti{DimensionalData.Dimensions.Lookups.Sampled{DateTimeNoLeap, SubArray{DateTimeNoLeap, 1, Vector{DateTimeNoLeap}, Tuple{UnitRange{Int64}}, true}, DimensionalData.Dimensions.Lookups.ForwardOrdered, DimensionalData.Dimensions.Lookups.Irregular{Tuple{DateTimeNoLeap, DateTimeNoLeap}}, DimensionalData.Dimensions.Lookups.Points, DimensionalData.Dimensions.Lookups.NoMetadata}}}, SubArray{Union{Missing, Float64}, 1, Matrix{Union{Missing, Float64}}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, true}, Symbol, DimensionalData.Dimensions.Lookups.Metadata{Rasters.GRIBsource, Dict{String, Any}}, Missing}, 1, DimensionalData.DimSlices{Raster{Union{Missing, Float64}, 1, Tuple{Dim{:values, DimensionalData.Dimensions.Lookups.NoLookup{SubArray{Int64, 1, Base.OneTo{Int64}, Tuple{Vector{Int64}}, false}}}}, Tuple{Ti{DimensionalData.Dimensions.Lookups.Sampled{DateTimeNoLeap, SubArray{DateTimeNoLeap, 1, Vector{DateTimeNoLeap}, Tuple{UnitRange{Int64}}, true}, DimensionalData.Dimensions.Lookups.ForwardOrdered, DimensionalData.Dimensions.Lookups.Irregular{Tuple{DateTimeNoLeap, DateTimeNoLeap}}, DimensionalData.Dimensions.Lookups.Points, DimensionalData.Dimensions.Lookups.NoMetadata}}}, SubArray{Union{Missing, Float64}, 1, Matrix{Union{Missing, Float64}}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, true}, Symbol, DimensionalData.Dimensions.Lookups.Metadata{Rasters.GRIBsource, Dict{String, Any}}, Missing}, 1, Tuple{Ti{Vector{Vector{Int64}}}}, Raster{Union{Missing, Float64}, 2, Tuple{Dim{:values, DimensionalData.Dimensions.Lookups.NoLookup{SubArray{Int64, 1, Base.OneTo{Int64}, Tuple{Vector{Int64}}, false}}}, Ti{DimensionalData.Dimensions.Lookups.Sampled{DateTimeNoLeap, Vector{DateTimeNoLeap}, DimensionalData.Dimensions.Lookups.ForwardOrdered, DimensionalData.Dimensions.Lookups.Irregular{Tuple{DateTime, DateTime}}, DimensionalData.Dimensions.Lookups.Points, DimensionalData.Dimensions.Lookups.NoMetadata}}}, Tuple{}, Matrix{Union{Missing, Float64}}, Symbol, DimensionalData.Dimensions.Lookups.Metadata{Rasters.GRIBsource, Dict{String, Any}}, Missing}}}, Symbol, Dict{Symbol, Any}}