SURFEX
V8_0
Surfex V8_0 release
Main Page
Data Types List
Files
File List
File Members
All
Classes
Files
Functions
Variables
src
SURFEX
substract_to_date_surf.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
substract_to_date_surf
(KYEAR,KMONTH,KDAY,PSEC)
7
! #######################################################
8
!
9
!!**** *SUBSTRACT_TO_DATE_SURF* - finds the current date and hour from a date
10
!!
11
!! PURPOSE
12
!! -------
13
!!
14
!! WARNING
15
!!
16
!! -----> Only correct for dates between 19900301 and 21000228 <-----
17
!!
18
!! The correct test should be:
19
!! IF( ((MOD(KYEAR,4)==0).AND.(MOD(KYEAR,100)/=0)) .OR. (MOD(KYEAR,400)==0))THEN
20
!!
21
!!** METHOD
22
!! ------
23
!!
24
!! A recursive method is used, removing one day ofter the other.
25
!!
26
!! EXTERNAL
27
!! --------
28
!!
29
!! IMPLICIT ARGUMENTS
30
!! ------------------
31
!!
32
!! REFERENCE
33
!! ---------
34
!!
35
!! Book 2 (add_forecast_to_date)
36
!!
37
!! AUTHOR
38
!! ------
39
!!
40
! G.Jaubert Meteo-France (from add_forecast_to_date)
41
!!
42
!! MODIFICATIONS
43
!! -------------
44
!! Original 23/07/01
45
!-------------------------------------------------------------------------------
46
!
47
!* 0. DECLARATIONS
48
! ------------
49
!
50
!
51
USE
yomhook
,ONLY
: lhook, dr_hook
52
USE
parkind1
,ONLY
: jprb
53
!
54
IMPLICIT NONE
55
!
56
!* 0.1 Declaration of arguments
57
! ------------------------
58
INTEGER
,
INTENT(INOUT)
:: kyear
! year of date
59
INTEGER
,
INTENT(INOUT)
:: kmonth
! month of date
60
INTEGER
,
INTENT(INOUT)
:: kday
! day of date
61
REAL
,
INTENT(INOUT)
:: psec
! number of seconds since date at 00 UTC
62
!
63
REAL(KIND=JPRB)
:: zhook_handle
64
!-------------------------------------------------------------------------------
65
IF
(lhook) CALL dr_hook(
'SUBSTRACT_TO_DATE_SURF'
,0,zhook_handle)
66
!
67
!* 1. Return condition: PSEC >0
68
! -------------------------
69
!
70
DO
71
IF
(psec >= 0.)
EXIT
72
!
73
!-------------------------------------------------------------------------------
74
!
75
!* 2. remove one day
76
! --------------
77
!
78
psec=psec+86400.
79
!
80
!
81
!* 2.1 first day of the month
82
! ---------------------
83
!
84
IF
(kday==1)
THEN
85
IF
(kmonth==1)
THEN
86
kday=31
87
kmonth=12
88
kyear=kyear-1
89
ELSE
90
kmonth=kmonth-1
91
SELECT
CASE
(kmonth)
92
CASE
(4,6,9,11)
93
kday=30
94
CASE
(1,3,5,7:8,10,12)
95
kday=31
96
CASE
(2)
97
IF
( ((mod(kyear,4)==0).AND.(mod(kyear,100)/=0)) .OR. (mod(kyear,400)==0))
THEN
98
kday=29
99
ELSE
100
kday=28
101
ENDIF
102
END SELECT
103
ENDIF
104
!
105
!* 2.2 Other days
106
! ----------
107
ELSE
108
kday=kday-1
109
ENDIF
110
!
111
!-------------------------------------------------------------------------------
112
!
113
!* 3. Recursive call
114
! --------------
115
!
116
ENDDO
117
!
118
IF
(lhook) CALL dr_hook(
'SUBSTRACT_TO_DATE_SURF'
,1,zhook_handle)
119
!-------------------------------------------------------------------------------
120
!
121
END SUBROUTINE
substract_to_date_surf
substract_to_date_surf
subroutine substract_to_date_surf(KYEAR, KMONTH, KDAY, PSEC)
Definition:
substract_to_date_surf.F90:6
Generated on Fri May 13 2016 09:31:05 for SURFEX by
1.8.5