Skip to content

Commit 3917c5e

Browse files
authored
Merge pull request #131 from bryanguarente/main
Updated RGBs for MTG and new NOAA RGBs
2 parents 8d06efe + 895dd8d commit 3917c5e

File tree

2 files changed

+247
-0
lines changed

2 files changed

+247
-0
lines changed

src/goes2go/accessors.py

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,75 @@ def DayCloudPhase(self):
741741

742742
return ds["DayCloudPhase"]
743743

744+
def DayCloudPhaseEUMETSAT(self):
745+
"""Create the Day Cloud Phase EUMETSAT RGB.
746+
747+
(See `Quick Guide <https://eumetrain.org/sites/default/files/2023-01/CloudPhaseRGB.pdf>`__ for reference)
748+
749+
.. image:: /_static/DayCloudPhaseEUMETSAT.png
750+
751+
752+
"""
753+
ds = self._obj
754+
755+
# Load the three channels into appropriate R, G, and B variables
756+
R, G, B = self._load_RGB_channels((5, 6, 2))
757+
758+
# _normalize each channel by the appropriate range of values. (Clipping happens inside function)
759+
R = _normalize(R, 0, .5)
760+
G = _normalize(G, 0, .5)
761+
B = _normalize(B, 0, 1)
762+
763+
# The final RGB array :)
764+
RGB = np.dstack([R, G, B])
765+
766+
ds["DayCloudPhaseEUMETSAT"] = (("y", "x", "rgb"), RGB)
767+
ds["rgb"] = ["R", "G", "B"]
768+
ds["DayCloudPhaseEUMETSAT"].attrs["Quick Guide"] = (
769+
"https://eumetrain.org/sites/default/files/2023-01/CloudPhaseRGB.pdf"
770+
)
771+
ds["DayCloudPhaseEUMETSAT"].attrs["long_name"] = "Day Cloud Phase EUMETSAT"
772+
773+
return ds["DayCloudPhaseEUMETSAT"]
774+
775+
def DayCloudType(self):
776+
"""Create the Day Cloud Phase Type RGB.
777+
778+
(See `Quick Guide <https://eumetrain.org/sites/default/files/2021-05/CloudTypeRGB.pdf>`__ for reference)
779+
780+
.. image:: /_static/DayCloudType.png
781+
782+
783+
"""
784+
ds = self._obj
785+
786+
# Load the three channels into appropriate R, G, and B variables
787+
R, G, B = self._load_RGB_channels((4, 2, 5))
788+
789+
# _normalize each channel by the appropriate range of values. (Clipping happens inside function)
790+
R = _normalize(R, 0, .1)
791+
G = _normalize(G, 0, .8)
792+
B = _normalize(B, 0, .8)
793+
794+
# Apply the gamma correction to Red channel.
795+
# corrected_value = value^(1/gamma)
796+
gamma = 1.5
797+
R = _gamma_correction(R, gamma)
798+
gamma = .75
799+
G = _gamma_correction(G, gamma)
800+
801+
# The final RGB array :)
802+
RGB = np.dstack([R, G, B])
803+
804+
ds["DayCloudType"] = (("y", "x", "rgb"), RGB)
805+
ds["rgb"] = ["R", "G", "B"]
806+
ds["DayCloudType"].attrs["Quick Guide"] = (
807+
"https://eumetrain.org/sites/default/files/2021-05/CloudTypeRGB.pdf"
808+
)
809+
ds["DayCloudType"].attrs["long_name"] = "Day Cloud Type"
810+
811+
return ds["DayCloudType"]
812+
744813
def DayConvection(self):
745814
"""Create the Day Convection RGB.
746815
@@ -1309,3 +1378,40 @@ def SeaSpray(self, **kwargs):
13091378
ds["SeaSpray"].attrs["long_name"] = "Sea Spray"
13101379

13111380
return ds["SeaSpray"]
1381+
1382+
def BlowingSnow(self, **kwargs):
1383+
"""Create the Blowing Snow RGB.
1384+
1385+
(See `Quick Guide <https://rammb2.cira.colostate.edu/wp-content/uploads/2024/11/GOES-BlowingSnowRGB1_QuickGuide_24April2024.pdf>`__ for reference)
1386+
1387+
.. image:: /_static/BlowingSnow.png
1388+
1389+
"""
1390+
ds = self._obj
1391+
1392+
# Load the three channels into appropriate R, G, and B variables
1393+
R = ds["CMI_C02"].data
1394+
G = ds["CMI_C05"].data
1395+
B = ds["CMI_C07"].data - ds["CMI_C13"].data
1396+
1397+
# Normalize each channel by the appropriate range of values. e.g. R = (R-minimum)/(maximum-minimum)
1398+
R = _normalize(R, 0, .5) # values for this channel go from 0 to 1.
1399+
G = _normalize(G, 0, 0.2) # values for this channel go from 0 to 1.
1400+
B = _normalize(B, 0, 30)
1401+
1402+
# Apply a gamma correction to each R, G, B channel
1403+
R = _gamma_correction(R, 1/0.7)
1404+
G = _gamma_correction(G, 1.0)
1405+
B = _gamma_correction(B, 1/0.7)
1406+
1407+
# The final RGB array :)
1408+
RGB = np.dstack([R, G, B])
1409+
1410+
ds["BlowingSnow"] = (("y", "x", "rgb"), RGB)
1411+
ds["rgb"] = ["R", "G", "B"]
1412+
ds["BlowingSnow"].attrs["Quick Guide"] = (
1413+
"https://rammb2.cira.colostate.edu/wp-content/uploads/2024/11/GOES-BlowingSnowRGB1_QuickGuide_24April2024.pdf"
1414+
)
1415+
ds["BlowingSnow"].attrs["long_name"] = "Blowing Snow"
1416+
1417+
return ds["BlowingSnow"]

src/goes2go/rgb.py

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@
2020
- TrueColor
2121
- FireTemperature
2222
- AirMass
23+
- BlowingSnow
2324
- DayCloudPhase
25+
- DayCloudPhaseEUMETSAT
26+
- DayCloudType
2427
- DayConvection
2528
- DayCloudConvection
2629
- DayLandCloud
@@ -30,6 +33,7 @@
3033
- DaySnowFog
3134
- NighttimeMicrophysics
3235
- Dust
36+
- SeaSpray
3337
- SulfurDioxide
3438
- Ash
3539
- SplitWindowDifference
@@ -562,6 +566,42 @@ def AirMass(C, **kwargs):
562566

563567
return rgb_as_dataset(C, RGB, "Air Mass", **kwargs)
564568

569+
def BlowingSnow(C, **kwargs):
570+
"""
571+
Blowing Snow RGB:
572+
(See `Quick Guide <https://rammb2.cira.colostate.edu/wp-content/uploads/2024/11/GOES-BlowingSnowRGB1_QuickGuide_24April2024.pdf>`__ for reference)
573+
574+
.. image:: /_static/BlowingSnow.png
575+
576+
Parameters
577+
----------
578+
C : xarray.Dataset
579+
A GOES ABI multichannel file opened with xarray.
580+
\*\*kwargs :
581+
Keyword arguments for ``rgb_as_dataset`` function.
582+
- latlon : derive latitude and longitude of each pixel
583+
584+
"""
585+
# Load the three channels into appropriate R, G, and B variables
586+
R = C["CMI_C02"].data
587+
G = C["CMI_C05"].data
588+
B = C["CMI_C07"].data - C["CMI_C13"].data
589+
590+
# Normalize each channel by the appropriate range of values. e.g. R = (R-minimum)/(maximum-minimum)
591+
R = normalize(R, 0, 0.5)
592+
G = normalize(G, 0, 0.2)
593+
B = normalize(B, 0, 30)
594+
595+
# Apply the gamma correction to Red channel.
596+
# corrected_value = value^(1/gamma)
597+
gamma = 1/.7
598+
R = gamma_correction(R, gamma)
599+
B = gamma_correction(B, gamma)
600+
601+
# The final RGB array :)
602+
RGB = np.dstack([R, G, B])
603+
604+
return rgb_as_dataset(C, RGB, "Blowing Snow", **kwargs)
565605

566606
def DayCloudPhase(C, **kwargs):
567607
"""
@@ -595,6 +635,71 @@ def DayCloudPhase(C, **kwargs):
595635

596636
return rgb_as_dataset(C, RGB, "Day Cloud Phase", **kwargs)
597637

638+
def DayCloudPhaseEUMETSAT(C, **kwargs):
639+
"""
640+
Day Cloud Phase EUMETSAT RGB:
641+
(See `Quick Guide <https://eumetrain.org/sites/default/files/2023-01/CloudPhaseRGB.pdf>`__ for reference)
642+
643+
.. image:: /_static/DayCloudPhaseEUMETSAT.png
644+
645+
Parameters
646+
----------
647+
C : xarray.Dataset
648+
A GOES ABI multichannel file opened with xarray.
649+
\*\*kwargs :
650+
Keyword arguments for ``rgb_as_dataset`` function.
651+
- latlon : derive latitude and longitude of each pixel
652+
653+
"""
654+
# Load the three channels into appropriate R, G, and B variables
655+
R, G, B = load_RGB_channels(C, (5, 6, 2))
656+
657+
# Normalize each channel by the appropriate range of values. (Clipping happens inside function)
658+
R = normalize(R, 0, .5)
659+
G = normalize(G, 0, .5)
660+
B = normalize(B, 0, 1)
661+
662+
# The final RGB array :)
663+
RGB = np.dstack([R, G, B])
664+
665+
return rgb_as_dataset(C, RGB, "Day Cloud Phase EUMETSAT", **kwargs)
666+
667+
def DayCloudType(C, **kwargs):
668+
"""
669+
Day Cloud Type RGB:
670+
(See `Quick Guide <https://eumetrain.org/sites/default/files/2021-05/CloudTypeRGB.pdf>`__ for reference)
671+
672+
.. image:: /_static/DayCloudType.png
673+
674+
Parameters
675+
----------
676+
C : xarray.Dataset
677+
A GOES ABI multichannel file opened with xarray.
678+
\*\*kwargs :
679+
Keyword arguments for ``rgb_as_dataset`` function.
680+
- latlon : derive latitude and longitude of each pixel
681+
682+
"""
683+
# Load the three channels into appropriate R, G, and B variables
684+
R, G, B = load_RGB_channels(C, (4, 2, 5))
685+
686+
# Normalize each channel by the appropriate range of values. (Clipping happens inside function)
687+
R = normalize(R, 0, .1)
688+
G = normalize(G, 0, .8)
689+
B = normalize(B, 0, .8)
690+
691+
# Apply the gamma correction to Red channel.
692+
# corrected_value = value^(1/gamma)
693+
gamma = 1.5
694+
R = gamma_correction(R, gamma)
695+
gamma = .75
696+
G = gamma_correction(G, gamma)
697+
698+
# The final RGB array :)
699+
RGB = np.dstack([R, G, B])
700+
701+
return rgb_as_dataset(C, RGB, "Day Cloud Type", **kwargs)
702+
598703

599704
def DayConvection(C, **kwargs):
600705
"""
@@ -910,6 +1015,42 @@ def Dust(C, **kwargs):
9101015

9111016
return rgb_as_dataset(C, RGB, "Dust", **kwargs)
9121017

1018+
def SeaSpray(C, **kwargs):
1019+
"""
1020+
Sea Spray RGB:
1021+
(See `Quick Guide <https://rammb.cira.colostate.edu/training/visit/quick_guides/VIIRS_Sea_Spray_RGB_Quick_Guide_v2.pdf
1022+
>`__ for reference)
1023+
1024+
.. image:: /_static/SeaSpray.png
1025+
1026+
Parameters
1027+
----------
1028+
C : xarray.Dataset
1029+
A GOES ABI multichannel file opened with xarray.
1030+
\*\*kwargs :
1031+
Keyword arguments for ``rgb_as_dataset`` function.
1032+
- latlon : derive latitude and longitude of each pixel
1033+
1034+
"""
1035+
# Load the three channels into appropriate R, G, and B variables
1036+
R = C["CMI_C07"].data - C["CMI_C13"].data
1037+
G = C["CMI_C03"].data
1038+
B = C["CMI_C02"].data
1039+
1040+
# Normalize values
1041+
R = normalize(R, 0, 5)
1042+
G = normalize(G, .01, .09)
1043+
B = normalize(B, .02, .12)
1044+
1045+
# Apply a gamma correction to the image
1046+
gamma = 1/.6
1047+
G = gamma_correction(G, gamma)
1048+
B = gamma_correction(B, gamma)
1049+
1050+
# The final RGB array :)
1051+
RGB = np.dstack([R, G, B])
1052+
1053+
return rgb_as_dataset(C, RGB, "Sea Spray", **kwargs)
9131054

9141055
def SulfurDioxide(C, **kwargs):
9151056
"""

0 commit comments

Comments
 (0)