/[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.2 - (show annotations) (download)
Wed Aug 29 14:16:24 2001 UTC (22 years, 8 months ago) by adcroft
Branch: MAIN
CVS Tags: checkpoint46n_post, checkpoint51k_post, checkpoint47e_post, checkpoint52l_pre, ecco_c44_e19, hrcube4, hrcube5, checkpoint46l_post, checkpoint57g_pre, checkpoint46g_pre, checkpoint47c_post, release1_p13_pre, checkpoint50c_post, checkpoint57b_post, checkpoint46f_post, checkpoint52d_pre, checkpoint57g_post, checkpoint48e_post, checkpoint56b_post, checkpoint50g_post, checkpoint46b_post, checkpoint52j_pre, checkpoint43a-release1mods, checkpoint51o_pre, checkpoint44g_post, checkpoint54d_post, checkpoint48c_post, checkpoint54e_post, ecco_c50_e32, ecco_c50_e33, ecco_c50_e30, ecco_c50_e31, release1_p13, checkpoint51l_post, checkpoint48i_post, checkpoint40pre9, checkpoint46l_pre, checkpoint57d_post, checkpoint50d_pre, checkpoint52k_post, chkpt44d_post, checkpoint55, checkpoint54, checkpoint57, checkpoint56, checkpoint51, checkpoint53, checkpoint52, release1_p8, release1_p9, checkpoint50d_post, release1_p1, release1_p2, release1_p3, release1_p4, release1_p5, release1_p6, release1_p7, checkpoint52f_post, checkpoint50b_pre, checkpoint44e_pre, checkpoint54f_post, checkpoint51f_post, release1_b1, checkpoint48b_post, ecco_c51_e34d, ecco_c51_e34e, ecco_c51_e34f, ecco_c51_e34g, ecco_c51_e34a, ecco_c51_e34b, ecco_c51_e34c, checkpoint43, checkpoint51d_post, checkpoint48c_pre, checkpoint55a_post, checkpoint51t_post, checkpoint51n_post, release1_chkpt44d_post, checkpoint55i_post, checkpoint52i_pre, checkpoint57h_post, hrcube_2, hrcube_3, checkpoint51s_post, checkpoint55c_post, checkpoint48d_pre, checkpoint51j_post, checkpoint47i_post, checkpoint52e_pre, checkpoint57f_post, checkpoint52e_post, checkpoint51n_pre, checkpoint47d_post, icebear5, icebear4, icebear3, icebear2, checkpoint53d_post, checkpoint46d_pre, checkpoint57a_post, checkpoint48d_post, release1-branch_tutorials, checkpoint57h_pre, checkpoint48f_post, checkpoint45d_post, checkpoint52b_pre, checkpoint54b_post, checkpoint46j_pre, ecco_c50_e28, checkpoint51l_pre, checkpoint52m_post, checkpoint47d_pre, chkpt44a_post, checkpoint55g_post, checkpoint44h_pre, checkpoint48h_post, checkpoint51q_post, ecco_c50_e29, checkpoint51b_pre, checkpoint46a_post, checkpoint47g_post, checkpoint52b_post, checkpoint52c_post, checkpoint46j_post, checkpoint51h_pre, checkpoint46k_post, checkpoint46b_pre, chkpt44c_pre, checkpoint52h_pre, checkpoint45a_post, checkpoint57c_post, checkpoint50f_post, checkpoint50a_post, checkpoint50f_pre, hrcube_1, checkpoint51m_post, checkpoint55d_post, checkpoint44e_post, ecco_c44_e18, ecco_c44_e17, ecco_c44_e16, release1_p12, release1_p10, release1_p11, release1_p16, release1_p17, release1_p14, release1_p15, checkpoint47a_post, ecco_c50_e33a, checkpoint53c_post, checkpoint55d_pre, checkpoint57c_pre, checkpoint55j_post, branchpoint-genmake2, checkpoint54a_post, checkpoint46e_pre, checkpoint55h_post, checkpoint51r_post, checkpoint45b_post, checkpoint51i_post, checkpoint57e_post, release1-branch-end, release1_final_v1, checkpoint55b_post, checkpoint51b_post, release1_p12_pre, checkpoint46c_pre, checkpoint53a_post, checkpoint44f_post, checkpoint47b_post, checkpoint44b_post, checkpoint55f_post, ecco_c51_e34, checkpoint46h_pre, checkpoint52d_post, checkpoint53g_post, checkpoint46m_post, checkpoint46a_pre, checkpoint50c_pre, checkpoint45c_post, ecco_ice2, ecco_ice1, checkpoint44h_post, eckpoint57e_pre, checkpoint46g_post, checkpoint51c_post, checkpoint52a_pre, checkpoint46i_post, checkpoint50h_post, checkpoint52i_post, checkpoint50e_pre, checkpoint50i_post, ecco_c44_e25, checkpoint51i_pre, checkpoint48a_post, checkpoint56a_post, checkpoint53f_post, checkpoint47j_post, checkpoint54a_pre, checkpoint53b_pre, branch-exfmods-tag, checkpoint57h_done, checkpoint52j_post, checkpoint47f_post, checkpoint50e_post, chkpt44a_pre, ecco_c44_e22, ecco_c44_e23, ecco_c44_e20, ecco_c44_e21, ecco_c44_e26, ecco_c44_e27, ecco_c44_e24, checkpoint57f_pre, checkpoint46c_post, ecco-branch-mod1, ecco-branch-mod2, ecco-branch-mod3, ecco-branch-mod4, ecco-branch-mod5, branch-netcdf, checkpoint52l_post, checkpoint52n_post, checkpoint46e_post, release1_beta1, checkpoint56c_post, checkpoint51e_post, checkpoint44b_pre, checkpoint42, checkpoint57a_pre, checkpoint40, checkpoint41, checkpoint46, checkpoint47, checkpoint44, checkpoint45, checkpoint48, checkpoint49, checkpoint46h_post, checkpoint51o_post, checkpoint50, checkpoint51f_pre, chkpt44c_post, checkpoint53b_post, checkpoint47h_post, checkpoint52a_post, checkpoint44f_pre, checkpoint51g_post, ecco_c52_e35, checkpoint46d_post, checkpoint50b_post, release1-branch_branchpoint, checkpoint52f_pre, checkpoint53d_pre, checkpoint55e_post, checkpoint54c_post, checkpoint51a_post, checkpoint51p_post, checkpoint48g_post, checkpoint51u_post
Branch point for: c24_e25_ice, branch-exfmods-curt, release1_coupled, release1_final, release1-branch, branch-genmake2, release1, branch-nonh, tg2-branch, ecco-branch, release1_50yr, netcdf-sm0, icebear, checkpoint51n_branch
Changes since 1.1: +3 -3 lines
Bug fix: the number of digits for the timeStepNumber record in META
information was 8 where as the number of digits in file-names is 10.
Beyond 99999999 iterations, timeStepNumber becomes ******** even
though the data is being written properly.

Reported by Jeff Scott.

(How he's managed to do that number of iterations, I don't know but thanks.)

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

  ViewVC Help
Powered by ViewVC 1.1.22