File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed
Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -22,12 +22,19 @@ DiskArrays.haschunks(::GDALBand) = DiskArrays.Chunked()
2222# end
2323# end
2424function DiskArrays. readblock! (b:: GDALBand , aout:: Matrix , r:: AbstractUnitRange... )
25- for chunk in eachchunk (b)
26- overlap = tuple ((intersect (r[i], chunk[i]) for i in eachindex (r)). .. )
27- if all (x -> ! isempty (x), overlap)
28- chunk_data = AG. read (b. filename, overlap... )
29- aout_indices = tuple ((overlap[i] .- first (r[i]) .+ 1 for i in eachindex (r)). .. )
30- view (aout, aout_indices... ) .= chunk_data
25+ # Open the dataset before reading
26+ AG. read (b. filename) do ds
27+ # Get the correct band from the dataset
28+ AG. getband (ds, b. band) do bh
29+ for chunk in eachchunk (b)
30+ overlap = tuple ((intersect (r[i], chunk[i]) for i in eachindex (r)). .. )
31+ if all (x -> ! isempty (x), overlap)
32+ # Read the chunk data from the band `bh` for the overlapping ranges
33+ chunk_data = AG. read (bh, overlap... )
34+ aout_indices = tuple ((overlap[i] .- first (r[i]) .+ 1 for i in eachindex (r)). .. )
35+ view (aout, aout_indices... ) .= chunk_data
36+ end
37+ end
3138 end
3239 end
3340end
You can’t perform that action at this time.
0 commit comments