Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/openstack.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ struct OpenStack{X,K,T,DS,M}
end
OpenStack{X,K,T}(dataset::DS, mods::M) where {X,K,T,DS,M} =
OpenStack{X,K,T,DS,M}(dataset, mods)
OpenStack(fs::FileStack{Source,K}) where {K,Source} =
OpenStack{Source,K}(sourceconstructor(Source())(filename(fs)), fs.mods)
OpenStack(fs::FileStack{Source,K,T}) where {Source,K,T} =
OpenStack{Source,K,T}(sourceconstructor(Source())(filename(fs)), fs.mods)

dataset(os::OpenStack) = os.dataset

Expand Down
4 changes: 2 additions & 2 deletions src/stack.jl
Original file line number Diff line number Diff line change
Expand Up @@ -527,8 +527,8 @@ function DD.modify(f, s::AbstractRasterStack{<:FileStack{<:Any,K}}) where K
end

# Open a single file stack
function Base.open(f::Function, st::AbstractRasterStack{K,T,<:Any,<:FileStack{X}}; kw...) where {X,K,T}
ost = OpenStack{X,K,T}(parent(st))
function Base.open(f::Function, st::AbstractRasterStack{K}; kw...) where K
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lol! I didnt realize this was how it happens.

Can't we just define

Base.open(st::AbstractRasterStack{K}; kw...) = OpenStack(parent(st))
Base.close(st::AbstractRasterStack{K}; kw...) = somehow_flatten_and_invoke_on_openstack(close, st) # maybe replace with filearray

and that's lazy=:open?

It looks like the multifile implementation is recursive but we could figure that out.

Copy link
Owner

@rafaqz rafaqz May 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but that will be part of doing that properly everywhere?

(And not exactly, you need to wrap as a RasterStack)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are the easy stacks where it's one dataset, often it's not

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And fwiw lazy=:open is confusing syntax, it has to be something else

Copy link
Collaborator

@asinghvi17 asinghvi17 May 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something else is fine, I don't even mind single-arg Base.open(ras) or Rasters.open(filename)

Copy link
Owner

@rafaqz rafaqz May 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason not to only allow open(rast) is it needs a double open. It should work too but as an option for a lazy raster

Raster(fn; open=true) would open to get metadata and just stay open.

ost = OpenStack(parent(st))
# TODO is this needed?
layers = map(K) do k
ost[k]
Expand Down
Loading