Skip to content

Conversation

@tiemvanderdeure
Copy link
Collaborator

open(stack) seems to be broken on main.

Needs test but not sure which files to use?

# 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.

@rafaqz
Copy link
Owner

rafaqz commented May 8, 2025

Probably test in stack.jl ?

@tiemvanderdeure
Copy link
Collaborator Author

Probably test in stack.jl ?

I just added it to gribdatasets.jl to not have to write another file. I've checked it errors on main.

@rafaqz rafaqz merged commit 8b02c41 into main Jul 5, 2025
4 of 5 checks passed
@rafaqz rafaqz deleted the tvd/openstack branch July 5, 2025 01:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants