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

Computation of Earth scene radiance #62

Closed helgaweb closed 4 years ago

helgaweb commented 4 years ago

I was wondering, why the Earth scene radiance (Ne) does not account for linear radiance estimate Nlin as described in the KLM User's Guide. Following 7.1.2.4-6 on page 7-9, Ne is calculated as: Ne = Nlin + Ncor

https://github.com/pytroll/pygac/blob/2d7fbafbf03ae59d14b1fffdd33154358faee139/pygac/calibration.py#L553-L558

carloshorn commented 4 years ago

Hi @helgaweb, indeed, to me it also looks like Nlin is missing. Currently, I am working on a refactoring of calibration.py, where I want to put more comments on the equations. Hope to push the corresponding commit to #58 today.

helgaweb commented 4 years ago

@carloshorn that will be very helpful, thanks! I think the documentation in the KLM User's guide is quite well done and provides a good basis. Alright, let's wait for @abhaydd and @mraspaud ideas on this and then I could open a PR (after you finished the refactoring).

carloshorn commented 4 years ago

I checked the code, and it is doing the right thing, but written in a confusing way... The coefficients are defined here: https://github.com/pytroll/pygac/blob/2d7fbafbf03ae59d14b1fffdd33154358faee139/pygac/calibration.py#L304-L306 Which shows, that the linear correction 'b1' term is added by one, which therefore accounts for the linear part. However, I agree that there should be a huge alert sign in the code.

abhaydd commented 4 years ago

@helgaweb @carloshorn Yes, the Nlin is of course included properly (but implemented in an unclear way). Otherwise we would have been off by hundreds of degrees. The non-linearity correction is typically only a fraction and translates to less than few Kelvins.

helgaweb commented 4 years ago

@abhaydd Thanks a lot. Sorry I've overseen the change in the b1 coefficient (as clarified by @carloshorn) and was therefore confused about the calculation of Ne.

carloshorn commented 4 years ago

@helgaweb, I pushed the comment lines to #58. I would appreciate if you could have a look at it and leave a feedback telling if the comments are sufficient to understand what the functions do.

abhaydd commented 4 years ago

@helgaweb @carloshorn I can understand why one can get confused. The code clearly needs revamping. And it’s good to have the fresh minds like yours and Carlos’s :)

helgaweb commented 4 years ago

@carloshorn Sure. I hope to give you some feedback by monday!

mraspaud commented 4 years ago

I'm reopening this as I think it's a problem that it isn't documented clearly that the coeffs are taking acount of this. Hopefully #58 closes this.