geoscatter(moving3yearAvg.Properties.CustomProperties.Latitude,...
moving3yearAvg.Properties.CustomProperties.Longitude,...
moving3yearAvg{1,:},moving3yearAvg{1,:}>100,'filled')
Group by Time Periods
Another way to group by time is by using periodic time units to look for things like seasonality or
daily cycles. For example, consider the average daily pattern of NO2 concentrations at each site. It is
likely that fossil fuel combustion emissions from human activity and atmospheric photochemistry
driven by the sun contribute to a daily cycle in NO2 concentrations. You cannot calculate the mean
daily cycle using retime. One approach is to use the varfun function by adding a grouping variable
based on the time of day of each timestamp. The timeofday function returns the time of day, or
length of time since midnight, as a duration. This code sample shows the approach by using varfun.
NO2bySite.Hour = timeofday(NO2bySite.Timestamp);
NO2bySite.Hour.Format = "hh:mm";
meanDailyCycleNO2 = varfun(@mean,NO2bySite,"GroupingVariable","Hour")
For common calendar periods such as hour of day or month of year, there is a simpler method. These
common calendar periods are options of the groupsummary function. Call groupsummary with the
"hourofday" option.
meanDailyCycleNO2 = groupsummary(NO2bySite,"Timestamp","hourofday","mean")
meanDailyCycleNO2=24×444 table
hourofday_Timestamp
GroupCount
mean_Alaska_KenaiPeninsula_1004
mean_Arizona_Apache_1
___________________
__________
_______________________________
_____________________
Grouped Calculations in Tables and Timetables
9-99
Précédent

- 443/1450

Suivant