Plotting Eddy Kinetic Energy

48 ビュー (過去 30 日間)
Desak Made Pera Rosita Dewi
Desak Made Pera Rosita Dewi 2021 年 4 月 3 日
回答済み: Nipun 2024 年 6 月 6 日
Hi I have problem with plotting eddy kinetic energy (EKE)
I have a data of sea surface height (variable name: adt) with matrix [n m k]. n is latitude, m is longitude and k is time.
I want to plot EKE with equation below
here is my initial code
regionName = 'SouthIndian' % change as you need to ..
eval(['load ' regionName]); %to evaluate the data
[n, m, k] = size(b.adt); %n =lat, m= lon, k = absolute topohraphy
adt_mean = squeeze(mean(shiftdim(b.adt,2)));
g=(9.8).^2;
f=2.*(coriolisf(b.lat)).^2;
dhx=(diff(adt_mean)./diff(b.lat)).^2;
dhy=(diff(shiftdim(adt_mean,1))./diff(b.lon)).^2;
eke=g/f*(dhx+dhy);
But it doesnt working. Plese help or any suggestion about it.
  2 件のコメント
Desak Made Pera Rosita Dewi
Desak Made Pera Rosita Dewi 2021 年 4 月 3 日
matlab said the matrix size do not match
Amilton Roberto Muhosse
Amilton Roberto Muhosse 2023 年 5 月 23 日
I DO NOT UNDERSTAND WHAT IS ABSOLUTE P=TOPOGRAPHY

サインインしてコメントする。

回答 (1 件)

Nipun
Nipun 2024 年 6 月 6 日
Hi Desak,
I understand that you want to calculate and plot the Eddy Kinetic Energy (EKE) from sea surface height (adt) data. Based on the shared information about the code, I can confirm that the root cause of the problem is dimension handling and related calculation.
Here is the recommended version for the expected output:
regionName = 'SouthIndian'; % change as needed
eval(['load ' regionName]); % load the data
% Extract dimensions
[n, m, k] = size(b.adt); % n = lat, m = lon, k = time
% Compute the mean absolute dynamic topography (adt) over time
adt_mean = mean(b.adt, 3);
% Constants
g = (9.8)^2;
% Compute Coriolis parameter squared (f^2)
f = 2 * (coriolisf(b.lat)).^2;
% Calculate spatial derivatives
[lat_grid, lon_grid] = meshgrid(b.lat, b.lon);
dhx = (diff(adt_mean, 1, 1) ./ diff(lat_grid, 1, 1)).^2; % Gradient in lat direction
dhy = (diff(adt_mean, 1, 2) ./ diff(lon_grid, 1, 2)).^2; % Gradient in lon direction
% Extend the matrices to original size by padding with zeros
dhx = padarray(dhx, [1, 0], 'post');
dhy = padarray(dhy, [0, 1], 'post');
% Compute EKE
eke = g ./ f .* (dhx + dhy);
% Plotting EKE
figure;
imagesc(b.lon, b.lat, eke');
set(gca, 'YDir', 'normal');
colorbar;
title('Eddy Kinetic Energy (EKE)');
xlabel('Longitude');
ylabel('Latitude');
For more information on the functions used, refer to the following MathWorks documentation:
  1. "coriolisf" : https://www.mathworks.com/matlabcentral/fileexchange/47338-coriolisf
  2. "padarray" : https://www.mathworks.com/help/images/ref/padarray.html
  3. "meshgrid" : https://www.mathworks.com/help/matlab/ref/meshgrid.html
Hope this helps.
Regards,
Nipun

カテゴリ

Help Center および File ExchangeOceanography and Hydrology についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by