Conditional Statements in QGIS raster calculator?

You can create a condition by using a little 'trick':

Suppose you have a raster file (layer1) with values below 0 but you want only positive values.

("[email protected]" > 0 )

Is resulting in 1 when it is above 0 and is resulting in 0 when it is below 0.

("[email protected]" > 0 ) * "[email protected]"

When you multiply this with the raster value it will either be 0 or it will be 1 multiplied with the raster value.

So far as I know, the default raster calculator in QGIS does not support conditional statements. You'll need to download a plugin called RasterCalc. This (and other options) are discussed at Open source, Python option for Arcpy's Con tool? Note that syntax may not be directly compatible between the softwares, so you may need to make some adjustments rather than cut/pasting directly - Con is a specific tool in ArcGIS.