pytroll / pygac

A python package to read and calibrate NOAA and Metop AVHRR GAC and LAC data
https://pygac.readthedocs.org/
GNU General Public License v3.0
20 stars 25 forks source link

Fix sun-earth distance correction #107

Closed sfinkens closed 2 years ago

sfinkens commented 2 years ago

Recently a bug in pyorbital's sun-earth distance correction was fixed: https://github.com/pytroll/pyorbital/issues/97.

Pygac does not use pyorbital for this, but makes the same mistake:

https://github.com/pytroll/pygac/blob/05ba35e84caddbe96e5053b35d80abe20a091c01/pygac/utils.py#L89

I propose to use pyorbital for this.

@ninahakansson @abhaydd @kgkarl This would change the output (to the better).

mraspaud commented 2 years ago

It makes total sense to remove code duplication, I'm in favour.

To make sure the bug doesn't reappear, maybe a test case for reflectance computation could be added at the same time?

sfinkens commented 2 years ago

Sorry, false alarm. As pointed out by @abhaydd the factor is applied only once, so there's no problem.

https://github.com/pytroll/pygac/blob/05ba35e84caddbe96e5053b35d80abe20a091c01/pygac/calibration.py#L340

I'm opening a new issue regarding code duplication.

mraspaud commented 2 years ago

@sfinkens, I still think it makes sense to remove code duplication and use pyorbital here.