How to make two different grid systems comparable?
2 次查看(过去 30 天)
显示 更早的评论
Hello all,
I am trying to solve a problem which has been solved previously, but I am still struglling to figure a way out. I want to unify the coordinate systems (polar stereographic coordinate) in the Arctic from two different dataset - a) NSIDC sea ice motion nand b) ECCO sea ice motion.
Now, the NSIDC one has a grid system of 361x361 but the ECCO has a 90x90 grid system. I am tryiong to make a point by poiny velocity comparison in these two dataset and this why I want to prepare a unified coordinate system first so that NSIDC also becomes 90x90 (or any other way to make them comparable).
This is the velocity profile from both data set on 11-Jan-2017.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1712911/image.png)
I have attached the velocity field from both dataset in this question (NSIDC_vs_ECCO.mat. This is the code for the plot -
for day = 1:31
figure(1), clf; clc;
t = tiledlayout(1,2); t.TileSpacing = 'tight'; t.Padding = 'compact';
% NSIDC
nexttile
pcolor(longitude,latitude,seaice_NSIDC(:,:,day));
shading interp; hold on;
title('NSIDC Polar Pathfinder','FontSize',F);
% ECCO
nexttile
pcolor(X,Y,seaice_ECCO(:,:,day)); colorbar; clim([0 0.55]);
shading interp; hold on;
title('ECCO sea ice velocity','FontSize',F);
sgtitle([datestr(NSIDC_datetime(day), 'yyyy-mm-dd')],'FontSize',F+5);
end
Can anyone please help me out with making a code that with calcuate the difference betwen the velocity vectors in both dataset?
As in, "NSIDC - ECCO" plot
Any feedback will be highly appreciated!! Thank you so much for your time.
0 个评论
采纳的回答
Arun
2024-6-21
I understand that you wish to unify the coordinate systems in the Arctic from two different datasets and calculate the difference between the velocity vectors in both datasets.
The following steps can be followed to achieve the required results:
Step-1: Interpolate the NSIDC data for the coordinates in the ECCO grid system using "interp2" function.
load('NSIDC_vs_ECCO.mat');
% Find the range of latitude and longitude
% Initialize interpolated NSIDC data
VelocityNSIDC_interpolated = zeros(90, 90, 31);
latVec = linspace(min(min(latitude)), max(max(latitude)), 361);
lonVec = linspace(min(min(longitude)), max(max(longitude)), 361);
[newLon, newLat] = meshgrid(lonVec, latVec);
for day = 1:31
% Interpolate each day's data
VelocityNSIDC_interpolated(:,:,day) = interp2(newLon, newLat, seaice_NSIDC(:,:,day), Y, X,'linear');
end
F = 5;
Step-2: Calculate the difference as required.
for day = 1:31
figure(1), clf; clc;
t = tiledlayout(1,2); t.TileSpacing = 'tight'; t.Padding = 'compact';
% NSIDC
nexttile
pcolor(X,Y,VelocityNSIDC_interpolated(:,:,day));
shading interp; hold on;
title('NSIDC Polar Pathfinder','FontSize',F);
% ECCO
nexttile
pcolor(X,Y,seaice_ECCO(:,:,day)); colorbar; clim([0 0.55]);
shading interp; hold on;
title('ECCO sea ice velocity','FontSize',F);
% sgtitle([datestr(NSIDC_datetime(day), 'yyyy-mm-dd')],'FontSize',F+5);
diff(:,:,day) = VelocityNSIDC_interpolated(:,:,day) - seaice_ECCO(:,:,day);
end
Step-3: Plot the difference data.
for day = 1:31
figure(1), clc;
t = tiledlayout(1,2); t.TileSpacing = 'tight'; t.Padding = 'compact';
% ECCO
nexttile
pcolor(X,Y,diff(:,:,day)); colorbar; clim([0 0.55]);
shading interp; hold on;
title('ECCO sea ice velocity','FontSize',F);
% sgtitle([datestr(NSIDC_datetime(day), 'yyyy-mm-dd')],'FontSize',F+5);
end
This process will provide the required result.
For more information related to the "interp2" function, please refer the following documentation link: https://www.mathworks.com/help/matlab/ref/interp2.html
Hope this helps!
Regards
Arun
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!