% MAKE_NCFILE_PIES_WBTS  Generate netCDF files of PIES pressure data
%
% Time-stamp: <2013-08-19 12:09:23 mlankhorst>

     

% load WBTS PIES data
%  Project: Western Boundary Time Series  
%  Site name: A
%  Latitude: 26.5156 N
%  Longitude: 76.8336 W
%  Depth: 1020 m
% 
%  For further information please contact
%  Dr. Christopher Meinen
%  Christopher.Meinen@noaa.gov
%  (305) 361-4355 
% 
% 
%  Update: 01-Nov-2012
% 
%
%  Year  Month  Day  Tau1000    Pressure   U          V
%                  [ seconds ]  [ dbar ]   [ cm/s ]   [ cm/s ]
infile = '/Molly/work/data/WBTS/Abaco/IES/wbts_ies_site_A.asc';
wbts_pies = load (infile);
Year     = wbts_pies(:,1);
Month    = wbts_pies(:,2);
Day      = wbts_pies(:,3);
Tau      = wbts_pies(:,4);
Pressure = wbts_pies(:,5);
U        = wbts_pies(:,6);
V        = wbts_pies(:,7);

lat = 26.5156;
lon = -76.8336;
site = 'A';
nominal_depth = 1020;
update_time = datenum('01-Nov-2012');

outfile = 'wbts_siteA_PIES.nc';

fprintf('  Writing output file %s ...\n',outfile);

writep(infile,outfile, ...
   Year, Month, Day, Tau, Pressure, U, V, lat, lon, site, nominal_depth, update_time);

fprintf('\n');

%%%%%%  Display file content for double-checking  %%%%%

fprintf(['\n\n    Displaying contents of file %s\n\n', ...
   '****************************************\n\n'], ...
  outfile);

if exist(outfile, 'file')
    ncdisp(outfile)
else
    fprintf(['\n    Outfile is empty: %s\n'], outfile);
end

fprintf(['\n****************************************\n\n', ...
   '[End of contents of file %s]\n\n\n'], ...
  outfile);

    
