/[MITgcm]/MITgcm_contrib/ifenty/Curvi/input/plot_grid.m
ViewVC logotype

Annotation of /MITgcm_contrib/ifenty/Curvi/input/plot_grid.m

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations) (download)
Thu Jul 6 17:57:44 2006 UTC (19 years ago) by edhill
Branch: MAIN
CVS Tags: HEAD
initial ci -- produces a quick plot of the grid with coastlines

1 edhill 1.1 %
2     % Ed Hill
3     %
4     % Quick script to double the lengths/areas around the face edges.
5    
6     fin = 'b.face001.bin';
7    
8     sNx = 102;
9     sNy = 41;
10    
11     vnall = { 'XC','YC','dxF','dyF','rA','XG','YG','dxV', ...
12     'dyU','rAz','dxC','dyC','rAw','rAs','dxG','dyG' };
13    
14     gvars = { 'XC','YC','DXF','DYF','RA','XG','YG','DXV', ...
15     'DYU','RAZ','DXC','DYC','RAW','RAS','DXG','DYG' };
16    
17     nslab = (sNx + 1)*(sNy + 1);
18    
19     grid = {};
20     for ivar = 1:length(gvars)
21    
22     disp([ ' reading : ' gvars{ivar} ]);
23    
24     gid = fopen(fin, 'r', 'ieee-be');
25     fseek(gid,(ivar-1)*nslab*8,'bof');
26     tmp = reshape(fread(gid,nslab,'real*8',0,'ieee-be'),[sNx+1,sNy+1]);
27     fclose(gid);
28     grid.(gvars{ivar}) = tmp;
29    
30     end
31    
32     fac = pi/180.0;
33     [ xg, yg, zg ] = sph2cart( grid.XG*fac, grid.YG*fac, 1 );
34    
35     plot3(xg,yg,zg, 'b-')
36     hold on
37     plot3(xg',yg',zg', 'b-')
38     hold off
39    
40     center = [ sum(sum(xg)) sum(sum(yg)) sum(sum(zg)) ];
41     center = center./norm(center);
42     hold on
43     plot3(center(1),center(2),center(3),'rx')
44     hold off
45    
46     load coast
47     near = zeros([ length(lat) 3 ]);
48     [near(:,1) near(:,2) near(:,3)] = ...
49     sph2cart(long*(pi/180),lat*(pi/180),1);
50     for i = 1:length(near)
51     if norm(near(i,:) - center) > 0.4
52     near(i,:) = NaN;
53     end
54     end
55     hold on
56     plot3(near(:,1),near(:,2),near(:,3),'g-')
57     hold off
58    
59     axis equal
60     view(32,36)
61    
62    
63     nr = 5;
64     xr = xg(1:nr:end,1:nr:end);
65     yr = yg(1:nr:end,1:nr:end);
66     zr = zg(1:nr:end,1:nr:end);
67     figure(2)
68     plot3(xr,yr,zr, 'b-')
69     hold on
70     plot3(xr',yr',zr', 'b-')
71     plot3(near(:,1),near(:,2),near(:,3),'g-')
72     hold off
73     axis equal
74     view(32,36)
75    
76     print -depsc lab_sea_001.eps

  ViewVC Help
Powered by ViewVC 1.1.22