/[MITgcm]/MITgcm/pkg/mdsio/mdsio_writemeta.F
ViewVC logotype

Contents of /MITgcm/pkg/mdsio/mdsio_writemeta.F

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


Revision 1.4 - (show annotations) (download)
Fri Aug 19 22:42:02 2005 UTC (18 years, 10 months ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint57s_post, checkpoint58b_post, checkpoint57y_post, checkpoint57r_post, checkpoint59, checkpoint58, checkpoint58f_post, checkpoint58d_post, checkpoint58a_post, checkpoint57z_post, checkpoint58y_post, checkpoint58t_post, checkpoint57t_post, checkpoint57v_post, checkpoint60, checkpoint61, checkpoint57x_post, checkpoint58w_post, checkpoint57y_pre, checkpoint58o_post, checkpoint58p_post, checkpoint58q_post, checkpoint58e_post, checkpoint58m_post, checkpoint58r_post, checkpoint58n_post, checkpoint59q, checkpoint59p, checkpoint59r, checkpoint59e, checkpoint59d, checkpoint59g, checkpoint59f, checkpoint59a, checkpoint59c, checkpoint59b, checkpoint59m, checkpoint59l, checkpoint59o, checkpoint59n, checkpoint59i, checkpoint59h, checkpoint59k, checkpint57u_post, checkpoint57q_post, mitgcm_mapl_00, checkpoint58k_post, checkpoint58v_post, checkpoint58l_post, checkpoint58g_post, checkpoint58x_post, checkpoint59j, checkpoint58h_post, checkpoint58j_post, checkpoint57w_post, checkpoint58i_post, checkpoint58c_post, checkpoint58u_post, checkpoint58s_post
Changes since 1.3: +7 -6 lines
Inlcude headers before declaring arguments.

1 C $Header: /u/gcmpack/MITgcm/pkg/mdsio/mdsio_writemeta.F,v 1.3 2005/05/19 21:46:15 ce107 Exp $
2 C $Name: $
3
4 #include "MDSIO_OPTIONS.h"
5
6 subroutine MDSWRITEMETA(
7 I mFileName,
8 I dFileName,
9 I filePrec,
10 I ndims,
11 I dimList,
12 I nrecords,
13 I myIter,
14 I mythid )
15
16 C IN:
17 C mFileName string - complete name of meta-file
18 C dFileName string - complete name of data-file
19 C ndims integer - number of dimensions
20 C dimList integer - array of dimensions, etc.
21 C nrecords integer - record number
22 C myIter integer - time-step number
23 C mythid integer - thread id
24 C OUT:
25 C
26 C Created: 03/20/99 adcroft@mit.edu
27
28 implicit none
29
30 C Global variables / common blocks
31 #include "SIZE.h"
32 #include "EEPARAMS.h"
33 #include "PARAMS.h"
34
35 C Arguments
36 character*(*) mFileName
37 character*(*) dFileName
38 integer filePrec
39 integer ndims
40 integer dimList(3,ndims)
41 integer nrecords
42 integer myIter
43 integer mythid
44
45 C Functions
46
47 C Local
48 integer i,ii,mUnit
49 logical ex
50 character*(max_len_mbuf) msgbuf
51 C ------------------------------------------------------------------
52
53 C We should *read* the met-file if it exists to check
54 C that the information we are writing is consistent
55 C with the current contents
56 inquire( file=mFileName, exist=ex )
57 C However, it is bloody difficult to parse files
58 C in fortran so someone else can do this.
59 C For now, we will assume everything is ok
60 C and that the last record is written to the
61 C last consecutive record in the file.
62
63 C Assign a free unit number as the I/O channel for this subroutine
64 call MDSFINDUNIT( mUnit, mythid )
65
66 C Open meta-file
67 open( mUnit, file=mFileName, status='unknown',
68 & form='formatted' )
69
70 C Write the number of dimensions
71 write(mUnit,'(1x,a,i3,a)') 'nDims = [ ',ndims,' ];'
72
73 C For each dimension, write the following:
74 C 1 global size (ie. the size of the global dimension of all files)
75 C 2 global start (ie. the global position of the start of this file)
76 C 3 global end (ie. the global position of the end of this file)
77
78 write(mUnit,'(1x,a)') 'dimList = ['
79 do ii=1,ndims
80 if (ii.lt.ndims) then
81 write(mUnit,'(10x,3(i5,","))') (dimList(i,ii),i=1,3)
82 else
83 write(mUnit,'(10x,i5,",",i5,",",i5)') (dimList(i,ii),i=1,3)
84 endif
85 enddo
86 write(mUnit,'(10x,a)') '];'
87
88 C Record the precision of the file
89 if (filePrec .EQ. precFloat32) then
90 write(mUnit,'(1x,a)') "format = [ 'float32' ];"
91 elseif (filePrec .EQ. precFloat64) then
92 write(mUnit,'(1x,a)') "format = [ 'float64' ];"
93 else
94 write(msgbuf,'(a)')
95 & ' MDSWRITEMETA: invalid filePrec'
96 call print_error( msgbuf, mythid )
97 stop 'ABNORMAL END: S/R MDSWRITEMETA'
98 endif
99
100 C Record the current record number
101 C This is a proxy for the actual number of records in the file.
102 C If we could read the file then we could do this properly.
103 write(mUnit,'(1x,a,i5,a)') 'nrecords = [ ',nrecords,' ];'
104
105 C Record the file-name for the binary data
106 Cveto ii=ILNBLNK( dFileName )
107 Cveto write(mUnit,'(1x,3a)') 'binarydatafile = [ ',dFileName(1:ii),' ];'
108
109 C Write the integer time (integer iteration number) for later record
110 C keeping. If the timestep number is less than 0 then we assume
111 C that the information is superfluous and do not write it.
112 if (myIter .ge. 0)
113 & write(mUnit,'(1x,a,i10,a)') 'timeStepNumber = [ ',myIter,' ];'
114
115 C Close meta-file
116 close(mUnit)
117
118 C ------------------------------------------------------------------
119 return
120 end

  ViewVC Help
Powered by ViewVC 1.1.22