pyspectral icon indicating copy to clipboard operation
pyspectral copied to clipboard

Applying atmospheric correction directly to images

Open eswnl opened this issue 3 months ago • 3 comments

I have read the page at https://pyspectral.readthedocs.io/en/latest/rayleigh_correction.html but as I am new to this, I still need to do further reading and look at example programs.

I have raw geokompsat 2A images for each band and wonder if the rayleigh correction in Pyspectral can help me perform atmospheric correction before combining into the RGB image.

Reading the documentation, it outputs the correction factor (of which there are 4 values in % - why are there 4 values?) which needs to be subtracted from the raw data.

I guess this process can only be done at data level and not at image level?

eswnl avatar Oct 17 '25 07:10 eswnl

Interesting question! I you have sufficient information in your images to transform the physical values of reflectance pyspectral outputs to image (0-255) values, then in principle, in will be doable.

As to why there are 4 values, it's because the original data in the example from the page you link to is 2x2.

mraspaud avatar Oct 17 '25 16:10 mraspaud

Thank you for the reply. I did read further and hopefully my understanding is correct is that the correction factor is only for that point on the earth relative to the sun and satellite. If the image is 11000x11000, the correction factor has to be done on each pixel (pixel value x correction factor). That's 121 million calculations and only for that time of day. My guess is that it operates more like a sliding window of x by y pixels moving across the whole image.

I don't know how you automate the calculation of the angles. For that resolution, moving 1 pixel across is moving 1 km.

eswnl avatar Oct 18 '25 07:10 eswnl

You are right that the correction factor is a per pixel factor. It is, as you say, unique to that sun-satellite viewing geometry and wavelength. You are familiar with Satpy right? Satpy implements this correction, derived by Pyspectral, per channel on a 2-d satellite scene.

adybbroe avatar Oct 20 '25 17:10 adybbroe