Using Python To Explore GOES-16 Data
Using Python To Explore GOES-16 Data
01 Python Setup
04 Radiance to Reflectance
05 Gamma correction
08 GLM Counts
09 GLM Plots
10 Jupyter Notebook
Python Setup
To read GOES-16 data you will need the netCDF4 package. To manipulate and plot the data we
recommend matplotlib & numpy.
Here is what the import segment looks like for the example code
%matplotlib inline
from netCDF4 import Dataset
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure(figsize=(6,6),dpi=200)
im = plt.imshow(radiance, cmap='Greys_r')
cb = fig.colorbar(im, orientation='horizontal')
cb.set_ticks([1, 100, 200, 300, 400, 500, 600])
cb.set_label('Radiance (W m-2 sr-1 um-1)')
plt.show()
Radiance to Reflectance
It is useful to convert the radiance values from an absolute scale into a relative scale to make them
easier to deal with in the following steps. We will use the example formula published by NOAA at
http://www.goes-r.gov/products/ATBDs/baseline/Imagery_v2.0_no_color.pdf on page 21.
# Define some constants needed for the conversion. From the pdf linked above
Esun_Ch_01 = 726.721072
Esun_Ch_02 = 663.274497
Esun_Ch_03 = 441.868715
d2 = 0.3
# Apply the formula to convert radiance to reflectance
ref = (radiance * np.pi * d2) / Esun_Ch_02
# Plot reflectance
fig = plt.figure(figsize=(6,6),dpi=200)
im = plt.imshow(ref, vmin=0.0, vmax=1.0, cmap='Greys_r')
cb = fig.colorbar(im, orientation='horizontal')
cb.set_ticks([0, 0.2, 0.4, 0.6, 0.8, 1.0])
cb.set_label('Reflectance')
plt.show()
Gamma correction
You’ll notice the image above looks very dark, that is because the values are in linear units. We do a
simple gamma correction to adjust this and brighten the image
On GOES-16, Band 2 (Red Visible) is 500-meter resolution while Band 1 (Blue Visible) and Band 3
(Veggie IR) are 1,000-meter resolution. In order to combine the 3 bands into an RGB image we will
first resample bands 2 to 1000-meter resolution.
# Rebin function from https://stackoverflow.com/questions/8090229/resize-with-averaging-or-rebin-a-
numpy-2d-array
def rebin(a, shape):
sh = shape[0],a.shape[0]//shape[0],shape[1],a.shape[1]//shape[1]
return a.reshape(sh).mean(-1).mean(1)
Lets make a geocolor image using the veggie near IR band directly in place of green and see how that
looks.
GLM Counts
GLM provides latitude longitude points for events (detections) which are then aggregated into group
and flash events. Think about how for a single ground strike in a supercell thunderstorm the intracloud
portion of the lightning may extend for many 10s to 100s of miles as the extent of the events. This
data is then aggregated to provide cluster centroids which are stored as the flashes.
event_lat = g16glm.variables['event_lat'][:]
event_lon = g16glm.variables['event_lon'][:]
group_lat = g16glm.variables['group_lat'][:]
group_lon = g16glm.variables['group_lon'][:]
flash_lat = g16glm.variables['flash_lat'][:]
flash_lon = g16glm.variables['flash_lon'][:]
GLM Plots
Here we will just plot all of the data on top of each other so you can observed how the data are
aggregated together.
fig = plt.figure(figsize=(6,6),dpi=200)
map = Basemap(projection='merc', lat_0 = 0, lon_0 = -70.0,
resolution = 'l', area_thresh = 1000.0,
llcrnrlon=-135.0, llcrnrlat=-65.0,
urcrnrlon=0.0, urcrnrlat=65.0)
map.drawcoastlines()
map.drawcountries()
map.fillcontinents(color = 'tan')
map.drawmapboundary()
plt.show()
Jupyter Notebook
The notebook and example data shown here are available at https://github.com/occ-data/goes16-
jupyter