readerinfo

This module contains the ReaderInfo class which holds information about the area being read and info on the current block

class rios.readerinfo.ReaderInfo(workingGrid, windowxsize, windowysize, overlap, loggingstream)[source]

ReaderInfo class. Holds information about the area being read and info on the current block

getBlockCoordArrays()[source]

Return a tuple of the world coordinates for every pixel in the current block. Each array has the same shape as the current block. Return value is a tuple:

(xBlock, yBlock)

where the values in xBlock are the X coordinates of the centre of each pixel, and similarly for yBlock.

The coordinates returned are for the pixel centres. This is slightly inconsistent with usual GDAL usage, but more likely to be what one wants.

getBlockCount()[source]

Gets the count of the current block

getBlockSize()[source]

Get the size of the current block. Returns a tuple:

(numCols, numRows)

for the current block. Mostly the same as the window size, except on the edge of the raster.

getFilenameFor(block)[source]

Get the input filename of a dataset

getGDALBandFor(block, band)[source]

Get the underlying GDAL handle for a band of a dataset

getGDALDatasetFor(block)[source]

Get the underlying GDAL handle of a dataset

getNoDataValueFor(block, band=1)[source]

Returns the ‘no data’ value for the dataset underlying the block. This should be the same as what was set for the stats ignore value when that dataset was created. The value is cast to the same data type as the dataset.

getOverlapSize()[source]

Returns the size of the pixel overlap between each window. This is the number of pixels added as margin around each block

getPercent()[source]

Returns the percent complete.

getPixColRow(x, y)[source]

This function is for internal use only. The user should be looking at getBlockCoordArrays() or getPixRowColBlock() for dealing with blocks and coordinates.

Get the (col, row) relative to the current image grid, for the nominated pixel within the current block. The given (x, y) are column/row numbers (starting at zero), and the return is a tuple:

(column, row)

where these are relative to the whole of the current working grid. If working with a single raster, this is the same as for that raster, but if working with multiple rasters, the working grid is the intersection or union of them.

Note that this function will give incorrect/misleading results if used in conjunction with a block overlap.

getPixRowColBlock(x, y)[source]

Return the row/column numbers, within the current block, for the pixel which contains the given (x, y) coordinate. The coordinates of (x, y) are in the world coordinate system of the reference grid. The row/col numbers are suitable to use as array indices in the array(s) for the current block. If the nominated pixel is not contained within the current block, the row and column numbers are both None (hence this should be checked).

Return value is a tuple of 2 int values

(row, col)

getPixelSize()[source]

Gets the current pixel size and returns it as a tuple (x and y)

getProjection()[source]

Return the WKT describing the current projection system

getTotalBlocks()[source]

Returns the total number of blocks the dataset has been split up into for processing

getTotalSize()[source]

Returns the total size (in pixels) of the dataset being processed

getTransform()[source]

Return the current transform between world and pixel coords. This is as defined by GDAL.

getWindowSize()[source]

Returns the size of the current window. Returns a tuple (numCols, numRows)

isFirstBlock()[source]

Returns True if this is the first block to be processed

isLastBlock()[source]

Returns True if this is the last block to be processed

setBlockBounds(blocktl, blockbr)[source]

Sets the coordinate bounds of the current block

This routine is for internal use by RIOS. Its use in any other context is not sensible.

setBlockCount(xblock, yblock)[source]

Sets the count of the current block

This routine is for internal use by RIOS. Its use in any other context is not sensible.

setBlockDataset(block, dataset, filename)[source]

Saves a match between the numpy block read and it’s GDAL dataset. So we can look up the dataset later given a block.

This routine is for internal use by RIOS. Its use in any other context is not sensible.

setBlockSize(blockwidth, blockheight)[source]

Sets the size of the current block

This routine is for internal use by RIOS. Its use in any other context is not sensible.