disp('prt_HiWinGS2013_flux_10');
fclose('all');
clear jazz;
%This program takes data computed by the amma06_da_red1.m progam and creates an ascii
%file appropriate for reading into a spreadsheet (e.g., lotus, quatropro, etc)
%To use it, you must first run the analysis program, or stick a call to thisin it

f=[procturb_path,jdollars,'_flux_10min_',datasetv,'_',dcname,'.txt'];
flist=fopen(f,'w');

npz=length(jdy);
jazz(1,1:npz)=jdy';						%date
jazz(2,1:npz)=ushp';					%uship
jazz(3,1:npz)=U';						%u true
jazz(4,1:npz)=dir';						%true dir
jazz(5,1:npz)=urel';					%u rel
jazz(6,1:npz)=reldir';					%rel dir
jazz(7,1:npz)=head';					%ship heading
jazz(8,1:npz)=dt(:,4)';					%Ts
jazz(9,1:npz)=ta';						%T
qsx=qsea(dt(:,4));
jazz(10,1:npz)=qsx';					%qs
jazz(11,1:npz)=qa';						%qa	
jazz(12,1:npz)=hsc';					%hs covariance
jazz(13,1:npz)=hsib';					%hs ID
jazz(14,1:npz)=hsbb';					%hs bulk						
jazz(15,1:npz)=hlc_bl';					%hl covariance from licor
jazz(16,1:npz)=hlib_lic';				%hl ID
jazz(17,1:npz)=hlbb';					%hl bulk
jazz(18,1:npz)=-(rhoair.*wuj)';		    %stress streamwise covariance
jazz(19,1:npz)=-(rhoair.*wvj)';		    %   "     xstream
jazz(20,1:npz)=(rhoair.*usib.^2)';	    %stress ID
jazz(21,1:npz)=taubb';					%stress bulk
jazz(22,1:npz)=rs';						%solar flux
jazz(23,1:npz)=rl';						%IR flux
jazz(24,1:npz)=org';					%ORG rain rate
jazz(25,1:npz)=jplume';					%ship plume contam index
jazz(26,1:npz)=tiltx';					%tilt of good data
jazz(27,1:npz)=jmanuv';					%maneuver index
jazz(28,1:npz)=ct';						%ct
jazz(29,1:npz)=cql';					%cq from Licor
jazz(30,1:npz)=cu';						%cu
jazz(31,1:npz)=cw';						%cw
jazz(32,1:npz)=HRF';					%Rain heat flux
jazz(33,1:npz)=hl_webb';				%Hl webb flux
jazz(34,1:npz)=Lat';					%lat
jazz(35,1:npz)=Lon';					%lon
jazz(36,1:npz)=zu_etl';					%zu
jazz(37,1:npz)=zt_etl';					%zt
jazz(38,1:npz)=zq_etl';					%zq
jazz(39,1:npz)=ushp_im'; 				%uship  scs
jazz(40,1:npz)=U_scs';					%u true	scs
jazz(41,1:npz)=dir_scs';				%true dir scs
jazz(42,1:npz)=x(:,101)';				%ship course scs 
jazz(43,1:npz)=tsg';					%Ts scs
jazz(44,1:npz)=ta_im';					%T scs
jazz(45,1:npz)=qs_tsg';					%qs scs
jazz(46,1:npz)=qa_im';					%qa scs	 
jazz(47,1:npz)=rs_im';					%solar flux  IMET	 
jazz(48,1:npz)=rl_im';                  %IR flux IMET
jazz(49,1:npz)=wco2_lic';               %w’c’
jazz(50,1:npz)=q_lic';                  %Specific Humidity from Licor (g/kg)
jazz(51,1:npz)=sgq_lic';                %Stv of Specific Humidity from Licor (g/kg)
jazz(52,1:npz)=co2_lic';                %CO2 concentration from Licor (umol/mol)
jazz(53,1:npz)=sgco2_lic;               %Stv of CO2 concentration from Licor (umol/mol)
jazz(54,1:npz)=press';                  %atmospheric pressure (mbar)
jazz(55,1:npz)=Uearth';                 %Wind speed (m/s) relative to earth
jazz(56,1:npz)=direarth';               %Wind direction (deg) from relative to earth

%vectorized print, 53 columns
%                 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     36    37   38     39    40     41     42    43    44    45    46    47    48    49     50     51     52 
fprintf(flist,'%11.5f %8.3f %8.3f %8.2f %8.3f %8.2f %8.2f  %8.3f %8.3f %8.3f %8.3f %8.2f %8.2f %8.2f %9.2f %9.2f  %8.4f %8.4f %8.4f %8.4f %11.5f %11.5f %11.5f %11.5f %11.5f %11.5f %11.5f %11.5f %11.5f %11.5f  %11.5f %11.5f  %11.5f %11.5f  %11.5f %11.5f %11.5f %11.5f %11.5f  %11.5f  %11.5f %11.5f %11.5f %11.5f %11.5f %11.5f %11.5f %11.5f %11.5f %11.5f %11.5f %11.5f %11.5f %11.5f %11.5f %11.5f \r\n',jazz);
%                jd    ushp utrue dirtr urel  dirrl  head  tsnk  tair   qs    qa    hsc   hsib  hsb   hlc  hlb   taucx taucy tauib  taub  psp   pir   org   J    tilt  jm    ct     cql   cu    cw   RF   webb    lat     lon      zu    zt    zq    sog utruim dirtrim  cog   tsg   taim  qsg   qaim  rsim  rlim  hlcl  wclic  qlic  sgq_lic hlib
fclose('all');
disp(['File written as ' f]);
