SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
interpol_linear.F90
Go to the documentation of this file.
1 !SFX_LIC Copyright 1994-2014 CNRS, Meteo-France and Universite Paul Sabatier
2 !SFX_LIC This is part of the SURFEX software governed by the CeCILL-C licence
3 !SFX_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
4 !SFX_LIC for details. version 1.
5 ! #########
6  SUBROUTINE interpol_linear(PDAT,PNDAT,PVAL0,PVAL1,PVAL2,POUT)
7 ! #############################################################
8 !
9 !!**** *INTERPOL_LINEAR* Linear interpolation between 3 month.
10 !! Current value is reached evry 16 of each month,
11 !! except in February every 15.
12 !!
13 !!
14 !! PURPOSE
15 !! -------
16 !!
17 !! METHOD
18 !! ------
19 !!
20 !! EXTERNAL
21 !! --------
22 !!
23 !! IMPLICIT ARGUMENTS
24 !! ------------------
25 !!
26 !!
27 !! REFERENCE
28 !! ---------
29 !!
30 !! AUTHOR
31 !! ------
32 !!
33 !! B. Decharme Meteo-France
34 !!
35 !! MODIFICATION
36 !! ------------
37 !!
38 !! Original 07/2015
39 !!
40 !----------------------------------------------------------------------------
41 !
42 !* 0. DECLARATION
43 ! -----------
44 !
45 USE yomhook ,ONLY : lhook, dr_hook
46 USE parkind1 ,ONLY : jprb
47 !
48 IMPLICIT NONE
49 !
50 !* 0.1 Declaration of arguments
51 ! ------------------------
52 !
53 REAL, INTENT(IN) :: pdat ! Present date in the current month
54 REAL, INTENT(IN) :: pndat ! Number of date in the current month
55 REAL, DIMENSION(:), INTENT(IN) :: pval0 ! Value of the precedent month
56 REAL, DIMENSION(:), INTENT(IN) :: pval1 ! Value of the current month
57 REAL, DIMENSION(:), INTENT(IN) :: pval2 ! Value of the next month
58 REAL, DIMENSION(:), INTENT(OUT) :: pout ! Interpolated value
59 !
60 !
61 !* 0.2 Declaration of other local variables
62 ! ------------------------------------
63 !
64 REAL :: zfact0, zfact1, zfact2
65 !
66 REAL(KIND=JPRB) :: zhook_handle
67 !
68 !----------------------------------------------------------------------------
69 !
70 !* 0. Allocation
71 ! ----------
72 !
73 IF (lhook) CALL dr_hook('INTERPOL_LINEAR',0,zhook_handle)
74 !
75 !* 1. Initialization
76 ! --------------
77 !
78 !* 2. Coef calculation
79 ! ----------------
80 !
81 zfact0=max(1.0-(pdat*2.0+pndat-1.0)/(pndat*2.0),0.0)
82 zfact1=(2.0*pndat-abs(2.0*pdat-pndat-1.0))/(pndat*2.0)
83 zfact2=max(1.0-((pndat+1.0-pdat)*2.0+pndat-1.0)/(pndat*2.0),0.0)
84 !
85 !* 3. Final calculation
86 ! -----------------
87 !
88 pout(:) = pval0(:)*zfact0+pval1(:)*zfact1+pval2(:)*zfact2
89 !
90 !* 4. End
91 ! ---
92 !
93 IF (lhook) CALL dr_hook('INTERPOL_LINEAR',1,zhook_handle)
94 !
95 !-------------------------------------------------------------------------------
96 !
97 END SUBROUTINE interpol_linear
subroutine interpol_linear(PDAT, PNDAT, PVAL0, PVAL1, PVAL2, POUT)