Removing CTD downcasting values from Matrix
4 次查看(过去 30 天)
显示 更早的评论
Hello all,
I have a matrix of doubles from a CTD profiler with information of depth. I need to remove the values of downcasting of the instrument as the sampling is unconstant compared to the upward casting.
What lines of code (for loop I am guessing) could I use to remove the down casting values? So when the depth component is increasing.
Thank you for your help!
0 个评论
回答(1 个)
Shivani
2023-4-7
编辑:Shivani
2023-4-7
Hi,
I am assuming that the matrix contains downward casting values first, that is when the CTD profiler moves from the surface to the bottom of the ocean followed by the upward casting values which is when the profiler moves back to the surface.
To remove the downcasting values we will have to simply extract the array containing upcast values, i.e. the second half of the matrix. We can do so by applying the max() function on the column containing the depth data. By doing so we will obtain the row index of the CTD values at maximum depth. We can use that to extract the rows from that index till the end and all the columns corresponding to these rows.
This will contain the upward casting values only because the upward casting of the CTD profiler is done only after it reaches the maximum depth.
Here’s an example with some assumed CTD data:
% columns 1,2,3 and 4 correspond to depth, temperature, salinity and pressure repectively
ctd =[100.0 10.1 35.5 1000.0; 200.0 11.5 36.2 2000.0; 300.0 12.3 36.5 3000.0; 400.0 13.2 36.8 4000.0; 500.0 14.1 3.0 5000.0; 400.0 13.5 36.7 4000.0;300.0 12.8 36.4 3000.0; 200.0 11.9 36.1 2000.0; 100.0 10.8 35.7 1000.0; 0.0 9.6 35.2 0.0]
% extracting max_depth and corresponding index from matrix
[max_depth, ind] = max(ctd(:,1))
%generating the required matrix with the downcasting values filtered out
ctd_filt = ctd(ind:end,:)
2 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Oceanography and Hydrology 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!