VMT_BuildTecplotFile_XSBathy

PURPOSE ^

Takes the processed data structure and writes a TecPlot ASCII data file

SYNOPSIS ^

function VMT_BuildTecplot_XSBathy(V,savefile)

DESCRIPTION ^

 Takes the processed data structure and writes a TecPlot ASCII data file
 containing the mean cross section bathymetry.
 Modified from code by Frank L. Engel, USGS

 P.R. Jackson, USGS
 Last Edited: 2/20/2013

 11-7-11: Fixed the issue with improper IJK dimensions which caused files
 to not load properly into Tecplot. (PRJ)

 TecPlot Variable List
 +=======================================================================+
 |   NAME             |   DESCRIPTION                                    |
 +=======================================================================+
 |   X                |   UTM Easting (m)                                |
 |   Y                |   UTM Northing (m)                               |
 |   BedDepth         |   Bed depth (m)                                  |
 |   Dist             |   dist across XS, oriented looking u/s (m)       |
 |   BedElev          |   Bed elevation (m)                              |
 +=======================================================================+

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function VMT_BuildTecplot_XSBathy(V,savefile)
0002 % Takes the processed data structure and writes a TecPlot ASCII data file
0003 % containing the mean cross section bathymetry.
0004 % Modified from code by Frank L. Engel, USGS
0005 %
0006 % P.R. Jackson, USGS
0007 % Last Edited: 2/20/2013
0008 %
0009 % 11-7-11: Fixed the issue with improper IJK dimensions which caused files
0010 % to not load properly into Tecplot. (PRJ)
0011 %
0012 % TecPlot Variable List
0013 % +=======================================================================+
0014 % |   NAME             |   DESCRIPTION                                    |
0015 % +=======================================================================+
0016 % |   X                |   UTM Easting (m)                                |
0017 % |   Y                |   UTM Northing (m)                               |
0018 % |   BedDepth         |   Bed depth (m)                                  |
0019 % |   Dist             |   dist across XS, oriented looking u/s (m)       |
0020 % |   BedElev          |   Bed elevation (m)                              |
0021 % +=======================================================================+
0022 %
0023 
0024 
0025 format long
0026 
0027 % disp('Creating TecPlot Data Grid...')
0028 % Create block style matrix of all processed data
0029 tecdata = [];
0030 
0031 % Sort the Distances such that when plotting in 2D (Dist. vs. Depth),
0032 % you are looking upstream into the transect
0033 Dist = sort(V.mcsDist,2,'descend');
0034 
0035 % Build tecplot data matrix
0036 tecdata = [V.mcsX(1,:)' V.mcsY(1,:)' V.mcsBed' Dist(1,:)'...
0037     V.mcsBedElev'];
0038 
0039 %size(tecdata)
0040 % Replace NaNs with a no data numeric value
0041 nodata = -999;
0042 n = find(isnan(tecdata));
0043 tecdata(n) = nodata;
0044 
0045 % Name of output file (needs to be modified to take handle args from GUI)
0046 %outfile=['tecplot_Rosovskii_outfile.dat'];
0047 outfile = [savefile(1:end-4) '_XSBathy.dat'];
0048 
0049 % Print out a TECPLOT FILE
0050 fid = fopen(outfile,'w');
0051 fprintf(fid, 'TITLE     = "AVEXSEC_TECOUT"\n');
0052 fprintf(fid, 'VARIABLES = "X"\n');
0053 fprintf(fid, '"Y"\n');
0054 fprintf(fid, '"BedDepth"\n');
0055 fprintf(fid, '"Dist"\n');
0056 fprintf(fid, '"BedElev"\n');
0057 fprintf(fid, 'ZONE T="ZONE 1"\n');
0058 fprintf(fid, ' I=%d  J=1',size(tecdata,1));
0059 fprintf(fid, '  K=1');
0060 fprintf(fid, ' F=POINT\n');
0061 fprintf(fid, 'DT=(SINGLE SINGLE SINGLE SINGLE SINGLE)\n');
0062 for m = 1:size(tecdata,1)
0063     fprintf(fid,'%13.10f %13.10f %10.8f %6.8f %10.8f\n',tecdata(m,:));
0064 end
0065 fclose(fid);
0066 
0067 disp('Saving Tecplot ASCII XS Bathy Data file...')
0068 %directory = pwd;
0069 %fileloc = [directory '\' outfile];
0070 disp(outfile)
0071 
0072 
0073 format short

Generated on Thu 21-Aug-2014 10:40:31 by m2html © 2005