Plot aerosol feature subtypes
-
- Posts: 1
- Joined: Mon Jan 08, 2024 7:26 am America/New_York
Plot aerosol feature subtypes
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?
- Attachments
-
- WhatsApp Image 2024-01-08 at 17.56.15_b34c3231.jpg (33.71 KiB) Not viewed yet
Tags:
-
- Posts: 6
- Joined: Tue Jan 09, 2024 2:16 am America/New_York
Re: Plot aerosol feature subtypes
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
[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
Last edited by ASDC - David W. on Tue Jan 09, 2024 2:13 pm America/New_York, edited 1 time in total.
Reason: removing website advertising link
Reason: removing website advertising link