source: CPL/oasis3/trunk/src/mod/oasis3/src/reverse.f @ 1677

Last change on this file since 1677 was 1677, checked in by aclsce, 12 years ago

Imported oasis3 (tag ipslcm5a) from cvs server to svn server (igcmg project).

File size: 3.7 KB
Line 
1      SUBROUTINE reverse (pfild ,kxlon ,kylat, cdxord, cdyord)
2      USE mod_kinds_oasis
3C****
4C               *****************************
5C               * OASIS ROUTINE  -  LEVEL 3 *
6C               * -------------     ------- *
7C               *****************************
8C
9C**** *reverse* - Ordering routine
10C
11C     Purpose:
12C     -------
13C     Reorder field according to cdxord and cdyord information
14C
15C**   Interface:
16C     ---------
17C       *CALL*  *reverse (pfild ,kxlon ,kylat, cdxord, cdyord)*
18C
19C     Input:
20C     -----
21C                pfild : field to be reordered (real 2D)
22C                kxlon : number of longitudes
23C                kylat : number of latitudes
24C                cdxord : latitude ordering
25C                cdyord : longitude ordering
26C
27C     Output:
28C     ------
29C                pfild : field reordered (real 2D)
30C
31C     Workspace:
32C     ---------
33C     None
34C
35C     Externals:
36C     ---------
37C     None
38C
39C     Reference:
40C     ---------
41C     See OASIS manual (1995)
42C
43C     History:
44C     -------
45C       Version   Programmer     Date      Description
46C       -------   ----------     ----      ----------- 
47C       1.0       L. Terray      94/01/01  created
48C       2.0       L. Terray      95/10/10  modified; new structure
49C       2.3       S. Valcke      99/04/30  added: printing levels
50C
51C %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
52C
53C* ---------------------------- Include files ---------------------------
54C
55      USE mod_unit
56      USE mod_printing
57C
58C* ---------------------------- Argument declarations -------------------
59C
60      REAL (kind=ip_realwp_p) pfild(kxlon,kylat)
61      CHARACTER*8 cdxord, cdyord
62C
63C* ---------------------------- Local declarations ----------------------
64C
65      LOGICAL llxord, llyord
66C
67C* ---------------------------- Poema verses ----------------------------
68C
69C %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
70C
71C*    1. Initialization
72C        --------------
73C
74      IF (nlogprt .GE. 2) THEN
75          WRITE (UNIT = nulou,FMT = *) ' '
76          WRITE (UNIT = nulou,FMT = *) ' '
77          WRITE (UNIT = nulou,FMT = *) 
78     $    '           ROUTINE reverse  -  Level 3'
79          WRITE (UNIT = nulou,FMT = *) 
80     $    '           ***************     *******'
81          WRITE (UNIT = nulou,FMT = *) ' '
82          WRITE (UNIT = nulou,FMT = *) 
83     $    ' Reorder field North ---> South '
84          WRITE (UNIT = nulou,FMT = *) ' and from Greenwhich ---> West '
85          WRITE (UNIT = nulou,FMT = *) ' if necessary '
86          WRITE (UNIT = nulou,FMT = *) ' '
87          WRITE (UNIT = nulou,FMT = *) ' '
88      ENDIF
89      llxord = cdxord .EQ. 'SUDNOR'
90      llyord = cdyord .EQ. 'WSTEST'
91C
92C
93C*    2. Reorder field 
94C        -------------
95C* South-North buisness
96C
97      IF ( .NOT. llxord) THEN
98          ijmed = kylat/2 
99          DO 210 jj = 1, ijmed
100            DO 220 ji = 1, kxlon
101              zfild = pfild(ji,kylat + 1 - jj)
102              pfild(ji,kylat + 1 - jj) = pfild(ji,jj)
103              pfild(ji,jj) = zfild
104 220        CONTINUE
105 210      CONTINUE
106      ENDIF
107C
108C* East-West one
109C
110      IF ( .NOT. llyord) THEN
111          iimed = kxlon/2 
112          DO 230 jj = 1, kylat
113            DO 240 ji = 1, iimed
114              zfild = pfild(kxlon + 1 - ji,jj)
115              pfild(kxlon + 1 - ji,jj) = pfild(ji,jj)
116              pfild(ji,jj) = zfild
117 240        CONTINUE
118 230      CONTINUE
119      ENDIF
120C
121C
122C*    3. End of routine
123C        --------------
124C
125      IF (nlogprt .GE. 2) THEN
126          WRITE (UNIT = nulou,FMT = *) ' '
127          WRITE (UNIT = nulou,FMT = *) 
128     $    '          --------- End of routine reverse ---------'
129          CALL FLUSH (nulou)
130      ENDIF
131      RETURN
132      END
Note: See TracBrowser for help on using the repository browser.