Hovmoller Diagram / Heat Map -- need help with creating plot?

10 次查看(过去 30 天)
Hello MATLAB Community,
I am working with satellite data and want to produce a Hovmoller diagram (or heat map, as I like to think about it), with Latitude on my x-axis, Time on my y-axis, and a certain measurement (represented by 'AOD' in my code) represented by color. The satellite will keep returning to about the same Latitude over and over again. My Latitude values however are all unique, with minute differences between them. In the same way, my time values are also unique, with small differences on the order of seconds between them.
I have three vectors of the same size where a certain unique latitude is associated with a certain unique time which is associated with a certain measurement. I'd like to reshape my measurement vector into a matrix; here is my code thus far:
% The AOD matrix will be the size of x * y (Lat x Time), and NaN values will be
% present in accordance with the if statement below.
[ Latitude , time ] = meshgrid( Master_Latitude_screened_sorted , Master_Profile_Time_screened_sorted);
Master_AOD_screened_matrix = NaN(size( Latitude )) ;
AOD_grid = griddata(Master_Latitude_screened_sorted, Master_Profile_Time_screened_sorted, Master_AOD_screened_sorted, Latitude, time);
for i = 1:length(Master_Latitude_screened_sorted)
disp(i) % to know which iteration of the loop it is on.
% To kill and evaluate only a few of the values, ctrl - C!
for j = 1:length(Master_Profile_Time_screened_sorted)
for k = 1:length(Master_AOD_screened_sorted)
if Master_Latitude_screened_sorted(k) == Latitude(i,j) && Master_Profile_Time_screened_sorted(k) == time(i,j)
Master_AOD_screened_matrix(i,j) = Master_AOD_screened_sorted(k);
end
end
end
end
Should producing a heat map from these vectors be possible? I understand that I likely have to turn my measurement vector into a matrix... is that possible considering I have all unique values of Latitude and Time? Do I need to round out my Latitude and Time values perhaps to the integer/daily scale so that the matrix can be formed?
Any help would be much appreciated!
Thanks.

回答(2 个)

KSSV
KSSV 2019-5-31
Hovmoller plot is a plot which has spatial information (keeping either x or y constant and varying y or x ) along X-axes and a variable evolution with time on y -axes.
  1. Assume you have X,Y,Z data. X, Y are 2D and Z is a 3D matrix of a variable which eveolves with time.
  2. Fix a lon (x) or lat (y) .
  3. Along the fixed lon/lat you have lat/lon varying.
  4. Get the row index (if lon constant), column index (if lat constant).
  5. Extract the above index data from Z for all times. This will be a matrix H.
  6. Use pcolor with lat (if lon constant) or lon (if lat constant) along X-axes and time along Y-axes.
I hope the above steps will help you.
  1 个评论
Srishti Dasarathy
Srishti Dasarathy 2019-5-31
Hi KSSV,
I'm not sure I understand. My X and my Y are 1D, they are both vectors. My Z is similarly 1D, and my question is about reshaping my Z vector to a 2D matrix that I can then create the plot for. I'm not sure how this will help?
Thanks.

请先登录,再进行评论。


salah morsi
salah morsi 2019-8-19
编辑:salah morsi 2019-8-19
creat a 3d meshgrid, using ur variables x , y ,z, then using contourf, u should be able to generate the diagram, i hope this helps, if not i can provide more details

类别

Help CenterFile Exchange 中查找有关 Geographic Plots 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by