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

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

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

Initial import of Stark code.

Line 
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 % Purpose: Output an OAX5 .grid file from input mesh data.
4 % Format:  The .grid file contains columns of the independent variables
5 %          followed by the correlation scales in the directions of the
6 %          independent variables.  It allows for the horizontal
7 %          correlation scales to have a variable major axis through the
8 %          assignment of a rotation angle.  This version sets constant
9 %          correlation scales in the x and y directions.
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12 %
13 % Load grid files ... in case any are needed
14 %
15 meshname='yessub_cen2'
16 [in,x,y,z,bnd]=loadgrid(meshname);
17 size(in);
18 ne=ans(1);
19 size(x);
20 nn=ans(1);
21 %
22 % Set independent variables (x and y should be first and second)
23 %
24 nodes=get_nodes(['/usr/yes/naimie/meshes/',meshname],[meshname,'ll']);
25 x=nodes(:,1);
26 y=nodes(:,2);
27 vid(:,1)=x;vid(:,2)=y;
28 %
29 % Set correlation scales for independent variables
30 %  (rot is the angle of rotation ccw from the x axis to the x' axis)
31 %
32 %
33 rot(1:nn,1)=0.0;
34 cor(1:nn,1:2)=0.50;
35 %
36 % Output grid file (x,y,id,rot,Sx',Sy',Sid)
37 %  id=columns of independent variables (likely z and t)
38 %  Sx',Sy' are the correlation scales in the x' and y' directions
39 %  Sid are the correlation scales in the id directions
40 %
41 fid=fopen([meshname,'ll.grid'],'w');
42 for i=1:nn
43   fprintf(fid,' %7.3f',vid(i,:));
44   fprintf(fid,' %5.1f',rot(i,1));
45   fprintf(fid,' %6.2f',cor(i,:));
46   fprintf(fid,'\n');
47 end
48 fclose(fid);
49 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
50 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracBrowser for help on using the browser.