m_map won't run

9 views (last 30 days)
muhamad restu
muhamad restu on 20 Sep 2022
Commented: Walter Roberson on 21 Sep 2022
I'm trying to run m map, I have downloaded this and made it part of the pathway on matlab, I then run this line:
for nt = 313:324
figure ()
m_proj('miller','lon',[w e],'lat',[s n]);
% m_pcolor(lon_sst,lat_sst,nanmean(sstGradMonthly(:,:,3:4),3).*1e2);
% m_contourf(lon_sst,lat_sst,nanmean(sstGradMonthly(:,:,3:4),3).*1e2,(0:0.025:4),'edgeColor','none'); hold on;
% m_contour(lon_sst,lat_sst,nanmean(sstGradMonthly(:,:,3:4),3).*1e2,(0:2:2),'edgeColor','k','lineWidth',1);
m_pcolor(lonOce,latOce,sstGrad(:,:,nt).*1e2);
shading flat; hold on;
m_contourf(lonOce,latOce,sstGrad(:,:,nt).*1e2,(0:0.025:4),'edgeColor','none'); hold on;
m_contour(lonOce,latOce,sstGrad(:,:,nt).*1e2,(0:2:2),'edgeColor','k','lineWidth',1);
% m_pcolor(lonOce,latOce,sstMonthly(:,:,nt));
% shading flat; hold on;
% m_contourf(lonOce,latOce,sstMonthly(:,:,nt),(24:0.25:32),'edgeColor','none'); hold on;
% hold on;
% m_quiver(lonOce(1:3:end,1:3:end),latOce(1:3:end,1:3:end),uoMonthly(1:3:end,1:3:end,nt),voMonthly(1:3:end,1:3:end,nt),'Color','k');
% hold on;
% m_pcolor(lonOce,latOce,nanmean(sstMonthly,3));
% shading flat; hold on;
% m_contourf(lonOce,latOce,nanmean(sstMonthly,3),(24:0.25:32),'edgeColor','none'); hold on;
% hold on;
% m_quiver(lonOce(1:3:end,1:3:end),latOce(1:3:end,1:3:end),nanmean(uoMonthly(1:3:end,1:3:end,:),3),nanmean(voMonthly(1:3:end,1:3:end,:),3),'Color','k');
% hold on;
m_gshhs_f('patch','w','edgeColor',[.2 .2 .2],'linewidth',.5); hold on;
m_grid('linestyle','none','xtick',6,'ytick',4,'fontsize',16);
title([datestr(datenum(time(nt)),'mmmm yyyy')],'fontsize',16,'fontweight','b');
% title([datestr(datenum(1,nt,1),'mmmm')],'fontsize',16,'fontweight','b');
% title(['Winter Season (DJF)'],'fontsize',16,'fontweight','b');
xlabel ('Longitude','fontsize',16);
ylabel ('Latitude','fontsize',16);
cb = colorbar ('eastoutside','fontsize',16);
xlabel(cb,'{\times} 10^{-2} ({\circ}C/km)','fontsize',16)
% xlabel(cb,'Sea surface temperature ({\circ}C)','fontsize',16)
caxis([0 4]);
% caxis([24 32]);
cmap = getPyPlot_cMap('RdYlBu_r', 32);
colormap (cmap);
set(gcf, 'Position', get(0, 'Screensize'));
export_fig([outputFolder sprintf(['sstGradSS' datestr(datenum(time(nt,:)),'yyyymm')])], '-png', '-transparent');
% export_fig(sprintf(['sstSeasonalJS01DJF']), '-png', '-transparent');
close;
end
but get given this error :
Index in position 3 exceeds array bounds (must not exceed 109).
Error in upwDataProc (line 113)
m_pcolor(lonOce,latOce,sstGrad(:,:,nt).*1e2);
I have checked the file and everything is there and in the pathway, plus have redownloaded mutliple times, so if anyone has any ideas that would be a great help, thank you.
  1 Comment
Walter Roberson
Walter Roberson on 21 Sep 2022
Before the for loop, what shows up for
size(sstGrad)
I predict that it will show up having a third dimension of 109, but the code assumes it has a third dimension of at least 324. We do not know what the code to that point is doing to justify a belief that at least 324 layers exist.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!