MATLAB读取NC4文件

% this script will read-in and plot NetCDF data in MATLAB
% Define data file. Add directory path if necessary.
file = 'MERRA2_100.instM_2d_asm_Nx.199001.nc4';


% Uncomment to display metadata information
%ncdisp(file);

% read-in variables
var1 = ncread(file, 'TO3');
% MATLAB data is oriented by (Y,X), but the data was written as (X,Y).
% The rot90 and fliplr function correctly orient the data.
var1 = rot90(fliplr(var1));
lats = ncread(file, 'lat');
lons = ncread(file, 'lon');


% ========== Plot Data ========================
pcolor(lons,lats,var1(:,:,1));
shading flat
c = colorbar;
ylabel(c,'Dobsons')
load coast
hold on
plot(long,lat,'black')
title('MERRA-2 Total Column Ozone')
xlabel('degrees longitude')
ylabel('degrees latitude')

发布了7 篇原创文章 · 获赞 0 · 访问量 87

猜你喜欢

转载自blog.csdn.net/weixin_39249524/article/details/104340228
今日推荐