File: nmakll.F

package info (click to toggle)
emoslib 2%3A4.5.9-11
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 356,680 kB
  • sloc: fortran: 93,146; ansic: 27,963; sh: 7,598; f90: 5,215; perl: 604; cpp: 305; makefile: 89; python: 53
file content (154 lines) | stat: -rw-r--r-- 3,473 bytes parent folder | download | duplicates (5)
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-2016 ECMWF.
C
C This software is licensed under the terms of the Apache Licence 
C Version 2.0 which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
C
C In applying this licence, ECMWF does not waive the privileges and immunities 
C granted to it by virtue of its status as an intergovernmental organisation 
C nor does it submit to any jurisdiction.
C

      SUBROUTINE NMAKLL( KTRUNC, PINTVL, PLAT, KNUM, PLEG, KRET)
C
C---->
C**** NMAKLL
C
C     PURPOSE
C     _______
C
C     This routine creates legendre functions for latitude rows from
C     the given latitude.
C
C     INTERFACE
C     _________
C
C     CALL NMAKLL( KTRUNC, PINTVL, PLAT, KNUM, PLEG, KRET)
C
C     Input parameters
C     ________________
C
C     KTRUNC  - Truncation.
C     PINTVL  - Grid interval (degrees)
C     PLAT    - Start latitude in degrees.
C     KNUM    - Number of latitudes
C
C     Output parameters
C     ________________
C
C     PLEG     - Array of legendre functions for the latitude.
C     KRET     - Return status code
C                0 = OK
C
C     Common block usage
C     __________________
C
C     JDCNDBG
C
C     Method
C     ______
C
C     See below.
C
C     Externals
C     _________
C
C     INTLOG   - Output log message
C     INTLOGR  - Output log message (with real value)
C
C     Reference
C     _________
C
C     None.
C
C     Comments
C     ________
C
C     None at present.
C
C     AUTHOR
C     ______
C
C     J.D.Chambers      *ECMWF*      June 1999
C
C     MODIFICATIONS
C     _____________
C
C     None.
C
C----<
C
      IMPLICIT NONE
C
#include "jparams.h"
#include "parim.h"
C
C     Parameters
C
      INTEGER JPROUTINE
      PARAMETER ( JPROUTINE = 30500 )
C
C     Subroutine arguments
C
      INTEGER KTRUNC, KRET, KNUM
      REAL PLEG, PINTVL, PLAT
      DIMENSION PLEG(*)
C
C     Local variables
C
      REAL ZLAST, ZLAT, ALAT, DEG2RAD
      INTEGER NEXTRW, NEXT, FIRST, LAST
C
C     _______________________________________________________
C
C*    Section 1.    Initialization.
C     _______________________________________________________
C
 100  CONTINUE
C
      IF( NDBG.GT.1 ) THEN
        CALL INTLOG(JP_DEBUG,'NMAKLL: Input parameters:',JPQUIET)
        CALL INTLOG(JP_DEBUG,'NMAKLL: Truncation = ', KTRUNC)
        CALL INTLOG(JP_DEBUG,'NMAKLL: Number of latitudes = ', KNUM)
        CALL INTLOGR(JP_DEBUG,
     X    'NMAKLL: Grid interval (degrees) = ', PINTVL)
        CALL INTLOGR(JP_DEBUG,
     X    'NMAKLL: Latitude in degrees = ', PLAT)
      ENDIF
C
      IF( PLAT.LT.0.0 ) THEN
        ZLAT = 0.0
      ELSE
        ZLAT = PLAT
      ENDIF
C
C     _______________________________________________________
C
C*    Section 2.    Processing.
C     _______________________________________________________
C
      DEG2RAD = PPI / 180.0
C
      ZLAST = ZLAT - (KNUM-1)*PINTVL
      NEXTRW = 1
      FIRST = NINT(ZLAT/PINTVL)
      LAST  = NINT(ZLAST/PINTVL)
      DO NEXT = FIRST, LAST, -1
        ALAT = (NEXT*PINTVL) * DEG2RAD
C
        IF( NDBG.GT.1 ) CALL INTLOGR(JP_DEBUG,
     X    'NMAKLL: Next latitude constructed = ', (NEXT*PINTVL))
C
        CALL JSPLEG1( PLEG(NEXTRW), ALAT, KTRUNC)
        NEXTRW = NEXTRW + (KTRUNC+1)*(KTRUNC+4)/2
      ENDDO
C     _______________________________________________________
C
C*    Section 9. Return to calling routine. Format statements
C     _______________________________________________________
C
 900  CONTINUE
      KRET = 0
C
 990  CONTINUE
      RETURN
      END