% 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')
% 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 informa...