temperature range of file not seen in plot or matching colorbar
조회 수: 2 (최근 30일)
이전 댓글 표시
I know the maximum temperature reached in a netcdf file I'm working with is 314 K. However, when I plot it using countourf, neither that temperature nor anything close to it is visible in the plot. And the colorbar color assigned to this max temp does not match what I'm seeing in the plot. Here is the code I'm using:
ncfile1='./ANN_climo.nc';
var1='TS';
tmp1=squeeze(ncread(ncfile1,var1));
lat=ncread(ncfile1,'lat');
lev=ncread(ncfile1,'lev');
lon=ncread(ncfile1,'lon');
%checking max/min temps
max(max(tmp1))
min(min(tmp1))
%plotting
tmp2 = transpose(tmp1);
contourf(lon,lat,tmp2, 'LineStyle','none');
hold on
%adding dotted line for freezing point
contourf(lon,lat,tmp2, [273.0,273.0], 'linestyle', 'none');
contourf(lon,lat,tmp2,[273.0,273.0], 'linestyle', '--', 'linecolor', 'k')
%specifying the colormap
colormap('turbo')
%check default colorbar limits
caxis
set(gca,'fontsize',14);
ylabel('Latitude (\circ)')
xlabel('Longitude (\circ)')
h = colorbar;
xlabel(h,'(K)');
hold off
What am I missing?
댓글 수: 0
답변 (1개)
Cris LaPierre
2024년 3월 20일
Without the data, we can only speculate.
I suspect you are not seeing it because you have programmatically set the contour line to 273.
contourf(lon,lat,tmp2, [273.0,273.0], 'linestyle', 'none');
From the doc page description of the levels input: "To draw contour lines at a single height k, specify levels as a two-element row vector [k k]"
What if you just try
contourf(lon,lat,tmp2,'linestyle', 'none');
참고 항목
카테고리
Help Center 및 File Exchange에서 Purple에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!