function [time,temp,rh,dew,ux,vx] = read_twr(path, period)
warning off
z = dir([path 'nsatwr*']);
Archive = [];
for i = 1:length(z)
    x = rd_netcdf([path z(i).name]);
    y = attribute_list([path z(i).name]);
    time = double(x.base_time)/60/60/24 + datenum([1970 1 1 0 0 0]) + double(x.time/60/60/24);
    % QC
    temp = x.temp_mean;
    temp(x.qc_temp_mean > 0) = NaN;
    rh = x.rh_mean;
    rh(x.qc_rh_mean > 0) = NaN;
    dew_point = x.dew_point_mean;
    dew_point(x.qc_dew_point_mean > 0) = NaN;
    wspd_vec = x.wspd_vec_mean;
    wspd_vec(x.qc_wspd_vec_mean > 0) = NaN;
    wdir_vec = x.wdir_vec_mean;
    wdir_vec(x.qc_wdir_vec_mean > 0) = NaN;
    % accumulate
    Archive = [Archive; time double(temp') double(rh')  double(dew_point') double(wspd_vec') double(wdir_vec')];
end

Archive(Archive(:,1) < datenum(period(1,:)) | Archive(:,1) > datenum(period(2,:))+ 1 - 1/24/60,:) = [];
clear mex

% interpret
time = Archive(:,1);
temp = Archive(:,2:5);
rh = Archive(:,6:9);
dew = Archive(:,10:13);
wsp = Archive(:,14:17);
wdir = Archive(:,18:21);

% convert
temp = temp + 273.15;
dew = dew + 273.15;
ux = wsp.*sind(wdir);
vx = wsp.*cosd(wdir);

