


function [u,x,y]=read_hiswa(file); file = hiswa output name nx = number of colums in hiswa output ny = number of rows in hiswa output


0001 function [u,x,y]=read_hiswa(file); 0002 % function [u,x,y]=read_hiswa(file); 0003 % file = hiswa output name 0004 % nx = number of colums in hiswa output 0005 % ny = number of rows in hiswa output 0006 0007 % parameters specific to L. Pontch. run: 0008 0009 xorig=6.9e5; %x-origin of FRAME output 0010 yorig=1.5e5; %y-origin of FRAME output 0011 xlength=79600; %x length of FRAME output 0012 ylength=43600; %y length of FRAME output 0013 xdivs=199; %numb of x divisions in FRAME output 0014 ydivs=109; %numb of y divisions in FRAME output 0015 0016 nx=xdivs+1; %numb of x output nodes 0017 ny=ydivs+1; %numb of y output nodes 0018 0019 deltax=xlength/xdivs; %x output grid spacing 0020 deltay=ylength/ydivs; %y output grid spacing 0021 0022 0023 % create x and y plotting vectors: 0024 0025 x=xorig+[0:xdivs]*deltax; 0026 y=yorig+[0:ydivs]*deltay; 0027 0028 % read in HISWA ouput; 0029 0030 fid=fopen(file,'r'); 0031 if(fid==-1), 0032 disp('file not found') 0033 return 0034 end 0035 u=fscanf(fid,'%g'); 0036 fclose(fid); 0037 0038 %manipulate array so it's the right size and orientation: 0039 0040 u=reshape(u,nx,ny); 0041 u=flipud(u'); 0042 0043 % where Ub=0, set to nan so it doesn't get plotted: 0044 0045 ind=find(u==0); 0046 u(ind)=u(ind)*nan; 0047 0048