
path = '/hawaii_region/files/L2B/'; % path to file
L2B_file = 'qs_l2b_31113_v4.0_200506100316.nc'; % unzipped L2B file

% swath parameters for rev 31113
astart = 2198; % along track start
aend = 2301; % along track end
cstart = 60; % cross track start
cend = 149; % cross track end

file = [path L2B_file];

% read the netcdf file (.nc)
lat = ncread(file, 'lat');
lon = ncread(file, 'lon');
direction = ncread(file, 'retrieved_wind_direction');
speed = ncread(file, 'retrieved_wind_speed');

% Plot wind direction with gray scale
figure
colormap('gray');
imagesc(direction(cstart:cend,astart:aend),[0 360]); % (cstart:cend,astart:aend)
 
cm=gray;
cm2=cm;
[ncm k]=size(cm);
for k=1:ncm/2
  cm2(k,:)=1-cm(2*k-1,:);
  cm2(ncm-k+1,:)=1-cm(2*k-1,:);
end
map = colormap(cm2);
colorbar;
axis ij;
% axis off

% Plot the wind speed
figure
imagesc(speed(cstart:cend,astart:aend),[0 50]); % (cstart:cend,astart:aend)
colormap('jet');
colorbar;
% axis off
