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

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

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

Initial import of Stark code.

Line 
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 %
3 % load node and element files
4 %
5 figure
6 load_bank150
7 close
8 %
9 % load level surface data
10 %
11 !ls *.lst *.lte *.lsa
12 fname=input('Enter the name of the .lst file: ','s')
13 [pfid,message]=fopen([fname]);
14 datatype=fname(length(fname)-2:length(fname))
15 gridname=fgets(pfid);
16 header=fgets(pfid);
17 nl=fscanf(pfid,'%d1');
18 zl=fscanf(pfid,'%f',[nl 1])';
19 data=fscanf(pfid,'%f',[1 inf])';
20 size(data);
21 nn=ans(1)/nl;
22 datal=reshape(data,[nl nn]);
23 datal=datal';
24 datalmin=min(min(datal))
25 datalmax=max(max(datal))
26 cmin=ceil(datalmin);
27 cmax=floor(datalmax);
28 % floor rounds toward -infinity
29 % ceil  rounds toward +infinity
30 % fix   rounds toward  0
31 %
32 % output avs .inp files
33 %
34 for il=1:nl
35    size(in);
36    nel=0;
37    clear inl
38    for ie=1:ans(1)
39       depth=(z(in(ie,1))+z(in(ie,2))+z(in(ie,3)))/3.0;
40       if depth >= -zl(il)
41          nel=nel+1;
42          inl(nel,1)=in(ie,1);
43          inl(nel,2)=in(ie,2);
44          inl(nel,3)=in(ie,3);
45       end
46    end
47    inpfile=['truth_level',num2str(il),'.inp']
48    write_inp_2d(inpfile,x,y,inl,datal(:,il))
49 end
50 %
51 %
52 %
53 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracBrowser for help on using the browser.