MATLAB code for plotting the feature types from CALIPSO level 2 vertical feature mask data

Please enter here to ask a question about any NASA Science related topics!
Post Reply
ank_earthdata19
Posts: 4
Joined: Tue Jul 13, 2021 8:03 am America/New_York

MATLAB code for plotting the feature types from CALIPSO level 2 vertical feature mask data

by ank_earthdata19 » Wed Jul 14, 2021 3:12 pm America/New_York

Dear Sir/Madam,
I have plotted the vertical feature mask of all feature types using CALIPSO Level 2 Version 4.2 Vertical Feature Mask product after modifying the code available on the website of HDF-EOS (http://hdfeos.org/zoo/LaRC/CAL_LID_L2_V ... 11ZD_hdf.m). Here, I have plotted only with the latitude. But, I want to plot with both latitude and longitude as shown in the example image of the 'Layer Type' section on the CALIPSO website (https://www-calipso.larc.nasa.gov/resou ... /index.php). Also, the plot that appears after running my code is not that much good as shown in the example I mentioned above. If you look at my code, you will see I added 'linecolor','none' in contourf line to omit the contour line. But, still, some outlines are appearing in the contour. I have attached my figure here. Please have a look at that to understand what I am trying to mean. Can anyone tell me why? Is it because of contour? Is there any other way to plot instead of using contourf?
I have seen one Meteoinfo example (http://meteothink.org/examples/meteoinf ... lipso.html) which is written in python (I think). but I don't have any knowledge in python. Still I gave a try using the following line:
image(lat, altitude, rot90(data, 1))
But, it doesn't work. So, can anyone guide me on how to plot all feature type using CALIPSO vertcal feature mask data as just like similar to the image I have mentioned above. I'm very new to this type of data. So, any help on this will be very much appreciable. Thank you.

Ankan
Attachments
calipso_vfm_allfeatures.jpg
calipso_vfm_allfeatures.jpg (178.42 KiB) Not viewed yet
calipso_vfm_allfeatures_code.pdf
(226 KiB) Downloaded 64 times
by ASDC - cheyenne.e.land » Fri Aug 27, 2021 1:38 pm America/New_York
Hello @ank_earthdata19,

We apologize for the long delay. To answer the first part of your question:
The final plot is done with imagesc command. imagesc(pfNum, Z2, aeroSubtype);

pfNum is a vector of profile numbers
Z2 is the size which involves getting the number of 1km records, single shot, and sizing the buffer by the “hi” & “low” buffer.
aeroSubtype. – breaking out the VFM mask

Z = the lidar altitude
Z_hi = (fliplr(linspace(Z(288), Z(89), num1kmRows)))';
Z_lo = Z(289:2*289);
Z2 = [Z_hi; Z_lo];


As far as plotting both the lat and lon:
Here is a real simple example of using sprintf to get lat and lon on same xtick
Latitude = [-10 0 10 20 30 40 50 60 70 80 90];
Longitude = [70 80 90 100 110 120 130 140 150 160 170];


pfStop = last; pfStart = start;
lat = Latitude;
lon = Longitude;

pfCount = pfStop - pfStart + 1;
%pfNum = 1:pfCount;
latmin = lat(start);
latmax = lat(last);


latTickPos = zeros(11, 1);
latTickPos(start) = lat(start);
latTickPos(last) = lat(last);

latLabels{start} = sprintf('%.2f %.2f', lat(start),lon(start));
latLabels{last} = sprintf('%.2f %.2f', lat(last),lon(last));

for k = 2:11
axFrac = (k-1)/11;
latTickPos(k) = round( pfCount*axFrac );
N = round( pfStart + pfCount*axFrac - 1 );
latLabels{k} = sprintf('%.2f %.2f', lat(N),lon(N));
end

latLabels = cellfun(@(x) strrep(x,' ','\newline'), latLabels,'UniformOutput',false);
% a = gca;
% a.XTickLabel = latLabels;
set(gca,'XTick', latTickPos);
set(gca,'XTickLabel', latLabels );

For the second part of your question, CALIPSO does not distribute code to make the plots. Again we apologize for the long wait.

Warm Regards,

NASA Langley ASDC User Services
Go to full post

Tags:

ASDC - ingridgs
User Services
User Services
Posts: 45
Joined: Fri Apr 23, 2021 9:14 am America/New_York
Answers: 1

Re: MATLAB code for plotting the feature types from CALIPSO level 2 vertical feature mask data

by ASDC - ingridgs » Thu Jul 15, 2021 1:14 pm America/New_York

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

ank_earthdata19
Posts: 4
Joined: Tue Jul 13, 2021 8:03 am America/New_York

Re: MATLAB code for plotting the feature types from CALIPSO level 2 vertical feature mask data

by ank_earthdata19 » Wed Jul 21, 2021 7:38 am America/New_York

Okay. I am eagerly waiting for your response. Thank you.

ASDC - ingridgs
User Services
User Services
Posts: 45
Joined: Fri Apr 23, 2021 9:14 am America/New_York
Answers: 1

Re: MATLAB code for plotting the feature types from CALIPSO level 2 vertical feature mask data

by ASDC - ingridgs » Thu Jul 22, 2021 11:13 am America/New_York

Hi Ankan,

The answer to your question was replied via the HDF Forum.

Thank you.

ank_earthdata19
Posts: 4
Joined: Tue Jul 13, 2021 8:03 am America/New_York

Re: MATLAB code for plotting the feature types from CALIPSO level 2 vertical feature mask data

by ank_earthdata19 » Fri Jul 23, 2021 9:39 am America/New_York

Hi,
Actually, the question asked in the HDF Forum (the link you have given in your last reply) is a different question. There the question is how to plot cloud subtypes from CALIPSO vertical feature mask data in MATLAB.
But, here I am asking :
Question no 1: How to plot feature types similar to the image shown in the example image of the 'Layer Type' section on the CALIPSO website (https://www-calipso.larc.nasa.gov/resou ... /index.php)? In this image, the feature types are plotted both in latitude and longitude. What I am able to do so far in MATLAB is only with the latitude, not with both latitude and longitude. For clarity, I am also attaching a sample image so that you will understand easily what I am looking for to do so.
Also, I am asking:
Question no 2: Is there any other possible way to plot this instead of using the 'contourf' command. Like in the Meteoinfo example (http://meteothink.org/examples/meteoinf ... lipso.html), they used these lines:
# Plot
levs = arange(8)
cols = [(255,255,255),(0,0,255),(51,255,255),(255,153,0),(255,255,0),(0,255,0),(127,127,127),(0,0,0)]
ls = makesymbolspec('image', levels=levs, colors=cols)
layer = imshow(rot90(data, 1), symbolspec=ls, extent=[lat[0],lat[-1],alt[0],alt[-1]])
colorbar(layer, ticklabels=['Invalid', 'Clear Air', 'Cloud', 'Aerosol', 'Strato Feature', 'Surface', 'Subsurface', 'No Signal'])
basename = os.path.basename(fn)
title([basename, 'Feature Type (Bits 1-3) in Feature Classification Flag'])
xlabel('Latitude (degrees north)')
ylabel('Altitude (km)')
xaxis(tickin=False)
yaxis(tickin=False)
But these are written in Jython. And I don't have any knowledge of this. I have tried in MATLAB but couldn't able to do it. So, is it possible to do the same code like using 'imshow' instead of 'contourf' in MATLAB for better visualization of the data?
Therefore, any help on these will be very much appreciable. Thank you.
Attachments
CALIPSO_VFM_sample image.png
CALIPSO_VFM_sample image.png (43.36 KiB) Not viewed yet

ASDC - cheyenne.e.land
User Services
User Services
Posts: 31
Joined: Mon Mar 22, 2021 3:55 pm America/New_York
Answers: 1

Re: MATLAB code for plotting the feature types from CALIPSO level 2 vertical feature mask data

by ASDC - cheyenne.e.land » Mon Aug 16, 2021 2:49 pm America/New_York

Hello,

We wanted to let you know that we are currently looking into this. Apologies for any inconvenience and thank you for your patience.

ASDC - cheyenne.e.land
User Services
User Services
Posts: 31
Joined: Mon Mar 22, 2021 3:55 pm America/New_York
Answers: 1

Re: MATLAB code for plotting the feature types from CALIPSO level 2 vertical feature mask data

by ASDC - cheyenne.e.land » Fri Aug 27, 2021 1:38 pm America/New_York

Hello @ank_earthdata19,

We apologize for the long delay. To answer the first part of your question:
The final plot is done with imagesc command. imagesc(pfNum, Z2, aeroSubtype);

pfNum is a vector of profile numbers
Z2 is the size which involves getting the number of 1km records, single shot, and sizing the buffer by the “hi” & “low” buffer.
aeroSubtype. – breaking out the VFM mask

Z = the lidar altitude
Z_hi = (fliplr(linspace(Z(288), Z(89), num1kmRows)))';
Z_lo = Z(289:2*289);
Z2 = [Z_hi; Z_lo];


As far as plotting both the lat and lon:
Here is a real simple example of using sprintf to get lat and lon on same xtick
Latitude = [-10 0 10 20 30 40 50 60 70 80 90];
Longitude = [70 80 90 100 110 120 130 140 150 160 170];


pfStop = last; pfStart = start;
lat = Latitude;
lon = Longitude;

pfCount = pfStop - pfStart + 1;
%pfNum = 1:pfCount;
latmin = lat(start);
latmax = lat(last);


latTickPos = zeros(11, 1);
latTickPos(start) = lat(start);
latTickPos(last) = lat(last);

latLabels{start} = sprintf('%.2f %.2f', lat(start),lon(start));
latLabels{last} = sprintf('%.2f %.2f', lat(last),lon(last));

for k = 2:11
axFrac = (k-1)/11;
latTickPos(k) = round( pfCount*axFrac );
N = round( pfStart + pfCount*axFrac - 1 );
latLabels{k} = sprintf('%.2f %.2f', lat(N),lon(N));
end

latLabels = cellfun(@(x) strrep(x,' ','\newline'), latLabels,'UniformOutput',false);
% a = gca;
% a.XTickLabel = latLabels;
set(gca,'XTick', latTickPos);
set(gca,'XTickLabel', latLabels );

For the second part of your question, CALIPSO does not distribute code to make the plots. Again we apologize for the long wait.

Warm Regards,

NASA Langley ASDC User Services

ank_earthdata19
Posts: 4
Joined: Tue Jul 13, 2021 8:03 am America/New_York

Re: MATLAB code for plotting the feature types from CALIPSO level 2 vertical feature mask data

by ank_earthdata19 » Sat Aug 28, 2021 3:59 am America/New_York

Thank you so much for your reply.

Post Reply