
clear; clc; close all;

cd /Volumes/arguk/ASFS/asfs_coldtest_feb15to19/

filename = 'ASFS_Test_ASFS_1min_1990_01_01_0000_1990_01_01_0000_2019_02_15_1627';
Source = 'CR1000X "ASFS" test at INSTAAR (B Vaughn''s) cold chamber. Contanct: NOAA-ESRL, C. Cox - christopher.j.cox@noaa.gov. Please do not redistribute.';

x = importdata([filename,'.dat']);
data.dn = datenum(char(x.textdata(3:end,1)),'yyyy-mm-dd HH:MM:SS');
[yyyy mo dd hh mm u] = datevec(data.dn);
data.year  = yyyy;
data.month = mo;
data.day   = dd;
data.hour  = hh;
data.min   = mm;

fnames = x.textdata(2,2:end);
for k = 2:length(fnames)
    data.(strrep(fnames{k},'"','')) = x.data(:,k);
end


ncid = netcdf.create([filename,'.nc'],'NC_WRITE');

Date_Created = num2str(date);
attPut('Date_Created',Date_Created,ncid)

attPut('Note',Source,ncid)

fnames = fieldnames(data);
for k = 2:length(fnames)
    cdfPut(data.(char(fnames(k))),char(fnames(k)),'double',[],length(data.dn),ncid);  
end

netcdf.close(ncid)

clear; clc;








