import h5py
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import numpy as np
from cartopy.mpl.gridliner import LONGITUDE_FORMATTER, LATITUDE_FORMATTER
Plotting DISCOVR EPIC Level-2 ozone product parameters
Summary
This code graphs 4 different parameters from the DSCOVR EPIC Level 2 Total Ozone, Version 3 product (Ozone, Reflectivity, Radiative Cloud Fraction, Cloud Pressure).
Reference
Code Reference: https://hdfeos.org/zoo/LaRC/DSCOVR_EPIC_L2_TO3_03_20210301005516_03.h5.py
For more information on this data product please vist: https://avdc.gsfc.nasa.gov/pub/DSCOVR/EPIC_Pulications/EPICTO3UserGuide_final.pdf
Note
By: Cheyenne Land
Tested using Python 3.8.10
1. Setup
2. Open and read data
= 'DSCOVR_EPIC_L2_TO3_03_20210402092724_03.h5'
fn with h5py.File(fn, mode='r') as f:
= '/Ozone'
ozone = f[ozone][:].astype(np.float64)
dataozone = '/Reflectivity'
reflectivity = f[reflectivity][:].astype(np.float64)
datareflectivity = '/RadiativeCloudFraction'
RCF = f[RCF][:].astype(np.float64)
dataRCF = '/CloudPressure'
CP = f[CP][:].astype(np.float64)
dataCP = f['/Latitude'][:]
lat = f['/Longitude'][:] lon
3. Set fill value for each variable
= -999.0
FillValue
== FillValue] = np.nan
dataozone[dataozone = np.ma.masked_where(np.isnan(dataozone), dataozone)
dataozone
== FillValue] = np.nan
datareflectivity[datareflectivity = np.ma.masked_where(np.isnan(datareflectivity), datareflectivity)
datareflectivity
== FillValue] = np.nan
dataRCF[dataRCF = np.ma.masked_where(np.isnan(dataRCF), dataRCF)
dataRCF
== FillValue] = np.nan
dataCP[dataCP = np.ma.masked_where(np.isnan(dataCP), dataCP) dataCP
4. Find middle location
= lat[int(lat.shape[0]/2),int(lat.shape[1]/2)]
lat_m = lon[int(lon.shape[0]/2),int(lon.shape[1]/2)]
lon_m
= plt.figure(figsize=(12,9.5), dpi=300) fig
5. Plot the data
= ccrs.Orthographic(central_longitude=lon_m,
orth =lat_m,
central_latitude=None)
globe
= fig.add_subplot(221, projection=orth)
ax1 = ax1.scatter(lon, lat, c=dataozone, s=1, cmap=plt.cm.jet,
im1 =ccrs.PlateCarree())
transform
ax1.coastlines()= ax1.gridlines()
gl = False
gl.top_labels = False
gl.right_labels = LONGITUDE_FORMATTER
gl.xformatter = LATITUDE_FORMATTER
gl.yformatter = plt.colorbar(im1, fraction=0.022, pad=0.01)
cb1 'DU', fontsize=10)
cb1.set_label('Ozone', size = 10)
ax1.set_title(
= fig.add_subplot(222, projection=orth)
ax2 = ax2.scatter(lon, lat, c=datareflectivity, s=1, cmap=plt.cm.jet,
im2 =ccrs.PlateCarree())
transform
ax2.coastlines()= ax2.gridlines()
g2 = False
g2.top_labels = False
g2.right_labels = LONGITUDE_FORMATTER
g2.xformatter = LATITUDE_FORMATTER
g2.yformatter = plt.colorbar(im2, fraction=0.022, pad=0.01)
cb2 'Reflectivity', size = 10)
ax2.set_title(
= fig.add_subplot(223, projection=orth)
ax3 = ax3.scatter(lon, lat, c=dataRCF, s=1, cmap=plt.cm.jet,
im3 =ccrs.PlateCarree())
transform
ax3.coastlines()= ax3.gridlines()
g3 = False
g3.top_labels = False
g3.right_labels = LONGITUDE_FORMATTER
g3.xformatter = LATITUDE_FORMATTER
g3.yformatter = plt.colorbar(im3, fraction=0.022, pad=0.01)
cb3 'Radiative Cloud Fraction', size = 10)
ax3.set_title(
= fig.add_subplot(224, projection=orth)
ax4 = ax4.scatter(lon, lat, c=dataCP, s=1, cmap=plt.cm.jet,
im4 =ccrs.PlateCarree())
transform
ax4.coastlines()= ax4.gridlines()
g4 = False
g4.top_labels = False
g4.right_labels = LONGITUDE_FORMATTER
g4.xformatter = LATITUDE_FORMATTER
g4.yformatter = plt.colorbar(im4, fraction=0.022, pad=0.01)
cb4 'Cloud Pressure', size = 10)
ax4.set_title(
'DSCOVR_EPIC_L2_TO3_03_20210402092724_03', fontsize=10)
plt.suptitle('DSCOVR_EPIC_L2_TO3_03_20210402092724_03.png', dpi=200)
plt.savefig( plt.close()