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.
-
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.
-
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
-
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)
-
getTotalBlocks
()[source]¶ Returns the total number of blocks the dataset has been split up into for processing
-
getTransform
()[source]¶ Return the current transform between world and pixel coords. This is as defined by GDAL.
-
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.
-