I want to clip a raster using a shapefile with the command:
gdalwarp -cutline INPUT.shp INPUT.tif OUTPUT.tif
From this answer. However I want to set the pixels outside the mask to a particular value (-9999 for example). I want to do it with gdalwarp so I can perform the same process in several files (In other words I don't want to use QGIS, ArcGIS, or any similar package). A Python programmatic approach would also be desirable, as currently I am calling gdalwarp from a Python script.