File: ll2xyz.F

package info (click to toggle)
emoslib 2%3A4.4.5-2
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 359,232 kB
  • ctags: 13,125
  • sloc: fortran: 93,166; ansic: 27,958; sh: 7,500; f90: 5,209; perl: 604; cpp: 305; makefile: 78; python: 53
file content (98 lines) | stat: -rw-r--r-- 2,007 bytes parent folder | download | duplicates (6)
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
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 LL2XYZ(RLAT,RLONG,X,Y,Z,INROW)
C---->
C**** LL2XYZ
C
C     Purpose
C     -------
C
C     Converts an array of latitude/longitude values to an
C     array of (x,y,z) coordinates.
C
C
C     Interface
C     ---------
C
C     CALL LL2XYZ(RLAT,RLONG,X,Y,Z,INROW)
C
C     Input
C     -----
C
C     RLAT  - Array of latitudes.
C     RLONG - Array of corresponding longitudes.
C     INROW - Count of latitudes/longitudes.
C
C
C     Output
C     ------
C
C     (X,Y,Z) - Array of coordinates.
C
C
C     Method
C     ------
C
C     Z axis is the polar axis directed from south to north.
C     X and Y axes are in the equatorial plane and have origin at the
C     centre of the Earth. The X axis passes through (O north, 0 east).
C
C
C     Externals
C     ---------
C
C     None.
C
C
C     Author
C     ------
C
C     J.D.Chambers     ECMWF
C
C----<
C
      IMPLICIT NONE
C
C     Subroutine arguments
C
      REAL RLAT,RLONG,X,Y,Z
      DIMENSION RLONG(*),X(*),Y(*),Z(*)
      INTEGER INROW
C
C     Parameters
C
      INTEGER JPMAXGG
      PARAMETER( JPMAXGG = 1280 )
C
C     Local variables
C
      REAL FACTOR, COS_LAT, SIN_LAT, COS_LON, SIN_LON
      DIMENSION COS_LON(JPMAXGG), SIN_LON(JPMAXGG)
      DATA FACTOR/0.017453293/
      INTEGER LOOP
      REAL ALAT
C
      ALAT = RLAT * FACTOR
      COS_LAT = COS(ALAT)
      SIN_LAT = SIN(ALAT)
C
      DO LOOP = 1, INROW
        COS_LON(LOOP) = COS(RLONG(LOOP)*FACTOR)
        SIN_LON(LOOP) = SIN(RLONG(LOOP)*FACTOR)
C
        X(LOOP) = COS_LAT*COS_LON(LOOP)
        Y(LOOP) = COS_LAT*SIN_LON(LOOP)
        Z(LOOP) = SIN_LAT
      ENDDO
C
      RETURN
      END