File: eulavgg.F

package info (click to toggle)
emoslib 000380%2Bdfsg-3
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 47,712 kB
  • ctags: 11,551
  • sloc: fortran: 89,643; ansic: 24,200; makefile: 370; sh: 355
file content (143 lines) | stat: -rwxr-xr-x 4,173 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
C Copyright 1981-2007 ECMWF
C 
C Licensed under the GNU Lesser General Public License which
C incorporates the terms and conditions of version 3 of the GNU
C General Public License.
C See LICENSE and gpl-3.0.txt for details.
C

      SUBROUTINE EULAVGG(NEWFLD, NEXT, INROW, RLAT, RLON,
     X                   POLELAT, POLELON, FIELD, NGAUSS, TYPE)
C
C---->
C**** EULAVGG
C
C     PURPOSE
C     _______
C
C     Generates values along a latitude in a rotated gaussian grid.
C     (reverses the operations carried out by GGVALUE).
C
C     INTERFACE
C     _________
C
C     CALL EULAVGG(NEWFLD, NEXT, INROW, RLAT, RLON,
C    X             POLELAT, POLELON, FIELD, NGAUSS, TYPE)
C
C
C     Input parameters
C     ________________
C
C     NEWFLD  - the field of values being created
C     NEXT    - start offset of the latitude row being created
C     INROW   - the number of points in the latitude row
C     RLAT    = target point latitude in the rotated grid
C     RLON    = target point longitude in the rotated grid
C     POLELAT = latitude of the rotated South Pole
C     POLELON = longitude of the rotated South Pole
C     FIELD   = original unrotated gaussian field values
C     NGAUSS  = original unrotated gaussian field number
C     TYPE    = original unrotated gaussian field type
C             = 'F' for full (regular) gaussian field
C             = 'R' for reduced (quasi) gaussian field
C
C     Output parameters
C     ________________
C
C     NEWFLD(NEXT) to NEWFLD(NEXT+INROW-1) contains the latitude row
C     values.
C
C
C     METHOD
C     ______
C
C     Rotates the lat/long positions of points along the latitude row
C     in a rotated gaussian grid back to positions in the unrotated grid
C     and then interpolates vsalue from the original grid.
C
C
C     EXTERNALS
C     _________
C
C     LL2XYZ  - Converts a latitude/longitude position to (x,y,z)
C               wrt axes through the centre of the globe. The z-axis
C               runs from the south to north pole. The x- and y-axes
C               are in the plane of the equator with the x-axis
C               pointing out through lat/long (0,0).
C     YROTATE - Rotates the globe about the y-axis.
C     XYZ2LL  - Converts an (x,y,z) position to a latitude/longitude.
C     GGINTRP - Interpolates a value from an existing grid.
C
C
C     REFERENCE
C     _________
C
C     None
C
C
C     COMMENTS
C     ________
C
C     The input field is assumed to be global in extent, and a known
C     definition, either N160 or N80 (reduced or regular).
C
C
C     AUTHOR
C     ______
C
C     J.D.Chambers      ECMWF       April 1996
C
C
C     MODIFICATIONS
C     _____________
C
C     None.
C
C----<
C     _______________________________________________________
C
C*    Section 0. Definition of variables.
C     _______________________________________________________
C
      IMPLICIT NONE
C
C     Function arguments
      REAL NEWFLD, RLAT, RLON, POLELAT, POLELON, FIELD
      DIMENSION NEWFLD(*), RLON(*), FIELD(*)
      INTEGER NEXT, INROW, NGAUSS
      CHARACTER*1 TYPE
C
C     Parameters
      INTEGER JPMAXGG
      PARAMETER( JPMAXGG = 1280 )
C
C     Local variables
      REAL X(JPMAXGG), Y(JPMAXGG), Z(JPMAXGG)
      REAL RX(JPMAXGG),RY(JPMAXGG),RZ(JPMAXGG)
      REAL OLAT(JPMAXGG),OLON(JPMAXGG)
      INTEGER LOOP
C
C     Adjust the target row points longitude to add back the longitude
C     rotation
      DO LOOP = 1, INROW
        OLON(LOOP) = RLON(LOOP) - POLELON
        IF( OLON(LOOP).LT.0.0 )   OLON(LOOP) = OLON(LOOP) + 360.0
        IF( OLON(LOOP).GE.360.0 ) OLON(LOOP) = OLON(LOOP) - 360.0
      ENDDO
C
C     Convert the target row points lat/long to (x,y,z) coordinates
      CALL LL2XYZ(RLAT,OLON,X,Y,Z,INROW)
C
C     Rotate the target row points forward through the original latitude
C     rotation
      CALL YROTATE((90.0+POLELAT),X,Y,Z,RX,RY,RZ,INROW)
C
C     Convert the target row points adjusted (x,y,z) coordinates to
C     lat/long in the original grid (after longitude rotation)
      CALL XYZ2LL(RX,RY,RZ,OLAT,OLON,INROW)
C
C     Interpolate the rotated grid to the target row points
      CALL GGINTRP(NEWFLD,NEXT,INROW,OLAT,OLON,FIELD,NGAUSS,TYPE)
C
      RETURN
      END