%  Allcruise_plots.m

% path strings to data and figure folders - mac format
path_data = '/Volumes/cruises/SeaState_2015/Sikuliaq/flux/Processed_allcruise';
path_figs = '/Volumes/cruises/SeaState_2015/Sikuliaq/flux/Raw_images_allcruise';

% load 5 min flux file
data = load(fullfile(path_data,'SeaState_2015_PSD_flux_5min_all.txt'));

% data array:
% col   description
% 1     Decimal julian day
% 2     psd true wind speed @ 16.5m, m/s
% 3     psd true wind direction, deg
% 4     psd seasnake T, C
% 5     ship theromsalinograph T, C  bow
% 6     ship theromsalinograph salinity, psu  bow
% 7     psd air T at 15 m, C
% 8     psd air specific humidity at sea surface, g/kg
% 9     psd air specific humidity at 15 m, g/kg
% 10    psd solar flux, w/m^2
% 11    psd IR flux, w/m^2
% 12    psd optical raingage precip rate, mm/hr
% 13    ship sog from gps, m/s
% 14    ship heading from gyrocompass, deg
% 15    rel wind speed @ 16.5m, m/s
% 16    rel wind direction @ 16.5m, deg
% 17    decimal latitude, deg
% 18    decimal longtude, deg
% 19    Depth of SST sensor used in heat flux calc, m
% 20    standard deviation of ship speed, m/s
% 21    wind stress, coare 3.0, N/m^2
% 22    sensible heat flux, coare 3.0, w/m^2
% 23    latent heat flux, coare 3.0, w/m^2
% 24    rain heat flux, w/m^2
% 25    Ship air temp, C (15 m)
% 26    Ship air specific humidity, g/kg (15 m)
% 27    Ship true wind speed, m/s (15.5 m)
% 28    Ship true wind direction, deg (15.5 m)
% 29    Ship solar flux, w/m^2
% 30    Ship IR flux, w/m^2
% 31    BP, mb
% 32    RH (%)

jd_5min = data(:,1);
rspd = data(:,15); rdir = data(:,16);
sog = data(:,13); stdsog = data(:,20);

% rel wind
figure;
subplot(2,1,1);  plot(jd_5min, rspd,'r.');
xlabel('DOY'); ylabel('Rel Wind Speed (m/s)'); grid;
title('Rel Wind Components');
subplot(2,1,2); plot(jd_5min, rdir,'b.');
ylim([-180,180]); xlabel('DOY'); ylabel('Rel Wind Dir'); grid;
ppath = fullfile(path_figs,'SeaState_2015_RelWind.png');
print('-dpng',ppath);

% sog
figure;
subplot(2,1,1);  plot(jd_5min, sog,'r.');
xlabel('DOY'); ylabel('SOG (m/s)'); grid;
title('Rel Wind Components');
subplot(2,1,2); plot(jd_5min, stdsog,'b.');
xlabel('DOY'); ylabel('Std SOG (m/s)'); grid;
ppath = fullfile(path_figs,'SeaState_2015_SOG.png');
print('-dpng',ppath);

