Since you are new, let us show you how Trendy works.

Close-button

Average Water Temperature in Boston

This trend is disabled.

Your code has an error or you are requesting a feature that is not yet available.

This trend is disabled and will not collect data until re-enabled.

  • Created by: Tom Gaudette
  • Last ran: almost 2 years ago.
  • Auto-run in: almost 2 years.
  • Created on: 25 Jan 2012

236

data points

Disabled

Description:

This retrieves the air and water temperature for the last day from NOAA Station ID=8443970 located in Boston MA. For more information please visit http://tidesandcurrents.noaa.gov. It then saves the mean water temperature for trendy to display.

Recently Collected Data (last 5 of 236) Show All Data

Time Recorded (time1279) Data (data1279)
20 Sep 2012 06:13:10 NaN
19 Sep 2012 06:11:18 NaN
18 Sep 2012 06:11:21 NaN
17 Sep 2012 06:11:24 NaN
16 Sep 2012 06:11:49 NaN
% Retrieve data from NOAA Station ID=8443970 located in Boston MA.
%Station, Date, Time, Air Tmp, H2O Tmp, Baro Pr

% Get Yesterday's Date
yesterday = now-1;
dayStr = day(yesterday);
monthStr = month(yesterday);
yearStr = year(yesterday);

% Build string to retrieve data from yesterday to today
startDate = regexprep(sprintf('%4.d%2.d%2.d',yearStr,monthStr,dayStr),' ','0');
endDate = regexprep(sprintf('%4.d%2.d%2.d',year(date),month(date),day(date)),' ','0');
urlStr = ['http://tidesandcurrents.noaa.gov/data_menu.shtml?bdate=',startDate,'&edate=',endDate,'&metinterval=&unit=1&shift=g&stn=8443970+Boston%2C+MA&type=Meteorological+Observations&format=View+Data'];
targetStr = '------- -------- ----- ------- ------- -------';
numCol = 7;

p = urlfilter(urlStr,targetStr,numCol*24*10);

% Sometimes the data that is returned does not have any values.  This
% requires us to parse the data further
stationIdx = find(p==p(1));
x = ones(7,length(stationIdx))*nan;
for idx = 1:(length(stationIdx)-1)
   colIdx = stationIdx(idx+1)-stationIdx(idx);
   for idx2 = 1:colIdx
        x(idx2,idx)=p(stationIdx(idx)+idx2-1);
   end    
end

timeIdx = 1:size(x,2);
plot(timeIdx,x(5,:),timeIdx,x(6,:))
legend('Air Temp','Water Temp')
ylabel('Degrees Far')
xlabel('time 6min increments')

%noaaData = [timeIdx;x(5,:);timeIdx;x(6,:)];

avgWater = mean(x(6,~isnan(x(6,:))));
avgAir = mean(x(5,~isnan(x(5,:))));

% Just save the average water Temp
updatetrend(avgWater);

% Just save the average Air Temp
% updatetrend(avgAir);
Tags:

    Add Tags


    0 comments