OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
dunvec.f
Go to the documentation of this file.
1 CCCC
2 C
3  SUBROUTINE dunvec (A, AU, AMAG)
4 C
5  1 FORMAT(' *** SUBROUTINE DUNVEC MARCH 11, 1987 ***')
6 C
7 C-----LANGUAGE - VS FORTRAN
8 C
9 C-----FUNCTION - UNITIZES A VECTOR AND COMPUTES ITS MAGNITUDE
10 C
11 C-----MATHEMATICAL METHOD -
12 C
13 C-----ARGUMENTS -
14 C ARGUMENT TYPE IO DESCRIPTION
15 C -------- ---- -- -----------
16 C A(3) R*8 I INPUT VECTOR
17 C AU(3) R*8 O OUTPUT UNIT VECTOR OF A
18 C AMAG R*8 O MAGNITUDE OF A
19 C
20 C-----EXTERNAL REFERENCES - NONE
21 C
22 C-----CALLED BY - ANY
23 C
24 C-----COMMONS REFERENCED - NONE
25 C
26 C-----ERROR HANDLING - NONE
27 C
28 C-----FILES REFERENCED - NONE
29 C
30 C-----DESIGNER - R. COON CSC 03/01/87
31 C
32 C-----PROGRAMMER - R. COON CSC MARCH 11, 1987
33 C
34 C-----VERIFIED BY - K. P. WASCZKIEWICZ CSC MARCH 11, 1987
35 C
36 C-----MODIFICATIONS -
37 C NAME DATE DESCRIPTION
38 C M. WOOLSEY JAN.89 INSTALLED UNDERFLOW ERROR TRAP
39 CCCC
40 C DECLARE ARGUMENTS
41  real*8 a(3), au(3), amag
42 C
43  amag = dsqrt(a(1)**2 + a(2)**2 + a(3)**2)
44  IF (amag .NE. 0.0d+00 .AND. dabs(amag) .LT. 1.0d32) THEN
45  IF (dabs(a(1)) .GT. 1.0d-32) THEN
46  au(1)=a(1)/amag
47  ELSE
48  au(1) = 0.d0
49  END IF
50  IF (dabs(a(2)) .GT. 1.0d-32) THEN
51  au(2)=a(2)/amag
52  ELSE
53  au(2) = 0.d0
54  END IF
55  IF (dabs(a(3)) .GT. 1.0d-32) THEN
56  au(3)=a(3)/amag
57  ELSE
58  au(3) = 0.d0
59  END IF
60  ELSE
61  au(1)=0.0d+00
62  au(2)=0.0d+00
63  au(3)=0.0d+00
64  END IF
65 C
66  RETURN
67  END
#define real
Definition: DbAlgOcean.cpp:26
subroutine dunvec(A, AU, AMAG)
Definition: dunvec.f:4