I am using QGIS with the plugin Semi-Automatic Classification Plugin to apply DOS1 atmospheric correction to bands 3 and 8 of Sentinel-2. Example:
I want to automate this task with a python script but I don't know which formula is using this plugin.
I've got similar results by getting the smallest pixel (ignoring no-data value) for every band and substract this pixel to all pixels from that band:
inFile = 'band3.jp2' with rasterio.open(inFile) as r: values = r.read(1) values[values==0]=65535 #Ignore no-data values minValue = np.min(values) values = values - minValue values[values==(65535-minValue)]=0 #Set no-data values again to 0
But the result is not exactly the same. I have found the source code of the plugin but I don't understand it at all I just want to apply the same DOS1 formula with a simple script in python.