In a QGIS Python script I'm trying to produce raster 0/1 mask with use of procesing package. The pipeline looks like that:
Create an image of index (NDSI if that matters) with numpy arrays from a satellite image,
Do thresholding with saga:rastercalculator from processing to obtain 0/1 mask where the index exceeds a value. I can force data type on this stage, so I set it to 1 bit file. Because of some peculiarity of format and QGIS (as I understand it), assigning 0 in a saga formula results with NaNs in the output file,
Convert nans to 0 with saga:reclassifygridvalues.
Here my problem begins. There's no flag for datatype in reclassification, so it seems, that I get Float32 by default. And the values are 0 and 0.999, which is a problem, as I have to subtract them later on from another mask (raster calculation again) and instead of clean 0/1 cut I get a few shades of gray.
How can I make processing algorithms return 0/1 images consistently?