z = 1:100:length(d);
sd = ones(length(z),6);
for k = 1:length(z);
    sd(k,:) = d(z(k),:);  
end

clear k z


figure; hold;
scatter(sd(:,3),sd(:,2),75,sd(:,4),'filled')
plot(coast(:,1),coast(:,2),'k','LineWidth', 2)
colorbar('eastoutside')
ylim([29 37]);
xlim([-125 -117]);
title('0903JD - Surface Temperature \circC')
xlabel('longitude')
ylabel('latitude')
grid on

figure; hold;
scatter(sd(1:2843,3),sd(1:2843,2),75,sd(1:2843,5),'filled')
plot(coast(:,1),coast(:,2),'k','LineWidth', 2)
colorbar('eastoutside')
ylim([29 37]);
xlim([-125 -117]);
title('0903JD - Surface Salinity PSU')
xlabel('longitude')
ylabel('latitude')
grid on

contour3m(sd(:,3),sd(:,2),sd(:,4),10)

[x y] = meshgrid( min(sd(:,3)):.1:max(sd(:,3)) , min(sd(:,2)):.1:max(sd(:,2)) ); %minimum value:increment:maximum value of x and y axis grid
[xi,yi,zi] = griddata(sd(:,3),sd(:,2),sd(:,4),x,y,'cubic');
%gridding the temperature data to the above grid.
%‘cubic’ or any other interpolation methods can be used
figure; hold;
contourf(xi,yi,zi,'LineWidth', 2); %plotting the contour
plot(coast(:,1),coast(:,2),'k','LineWidth', 2)
colorbar('eastoutside')
ylim([29 37]);
xlim([-125 -117]);