% ----------------------------------------------------------------------- %
%
% Figure 2 of Archer et al. (2025)
%
% Matlab code shared on Zenodo.
%
% Paper:
% "Wide-swath satellite altimetry unveils global submesoscale ocean
% dynamics" by M. Archer, J. Wang, P. Klein, G. Dibarboure, and L-L Fu.
% Nature 2025.
%
% Requirements:
% --> Matlab: https://www.mathworks.com/products/matlab.html
% --> M_Map: www.eoas.ubc.ca/~rich/map.html
%
% Data links:
% --> SWOT minus DUACS SSHA standard deviation, over 14 cycles, available
% in same Zenodo repository ('SWOT_DUACSdiff_STD.mat')
% --> SWOT high-passed SSHA standard deviation, over 14 cycles, available 
% in same Zenodo repository ('SWOT_HighPass_50km_STD.mat')
%
% ----------------------------------------------------------------------- %

%% (1) ============================================================ SWOT-DUACS SSHA difference STD

clear;clc

% ----------------------- DATA
load SWOT_DUACSdiff_STD.mat % binned STD data at 0.5 degree resolution

% ----------------------- PLOTTING
figure('Position',[632 385 1611 875])
m_proj('robinson','lon',([-180 180]), 'lat',([-90 90]));hold on;
m_pcolor(lonb2,latb2,data),shading flat,hold on
caxis([0 .1]) % in meters
m_coast('patch',[0.7 0.7 0.7],'edgecolor','k'); 
m_grid('tickdir','in','linewi',2);
set(gcf,'color','w'),
set(gca,'fontsize',30)

%% (2) ============================================================ SWOT high-passed SSHA STD

clear;clc

% ----------------------- DATA
load SWOT_HighPass_50km_STD.mat % binned STD data at 0.5 degree resolution

% ----------------------- PLOTTING
figure('Position',[632 385 1611 875])
m_proj('robinson','lon',([-180 180]), 'lat',([-90 90]));hold on;
m_pcolor(lonb2,latb2,STD_all),shading flat,hold on
caxis([0 .03]) % in meters
m_coast('patch',[0.7 0.7 0.7],'edgecolor','k'); 
m_grid('tickdir','in','linewi',2);
set(gcf,'color','w'),
set(gca,'fontsize',30)
