fillmissing
填充缺失条目
clear;clc;close all
% interp nan's value
% save data.mat ssh longitude latitude
load('data.mat')
[x,y]=meshgrid(longitude,latitude);
x=x';y=y';
% plot
close all
figure
m_proj('miller','lon',[4 9.5],'lat',[52 57])
m_pcolor(x,y,ssh)
shading interp
m_gshhs_f('patch',[0.85 0.75 0.65]);
m_grid('box','on');
colorbar
caxis([-0.3 0.3])
cmap = load('colormore_2.txt');
colormap(flip(cmap))
title('original','fontsize',15)
export_fig('original.jpg')
%% method one nearest interp
ssh = fillmissing(ssh, 'nearest', 1);
ssh = fillmissing(ssh, 'nearest', 2);
% plot
close all
figure
m_proj('miller','lon',[4 9.5],'lat',[52 57])
m_pcolor(x,y,ssh)
shading interp
m_gshhs_f('patch',[0.85 0.75 0.65]);
m_grid('box','on');
colorbar
cmap = load('colormore_2.txt');
colormap(flip(cmap))
caxis([-0.3 0.3])
title('method one nearest interp ','fontsize',15)
export_fig('method one nearest interp1.jpg')
clear;clc;close all
% interp nan's value
load('data.mat')
[x,y]=meshgrid(longitude,latitude);
x=x';y=y';
% interp nan's value using fillmissing
%% method two constant interp
ssh = fillmissing(ssh,'constant',nanmean(ssh,'all'));
% plot
close all
figure
m_proj('miller','lon',[4 9.5],'lat',[52 57])
m_pcolor(x,y,ssh)
shading interp
m_gshhs_f('patch',[0.85 0.75 0.65]);
m_grid('box','on');
colorbar
cmap = load('colormore_2.txt');
colormap(flip(cmap))
caxis([-0.3 0.3])
title('method two constant interp ','fontsize',15)
export_fig('method two constant interp1 .jpg')
clear;clc;close all
% interp nan's value
load('data.mat')
[x,y]=meshgrid(longitude,latitude);
x=x';y=y';
% interp nan's value using fillmissing
%% method three linear interp
ssh = fillmissing(ssh, 'linear', 1);
ssh = fillmissing(ssh, 'linear', 2);
% plot
close all
figure
m_proj('miller','lon',[4 9.5],'lat',[52 57])
m_pcolor(x,y,ssh)
shading interp
m_gshhs_f('patch',[0.85 0.75 0.65]);
m_grid('box','on');
colorbar
cmap = load('colormore_2.txt');
colormap(flip(cmap))
caxis([-0.3 0.3])
title(' method three linear interp ','fontsize',15)
export_fig(' method three linear interp1 .jpg')