Takes the processed data structure and writes a TecPlot ASCII data file. Frank L. Engel, USGS Last Edited: 2/20/2013 TecPlot Variable List +=======================================================================+ | NAME | DESCRIPTION | +=======================================================================+ | X | UTM Easting (m) | | Y | UTM Northing (m) | | Depth | depth (m) | | Dist | dist across XS, oreinted looking u/s (m) | | u | stream-wise velocity magnitude per bin (cm/s) | | v | cross-stream velocity magnitude per bin (cm/s) | | w | vertical velocity magnitude per bin (cm/s) | | vp | primary vel. component-0 discharge meth. (cm/s)| | vs | secondary vel. comp.-0 discharge meth. (cm/s) | | U (Rotated) | depth-avg. stream-wise magnitude (cm/s) | | V (Rotated) | depth-avg. cross-stream magnitude (cm/s) | | ux (Rotated) | component of vel. in X dir., rotated (cm/s) | | uy (Rotated) | component of vel. in Y dir., rotated (cm/s) | | uz (Rotated) | component of vel. in Z dir., rotated (cm/s) | | Mag | vel magnitude (need better desc.) (cm/s) | | Bscat | backscatter (units?) | | Dir | direction deviation (degrees) | | vp (Roz) | primary vel. per bin using Rozovskii (cm/s) | | vs (Roz) | secondary vel. per bin using Rozovskii (cm/s) | | vpy (Roz) | cross-stream comp. of primary vel. (cm/s) | | vsy(Roz) | cross-stream comp. of secondary vel. (cm/s) | | phi_deg (Roz) | depth-avg. vel. vector angle (degrees) | | theta_deg (Roz) | individual bin vel. vector angle (degrees) | +=======================================================================+
0001 function VMT_BuildTecplotFile(V,savefile) 0002 % Takes the processed data structure and writes a TecPlot ASCII data file. 0003 % 0004 % Frank L. Engel, USGS 0005 % Last Edited: 2/20/2013 0006 % 0007 % TecPlot Variable List 0008 % +=======================================================================+ 0009 % | NAME | DESCRIPTION | 0010 % +=======================================================================+ 0011 % | X | UTM Easting (m) | 0012 % | Y | UTM Northing (m) | 0013 % | Depth | depth (m) | 0014 % | Dist | dist across XS, oreinted looking u/s (m) | 0015 % | u | stream-wise velocity magnitude per bin (cm/s) | 0016 % | v | cross-stream velocity magnitude per bin (cm/s) | 0017 % | w | vertical velocity magnitude per bin (cm/s) | 0018 % | vp | primary vel. component-0 discharge meth. (cm/s)| 0019 % | vs | secondary vel. comp.-0 discharge meth. (cm/s) | 0020 % | U (Rotated) | depth-avg. stream-wise magnitude (cm/s) | 0021 % | V (Rotated) | depth-avg. cross-stream magnitude (cm/s) | 0022 % | ux (Rotated) | component of vel. in X dir., rotated (cm/s) | 0023 % | uy (Rotated) | component of vel. in Y dir., rotated (cm/s) | 0024 % | uz (Rotated) | component of vel. in Z dir., rotated (cm/s) | 0025 % | Mag | vel magnitude (need better desc.) (cm/s) | 0026 % | Bscat | backscatter (units?) | 0027 % | Dir | direction deviation (degrees) | 0028 % | vp (Roz) | primary vel. per bin using Rozovskii (cm/s) | 0029 % | vs (Roz) | secondary vel. per bin using Rozovskii (cm/s) | 0030 % | vpy (Roz) | cross-stream comp. of primary vel. (cm/s) | 0031 % | vsy(Roz) | cross-stream comp. of secondary vel. (cm/s) | 0032 % | phi_deg (Roz) | depth-avg. vel. vector angle (degrees) | 0033 % | theta_deg (Roz) | individual bin vel. vector angle (degrees) | 0034 % +=======================================================================+ 0035 % 0036 0037 0038 format long 0039 0040 %disp('Creating TecPlot Data Grid...') 0041 % Create block style matrix of all processed data 0042 tecdata = []; 0043 0044 % Sort the Distances such that when plotting in 2D (Dist. vs. Depth), 0045 % you are looking upstream into the transect 0046 Dist = sort(V.mcsDist,2,'descend'); 0047 0048 % Create phi in degrees for each bin to place into Tecplot matrix 0049 for k = 1:size(V.mcsMag,1) 0050 phi_deg(k,:) = V.Roz.phi_deg; 0051 U(k,:) = V.Roz.U; 0052 V1(k,:) = V.Roz.V; % renamed V1 to be different than struc V 0053 end 0054 0055 % Rotate the depth-avg. vectors (no W vector computed) 0056 Z = zeros(size(V.mcsMag,1),size(V.mcsMag,2)); 0057 [U_rot, V_rot, W_rot] = vrotation(U,V1,Z,V.Roz.alpha); 0058 0059 % Build tecplot data matrix 0060 for k = 1:size(V.mcsX,2) 0061 for i = 1:size(V.mcsX,1) 0062 tempvec = [V.mcsX(i,k) V.mcsY(i,k) V.mcsDepth(i,k) Dist(i,k) ... 0063 V.u(i,k) V.v(i,k) V.w(i,k) V.vp(i,k) V.vs(i,k) U_rot(i,k) ... 0064 V_rot(i,k) V.Roz.ux(i,k) V.Roz.uy(i,k) ... 0065 V.Roz.uz(i,k) V.mcsMag(i,k) V.mcsBack(i,k) ... 0066 V.mcsDir(i,k) V.Roz.up(i,k) V.Roz.us(i,k) ... 0067 V.Roz.upy(i,k) V.Roz.usy(i,k) ... 0068 phi_deg(i,k) V.Roz.theta_deg(i,k)]; 0069 tecdata = [tecdata; tempvec]; 0070 end 0071 end 0072 0073 % Replace NaNs with a no data numeric value 0074 nodata = -999; 0075 n = find(isnan(tecdata)); 0076 tecdata(n) = nodata; 0077 0078 % Name of output file (needs to be modified to take handle args from GUI) 0079 %outfile=['tecplot_Rosovskii_outfile.dat']; 0080 outfile = [savefile(1:end-4) '.dat']; 0081 0082 % Print out a TECPLOT FILE 0083 fid = fopen(outfile,'w'); 0084 fprintf(fid, 'TITLE = "AVEXSEC_TECOUT"\n'); 0085 fprintf(fid, 'VARIABLES = "X"\n'); 0086 fprintf(fid, '"Y"\n'); 0087 fprintf(fid, '"Depth"\n'); 0088 fprintf(fid, '"Dist"\n'); 0089 fprintf(fid, '"u"\n'); 0090 fprintf(fid, '"v"\n'); 0091 fprintf(fid, '"w"\n'); 0092 fprintf(fid, '"vp"\n'); 0093 fprintf(fid, '"vs"\n'); 0094 fprintf(fid, '"U (Rotated)"\n'); 0095 fprintf(fid, '"V (Rotated)"\n'); 0096 fprintf(fid, '"ux (Rotated)"\n'); 0097 fprintf(fid, '"uy (Rotated)"\n'); 0098 fprintf(fid, '"uz (Rotated)"\n'); 0099 fprintf(fid, '"Mag"\n'); 0100 fprintf(fid, '"Bscat"\n'); 0101 fprintf(fid, '"Dir"\n'); 0102 fprintf(fid, '"vp (Roz)"\n'); 0103 fprintf(fid, '"vs (Roz)"\n'); 0104 fprintf(fid, '"vpy (Roz)"\n'); 0105 fprintf(fid, '"vsy (Roz)"\n'); 0106 fprintf(fid, '"phi_deg (Roz)"\n'); 0107 fprintf(fid, '"theta_deg (Roz)"\n'); 0108 fprintf(fid, 'ZONE T="ZONE 1"\n'); 0109 fprintf(fid, ' I=%d J=1',i); 0110 fprintf(fid, ' K=%d',k); 0111 fprintf(fid, ' F=POINT\n'); 0112 fprintf(fid, 'DT=(SINGLE SINGLE SINGLE SINGLE SINGLE SINGLE SINGLE SINGLE SINGLE SINGLE SINGLE SINGLE SINGLE SINGLE SINGLE SINGLE SINGLE SINGLE SINGLE SINGLE SINGLE SINGLE SINGLE)\n'); 0113 for m = 1:size(tecdata,1) 0114 fprintf(fid,'%13.10f %13.10f %10.8f %4.8f %4.8f %4.8f %4.8f %4.8f %4.8f %4.8f %4.8f %4.8f %4.8f %4.8f %4.8f %4.8f %4.8f %4.8f %4.8f %4.8f %4.8f %4.8f %4.8f\n',tecdata(m,:)); 0115 end 0116 fclose(fid); 0117 0118 %disp('Saving Tecplot ASCII Data file...') 0119 %directory = pwd; 0120 %fileloc = [directory '\' outfile]; 0121 %disp(outfile) 0122 0123 0124 format short