Page 1 of 1
Plot aerosol feature subtypes
Posted: Mon Jan 08, 2024 7:30 am America/New_York
by satyaprakash
I am trying to plot the contours of aerosol feature subtypes (dust, polluted dust, smoke etc.) with the help of CALIPSO Vertical feature mask (CAL_LID_L2_VFM-Standard-V4-51.2015-05-31T07-59-22ZD_Subset product) using python. I have referred to examples from
https://hdfeos.org/zoo/LaRC_CALIPSO_py.php but I am not able to plot it. Can anyone help me with the script to plot the aerosol feature subtype contours with respect to latitudeĀ andĀ altitude?
Re: Plot aerosol feature subtypes
Posted: Tue Jan 09, 2024 9:46 am America/New_York
by sidsaini445
Here is some sample Python code to plot the contours of aerosol subtypes from the CALIPSO Vertical Feature Mask (VFM) product with respect to latitude and altitude:
[code]import numpy as np
import matplotlib.pyplot as plt
from pyhdf.SD import SD, SDC
# Open the HDF4 file
FILE_NAME = 'CAL_LID_L2_VFM-Standard-V4-51.2015-05-31T07-59-22ZD_Subset.hdf'
hdf = SD(FILE_NAME, SDC.READ)
# Extract the feature classification data
data3D = hdf.select('Feature_Classification_Flags')[:,:].astype(int)
# Get the latitude and altitude arrays
latitude = hdf.select('Latitude')[:,0]
altitude = hdf.select('Altitude')[:,0]
# Create a plot
fig, ax = plt.subplots()
# Contourf plot for dust (class 3)
cs = ax.contourf(latitude, altitude, (data3D==3).astype(int), levels=[0,.5,1], cmap='Reds')
# Contourf plot for smoke (class 4)
cs = ax.contourf(latitude, altitude, (data3D==4).astype(int), levels=[0,.5,1], cmap='Greens')
ax.set_ylabel('Altitude (km)')
ax.set_xlabel('Latitude (degrees)')
plt.title('CALIPSO Aerosol Subtypes')
fig.colorbar(cs)
plt.show()[/code]
This plots filled contour plots showing the detected pixels of dust (red) and smoke (green) as a function of latitude and altitude from the CALIPSO data. Additional subtype classes could be added following the same contourf plotting approach.
Please let me know if you have any other questions!
Sid Saini