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

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

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

Initial import of Stark code.

Line 
1 %
2 % write drogue output .pth file for a single trajectory
3 %
4 %
5 %  write_pth(fname,gridname,ndts,tsec,x,y,z1,z2);
6 %
7 %          Input:
8 %                 fname    - path/name of .pth file
9 %                 gridname - domain name of computation
10 %                 ndts     - number of time steps in run (or zero)
11 %                 tsec     - length of run (or timestep) in seconds
12 %                 pth      - path data part of the .pth file.
13 %                 (x,y)    - length of run (or timestep) in seconds
14 %                 pth      - path data part of the .pth file.
15 %
16 function write_pth(fname,gridname,ndts,tsec,x,y,z1,z2);
17 fid=fopen(fname,'w');
18 fprintf(fid,'%c',gridname);
19 fprintf(fid,'\n RECORD ABOVE THIS LINE IS THE DOMAIN NAME ON WHICH \n');
20 fprintf(fid,' VELOCITIES WERE COMPUTED.                            \n');
21 fprintf(fid,' ************** BEGIN .IND FILE ECHO *************    \n');
22 fprintf(fid,'{Comment:}                                            \n');                                                       
23 fprintf(fid,'User comment/file description                         \n');                                     
24 fprintf(fid,'{# of model dts btwn drogue position updates (itrack)}\n');             
25 fprintf(fid,'1                                                     \n');                                                             
26 fprintf(fid,'{# of drog updates btwn drogue outputs (iprint)}      \n');                 
27 fprintf(fid,'1                                                     \n');                                                     
28 fprintf(fid,'{grid scaling factors in x,y directions (MKS->1.0)}   \n');                 
29 fprintf(fid,'1.0 1.0 1.0                                           \n');                                                   
30 fprintf(fid,'{drog coordinate scaling factors}                     \n');                                 
31 fprintf(fid,'1.0 1.0 1.0                                           \n');                                                     
32 fprintf(fid,'Number of starting drogues (ndr)                      \n');                                 
33 fprintf(fid,'1                                                     \n');                                                             
34 fprintf(fid,'Starting positions, x,y,z for ndr drogues             \n');                         
35 fprintf(fid,'%f %f %f\n',x(1),y(1),z1(1));
36 fprintf(fid,' ************** END .IND FILE ECHO ***************    \n');
37 fprintf(fid,'MODEL TIME-STEP (SECONDS)             : %10.4f\n',tsec);
38 fprintf(fid,'DROG3DDT  TIME-STEP (SECONDS)         : %10.4f\n',tsec);
39 fprintf(fid,'DROG3DDT OUTPUT INTERVAL (SECONDS)    : %10.4f\n',tsec);
40 fprintf(fid,'XXXX\n %i %f %i\n',ndts,tsec,1);
41 for i=1:length(x)
42    fprintf(fid,'%f %f %f %f\n',x(i),y(i),z1(i),z2(i));
43 end
44 fclose(fid);
Note: See TracBrowser for help on using the browser.