function ep_qcplot(x,ep,Filename) % EP_QCPLOT % Brian Schlining % 08 Mar 2000 ep_ini t = find(strcmp(ColumnS,'Decimal_Year')); %x = ep_cmpl; % Read the data files in epX directories on tsunami if ep == 1 dat = ep1; else dat = ep2; end Position = get(0, 'ScreenSize'); Position = [Position(1:3) Position(4) - Position(4)*.1]; if dat.west_longitude < 0 lat = [num2str(abs(dat.west_longitude)) 'W']; elseif dat.west_longitude > 0 lat = [num2str(abs(dat.west_longitude)) 'E']; else lat = '0' end if dat.north_latitude < 0 lon = [num2str(abs(dat.north_latitude)) 'S']; elseif dat.north_latitude > 0 lon = [num2str(abs(dat.north_latitude)) 'N']; else lon = '0'; end loc = [lon ' ' lat]; %======================================= % Get the dates, Correct for Y2K issues %======================================= sdn = x(ep).dat(:,t) + 1900; sdn = dy2date(sdn); % Get Dates %========================================================= % Refine the approximate dates to make them more accurate %========================================================= [Year Month Day Hour Minute Second] = datevec(sdn); i = strcmp(ColumnS,'Time'); Hour = x(ep).dat(:,i); Hour(find(Hour == 1200)) = 12/24; Hour(find(Hour == 1230)) = 12.5/24; Day = round(Day) + Hour; % Correct the day to the local time sdn = datenum(Year, Month, Day); good = [length(sdn) - 1 length(sdn)]; %========================== % First Figure: Ed, Lu, Es %========================== figure mA = subplot('position', [0.1300 0.11 .20 .65]); a = strmatch('Ed[20m]',ColumnS); b = strmatch('Ed[20m]PAR',ColumnS); EdCol = setdiff(a,b); %EsCol = EsCol(1:5); lambda = [412 443 490 510 555 656]; Ed = nanmean(x(ep).dat(good,EdCol)); plot(lambda, Ed, 'b') hold on plot(lambda, Ed, 'b.') title('Downwelled Irradiance'); xlabel('Wavelength [nm]') ylabel('E_d [\muW cm^-^2 nm^-^1]') set(gca, 'YLim', [0.01 100], 'YScale', 'log', 'XLim', [300 700], 'YGrid', 'on') % Es plot subplot('position', [0.6922 0.11 .20 .65]) a = strmatch('Ed[3m+]',ColumnS); b = strmatch('Ed[3m+]PAR',ColumnS); EsCol = setdiff(a,b); %EsCol = EsCol(1:5); lambda = [412 443 490 510 555 656]; h = [NaN NaN NaN]; Es = nanmean(x(ep).dat(good,EsCol)); h(3) = plot(lambda, Es, 'g'); hold on plot(lambda, Es, 'g.') set(gca, 'YLim', [10 1000], 'YScale', 'log', 'XLim', [300 700], 'YGrid', 'on') title('Surface Irradiance'); xlabel('Wavelength [nm]') ylabel('L_u [\muW cm^-^2 nm^-^1 sr^-^1]') subplot('position', [0.4111 0.11 .20 .65]) Lu20Col = strmatch('Lu[20m]',ColumnS); Lu1Col = strmatch('Lu[1.5m]',ColumnS); lambda = [412 443 490 510 555 670 683]; Lu20 = nanmean(x(ep).dat(good,Lu20Col)); Lu1 = nanmean(x(ep).dat(good,Lu1Col)); h(1) = plot(lambda, Lu20, 'b'); hold on plot(lambda, Lu20, 'b.') h(2) = plot(lambda, Lu1, 'r'); plot(lambda, Lu1, 'r.') set(gca, 'YLim', [0.001 10], 'YScale', 'log', 'XLim', [300 700], 'YGrid', 'on') hold off title('Upwelled Radiance'); xlabel('Wavelength [nm]') ylabel('E_s [\muW cm^-^2 nm^-^1]') lh = legend(h, '20m', '1.5m', 'Surface',0); Pos = get(lh, 'Position'); set(lh, 'Position', [0.6922 0.8 Pos(3) Pos(4)]) set(gcf, 'CurrentAxes', mA) text(300, 925, ['Position: ' loc]); text(300, 400, ['Date: ' datestr(nanmean(sdn(good)) + gmtoffset(dat.east_longitude)) ' [GMT]']) setfontsize(7) %========================= % Make a gif if specified %========================= if nargin > 2 [p fname ext] = fileparts(Filename); PaperPosition = [.25 2.5 4.5 3.25]; set(gcf,'PaperPosition',PaperPosition); writegif([p filesep fname 'a' ext]); close(gcf) end %=============================== % Second Figure: K, Kchl, Lw %=============================== figure % First plot: Ke, Kl, Kw, Km mA = subplot('position', [0.1300 0.11 .20 .65]); h = [NaN NaN NaN NaN]; % Ke - Downwelled a = strmatch('K',ColumnS); b = strmatch('KLw',ColumnS); KCol = setdiff(a,b); %EsCol = EsCol(1:5); lambda = [412 443 490 510 555 670]; Ke = nanmean(x(ep).dat(good,KCol)); h(1) = plot(lambda, Ke, 'k'); hold on plot(lambda, Ke, 'k.') % Kl - Upwelled Kl = calc_k(Lu1, Lu20, 18.5); lambda = [412 443 490 510 555 670 683]; h(2) = plot(lambda, Kl, 'r'); plot(lambda, Kl, 'r.') % Km - Modeled based on morel uisng [CHL] from morel K490 Chl = morel_chl2(nanmean(x(ep).dat(good, strmatch('K490', ColumnS))), 490); Km = morel_k(Chl, lambda); h(3) = plot(lambda, Km, 'g'); plot(lambda, Km, 'g.') % Kw - Pure water based on Morel Kw = morel_k(0, lambda); h(4) = plot(lambda, Kw, 'b'); plot(lambda, Kw, 'b.') title('Attenuation'); xlabel('Wavelength [nm]') ylabel('K [m^-^1]') set(gca, 'YLim', [-.2 1], 'XLim', [300 700],'YGrid', 'on') lh = legend(h, 'Based on E_d','Based on L_u', 'Modeled', 'Pure Water'); Pos = get(lh, 'Position'); set(lh, 'Position', [ 0.6922 .80 Pos(3) Pos(4)]) % Second Plot Kw-K subplot('position', [0.4111 0.11 .20 .65]) % Es lambda = [412 443 490 510 555 670]; Kw = morel_k(0, lambda); Ce = Ke - Kw; plot(lambda, Ce, 'k'); hold on plot(lambda, Ce, 'k.') %Lu lambda = [412 443 490 510 555 670 683]; Kw = morel_k(0, lambda); Cl = Kl - Kw; plot(lambda, Cl, 'r'); plot(lambda, Cl, 'r.') % Modeled Cm = Km - Kw; plot(lambda, Cm, 'g'); plot(lambda, Cm, 'g.') set(gca, 'YLim', [-.2 .2], 'XLim', [300 700], 'YGrid', 'on') title('K - K_{pure water} ') xlabel('Wavelength [nm]') ylabel('K [m^-^1]') % Third plot: Lw subplot('position', [0.6922 0.11 .20 .65]) lambda = [412 443 490 510 555]; Lwe = calc_lw(Lu20(1:5), Ke(1:5), 20); Lwl = calc_lw(Lu20(1:5), Kl(1:5), 20); Lwm = calc_lw(Lu20(1:5), Km(1:5), 20); plot(lambda, Lwe, 'k') hold on plot(lambda, Lwe, 'k.') plot(lambda, Lwl, 'r') plot(lambda, Lwl, 'r.') plot(lambda, Lwm, 'g') plot(lambda, Lwm, 'g.') set(gca, 'YLim', [0 1.4], 'XLim', [300 700], 'YGrid', 'on') title('Water Leaving Radiance') xlabel('Wavelength [nm]') ylabel('L_w [\muW cm^-^2 nm^-^1 sr^-^1]') set(gcf, 'CurrentAxes', mA) text(300, 1.3, ['Position: ' loc]); text(300, 1.2, ['Date: ' datestr(nanmean(sdn(good)) + gmtoffset(dat.east_longitude)) ' [GMT]']) setfontsize(7) %========================= % Make a gif if specified %========================= if nargin > 2 set(gcf,'PaperPosition',PaperPosition); writegif([p filesep fname 'b' ext]); close(gcf) end