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

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

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

Initial import of Stark code.

Line 
1 %
2 % Load data from files
3 %
4    ls *.s2r
5    filename=input('Enter the name of .s2r file: ','s');
6    [s2r,gridname]=read_s2r(filename);
7    scalar=s2r(:,2);
8    gridname=blank(gridname(1:length(gridname)-1));
9    [in,x,y,z,bnd]=loadgrid(gridname);
10    [y,x]=xy2ll_adr(x,y);
11    load(['/usr/people/naimie/meshes/',gridname,'/',gridname,'ll.bfd']);
12    bfd=eval([gridname,'ll']);xfd=bfd(:,1);yfd=bfd(:,2);
13 %
14 % Reshape fd grid and bathymetric depth arrays
15 %
16    nx=2;while xfd(nx+1)~=xfd(1);nx=nx+1;end;
17    ny=length(xfd)/nx;
18    xfd=reshape(xfd,nx,ny);
19    yfd=reshape(yfd,nx,ny);
20    batfd=reshape(bfd(:,10),nx,ny);
21 %
22 % Interpolate scalars to fd grid
23 % (i.e. fd gridpoints outside of domain have nearest node values written to them)
24 %
25    scalar=z;
26    scalara=(scalar(bfd(:,4)).*bfd(:,7)+scalar(bfd(:,5)).*bfd(:,8)+scalar(bfd(:,6)).*bfd(:,9))./(bfd(:,7)+bfd(:,8)+bfd(:,9));
27    scalara=reshape(scalara,nx,ny);
28 %
29 % Interpolate scalars to fd grid for only those fd nodes within domain
30 % (i.e. fd gridpoints outside of domain have NaN values written to them)
31 %
32    bfdi(:,1:3)=bfd(:,7:9);zz=find(bfd(:,3)==0);bfdi(zz,1:3)=NaN*ones(length(zz),3);
33    scalar=z;
34    scalari=(scalar(bfd(:,4)).*bfdi(:,1)+scalar(bfd(:,5)).*bfdi(:,2)+scalar(bfd(:,6)).*bfdi(:,3));
35    scalari=reshape(scalari,nx,ny);
36 %
37 % Plot boundary
38 %
39    figure
40    whitebg('w')
41    hold on
42    bndo=plotbnd(x,y,bnd);
43    set(bndo,'Color','k')
44    axis('equal')
45    [smin,smax,ibw]=colorband_fd_xy_cb(xfd,yfd,scalara,1,-100,1000,100)
46    hold on
47    lndfill('adrdep2kmgll');
Note: See TracBrowser for help on using the browser.