CALIPSO_DATA_VISUALIZATION

Use this Forum to find information on, or ask a question about, NASA Earth Science data.
Post Reply
nithish_kumar
Posts: 1
Joined: Fri Oct 29, 2021 12:27 am America/New_York
Answers: 0

CALIPSO_DATA_VISUALIZATION

by nithish_kumar » Fri Nov 05, 2021 4:35 am America/New_York

Dear Sir/Madam,
I am using CALIPSO level 2 V4-20 data for my project. In MATLAB I am trying to visualize vertical feature mask but I can see there is a problem, in altitude wise, with my plot. I used vfm_row2block.m script provided (https://www-calipso.larc.nasa.gov/resou ... #heading03). I have attached my MATLAB script and output figure here. I hope you can help me.
Attachments
row2block_script.pdf
(42.75 KiB) Downloaded 91 times
raw_fig.png
raw_fig.png (61.9 KiB) Not viewed yet
by srodier » Wed Nov 10, 2021 11:25 am America/New_York
Hi Nithish,

The VFM data array is not on an evenly spaced vertical grid, unfortunately using “imagesc” will not display the VFM data correctly.

I would recommend the following updates/changes to your MATLAB script.
Read the altitude array from the VFM file. You will find the Lidar Altitude information stored in the metadata. I have included a simple function that will retrieve the 583-bin standard Lidar altitude array. You will need to remove the bins that are not included in the VFM array.

Z = getLidarDataAltitudes( FILE_NAME );
Z1 = Z(34:578);

Read the single-shot latitude SDS 'ssLatitude' (it is in the Single_Shot_Detection Vdata, the dimensions will match the VFM data array after you have called the vfm_row2block)

lat_name='ssLatitude';
lat = sd.readData(sds_id);


Use pcolor in place of imagesc
pcolor(lat, Z1,ll);
shading flat.

Call cmap and caxis after you have created the image.


I have included your MATLAB script with these changes and an example of the plot it will produce.



function altitude = getLidarDataAltitudes( hdfFilename )
% Description: retrieves the altitude array from any of the CALIPSO level
% 1 & level 2 lidar data products; tested with versions 1.x,
% 2.x, and 3.01 of the CALIPSO data products
%
% Inputs: hdfFilename : string = CALIPSO data file name
%
% Outputs: altitude : 583 x 1 array of single = altitude at the
% midpoint of each CALIPSO vertical sampling element;
% NOTE! the CALIPSO altitude array is not uniformly
% spaced; see the CALIPSO documentation for details
%

altitudeCell = hdfread(hdfFilename, '/metadata', 'Fields', 'Lidar_Data_Altitudes', 'FirstRecord', 1 ,'NumRecords', 1);
altitude = altitudeCell{1};

end

>>>>


import matlab.io.hdf4.*
% Open the HDF4 File.
FILE_NAME = 'CAL_LID_L2_VFM-Standard-V4-20.2020-06-30T20-55-17ZN.hdf';
SD_id = sd.start(FILE_NAME, 'rdonly');
% Read data.
datafield_name='Feature_Classification_Flags';
sds_index = sd.nameToIndex(SD_id, datafield_name);
sds_id = sd.select(SD_id, sds_index);
data = sd.readData(sds_id);
sd.endAccess(sds_id);
% Read lat.
lat_name='ssLatitude';
sds_index = sd.nameToIndex(SD_id, lat_name);
sds_id = sd.select(SD_id, sds_index);
lat = sd.readData(sds_id);
sd.endAccess(sds_id);
% Close the file. sd.close(SD_id);
lat = lat';


b = data(:,1);
b = b';
ll = vfm_row2block(b,'type');
for i=2:3728
b = data(:,i);
%b = b';
lol = vfm_row2block(b,'type');
c = cat(2,ll,lol);
ll=c;
end


Z = getLidarDataAltitudes( FILE_NAME );
Z1 = Z(34:578);

% altitude = zeros(545,1);
% % 20.2km to 30.1km
% for i=0:54
% altitude(i+1) = 30.1 - i*0.18;
% end
% % 8.2km to 20.2km
% for i=0:199
% altitude(i+56) = 20.2 - (i)*0.06;
% end
% % -0.5km to 8.2km
% for i=0:289
% altitude(i+256) = 8.2 - (i)*0.03;
% end

% Create a Figure to Plot the data.
f = figure('Name', FILE_NAME, ...
'Renderer', 'zbuffer', ...
'Position', [0,0,800,600], ...
'Visible', 'off', ...
'PaperPositionMode', 'auto');

cmap=[ % Key R G B
[1.0000 1.0000 1.0000]; ... % 0=invalid
[0.0000 0.0000 1.0000]; ... % 1=clear air
[0.2000 1.0000 1.0000]; ... % 2=cloud
[1.0000 0.6000 0.0000]; ... % 3=aerosol
[1.0000 0.6000 0.0000]; ... % 3=aerosol
[1.0000 1.0000 0.0000]; ... % 4=strato. feat
[0.0000 1.0000 0.0000]; ... % 5=surface
[0.4980 0.4980 0.4980]; ... % 6=subsurface
[0.0000 0.0000 0.0000]; ... % 7=no signal
];
%imagesc(lat, altitude,ll);
pcolor(lat, Z1,ll);
shading flat;

colormap(cmap);
caxis([0 7]);


set(gca,'YDir','normal');
set(gca,'XDir','reverse');
% Set axis labels.
xlabel('Latitude (degrees north)');
ylabel('Altitude (km)');

% Put colorbar.
y = [ 1, 2, 3, 4, 5, 6, 7];
h = colorbar('YTickLabel', {'Clear Air','Cloud', 'Tropo. Aerosol','Strat. Aerosol',...
'Surface','Subsurface','No Signal'}, 'YTick', y);
tstring = {FILE_NAME;['Aerosol Type (Bits 1-3) in' ...
' Feature Classification Flag']};
title(tstring, 'Interpreter', 'none', 'FontSize', 16,...
'FontWeight','bold');
saveas(gcf,'vfm_raw_fig.png');
Go to full post

Tags:

ASDC - joseph.f.koch
User Services
User Services
Posts: 33
Joined: Mon Nov 23, 2020 3:57 pm America/New_York
Answers: 2

Re: CALIPSO_DATA_VISUALIZATION

by ASDC - joseph.f.koch » Fri Nov 05, 2021 3:27 pm America/New_York

Hi Nithish,

Thank you for your post. A CALIPSO Subject Matter Expert has been notified and will answer your question shortly. Please stand by!

Thanks,
ASDC User Services

srodier
Subject Matter Expert
Subject Matter Expert
Posts: 1
Joined: Wed Nov 10, 2021 11:08 am America/New_York
Answers: 1

Re: CALIPSO_DATA_VISUALIZATION

by srodier » Wed Nov 10, 2021 11:25 am America/New_York

Hi Nithish,

The VFM data array is not on an evenly spaced vertical grid, unfortunately using “imagesc” will not display the VFM data correctly.

I would recommend the following updates/changes to your MATLAB script.
Read the altitude array from the VFM file. You will find the Lidar Altitude information stored in the metadata. I have included a simple function that will retrieve the 583-bin standard Lidar altitude array. You will need to remove the bins that are not included in the VFM array.

Z = getLidarDataAltitudes( FILE_NAME );
Z1 = Z(34:578);

Read the single-shot latitude SDS 'ssLatitude' (it is in the Single_Shot_Detection Vdata, the dimensions will match the VFM data array after you have called the vfm_row2block)

lat_name='ssLatitude';
lat = sd.readData(sds_id);


Use pcolor in place of imagesc
pcolor(lat, Z1,ll);
shading flat.

Call cmap and caxis after you have created the image.


I have included your MATLAB script with these changes and an example of the plot it will produce.



function altitude = getLidarDataAltitudes( hdfFilename )
% Description: retrieves the altitude array from any of the CALIPSO level
% 1 & level 2 lidar data products; tested with versions 1.x,
% 2.x, and 3.01 of the CALIPSO data products
%
% Inputs: hdfFilename : string = CALIPSO data file name
%
% Outputs: altitude : 583 x 1 array of single = altitude at the
% midpoint of each CALIPSO vertical sampling element;
% NOTE! the CALIPSO altitude array is not uniformly
% spaced; see the CALIPSO documentation for details
%

altitudeCell = hdfread(hdfFilename, '/metadata', 'Fields', 'Lidar_Data_Altitudes', 'FirstRecord', 1 ,'NumRecords', 1);
altitude = altitudeCell{1};

end

>>>>


import matlab.io.hdf4.*
% Open the HDF4 File.
FILE_NAME = 'CAL_LID_L2_VFM-Standard-V4-20.2020-06-30T20-55-17ZN.hdf';
SD_id = sd.start(FILE_NAME, 'rdonly');
% Read data.
datafield_name='Feature_Classification_Flags';
sds_index = sd.nameToIndex(SD_id, datafield_name);
sds_id = sd.select(SD_id, sds_index);
data = sd.readData(sds_id);
sd.endAccess(sds_id);
% Read lat.
lat_name='ssLatitude';
sds_index = sd.nameToIndex(SD_id, lat_name);
sds_id = sd.select(SD_id, sds_index);
lat = sd.readData(sds_id);
sd.endAccess(sds_id);
% Close the file. sd.close(SD_id);
lat = lat';


b = data(:,1);
b = b';
ll = vfm_row2block(b,'type');
for i=2:3728
b = data(:,i);
%b = b';
lol = vfm_row2block(b,'type');
c = cat(2,ll,lol);
ll=c;
end


Z = getLidarDataAltitudes( FILE_NAME );
Z1 = Z(34:578);

% altitude = zeros(545,1);
% % 20.2km to 30.1km
% for i=0:54
% altitude(i+1) = 30.1 - i*0.18;
% end
% % 8.2km to 20.2km
% for i=0:199
% altitude(i+56) = 20.2 - (i)*0.06;
% end
% % -0.5km to 8.2km
% for i=0:289
% altitude(i+256) = 8.2 - (i)*0.03;
% end

% Create a Figure to Plot the data.
f = figure('Name', FILE_NAME, ...
'Renderer', 'zbuffer', ...
'Position', [0,0,800,600], ...
'Visible', 'off', ...
'PaperPositionMode', 'auto');

cmap=[ % Key R G B
[1.0000 1.0000 1.0000]; ... % 0=invalid
[0.0000 0.0000 1.0000]; ... % 1=clear air
[0.2000 1.0000 1.0000]; ... % 2=cloud
[1.0000 0.6000 0.0000]; ... % 3=aerosol
[1.0000 0.6000 0.0000]; ... % 3=aerosol
[1.0000 1.0000 0.0000]; ... % 4=strato. feat
[0.0000 1.0000 0.0000]; ... % 5=surface
[0.4980 0.4980 0.4980]; ... % 6=subsurface
[0.0000 0.0000 0.0000]; ... % 7=no signal
];
%imagesc(lat, altitude,ll);
pcolor(lat, Z1,ll);
shading flat;

colormap(cmap);
caxis([0 7]);


set(gca,'YDir','normal');
set(gca,'XDir','reverse');
% Set axis labels.
xlabel('Latitude (degrees north)');
ylabel('Altitude (km)');

% Put colorbar.
y = [ 1, 2, 3, 4, 5, 6, 7];
h = colorbar('YTickLabel', {'Clear Air','Cloud', 'Tropo. Aerosol','Strat. Aerosol',...
'Surface','Subsurface','No Signal'}, 'YTick', y);
tstring = {FILE_NAME;['Aerosol Type (Bits 1-3) in' ...
' Feature Classification Flag']};
title(tstring, 'Interpreter', 'none', 'FontSize', 16,...
'FontWeight','bold');
saveas(gcf,'vfm_raw_fig.png');
Attachments
VFM Plot with changes
VFM Plot with changes
vfm_raw_fig.png (114.25 KiB) Not viewed yet

Post Reply