Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/blaylockbk/goes2go into fea…
Browse files Browse the repository at this point in the history
…ture/local-data-accessor
  • Loading branch information
blaylockbk committed Jul 6, 2024
2 parents f1d1abc + 0d1a21d commit 1ebba04
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 78 deletions.
21 changes: 17 additions & 4 deletions .github/workflows/tests-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ jobs:
tests:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
# In order to save resources, only run particular
# matrix slots on other OS than Linux.
include:
- os: "macos-latest"
python-version: "3.11"
python-version: "3.12"
- os: "windows-latest"
python-version: "3.11"
python-version: "3.12"

env:
OS: ${{ matrix.os }}
Expand All @@ -53,7 +53,20 @@ jobs:
cache: "pip"
cache-dependency-path: "setup.cfg"

- name: Install project
- name: Install project (Linux)
if: runner.os == 'Linux'
run: |
pip3 install --requirement=requirements-test.txt
pip3 install --editable=.
- name: Install project (macOS)
if: runner.os == 'macOS'
run: |
pip3 install --break-system-packages --requirement=requirements-test.txt
pip3 install --break-system-packages --editable=.
- name: Install project (Windows)
if: runner.os == 'Windows'
run: |
pip3 install --requirement=requirements-test.txt
pip3 install --editable=.
Expand Down
146 changes: 73 additions & 73 deletions goes2go/accessors.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,8 @@ def get_latlon(self):
def _load_RGB_channels(self, channels):
"""Load the specified RGB channels.
Return the R, G, and B arrays for the three channels requested. This
function will convert the data any units in Kelvin to Celsius.
Return the R, G, and B arrays for the three channels requested.
This function convert any data given in Kelvin to Celsius.
Parameters
----------
Expand All @@ -368,7 +368,7 @@ def _load_RGB_channels(self, channels):
RGB = []
for u, c in zip(units, channels):
if u == "K":
# Convert form Kelvin to Celsius ## <-- Do I REALLY want to hard-code this in?
# Convert form Kelvin to Celsius
RGB.append(ds["CMI_C%02d" % c].data - 273.15)
else:
RGB.append(ds["CMI_C%02d" % c].data)
Expand Down Expand Up @@ -449,9 +449,9 @@ def TrueColor(self, gamma=2.2, pseudoGreen=True, night_IR=True):

ds["TrueColor"] = (("y", "x", "rgb"), RGB)
ds["rgb"] = ["R", "G", "B"]
ds["TrueColor"].attrs[
"Quick Guide"
] = "http://cimss.ssec.wisc.edu/goes/OCLOFactSheetPDFs/ABIQuickGuide_CIMSSRGB_v2.pdf"
ds["TrueColor"].attrs["Quick Guide"] = (
"http://cimss.ssec.wisc.edu/goes/OCLOFactSheetPDFs/ABIQuickGuide_CIMSSRGB_v2.pdf"
)
ds["TrueColor"].attrs["long_name"] = "True Color"

return ds["TrueColor"]
Expand Down Expand Up @@ -554,9 +554,9 @@ def breakpoint_stretch(C, breakpoint):

ds["NaturalColor"] = (("y", "x", "rgb"), RGB)
ds["rgb"] = ["R", "G", "B"]
ds["NaturalColor"].attrs[
"Quick Guide"
] = "http://cimss.ssec.wisc.edu/goes/OCLOFactSheetPDFs/ABIQuickGuide_CIMSSRGB_v2.pdf"
ds["NaturalColor"].attrs["Quick Guide"] = (
"http://cimss.ssec.wisc.edu/goes/OCLOFactSheetPDFs/ABIQuickGuide_CIMSSRGB_v2.pdf"
)
ds["NaturalColor"].attrs["long_name"] = "Natural Color"

return ds["NaturalColor"]
Expand All @@ -576,7 +576,7 @@ def FireTemperature(self):
R, G, B = self._load_RGB_channels((7, 6, 5))

# _normalize each channel by the appropriate range of values (clipping happens in function)
R = _normalize(R, 273, 333)
R = _normalize(R, 0, 60)
G = _normalize(G, 0, 1)
B = _normalize(B, 0, 0.75)

Expand All @@ -590,9 +590,9 @@ def FireTemperature(self):

ds["FireTemperature"] = (("y", "x", "rgb"), RGB)
ds["rgb"] = ["R", "G", "B"]
ds["FireTemperature"].attrs[
"Quick Guide"
] = "http://rammb.cira.colostate.edu/training/visit/quick_guides/Fire_Temperature_RGB.pdf"
ds["FireTemperature"].attrs["Quick Guide"] = (
"http://rammb.cira.colostate.edu/training/visit/quick_guides/Fire_Temperature_RGB.pdf"
)
ds["FireTemperature"].attrs["long_name"] = "Fire Temperature"

return ds["FireTemperature"]
Expand Down Expand Up @@ -626,9 +626,9 @@ def AirMass(self):

ds["AirMass"] = (("y", "x", "rgb"), RGB)
ds["rgb"] = ["R", "G", "B"]
ds["AirMass"].attrs[
"Quick Guide"
] = "http://rammb.cira.colostate.edu/training/visit/quick_guides/QuickGuide_GOESR_AirMassRGB_final.pdf"
ds["AirMass"].attrs["Quick Guide"] = (
"http://rammb.cira.colostate.edu/training/visit/quick_guides/QuickGuide_GOESR_AirMassRGB_final.pdf"
)
ds["AirMass"].attrs["long_name"] = "Air Mass"

return ds["AirMass"]
Expand Down Expand Up @@ -667,9 +667,9 @@ def AirMassTropical(self):

ds["AirMassTropical"] = (("y", "x", "rgb"), RGB)
ds["rgb"] = ["R", "G", "B"]
ds["AirMassTropical"].attrs[
"Quick Guide"
] = "https://www.eumetsat.int/media/43301"
ds["AirMassTropical"].attrs["Quick Guide"] = (
"https://www.eumetsat.int/media/43301"
)
ds["AirMassTropical"].attrs["long_name"] = "Air Mass Tropical"

return ds["AirMassTropical"]
Expand Down Expand Up @@ -702,9 +702,9 @@ def AirMassTropicalPac(self):

ds["AirMassTropicalPac"] = (("y", "x", "rgb"), RGB)
ds["rgb"] = ["R", "G", "B"]
ds["AirMassTropicalPac"].attrs[
"Quick Guide"
] = "https://cimss.ssec.wisc.edu/satellite-blog/archives/51777"
ds["AirMassTropicalPac"].attrs["Quick Guide"] = (
"https://cimss.ssec.wisc.edu/satellite-blog/archives/51777"
)
ds["AirMassTropicalPac"].attrs["long_name"] = "Air Mass Tropical Pac"

return ds["AirMassTropicalPac"]
Expand Down Expand Up @@ -736,9 +736,9 @@ def DayCloudPhase(self):

ds["DayCloudPhase"] = (("y", "x", "rgb"), RGB)
ds["rgb"] = ["R", "G", "B"]
ds["DayCloudPhase"].attrs[
"Quick Guide"
] = "http://rammb.cira.colostate.edu/training/visit/quick_guides/Day_Cloud_Phase_Distinction.pdf"
ds["DayCloudPhase"].attrs["Quick Guide"] = (
"http://rammb.cira.colostate.edu/training/visit/quick_guides/Day_Cloud_Phase_Distinction.pdf"
)
ds["DayCloudPhase"].attrs["long_name"] = "Day Cloud Phase"

return ds["DayCloudPhase"]
Expand Down Expand Up @@ -770,9 +770,9 @@ def DayConvection(self):

ds["DayConvection"] = (("y", "x", "rgb"), RGB)
ds["rgb"] = ["R", "G", "B"]
ds["DayConvection"].attrs[
"Quick Guide"
] = "http://rammb.cira.colostate.edu/training/visit/quick_guides/QuickGuide_GOESR_DayConvectionRGB_final.pdf"
ds["DayConvection"].attrs["Quick Guide"] = (
"http://rammb.cira.colostate.edu/training/visit/quick_guides/QuickGuide_GOESR_DayConvectionRGB_final.pdf"
)
ds["DayConvection"].attrs["long_name"] = "Day Convection"

return ds["DayConvection"]
Expand Down Expand Up @@ -809,9 +809,9 @@ def DayCloudConvection(self):

ds["DayCloudConvection"] = (("y", "x", "rgb"), RGB)
ds["rgb"] = ["R", "G", "B"]
ds["DayCloudConvection"].attrs[
"Quick Guide"
] = "http://rammb.cira.colostate.edu/training/visit/quick_guides/QuickGuide_DayCloudConvectionRGB_final.pdf"
ds["DayCloudConvection"].attrs["Quick Guide"] = (
"http://rammb.cira.colostate.edu/training/visit/quick_guides/QuickGuide_DayCloudConvectionRGB_final.pdf"
)
ds["DayCloudConvection"].attrs["long_name"] = "Day Cloud Convection"

return ds["DayCloudConvection"]
Expand Down Expand Up @@ -840,9 +840,9 @@ def DayLandCloud(self):

ds["DayLandCloud"] = (("y", "x", "rgb"), RGB)
ds["rgb"] = ["R", "G", "B"]
ds["DayLandCloud"].attrs[
"Quick Guide"
] = "http://rammb.cira.colostate.edu/training/visit/quick_guides/QuickGuide_GOESR_daylandcloudRGB_final.pdf"
ds["DayLandCloud"].attrs["Quick Guide"] = (
"http://rammb.cira.colostate.edu/training/visit/quick_guides/QuickGuide_GOESR_daylandcloudRGB_final.pdf"
)
ds["DayLandCloud"].attrs["long_name"] = "Day Land Cloud"

return ds["DayLandCloud"]
Expand Down Expand Up @@ -871,9 +871,9 @@ def DayLandCloudFire(self):

ds["DayLandCloudFire"] = (("y", "x", "rgb"), RGB)
ds["rgb"] = ["R", "G", "B"]
ds["DayLandCloudFire"].attrs[
"Quick Guide"
] = "http://rammb.cira.colostate.edu/training/visit/quick_guides/QuickGuide_GOESR_DayLandCloudFireRGB_final.pdf"
ds["DayLandCloudFire"].attrs["Quick Guide"] = (
"http://rammb.cira.colostate.edu/training/visit/quick_guides/QuickGuide_GOESR_DayLandCloudFireRGB_final.pdf"
)
ds["DayLandCloudFire"].attrs["long_name"] = "Day Land Cloud Fire"

return ds["DayLandCloudFire"]
Expand Down Expand Up @@ -907,9 +907,9 @@ def WaterVapor(self):

ds["WaterVapor"] = (("y", "x", "rgb"), RGB)
ds["rgb"] = ["R", "G", "B"]
ds["WaterVapor"].attrs[
"Quick Guide"
] = "http://rammb.cira.colostate.edu/training/visit/quick_guides/Simple_Water_Vapor_RGB.pdf"
ds["WaterVapor"].attrs["Quick Guide"] = (
"http://rammb.cira.colostate.edu/training/visit/quick_guides/Simple_Water_Vapor_RGB.pdf"
)
ds["WaterVapor"].attrs["long_name"] = "Water Vapor"

return ds["WaterVapor"]
Expand Down Expand Up @@ -950,9 +950,9 @@ def DifferentialWaterVapor(self):

ds["DifferentialWaterVapor"] = (("y", "x", "rgb"), RGB)
ds["rgb"] = ["R", "G", "B"]
ds["DifferentialWaterVapor"].attrs[
"Quick Guide"
] = "http://rammb.cira.colostate.edu/training/visit/quick_guides/QuickGuide_GOESR_DifferentialWaterVaporRGB_final.pdf"
ds["DifferentialWaterVapor"].attrs["Quick Guide"] = (
"http://rammb.cira.colostate.edu/training/visit/quick_guides/QuickGuide_GOESR_DifferentialWaterVaporRGB_final.pdf"
)
ds["DifferentialWaterVapor"].attrs["long_name"] = "Differential Water Vapor"

return ds["DifferentialWaterVapor"]
Expand Down Expand Up @@ -989,9 +989,9 @@ def DaySnowFog(self):

ds["DaySnowFog"] = (("y", "x", "rgb"), RGB)
ds["rgb"] = ["R", "G", "B"]
ds["DaySnowFog"].attrs[
"Quick Guide"
] = "http://rammb.cira.colostate.edu/training/visit/quick_guides/QuickGuide_DaySnowFog.pdf"
ds["DaySnowFog"].attrs["Quick Guide"] = (
"http://rammb.cira.colostate.edu/training/visit/quick_guides/QuickGuide_DaySnowFog.pdf"
)
ds["DaySnowFog"].attrs["long_name"] = "Day Snow Fog"

return ds["DaySnowFog"]
Expand Down Expand Up @@ -1022,9 +1022,9 @@ def NighttimeMicrophysics(self):

ds["NighttimeMicrophysics"] = (("y", "x", "rgb"), RGB)
ds["rgb"] = ["R", "G", "B"]
ds["NighttimeMicrophysics"].attrs[
"Quick Guide"
] = "http://rammb.cira.colostate.edu/training/visit/quick_guides/QuickGuide_GOESR_NtMicroRGB_final.pdf"
ds["NighttimeMicrophysics"].attrs["Quick Guide"] = (
"http://rammb.cira.colostate.edu/training/visit/quick_guides/QuickGuide_GOESR_NtMicroRGB_final.pdf"
)
ds["NighttimeMicrophysics"].attrs["long_name"] = "Nighttime Microphysics"

return ds["NighttimeMicrophysics"]
Expand Down Expand Up @@ -1059,9 +1059,9 @@ def Dust(self):

ds["Dust"] = (("y", "x", "rgb"), RGB)
ds["rgb"] = ["R", "G", "B"]
ds["Dust"].attrs[
"Quick Guide"
] = "http://rammb.cira.colostate.edu/training/visit/quick_guides/Dust_RGB_Quick_Guide.pdf"
ds["Dust"].attrs["Quick Guide"] = (
"http://rammb.cira.colostate.edu/training/visit/quick_guides/Dust_RGB_Quick_Guide.pdf"
)
ds["Dust"].attrs["long_name"] = "Dust"

return ds["Dust"]
Expand Down Expand Up @@ -1092,9 +1092,9 @@ def SulfurDioxide(self):

ds["SulfurDioxide"] = (("y", "x", "rgb"), RGB)
ds["rgb"] = ["R", "G", "B"]
ds["SulfurDioxide"].attrs[
"Quick Guide"
] = "http://rammb.cira.colostate.edu/training/visit/quick_guides/Quick_Guide_SO2_RGB.pdf"
ds["SulfurDioxide"].attrs["Quick Guide"] = (
"http://rammb.cira.colostate.edu/training/visit/quick_guides/Quick_Guide_SO2_RGB.pdf"
)
ds["SulfurDioxide"].attrs["long_name"] = "Sulfur Dioxide"

return ds["SulfurDioxide"]
Expand Down Expand Up @@ -1125,9 +1125,9 @@ def Ash(self):

ds["Ash"] = (("y", "x", "rgb"), RGB)
ds["rgb"] = ["R", "G", "B"]
ds["Ash"].attrs[
"Quick Guide"
] = "http://rammb.cira.colostate.edu/training/visit/quick_guides/GOES_Ash_RGB.pdf"
ds["Ash"].attrs["Quick Guide"] = (
"http://rammb.cira.colostate.edu/training/visit/quick_guides/GOES_Ash_RGB.pdf"
)
ds["Ash"].attrs["long_name"] = "Ash"

return ds["Ash"]
Expand All @@ -1154,9 +1154,9 @@ def SplitWindowDifference(self):

ds["SplitWindowDifference"] = (("y", "x", "rgb"), RGB)
ds["rgb"] = ["R", "G", "B"]
ds["SplitWindowDifference"].attrs[
"Quick Guide"
] = "http://cimss.ssec.wisc.edu/goes/OCLOFactSheetPDFs/ABIQuickGuide_SplitWindowDifference.pdf"
ds["SplitWindowDifference"].attrs["Quick Guide"] = (
"http://cimss.ssec.wisc.edu/goes/OCLOFactSheetPDFs/ABIQuickGuide_SplitWindowDifference.pdf"
)
ds["SplitWindowDifference"].attrs["long_name"] = "Split Window Difference"

return ds["SplitWindowDifference"]
Expand Down Expand Up @@ -1186,9 +1186,9 @@ def NightFogDifference(self):

ds["NightFogDifference"] = (("y", "x", "rgb"), RGB)
ds["rgb"] = ["R", "G", "B"]
ds["NightFogDifference"].attrs[
"Quick Guide"
] = "http://cimss.ssec.wisc.edu/goes/OCLOFactSheetPDFs/ABIQuickGuide_NightFogBTD.pdf"
ds["NightFogDifference"].attrs["Quick Guide"] = (
"http://cimss.ssec.wisc.edu/goes/OCLOFactSheetPDFs/ABIQuickGuide_NightFogBTD.pdf"
)
ds["NightFogDifference"].attrs["long_name"] = "NightFogDifference"

return ds["NightFogDifference"]
Expand Down Expand Up @@ -1232,9 +1232,9 @@ def RocketPlume(self, night=False):

ds["RocketPlume"] = (("y", "x", "rgb"), RGB)
ds["rgb"] = ["R", "G", "B"]
ds["RocketPlume"].attrs[
"Quick Guide"
] = "https://cimss.ssec.wisc.edu/satellite-blog/images/2021/06/QuickGuide_Template_GOESRBanner_Rocket_Plume.pdf"
ds["RocketPlume"].attrs["Quick Guide"] = (
"https://cimss.ssec.wisc.edu/satellite-blog/images/2021/06/QuickGuide_Template_GOESRBanner_Rocket_Plume.pdf"
)
ds["RocketPlume"].attrs["long_name"] = "Rocket Plume"

return ds["RocketPlume"]
Expand Down Expand Up @@ -1268,9 +1268,9 @@ def NormalizedBurnRatio(self):

ds["NormalizedBurnRatio"] = (("y", "x", "rgb"), RGB)
ds["rgb"] = ["R", "G", "B"]
ds["NormalizedBurnRatio"].attrs[
"Quick Guide"
] = "https://ntrs.nasa.gov/citations/20190030825"
ds["NormalizedBurnRatio"].attrs["Quick Guide"] = (
"https://ntrs.nasa.gov/citations/20190030825"
)
ds["NormalizedBurnRatio"].attrs["long_name"] = "Normalized Burn Ratio"

return ds["NormalizedBurnRatio"]
Expand Down Expand Up @@ -1305,9 +1305,9 @@ def SeaSpray(self, **kwargs):

ds["SeaSpray"] = (("y", "x", "rgb"), RGB)
ds["rgb"] = ["R", "G", "B"]
ds["SeaSpray"].attrs[
"Quick Guide"
] = "https://rammb.cira.colostate.edu/training/visit/quick_guides/VIIRS_Sea_Spray_RGB_Quick_Guide_v2.pdf"
ds["SeaSpray"].attrs["Quick Guide"] = (
"https://rammb.cira.colostate.edu/training/visit/quick_guides/VIIRS_Sea_Spray_RGB_Quick_Guide_v2.pdf"
)
ds["SeaSpray"].attrs["long_name"] = "Sea Spray"

return ds["SeaSpray"]
2 changes: 1 addition & 1 deletion goes2go/rgb.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ def FireTemperature(C, **kwargs):
R, G, B = load_RGB_channels(C, (7, 6, 5))

# Normalize each channel by the appropriate range of values (clipping happens in function)
R = normalize(R, 273, 333)
R = normalize(R, 0, 60)
G = normalize(G, 0, 1)
B = normalize(B, 0, 0.75)

Expand Down

0 comments on commit 1ebba04

Please sign in to comment.