Skip to content

Commit

Permalink
add RasterSeries constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaqz committed Nov 13, 2024
1 parent e83b5c0 commit 2672a51
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/series.jl
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ struct RasterSeries{T<:Union{AbstractRaster,AbstractRasterStack},N,D<:Tuple,R<:T
new{T,N,D,R,A}(data, dims, refdims)
end
end
function RasterSeries(
data::A, dims::D, refdims::R
) where {A<:AbstractArray{T,N},D<:Tuple,R<:Tuple} where {T,N}
RasterSeries{T,N,D,R,A}(data, dims, refdims)
end
function RasterSeries(data::AbstractArray{<:Union{AbstractRasterStack,AbstractRaster}}, dims;
refdims=()
)
Expand Down Expand Up @@ -214,11 +219,21 @@ end
)
RasterSeries(data, dims, refdims)
end
@inline function DD.rebuild(
A::RasterSeries,
data::AbstractArray{<:Union{AbstractRaster,AbstractRasterStack}},
dims::Tuple,
refdims=(),
name=nothing,
metadata=nothing,
)
RasterSeries(data, dims, refdims)
end
@inline function DD.rebuild(
A::RasterSeries;
data=parent(A), dims=dims(A), refdims=refdims(A), name=nothing, metadata=nothing,
)
RasterSeries(data, dims, refdims)
rebuild(A, data, dims, refdims)
end

function Base.map(f, series::RasterSeries)
Expand Down

0 comments on commit 2672a51

Please sign in to comment.