File: wv2dppp.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 (154 lines) | stat: -rwxr-xr-x 3,672 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
144
145
146
147
148
149
150
151
152
153
154
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

      INTEGER FUNCTION WV2DPPP(ISEC2, ISEC4, NLONS, NLATS, STEP,
     X                         OLDWAVE, NEWWAVE, NORTH, WEST, PMISS)
C
C---->
C*****WV2DPPP*
C
C     PURPOSE
C     -------
C
C     Interface routine to call WV2DINT using (inconsistent)
C     GRIB headers in 2D wave spectra fields.
C
C
C     INTERFACE
C     ---------
C
C     IRET = WV2DPPP(ISEC2, ISEC4, NLONS, NLATS, STEP,
C    X               OLDWAVE, NEWWAVE, NORTH, WEST, PMISS)
C
C     Input arguments
C     ---------------
C
C     ISEC2   - Unpacked section 2 header from 2D wave spectra field
C     ISEC4   - Unpacked section 4 header from 2D wave spectra field
C     NLONS   - Number of points E-W in new grid
C     NLATS   - Number of points N-S in new grid
C     STEP    - Output grid resolution (degrees)
C     OLDWAVE - Original wave field
C     NORTH   - Output grid northernmost latitude (degrees)
C     WEST    - Output grid westernmost longitude (degrees)
C     PMISS   - Missing data value 
C
C     Output arguments
C     ----------------

C     NEWWAVE - New wave field
C
C     Function returns 0 if the interpolation was OK.
C
C
C     METHOD
C     ------
C
C     Setes up call to WV2DINT from 2D wave spectra field headers.
C
C
C     EXTERNALS
C     ---------
C
C     None.
C
C
C     REFERENCE
C     ---------
C
C     None.
C
C
C     Author.
C     -------
C
C     J.D.Chambers      ECMWF    November 1996
C
C
C----<
C
      IMPLICIT NONE
C
C     Subroutine arguments
C
      INTEGER ISEC2, ISEC4, NLONS, NLATS
      DIMENSION ISEC2(*), ISEC4(*)
      REAL STEP, OLDWAVE, NEWWAVE, NORTH, WEST, PMISS
      DIMENSION OLDWAVE(*), NEWWAVE(*)
C
C     Parameters
C
      INTEGER JPROUTINE, JPMXLAT
      PARAMETER (JPROUTINE = 19420)
      PARAMETER (JPMXLAT = 361)
C
C     Local arguments
C
      INTEGER NSPEC, MISSLAT, LOOP, NPTS, NUMLATS
      DIMENSION NPTS(JPMXLAT)
C
C     Externals
C
      INTEGER WV2DINT
      EXTERNAL WV2DINT
C
C ---------------------------------------------------------------------
C*    Section 1. Initalisation.
C ---------------------------------------------------------------------
C
  100 CONTINUE
C
      WV2DPPP = 0
C
C     Setup number of spectra at each point
C
      IF( ISEC4(8).EQ.64 ) THEN
        NSPEC = ISEC4(50)*ISEC4(51)
      ELSE
        NSPEC = 1
      ENDIF
C
C     Calculate number of latitudes if grid had been full from
C     North pole to South pole
C
      NUMLATS = (180000/ISEC2(10)) + 1
      IF( NUMLATS.GT.JPMXLAT ) THEN
        WV2DPPP = JPROUTINE + 1
        GOTO 900
      ENDIF
C
C     Fill an array with the number of points at each latitude
C     (this is a reduced latitude/longitude grid)
C
      MISSLAT = (90000 - ISEC2(4))/ISEC2(10)
      DO LOOP = 1, MISSLAT
        NPTS(LOOP) = 0
      ENDDO
      DO LOOP = 1, ISEC2(3)
        NPTS(LOOP+MISSLAT) = ISEC2(22+LOOP)
      ENDDO
      DO LOOP = MISSLAT+ISEC2(3), NUMLATS
        NPTS(LOOP) = 0
      ENDDO
C
C ---------------------------------------------------------------------
C*    Section 2. Do the interpolation.
C ---------------------------------------------------------------------
C
  200 CONTINUE
C
      WV2DPPP = WV2DINT(NUMLATS,NPTS,NLONS,NLATS,STEP,OLDWAVE,
     X                  NEWWAVE,NORTH,WEST,NSPEC,PMISS)
C
C ---------------------------------------------------------------------
C*    Section 9. Closedown.
C ---------------------------------------------------------------------
C
  900 CONTINUE
      RETURN
      END