Skip to content

Commit

Permalink
More fixes for transiogram.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
juliohm committed Oct 30, 2024
1 parent a870c3a commit e688860
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/empirical/transiogram.jl
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,12 @@ the categorical variable `var`.
Optionally, forward `parameters` for the underlying [`EmpiricalTransiogram`](@ref).
"""
function EmpiricalTransiogram(partition::Partition, var; kwargs...)
# retain categorical levels across subsets
levs = levels(parent(partition)[:, var])
# retain geospatial data with at least two elements
filtered = Iterators.filter(d -> nelements(domain(d)) > 1, partition)
@assert !isempty(filtered) "invalid partition of geospatial data"
t(d) = EmpiricalTransiogram(d, var; kwargs...)
t(d) = EmpiricalTransiogram(d |> Levels(var => levs), var; kwargs...)
tmapreduce(t, merge, collect(filtered))
end

Expand Down

0 comments on commit e688860

Please sign in to comment.