How to make two different grid systems comparable?

4 views (last 30 days)
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.
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.

Accepted Answer

Arun
Arun on 21 Jun 2024
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
  1 Comment
Ashfaq Ahmed
Ashfaq Ahmed on 3 Jul 2024
Hi @Arun, thank you so much!! This code totally suffice what I was needing. I really liked your this command -
VelocityNSIDC_interpolated(:,:,day) = interp2(newLon, newLat, seaice_NSIDC(:,:,day), Y, X,'linear');
However, just out of curiosity I am asking, can you help me doing possibly the opposite one? For example, I can see you converted the NSIDC grid system to ECCO grid system first. But what can I do if I want to make everything NSIDC based?

Sign in to comment.

More Answers (0)

Categories

Find more on Geographic Plots 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!