Skip to content

Commit

Permalink
Merge pull request #1514 from jw-rs/master
Browse files Browse the repository at this point in the history
gdal_calc.py: fixes streaking with --allBands option
  • Loading branch information
rouault committed May 7, 2019
2 parents e35259a + 24823d5 commit 31fdc15
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions gdal/swig/python/scripts/gdal_calc.py
Expand Up @@ -249,9 +249,6 @@ def doit(opts, args):

# use the block size of the first layer to read efficiently
myBlockSize = myFiles[0].GetRasterBand(myBands[0]).GetBlockSize()
# store these numbers in variables that may change later
nXValid = myBlockSize[0]
nYValid = myBlockSize[1]
# find total x and y blocks to be read
nXBlocks = (int)((DimensionsCheck[0] + myBlockSize[0] - 1) / myBlockSize[0])
nYBlocks = (int)((DimensionsCheck[1] + myBlockSize[1] - 1) / myBlockSize[1])
Expand All @@ -274,15 +271,18 @@ def doit(opts, args):
################################################################
# start looping through blocks of data
################################################################

# store these numbers in variables that may change later
nXValid = myBlockSize[0]
nYValid = myBlockSize[1]

# loop through X-lines
for X in range(0, nXBlocks):

# in the rare (impossible?) case that the blocks don't fit perfectly
# in case the blocks don't fit perfectly
# change the block size of the final piece
if X == nXBlocks - 1:
nXValid = DimensionsCheck[0] - X * myBlockSize[0]
myBufSize = nXValid * nYValid

# find X offset
myX = X * myBlockSize[0]
Expand Down

0 comments on commit 31fdc15

Please sign in to comment.