SURFEX v8.1
General documentation of Surfex
itor.F
Go to the documentation of this file.
1  SUBROUTINE itor(INT_V, REAL_V, N)
2 !
3 !**** SUBROUTINE itor - To convert from INTEGER to 64-bit REAL
4 !
5 ! S.Saarinen ECMWF 27/6/95
6 !
7 !** INTERFACE
8 ! ---------
9 !
10 ! CALL itor(int_v, real_v, n)
11 ! WHERE:
12 ! int_v = Integer vector (INPUT) of n elements:
13 ! Only 32-bit range is accepted i.e.
14 ! [-2147483648 ... 2147483647] which is the same as
15 ! [-2**31 ... 2**31 - 1]
16 ! real_v = 64-bit REAL-vector (OUTPUT) of n elements
17 ! each holding one integer value after conversion
18 ! n = length of the vectors
19 !
20 !
21 !-----------------------------------------------------------------------
22 !
23  USE parkind1, ONLY : jpim
24  IMPLICIT NONE
25  INTEGER(KIND=JPIM) :: N
26 !-- The following MUST be 64-bit REALs [i.e. REAL(8) on Fortran-90]
27  REAL(KIND=8) :: REAL_V(n)
28  INTEGER(KIND=JPIM) :: INT_V(n)
29  INTEGER(KIND=JPIM) :: I
30 
31  DO i=1,n
32  real_v(i) = min(max(-2147483647_jpim,int_v(i)),2147483647_jpim)
33  ENDDO
34 
35  RETURN
36  ENDSUBROUTINE itor
integer, parameter jpim
Definition: parkind1.F90:13
subroutine itor(INT_V, REAL_V, N)
Definition: itor.F:2