imagewriter

Contains functions used to write output files from applier.apply.

rios.imagewriter.addAutoColorTable(filename, autoColorTableType)[source]

If autoColorTable has been set up for this output, then generate a color table of the requested type, and add it to the current file. This is called AFTER the Dataset has been closed, so is performed on the filename. This only applies to thematic layers, so when we open the file and find that the layers are athematic, we do nothing.

rios.imagewriter.checkForNanOrInf(arr, filename)[source]

Check if the given array is float and contains any NaN or Inf elements. If any non-finite is found, then the filename is added to the global nanWarningFiles set.

If the array is not a float (or complex) dtype, then no check is done. If it is float (or complex), then numpy.isfinite is used to check all elements.

If the filename is already in nanWarningFiles, no further check is done.

rios.imagewriter.closeOutfiles(gdalOutObjCache, outfiles, controls, singlePassMgr, timings)[source]

Close all the output files

rios.imagewriter.deleteIfExisting(filename)[source]

Delete the filename if it already exists. If possible, use the appropriate GDAL driver to do so, to ensure that any associated files will also be deleted.

rios.imagewriter.doubleCheckCreationOptions(drivername, creationoptions, controls, workinggrid)[source]

Try to ensure that the given creation options are compatible with RIOS operations. Does not attempt to ensure they are totally valid, as that is GDAL’s job.

If it finds any incompatibility, an exception is raised.

rios.imagewriter.makeMinMaxList(singlePassMgr, symbolicName, seqNum)[source]

Make a list of min/max values per band, for the nominated output file, from values already present on singlePassMgr. Mimicing the list returned by addBasicStatsGDAL, for use with addHistogramsGDAL.

rios.imagewriter.openOutfile(symbolicName, filename, controls, arr, workinggrid)[source]

Open the requested output file

rios.imagewriter.warnNanOrInf(filename)[source]

Print a warning message if the given filename is a member of nanWarningFiles set. Clears the filename once the warning is printed.

rios.imagewriter.writeBlock(gdalOutObjCache, blockDefn, outfiles, outputs, controls, workinggrid, singlePassMgr, timings)[source]

Write the given block to the files given in outfiles