Skip to content

Commit

Permalink
Merge pull request #20 from JuliaDataCubes/fc/gdalbandreadblock
Browse files Browse the repository at this point in the history
Enable readblock of a GDALBand into subarrays
  • Loading branch information
felixcremer authored Apr 21, 2023
2 parents 59f9af5 + 0922779 commit c9d7d6d
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/datasets/archgdal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,23 @@ end
Base.size(b::GDALBand) = b.size
DiskArrays.eachchunk(b::GDALBand) = b.cs
DiskArrays.haschunks(::GDALBand) = DiskArrays.Chunked()
function DiskArrays.readblock!(b::GDALBand, aout, r::AbstractUnitRange...)
AG.read(b.filename) do ds
AG.getband(ds, b.band) do bh
DiskArrays.readblock!(bh, aout, r...)

function DiskArrays.readblock!(b::GDALBand, aout::Matrix, r::AbstractUnitRange...)
AG.read(b.filename) do ds
AG.getband(ds, b.band) do bh
DiskArrays.readblock!(bh, aout, r...)

end
end
end
end

function DiskArrays.readblock!(b::GDALBand, aout, r::AbstractUnitRange...)
aout2 = similar(aout)
DiskArrays.readblock!(b, aout2, r)
aout .= aout2
end


function DiskArrays.writeblock!(b::GDALBand, ain, r::AbstractUnitRange...)
AG.read(b.filename, flags=AG.OF_Update) do ds
AG.getband(ds, b.band) do bh
Expand Down

0 comments on commit c9d7d6d

Please sign in to comment.