Using map2mat for eof analysis!

1 次查看(过去 30 天)
Sophia
Sophia 2017-3-13
评论: Sophia 2017-5-16
I have a matrix mm_r of the size 361*361*36; where 36 represent the number of years
i need to make it of size 36*130321
% Get EOFs:
G = map2mat(ones(size(mm_r,3),size(mm_r,2)),mm_r);
  • *the error message is Attempted to access F(37,1); index out of bounds because size(F)=[36,361].
Error in map2mat (line 30) if F(ix,iy)>0**
  2 个评论
Walter Roberson
Walter Roberson 2017-3-13
Is mat2map from the pcatool File Exchange contribution?
Sophia
Sophia 2017-3-15
Yes, it is from pcatool file excahnge.

请先登录,再进行评论。

回答(3 个)

Chad Greene
Chad Greene 2017-3-13
Hi Sophia,
Be careful, because map2mat assumes the first dimension is time. For normal climate data (lon*lat*time or lat*lon*time) it's probably easier to use eof, which does all the reshaping for you.
  6 个评论
Sophia
Sophia 2017-5-16
编辑:Sophia 2017-5-16
Hi
I used your eof technique as well..Somehow, does not matter what i choose as N, I mean 2 or 3 the total of all the eof is 99.9%, is there a reason for that or i am missing something..take a look at the codes below
Sophia
Sophia 2017-5-16
I changed it to 36, it seems somehow better now. is it like that ??

请先登录,再进行评论。


Sophia
Sophia 2017-5-16
** the total is 99.9% **
clear all; clc;
data= load('north_x_y_lat_lon');
datacoord = reshape(data, 361,361,4);
lat = squeeze(datacoord(:,:,3));
long = squeeze(datacoord(:,:,4));
rlong = long*pi/180.;
rlat = lat*pi/180.;
load nsidc_sid_1979_2014.mat
N1=2;
[eof_maps,pc,expv] = eof(t_u,2);
[eof_maps1,pc1,expv1] = eof(t_v,2);
figure(1);clf;iw=1;jw=N1+2;
set(gcf,'MenuBar','none');
for i=1:iw*jw
if i<= iw*jw-2
C1 = squeeze(eof_maps(:,:,i));
C2 = squeeze(eof_maps1(:,:,i));
pc_u = pc';
pc_v = pc1';
subplot(iw,jw,i);
m_proj('stereographic','lat',90,'long', 300,'radius',35,'rect','on')
m_grid('linewi',1,'tickdir','out',...
'xtick',[],'ytick',[])
m_quiver(long(1:10:361,1:10:361), lat(1:10:361,1:10:361),-C1(1:10:361,1:10:361),-C2(1:10:361,1:10:361),2,'k')
m_coast('patch',[.6 .6 .6],'edgecolor','k')
axis on
set(gca,'Xticklabel',[])
set(gca,'Yticklabel',[])
title(strcat('EOF:',num2str(i),'/',num2str(expv(i)),'%'));
else
subplot(iw,jw,iw*jw-1);
plot(pc_u(:,1),'b','DisplayName','PC of u');
hold on
plot(pc_v(:,1),'r','DisplayName','PC of v');
grid on
xlabel('time')
title('PC')
legend(num2str([1:N1]'),2);
box on
subplot(iw,jw,iw*jw);
plot(pc_u(:,2),'b','DisplayName','PC of u');
hold on
plot(pc_v(:,2),'r','DisplayName','PC of v');
grid on
xlabel('time')
title('PC')
legend(num2str([1:N1]'),2);
box on
end
end

Sophia
Sophia 2017-5-16
the total again is 99.9%
clear all; clc;
data= load('north_x_y_lat_lon');
datacoord = reshape(data, 361,361,4);
lat = squeeze(datacoord(:,:,3));
long = squeeze(datacoord(:,:,4));
rlong = long*pi/180.;
rlat = lat*pi/180.;
load nsidc_sid_1979_2014.mat
N1=3;
[eof_maps,pc,expv] = eof(t_u,3);
[eof_maps1,pc1,expv1] = eof(t_v,3);
figure(1);clf;iw=1;jw=N1+3;
set(gcf,'MenuBar','none');
for i=1:iw*jw
if i<= iw*jw-3
C1 = squeeze(eof_maps(:,:,i));
C2 = squeeze(eof_maps1(:,:,i));
pc_u = pc';
pc_v = pc1';
subplot(iw,jw,i);
m_proj('stereographic','lat',90,'long', 300,'radius',35,'rect','on')
m_grid('linewi',1,'tickdir','out',...
'xtick',[],'ytick',[])
m_quiver(long(1:10:361,1:10:361), lat(1:10:361,1:10:361),-C1(1:10:361,1:10:361),-C2(1:10:361,1:10:361),2,'k')
m_coast('patch',[.6 .6 .6],'edgecolor','k')
axis on
set(gca,'Xticklabel',[])
set(gca,'Yticklabel',[])
title(strcat('EOF:',num2str(i),'/',num2str(expv(i)),'%'));
else
subplot(iw,jw,iw*jw-2);
plot(pc_u(:,1),'b','DisplayName','PC of u');
hold on
plot(pc_v(:,1),'r','DisplayName','PC of v');
grid on
xlabel('time')
title('PC')
legend(num2str([1:N1]'),2);
box on
subplot(iw,jw,iw*jw-1);
plot(pc_u(:,2),'b','DisplayName','PC of u');
hold on
plot(pc_v(:,2),'r','DisplayName','PC of v');
grid on
xlabel('time')
title('PC')
legend(num2str([1:N1]'),2);
box on
subplot(iw,jw,iw*jw);
plot(pc_u(:,3),'b','DisplayName','PC of u');
hold on
plot(pc_v(:,3),'r','DisplayName','PC of v');
grid on
xlabel('time')
title('PC')
legend(num2str([1:N1]'),2);
box on
end
end

类别

Help CenterFile Exchange 中查找有关 Dimensionality Reduction and Feature Extraction 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by