% Assumes file mtm_ndbc20042005.mat loaded....

% -------------------------------------------------------------------------
% Plot solar, wind, wave power running averages
% (ndbc data every 1 hour)

iii = find(~isnan(ndbc_rad_swpower1));
solar = ndbc_rad_swpower1(iii);
time = ndbc_rad_time(iii);

ll = length(time);  % length of time series
dd = 24*10/2;  % ten day interval
rave = smooth(solar, 24*10);  % compute average over 10 days
plot(time(dd:ll-dd), rave(dd:ll-dd), '.r')
datetick('x', 2);
xlabel('Time');
ylabel('Power Delivered (W/m or W/sq m)')
title('Solar(r), wind(g), wave(b) Power 10 Day Running Average');
hold on

% Plot wind power running averages

iii = ~isnan(ndbc_wind_power);
wind = ndbc_wind_power(iii);
time = ndbc_wind_time(iii);
rave = smooth(wind, 24*10);  % compute average over 10 days
ll = length(time);  % length of time series
plot(time(dd:ll-dd), rave(dd:ll-dd), '.g')

% Do the same with waves from NDBC...
% Plot wave power running averages 

iii = (~isnan(ndbc_wave_power));
wave = ndbc_wave_power(iii);
time = ndbc_wave_time(iii);
rave = smooth(wave, 24*10);  % compute average over 10 days
ll = length(time);  % length of time series
plot(time(dd:ll-dd), rave(dd:ll-dd), '.b')


