NCCOOS Trac Projects: Top | Web | Platforms | Processing | Viz | Sprints | Sandbox | (Wind)

root/gliderproc/trunk/MATLAB/opnml/FCAST_1.2/matlab_cen/read_vmt.m

Revision 495 (checked in by cbc, 12 years ago)

Initial import of Stark code.

Line 
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 %% Read a .vmt file and load data arrays
3 %% function [z,u,v,sigt,t,s,q2,q2l,enzm,enzh,enzq,nn,nnv,gridname,header]=read_vmt(fname)
4 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5 function [z,u,v,sigt,t,s,q2,q2l,enzm,enzh,enzq,nn,nnv,gridname,header]=read_vmt(fname)
6 ncol=13;
7 if nargin == 0
8    !ls *.vmt
9    fname=input('Enter the name of the .vmt file: ','s');
10 end
11 [pfid,message]=fopen([fname]);
12 datatype=fname(length(fname)-2:length(fname));
13 gridname=fgets(pfid);
14 gridname=gridname(1:length(gridname)-1);
15 header=fgets(pfid);
16 nnv=fscanf(pfid,'%f',1);
17 data=fscanf(pfid,'%f',[1 inf])';
18 fclose(pfid);
19 size(data);
20 nn=ans(1)/nnv/ncol;
21 string=[num2str(nn),'x',num2str(nnv),' ',datatype,' values read from ',fname];
22 fprintf(1,string); fprintf(1,'\n');
23 data=reshape(data,[ncol nn*nnv])';
24 z=data(:,2);
25 u=data(:,3);v=data(:,4);w=data(:,5);
26 sigt=data(:,6);t=data(:,7);s=data(:,8);
27 q2=data(:,9);q2l=data(:,10);
28 enzm=data(:,11);enzh=data(:,12);enzq=data(:,13);
Note: See TracBrowser for help on using the browser.