% -- % Jeff Sevadjian % Research Technician % Monterey Bay Aquarium Research Institute % 7700 Sandholdt Rd % Moss Landing, CA 95039, USA % ph: +1 831-775-1888 % Air temp from the 200WX is biased due to short power-on time. % Here, we compare air temp from the 200WX and the nearby MLML % weather station, and derive a relationship to correct 200WX air temp. %define buoy, deployment, data directory buoy = 'oa2'; dep = '201606'; atlas = '//atlas.shore.mbari.org/'; mydirOA = [atlas 'OA_Moorings/deployment_data/' ... buoy '/' dep '/realTime/']; %read-in .csv files met = csvread([mydirOA 'MET.csv'],1,0); mlml = csvread([atlas 'OA_Moorings/cal_data/MET/MLML_2016-06.csv'],1,2); %convert time in Unix to Matlab datenum dn = datenum([1970 1 1]); met(:,1) = dn + met(:,1)/86400/1000; mlml(:,1) = dn + mlml(:,1)/86400; clear dn; %simple time-series plots figure; hold on; plot(mlml(:,1),mlml(:,6),'b.-'); plot(met(:,1),met(:,3),'g.-'); %NaN empty MET data met(met(:,3)==0,3) = NaN; %align for n=1:size(met,1) [m(n),i(n)] = min(abs(met(n) - mlml(:,1))); end f = find(m < 30/1440); x = met(f,3); y = mlml(i(f),6); clear n m i f; %get rid of NaN values f = find(sum(isnan([x y]')) > 0); x(f) = []; y(f) = []; clear f; %scatter plot figure; hold on; plot(x,y,'k.'); %get regression pf = polyfit(x,y,1); % y = 0.3401x + 9.4422 %check pv = polyval(pf,[min(x) max(x)]); plot([min(x) max(x)],pv,'b-');