forked from gremau/NMEG_FluxProc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfluxall_fill_timestamps.m
36 lines (32 loc) · 1.25 KB
/
fluxall_fill_timestamps.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
function fluxall = fluxall_fill_timestamps( fluxall )
% FLUXALL_FILL_TIMESTAMPS - Make sure a UNM annual fluxall file timestamp
% record is complete and unambiguous.
%
% makes sure a FLUXALL dataset has a complete record
% of 30-minute timestamps using dataset_fill_timestamps and that all
% timestamp-related fields (jday, date) for added timestamps are non-nan.
% Begins each year's fluxall file at 00:30:00 on 1 Jan as per UNM convention.
%
% INPUTS:
% fluxall: table array; parsed fluxall data (arbitrary site and year)
%
% OUTPUTS:
% fluxall: table array; fluxall data with complete record of 30-minute
% timestamps
%
% SEE ALSO:
% table_fill_timestamps
%
% author: Timothy W. Hilton, UNM, Dec 2012
% Modified to use tables by Greg Maurer, 2015
year = mode( fluxall.year );
fluxall = table_fill_timestamps( fluxall, ...
'timestamp', ...
't_min', datenum( year, 1, 1, 0, 30, 0 ) );
t = fluxall.timestamp;
[ fluxall.year, fluxall.month, fluxall.day, ...
fluxall.hour, fluxall.min, fluxall.second ] = datevec( t );
fluxall.jday = t - datenum( year, 1, 0 );
fluxall.date = ( fluxall.month * 1e4 + ...
fluxall.day * 1e2 + ...
mod( fluxall.year, 1000 ) );