Closed geojamesc closed 5 years ago
Perhaps we can use
https://rasterio.readthedocs.io/en/stable/api/rasterio.mask.html
rasterio.mask.mask(dataset, shapes, all_touched=False, invert=False, nodata=None, filled=True, crop=False, pad=False, indexes=None)
call.
Script https://github.com/cropmapteam/Scotland-crop-map/commit/33c359088dae2b5c21d86cec9a8af56c238f4725 which calls rasterio.mask.mask(raster_src, mask_polys, invert=True) was written.
Script was ran against all 51 shapefiles containing the digitised RFI locations. So in the image below the pixels in the image which fell inside the red digitised polygons have been set to nodata:
Processing time per image is about 7 mins. On my local machine it took ~3hrs to process 43 images and mask out the RFI locations. The script detected problems with 8 of the shapefiles ( e.g. invalid geometries / duplicate features etc) during validation and so some of the images have not yet been processed. I will create a new issue to cover checking/editing of the digitised RFI locations.
Team members will digitise in QGIS polygons describing the location of radar interference noise present in the radar data. Script should take the polygons and mask out in the associated image the pixels falling within the digitised polygons as nodata.
This is an alternative to #22
The manually digitised polygons should be retained as they could provide possible training data for #22