Extracting coordinate values from a 3-D matrix
4 views (last 30 days)
Show older comments
I have a set of satellite data that is shown in the attachment. The latitude and longitude coordinates are given in two separate arrays of different sizes, latitude being a 1x72 array and longitude being a 1x192 array. They are attached to daily chlorophyll measurements in the variable chl_daily, which is a 72x192x366 matrix. The layers in this matrix are latitude, longitude, and day of the year. The values given in chl_daily, however, are concentration measurements of chlorophyll, and the latitude and longitude data that those points are connected to are not given in that matrix. I want to be able to plot chlorophyll concentrations spatially, on a map of the area, based on their associated coordinate location in latitude and longitude. My goal is to generate a matrix with three rows, where the first row is latitude, the second is longitude, and the third is the concentration derived from chl_daily for a particular day of the year. I have indexed into chl_daily for the day in question, which is chl_daily(:,:,222). Any help is greatly appreciated. Please let me know if you need access to the data itself, or more information. Thank you.
0 Comments
Answers (1)
Star Strider
on 16 Dec 2017
I would do something like this:
lat = 1:7; % Create Test Data
lon = 1:9; % Create Test Data
chl_daily = rand(7, 9, 10); % Create Test Data
[La,Ln] = meshgrid(lat, lon);
LatV = La(:);
LonV = Ln(:);
Chl_Mtx = reshape(chl_daily, numel(lat)*numel(lon), []);
LatSz = length(lat);
figure(1)
day = 2;
surf(reshape(LatV,[],LatSz), reshape(LonV,[],LatSz), reshape(Chl_Mtx(:,day), [], LatSz))
grid on
I don’t have the Mapping Toolbox. It may have utility functions that make this much easier. (I restricted the test data to make debugging and checking easier. My code should scale appropriately to your problem.)
0 Comments
See Also
Categories
Find more on Scenario Generation and Visualization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!