%All_Sal_Temp_Plotmaker
%
%Program to create four plots using data from all of the stations, where
%available:  deep salinity, surface salinity, deep temperature, and surface
%temperature.
%
%Soupy Alexander, 11/19/2001
%
%Requires NetCDF toolbox, Soupy's tools "singleJD.m" and "gregaxdNM.m", and Rich's
%tool "gregaxd.m"

%First pull out the appropriate data files
StationA_surf = netcdf('5941mc-a1h.nc','nowrite');
StationA_deep = netcdf('5952tcp-a1h.nc','nowrite');

StationB_surf = netcdf('5961mc-a1h.nc','nowrite');
StationB_deep = netcdf('5972tc-a1h.nc','nowrite');

StationC_surf = netcdf('5981mc-a1h.nc','nowrite');
StationC_deep = netcdf('5992tcp-a1h.nc','nowrite');

StationD_surf = netcdf('6001mc-a1h.nc','nowrite');
StationD_deep = netcdf('6012tcp-a1h.nc','nowrite');

StationE_surf = netcdf('6021mc-a1h.nc','nowrite');
StationE_deep = netcdf('6032tcp-a1h.nc','nowrite');

StationF_deep = netcdf('6043mc-a1h.nc');

%Next pull out the needed data from the data files
A_surf_t = StationA_surf{'time'}(:);
A_surf_t2 = StationA_surf{'time2'}(:);
A_surf_time = singleJD(A_surf_t,A_surf_t2);
A_surf_temp = StationA_surf{'T_20'}(:);
A_surf_sal = StationA_surf{'S_40'}(:);
A_surf_depth = StationA_surf{'depth'}(:);
A_deep_t = StationA_deep{'time'}(:);
A_deep_t2 = StationA_deep{'time2'}(:);
A_deep_time = singleJD(A_deep_t,A_deep_t2);
A_deep_temp = StationA_deep{'T_20'}(:);
A_deep_sal = StationA_deep{'S_40'}(:);
A_deep_depth = StationA_deep{'depth'}(:);

B_surf_t = StationB_surf{'time'}(:);
B_surf_t2 = StationB_surf{'time2'}(:);
B_surf_time = singleJD(B_surf_t,B_surf_t2);
B_surf_temp = StationB_surf{'T_20'}(:);
B_surf_sal = StationB_surf{'S_40'}(:);
B_surf_depth = StationB_surf{'depth'}(:);
B_deep_t = StationB_deep{'time'}(:);
B_deep_t2 = StationB_deep{'time2'}(:);
B_deep_time = singleJD(B_deep_t,B_deep_t2);
B_deep_temp = StationB_deep{'T_20'}(:);
B_deep_sal = StationB_deep{'S_40'}(:);
B_deep_depth = StationB_deep{'depth'}(:);

C_surf_t = StationC_surf{'time'}(:);
C_surf_t2 = StationC_surf{'time2'}(:);
C_surf_time = singleJD(C_surf_t,C_surf_t2);
C_surf_temp = StationC_surf{'T_20'}(:);
C_surf_sal = StationC_surf{'S_40'}(:);
C_surf_depth = StationC_surf{'depth'}(:);
C_deep_t = StationC_deep{'time'}(:);
C_deep_t2 = StationC_deep{'time2'}(:);
C_deep_time = singleJD(C_deep_t,C_deep_t2);
C_deep_temp = StationC_deep{'T_20'}(:);
C_deep_sal = StationC_deep{'S_40'}(:);
C_deep_depth = StationC_deep{'depth'}(:);

D_surf_t = StationD_surf{'time'}(:);
D_surf_t2 = StationD_surf{'time2'}(:);
D_surf_time = singleJD(D_surf_t,D_surf_t2);
D_surf_temp = StationD_surf{'T_20'}(:);
D_surf_sal = StationD_surf{'S_40'}(:);
D_surf_depth = StationD_surf{'depth'}(:);
D_deep_t = StationD_deep{'time'}(:);
D_deep_t2 = StationD_deep{'time2'}(:);
D_deep_time = singleJD(D_deep_t,D_deep_t2);
D_deep_temp = StationD_deep{'T_20'}(:);
D_deep_sal = StationD_deep{'S_40'}(:);
D_deep_depth = StationD_deep{'depth'}(:);

E_surf_t = StationE_surf{'time'}(:);
E_surf_t2 = StationE_surf{'time2'}(:);
E_surf_time = singleJD(E_surf_t,E_surf_t2);
E_surf_temp = StationE_surf{'T_20'}(:);
E_surf_sal = StationE_surf{'S_40'}(:);
E_surf_depth = StationE_surf{'depth'}(:);
E_deep_t = StationE_deep{'time'}(:);
E_deep_t2 = StationE_deep{'time2'}(:);
E_deep_time = singleJD(E_deep_t,E_deep_t2);
E_deep_temp = StationE_deep{'T_20'}(:);
E_deep_sal = StationE_deep{'S_40'}(:);
E_deep_depth = StationE_deep{'depth'}(:);

F_deep_t = StationF_deep{'time'}(:);
F_deep_t2 = StationF_deep{'time2'}(:);
F_deep_time = singleJD(F_deep_t,F_deep_t2);
F_deep_temp = StationF_deep{'T_20'}(:);
F_deep_sal = StationF_deep{'S_40'}(:);
F_deep_depth = StationF_deep{'depth'}(:);

%Set the time limits for the plot
startjd = julian(1999,12,01,00);
endjd = julian(2000,4,20,00);

%plot surface temperature from all stations together
figure(1)
subplot(6,1,1)
plot(A_surf_time,A_surf_temp)
axis([startjd endjd 0 20])
ylabel('^oC')
text(julian(2000,1,1,00),15,'Station A')
gregaxdNM(A_surf_time,5)
set(gca,'ytick',[0 5 10 15 20],'yticklabel',[0 5 10 15 20])
title('Surface Temperatures at Stations A-F')

subplot(6,1,2)
plot(B_surf_time,B_surf_temp)
axis([startjd endjd 0 20])
ylabel('^oC')
text(julian(2000,1,1,00),15,'Station B')
gregaxdNM(B_surf_time,5)
set(gca,'ytick',[0 5 10 15 20],'yticklabel',[0 5 10 15 20])

subplot(6,1,3)
plot(C_surf_time,C_surf_temp)
axis([startjd endjd 0 20])
ylabel('^oC')
text(julian(2000,1,1,00),15,'Station C')
gregaxdNM(C_surf_time,5)
set(gca,'ytick',[0 5 10 15 20],'yticklabel',[0 5 10 15 20])

subplot(6,1,4)
plot(D_surf_time,D_surf_temp)
axis([startjd endjd 0 20])
ylabel('^oC')
text(julian(2000,1,1,00),15,'Station D')
gregaxdNM(D_surf_time,5)
set(gca,'ytick',[0 5 10 15 20],'yticklabel',[0 5 10 15 20])

subplot(6,1,5)
plot(E_surf_time,E_surf_temp)
axis([startjd endjd 0 20])
ylabel('^oC')
text(julian(2000,1,1,00),15,'Station E')
gregaxdNM(E_surf_time,5)
set(gca,'ytick',[0 5 10 15 20],'yticklabel',[0 5 10 15 20])

subplot(6,1,6)
axis([startjd endjd 0 20])
ylabel('^oC')
text(julian(2000,1,1,00),15,['Surface Temperature Data Unavailable for Station F'])
gregaxd(E_surf_time,5)
set(gca,'ytick',[0 5 10 15 20],'yticklabel',[0 5 10 15 20])
set(gca,'box','on')

orient landscape

%Plot all of the deep temperatures on one plot
figure(2)
subplot(6,1,1)
plot(A_deep_time,A_deep_temp)
axis([startjd endjd 0 20])
ylabel('^oC')
text(julian(2000,1,1,00),15,['Station A, Depth = ' num2str(A_deep_depth) ' m'])
gregaxdNM(A_deep_time,5)
set(gca,'ytick',[0 5 10 15 20],'yticklabel',[0 5 10 15 20])
title('Deep Water Temperatures at Stations A-F')

subplot(6,1,2)
plot(B_deep_time,B_deep_temp)
axis([startjd endjd 0 20])
ylabel('^oC')
text(julian(2000,1,1,00),15,['Station B, Depth = ' num2str(B_deep_depth) ' m'])
gregaxdNM(B_deep_time,5)
set(gca,'ytick',[0 5 10 15 20],'yticklabel',[0 5 10 15 20])

subplot(6,1,3)
plot(C_deep_time,C_deep_temp)
axis([startjd endjd 0 20])
ylabel('^oC')
text(julian(2000,1,1,00),15,['Station C, Depth = ' num2str(C_deep_depth) ' m'])
gregaxdNM(C_deep_time,5)
set(gca,'ytick',[0 5 10 15 20],'yticklabel',[0 5 10 15 20])

subplot(6,1,4)
plot(D_deep_time,D_deep_temp)
axis([startjd endjd 0 20])
ylabel('^oC')
text(julian(2000,1,1,00),15,['Station D, Depth = ' num2str(D_deep_depth) ' m'])
gregaxdNM(D_deep_time,5)
set(gca,'ytick',[0 5 10 15 20],'yticklabel',[0 5 10 15 20])

subplot(6,1,5)
plot(E_deep_time,E_deep_temp)
axis([startjd endjd 0 20])
ylabel('^oC')
text(julian(2000,1,1,00),15,['Station E, Depth = ' num2str(E_deep_depth) ' m'])
gregaxdNM(E_deep_time,5)
set(gca,'ytick',[0 5 10 15 20],'yticklabel',[0 5 10 15 20])

subplot(6,1,6)
plot(F_deep_time,F_deep_temp)
axis([startjd endjd 0 20])
ylabel('^oC')
text(julian(2000,1,1,00),15,['Station F, Depth = ' num2str(F_deep_depth) ' m'])
gregaxd(F_deep_time,5)
set(gca,'ytick',[0 5 10 15 20],'yticklabel',[0 5 10 15 20])

orient landscape

%Surface Salinity
figure(3)
subplot(6,1,1)
plot(A_surf_time,A_surf_sal)
axis([startjd endjd 26 36])
ylabel('PSU')
text(julian(2000,1,1,00),30,'Station A')
gregaxdNM(A_surf_time,5)
set(gca,'ytick',[26 28 30 32 34 36],'yticklabel',[26 28 30 32 34 36])
title('Surface Salinity at Stations A-F')

subplot(6,1,2)
plot(B_surf_time,B_surf_sal)
axis([startjd endjd 26 36])
ylabel('PSU')
text(julian(2000,1,1,00),30,'Station B')
gregaxdNM(B_surf_time,5)
set(gca,'ytick',[26 28 30 32 34 36],'yticklabel',[26 28 30 32 34 36])

subplot(6,1,3)
plot(C_surf_time,C_surf_sal)
axis([startjd endjd 26 36])
ylabel('PSU')
text(julian(2000,1,1,00),30,'Station C')
gregaxdNM(C_surf_time,5)
set(gca,'ytick',[26 28 30 32 34 36],'yticklabel',[26 28 30 32 34 36])

subplot(6,1,4)
plot(D_surf_time,D_surf_sal)
axis([startjd endjd 26 36])
ylabel('PSU')
text(julian(2000,1,1,00),30,'Station D')
gregaxdNM(D_surf_time,5)
set(gca,'ytick',[26 28 30 32 34 36],'yticklabel',[26 28 30 32 34 36])

subplot(6,1,5)
plot(E_surf_time,E_surf_sal)
axis([startjd endjd 26 36])
ylabel('PSU')
text(julian(2000,1,1,00),30,'Station E')
gregaxdNM(E_surf_time,5)
set(gca,'ytick',[26 28 30 32 34 36],'yticklabel',[26 28 30 32 34 36])

subplot(6,1,6)
axis([startjd endjd 26 36])
ylabel('PSU')
text(julian(2000,1,1,00),30,['Surface Salinity Data Unavailable for Station F'])
gregaxd(E_surf_time,5)
set(gca,'ytick',[26 28 30 32 34 36],'yticklabel',[26 28 30 32 34 36])
set(gca,'box','on')

orient landscape

%Plots of salinity at depth for all 6 stations
figure(4)
subplot(6,1,1)
plot(A_deep_time,A_deep_sal)
axis([startjd endjd 30 36])
ylabel('PSU')
text(julian(2000,1,1,00),32,['Station A, Depth = ' num2str(A_deep_depth) ' m'])
gregaxdNM(A_deep_time,5)
set(gca,'ytick',[30 32 34 36],'yticklabel',[30 32 34 36])
title('Deep Water Salinity at Stations A-F')

subplot(6,1,2)
plot(B_deep_time,B_deep_sal)
axis([startjd endjd 30 36])
ylabel('PSU')
text(julian(2000,1,1,00),32,['Station B, Depth = ' num2str(B_deep_depth) ' m'])
gregaxdNM(B_deep_time,5)
set(gca,'ytick',[30 32 34 36],'yticklabel',[30 32 34 36])

subplot(6,1,3)
plot(C_deep_time,C_deep_sal)
axis([startjd endjd 30 36])
ylabel('PSU')
text(julian(2000,1,1,00),32,['Station C, Depth = ' num2str(C_deep_depth) ' m'])
gregaxd(C_deep_time,5)
set(gca,'ytick',[30 32 34 36],'yticklabel',[30 32 34 36])

subplot(6,1,4)
plot(D_deep_time,D_deep_sal)
axis([startjd endjd 30 36])
ylabel('PSU')
text(julian(2000,1,1,00),32,['Station D, Depth = ' num2str(D_deep_depth) ' m'])
gregaxdNM(D_deep_time,5)
set(gca,'ytick',[30 32 34 36],'yticklabel',[30 32 34 36])

subplot(6,1,5)
plot(E_deep_time,E_deep_sal)
axis([startjd endjd 30 36])
ylabel('PSU')
text(julian(2000,1,1,00),32,['Station E, Depth = ' num2str(E_deep_depth) ' m'])
gregaxdNM(E_deep_time,5)
set(gca,'ytick',[30 32 34 36],'yticklabel',[30 32 34 36])

subplot(6,1,6)
plot(F_deep_time,F_deep_sal)
axis([startjd endjd 30 36])
ylabel('PSU')
text(julian(2000,1,1,00),32,['Station F, Depth = ' num2str(F_deep_depth) ' m'])
gregaxd(F_deep_time,5)
set(gca,'ytick',[30 32 34 36],'yticklabel',[30 32 34 36])

orient landscape