File: numptns.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 (104 lines) | stat: -rwxr-xr-x 2,040 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
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 NUMPTNS(NORTH,SOUTH,GRIDSTEP)
C
C---->
C**** NUMPTNS
C
C     Purpose
C     -------
C
C     Calculate number of grid points in the range from north to south.
C
C
C     Interface
C     ---------
C
C     IRET = NUMPTNS(NORTH,SOUTH,GRIDSTEP)
C
C     Input
C     -----
C
C     NORTH    - Northern boundary in degrees
C     SOUTH    - Southern boundary in degrees
C     GRIDSTEP - Grid interval in degrees
C
C
C     Output
C     ------
C
C     Function returns the number of grid points in the north-south
C     interval.
C
C
C     Method
C     ------
C
C     The grid is assumed to be centred on the Equator.
C
C
C     Externals
C     ---------
C
C     None.
C
C     Author
C     ------
C
C     J.D.Chambers     ECMWF     Dec 1997
C
C
C     Modifications
C     -------------
C
C     None.
C
C----<
C
      IMPLICIT NONE
C
C     Function arguments
C
      REAL SOUTH, NORTH, GRIDSTEP
C
C     Local variables
C
      INTEGER N1, N2
      REAL TOP, BOTTOM
C
C ------------------------------------------------------------------
C     Section 1.   Initialise
C ------------------------------------------------------------------
C
  100 CONTINUE
C
      BOTTOM = SOUTH
      TOP    = NORTH
      IF( BOTTOM.GT.TOP) THEN
        BOTTOM = NORTH
        TOP    = SOUTH
      ENDIF
C ------------------------------------------------------------------
C     Section 2.   Calculate the number of points in the interval
C ------------------------------------------------------------------
C
  200 CONTINUE
C
      N1 = NINT(BOTTOM/GRIDSTEP)
      N2 = NINT(TOP/GRIDSTEP)
      NUMPTNS = N2 - N1 + 1
C
C ------------------------------------------------------------------
C     Section 9.   Return
C ------------------------------------------------------------------
C
  900 CONTINUE
C
      RETURN
      END