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

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

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

Initial import of Stark code.

Line 
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 % This matlab script file performs the following steps:
4 %  1. Read DROG3DDT style .pth file and appropriate grid
5 %  2. Plot colorbanded bathymetry and land
6 %  3. Plot numerical drifter trajectories by iteratively adding
7 %       nout timesteps worth of paths to the end of each path and
8 %       outputting .jpg file.
9 %-----------------------------------------------------------------------
10 % Load data from files
11 %  => gridname = name of fe grid on which .pth file was computed
12 %     ndrog    = number of numerical trajectories
13 %     ndts     = number of timesteps
14 %     dtsec    = timestep size in seconds
15 %     xdr,ydr  = matricies of numerical trajectory coordinates
16 %                (ndrog rows and ndts columns)
17 %     in       = finite element incidence list
18 %     x,y      = nodal coordinates of finite element grid
19 %     z        = nodal depths for finite element grid
20 %     bnd      = outer boundary segments for finite element grid
21 %
22    ls *.pth
23    filename=input('Enter the name of .pth file: ','s');
24    filename=blank(filename(1:length(filename)-4));
25    [gridname,ndrog,ndts,dtsec,pth]=read_pth(filename,4);
26    size(pth);
27    ndts=ans(1)/ndrog;
28    xdr=reshape(pth(:,1),ndrog,ndts)';
29    ydr=reshape(pth(:,2),ndrog,ndts)';
30    [in,x,y,z,bnd]=loadgrid(gridname);
31 %-----------------------------------------------------------------------
32 % Plot boundary
33 %
34    figure;
35    whitebg('w');
36    set(gcf,'menubar','none');
37    set(gca,'XLim',[      0. 500000.]);
38    set(gca,'YLim',[-200000. 300000.]);
39    set(gca,'Box','on');
40    set(gca,'XTick',[]);
41    set(gca,'YTick',[]);
42    [smin,smax,ibw]=colorband_fe(in,x,y,bnd,z,0,350,50);
43    hold on;
44 %-----------------------------------------------------------------------
45 % Plot land
46 %
47 landgrid='g2s'
48 load([landgrid,'.lnd'])
49 xland=eval([landgrid,'(:,2)']);
50 yland=eval([landgrid,'(:,3)']);
51 load([landgrid,'.lel'])
52 inland=eval([landgrid]);
53 c=[0.0 0.5 0.0];
54 for i=1:length(inland)
55    hf=fill(xland(inland(i,2:4)),yland(inland(i,2:4)),c);
56    set(hf,'EdgeColor','none');
57 end
58 %-----------------------------------------------------------------------
59 % Plot particle tracks - outputing .jpg file every nout timesteps
60 %    nout = the number of timesteps to include for each iteration
61 %           => ndts/nout output .jpg files
62    nout=5;
63    h=plot(xdr(1,:),ydr(1,:),'r*')
64    i=0;
65    clear pad;pad='00';
66    title(verbatim([filename,': Day ',num2str(i*dtsec/3600/24)]));
67    drawnow;
68    eval(['print -djpeg ',filename,'_',pad,num2str(i)]);
69    for i=nout+1:nout:ndts
70       clear pad;if i < 10;pad='00';elseif i < 100;pad='0';else;pad='';end;
71       for j=1:ndrog
72          h=plot(xdr(i-nout:i,j),ydr(i-nout:i,j),'k-');
73          set(h,'LineWidth',2.0);
74       end
75       title(verbatim([filename,': Day ',num2str(i*dtsec/3600/24)]));
76       drawnow;
77       eval(['print -djpeg ',filename,'_',pad,num2str(i)]);
78    end
79 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
80 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracBrowser for help on using the browser.