% *********************************************** % 
% Example MATLAB script of how to read CNAPS fields 
% Written by: Taylor Shropshire 
% Date: 10/11/22
% ********************************************** % 
clear; clc; close all;

% Path 
path_in='/Net/ftp_pub/taylor/caitlin_101222/CNAPS/';
fnames=dir([path_in,'*.nc']);

% Get grid 
ii=1;
fpath=[path_in,fnames(ii).name];
xc=ncread(fpath,'lon_rho')';
yc=ncread(fpath,'lat_rho')';
depth_t=ncread(fpath,'z_rho')*-1;

zz=1;
for ii=1:length(fnames)
fpath=[path_in,fnames(ii).name];
tmp=ncread(fpath,'temp');

figure(1);
field=tmp(:,:,zz)';	% rotated
pcolor(xc,yc,field);shading flat;colorbar;
xlabel('Longtidue'); ylabel('Latitude'); set(gca,'FontSize',16);
t=title(['File = ', fnames(ii).name]);
set(t,'Interpreter','none')
pause;
end 









