Added possibilty to change number of digits displayed in figure legend
Wrapped raster production into function (accepts device_id) + few other bits