/[MITgcm]/MITgcm/pkg/mnc/mnc_cw_readwrite.template
ViewVC logotype

Contents of /MITgcm/pkg/mnc/mnc_cw_readwrite.template

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


Revision 1.1 - (show annotations) (download)
Sat Jan 31 04:13:09 2004 UTC (20 years, 4 months ago) by edhill
Branch: MAIN
 o more work on the file-independent layer ("wrapper")

1 C $Header: $
2 C $Name: $
3
4 #include "MNC_OPTIONS.h"
5
6 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
7
8 SUBROUTINE MNC_CW_RX_WRITES_YY(
9 I myThid,
10 I fbname, bi,bj,
11 I vtype,
12 I indu,
13 I var )
14
15 implicit none
16
17 #include "netcdf.inc"
18 #include "mnc_common.h"
19 #include "EEPARAMS.h"
20 #include "EESUPPORT.h"
21 #include "PARAMS.h"
22 #include "GRID.h"
23
24 C Arguments
25 integer myThid, bi,bj, indu
26 character*(*) fbname, vtype
27 _RX var(*)
28
29 C Functions
30 integer IFNBLNK, ILNBLNK
31
32 C Local Variables
33 integer i, indv,nvf,nvl, n1,n2
34 integer bis,bie, bjs,bje, iG,jG, uniq_tnum
35 integer tile_num
36 character*(MAX_LEN_MBUF) msgbuf
37 character*(MNC_MAX_CHAR) fname
38
39 C Temporary storage for the simultaneous type conversion and
40 C re-shaping before passing to NetCDF
41 #define mnc_rtype_YY
42 #ifdef mnc_rtype_D
43 REAL*8 resh( sNx + 2*OLx + sNy + 2*OLy )
44 #endif
45 #ifdef mnc_rtype_R
46 REAL*4 resh( sNx + 2*OLx + sNy + 2*OLy )
47 #endif
48 #undef mnc_rtype_YY
49
50 C Only do I/O if I am the master thread
51 _BEGIN_MASTER( myThid )
52
53 C Check that the Variable Type exists
54 nvf = IFNBLNK(vtype)
55 nvl = ILNBLNK(vtype)
56 CALL MNC_GET_IND(myThid, MNC_MAX_ID, vtype, mnc_cw_vname, indv)
57 IF (indg .LT. 1) THEN
58 write(msgbuf,'(3a)') 'MNC_CW_RX_WRITES_YY ERROR: vtype ''',
59 & vtype(nff:nfl), ''' is not defined'
60 CALL print_error(msgbuf, mythid)
61 stop 'ABNORMAL END: S/R MNC_CW_RX_WRITES_YY'
62 ENDIF
63
64 IF (bi .LT. 1) THEN
65 bis = 1
66 bie = nSx
67 ELSE
68 bis = bi
69 bie = bi
70 ENDIF
71 IF (bj .LT. 1) THEN
72 bjs = 1
73 bje = nSy
74 ELSE
75 bjs = bj
76 bje = bj
77 ENDIF
78
79 DO bj = bjs,bje
80 DO bi = bis,bie
81
82 C Create the file name
83 CALL MNC_CW_GET_TILE_NUM(myThid, bi,bj, uniq_tnum)
84 fname(1:MNC_MAX_CHAR) = mnc_blank_name(1:MNC_MAX_CHAR)
85 n1 = IFNBLNK(fbname)
86 n2 = ILNBLNK(fbname)
87 ntot = n2 - n1 + 1
88 fname(1:ntot) = fbname(n1:n2)
89 ntot = ntot + 1
90 fname(ntot:ntot) = '.'
91 write(fname((ntot+1):(ntot+9)),'(i6.6,a3)') uniq_tnum, '.nc'
92
93 C Append to existing or create new file
94 CALL MNC_CW_FILE_AORC(myThid, fname)
95
96 C Write the variable one row at a time
97
98
99 ENDDO
100 ENDDO
101
102 _END_MASTER( myThid )
103
104 RETURN
105 END
106
107 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
108
109 CEH3 ;;; Local Variables: ***
110 CEH3 ;;; mode:fortran ***
111 CEH3 ;;; End: ***

  ViewVC Help
Powered by ViewVC 1.1.22