Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CIMSS True Color (Natural Color) RGB recipes #672

Merged
merged 4 commits into from Aug 28, 2019

Conversation

djhoese
Copy link
Member

@djhoese djhoese commented Mar 22, 2019

I talked with the NOAA/CIMSS GOES Imagery team about adding this composite to SatPy so that it could be included in CSPP Geo2Grid. This PR adds the necessary steps to add it. Although this is complete I want to wait for some feedback from the Imagery team because the produced output makes the output's green colors look very grey.

This recipe is described here: https://agupubs.onlinelibrary.wiley.com/doi/10.1029/2018EA000379

It is important to note that the Imagery team (as described in the above paper) consider composites to fall in to two categories: true color and false color. I have always considered true color one specific composite (with optional modifications like rayleigh correction and any number of enhancement differences). The Imagery team see it as the true color category where the various modifications/enhancements make separate composites in that category. They also use the name "natural color" for their true color because it is the way the earth looks "naturally". Although this name makes more sense for this RGB compared to what EUMETSAT's "natural color" is, most people know the EUTMETSAT version by this name. Therefore, I've named this composite "cimss_true_color".

  • Closes #xxxx
  • Tests added
  • Tests passed
  • Passes git diff origin/master -- "*py" | flake8 --diff
  • Fully documented

@djhoese djhoese added enhancement code enhancements, features, improvements component:compositors labels Mar 22, 2019
@djhoese djhoese added this to the v0.14 milestone Mar 22, 2019
@coveralls
Copy link

coveralls commented Mar 22, 2019

Coverage Status

Coverage increased (+0.03%) to 84.642% when pulling e539bac on djhoese:feature-cimss-true into 5d98f28 on pytroll:master.

@codecov
Copy link

codecov bot commented Mar 22, 2019

Codecov Report

Merging #672 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #672      +/-   ##
==========================================
+ Coverage   84.62%   84.64%   +0.01%     
==========================================
  Files         169      171       +2     
  Lines       24996    25035      +39     
==========================================
+ Hits        21153    21191      +38     
- Misses       3843     3844       +1
Impacted Files Coverage Δ
satpy/tests/enhancement_tests/test_abi.py 100% <100%> (ø)
satpy/tests/enhancement_tests/__init__.py 91.66% <100%> (+0.75%) ⬆️
satpy/composites/abi.py 100% <100%> (ø) ⬆️
satpy/enhancements/abi.py 100% <100%> (ø)
satpy/scene.py 90.47% <0%> (-0.18%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5d98f28...e539bac. Read the comment docs.

@djhoese djhoese modified the milestones: v0.14, v0.15 Apr 9, 2019
@mraspaud
Copy link
Member

mraspaud commented May 7, 2019

Did you get feedback from the Imagery team @djhoese ?

@djhoese
Copy link
Member Author

djhoese commented May 7, 2019

I sent them some updates, but not sure I got an explicit approval or disapproval. I will re-read the emails, check in with them in person, and let you know.

@djhoese djhoese modified the milestones: v0.15, v0.16 May 10, 2019
@djhoese djhoese removed this from the v0.16 milestone Jun 17, 2019
@djhoese
Copy link
Member Author

djhoese commented Jun 17, 2019

I'm missing some information from the GOES Imagery team on this. It seems that their true color (natural color) image doesn't use solar zenith correction. I was also given code from Kaba Bah that is used in AWIPS to generate these images from the L1b data, but am still waiting on answers to the "why" for some of the strategies taken. For example, their processing has an additional contrast enhancement applied to it to make the image brighter but doesn't use the full image (0-255) range.

I've removed this from the 0.16 milestone and we'll have to wait for answers before merging this.

@djhoese djhoese requested a review from mraspaud as a code owner August 28, 2019 14:57
@djhoese
Copy link
Member Author

djhoese commented Aug 28, 2019

Current Satpy true_color:

image

New cimss_true_color (no sunz or rayleigh):

image

New cimss_true_color_sunz (with sunz, no rayleigh):

image

New cimss_true_color_sunz_rayleigh (with sunz and rayleigh):

image

Comparison of enhancement methods (cira_stretch is used for satpy 'true_color', Kaba's contrast is used for all cimss_true_color variations):

true_color_stretch_compare

Code to generate above plot
import matplotlib.pyplot as plt
import numpy as np

plt.figure()
x = np.arange(256.0)

# sqrt
sqrt_data =  ((x / 255.) ** 0.5) * 255

# cira stretch
band_data = x / 2.55
log_root = np.log10(0.0223)
denom = (1.0 - log_root) * 0.75
band_data *= 0.01
band_data = band_data.clip(np.finfo(float).eps)
band_data = np.log10(band_data)
band_data -= log_root
band_data /= denom
band_data *= 255
band_data[band_data < 0] = 0

# contrast
aband = (np.linspace(0, 1.0, 256) ** 0.5) * 255
maxValue = 255
acont = 255.0 / 10.0
amax = 255.0 + 4
amid = 255.0 / 2.0
afact = (amax * (acont + maxValue) / (maxValue * (amax - acont)))
aband = (afact * (aband - amid) + amid)
aband[aband <= 10] = 0
aband[aband >= 255] = 255

plt.plot(x, x, label='linear')
plt.plot(x, sqrt_data, label='sqrt')
plt.plot(x, band_data, label='cira_stretch')
plt.plot(x, aband, label='Kaba\'s contrast')
plt.legend()
plt.savefig('true_color_stretch_compare.png')

@djhoese djhoese merged commit f9d0022 into pytroll:master Aug 28, 2019
@djhoese djhoese deleted the feature-cimss-true branch August 28, 2019 16:49
@djhoese
Copy link
Member Author

djhoese commented Aug 28, 2019

For reference, here is that plot again, but with the crefl_scaling added which is the default for Geo2Grid's true_color for ABI and AHI:

true_color_stretch_compare

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:compositors enhancement code enhancements, features, improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants