New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
ddatetoymdhms.h90 in branches/UKMO/dev_r5518_GO6_starthour_obsoper/NEMOGCM/NEMO/OPA_SRC/OBS – NEMO

source: branches/UKMO/dev_r5518_GO6_starthour_obsoper/NEMOGCM/NEMO/OPA_SRC/OBS/ddatetoymdhms.h90 @ 15404

Last change on this file since 15404 was 15404, checked in by jroberts, 12 months ago

Bug fix to avoid losing observations in the NEMO obsoper when it converts
YYYYMMDD.hhmmss to date due to limits of floating point precision

File size: 1.4 KB
Line 
1   !!----------------------------------------------------------------------
2   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
3   !! $Id$
4   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
5   !!----------------------------------------------------------------------
6
7   SUBROUTINE ddatetoymdhms( ddate, kyea, kmon, kday, khou, kmin, ksec )
8      !!----------------------------------------------------------------------
9      !!
10      !!                    *** ROUTINE ddatetoymdhms ***
11      !!
12      !! ** Purpose : Convert YYYYMMDD.hhmmss to components
13      !!
14      !! ** Method  :
15      !!
16      !! ** Action  :
17      !!
18      !! History
19      !!----------------------------------------------------------------------
20      !! * Modules used
21
22      !! * Arguments
23      real(wp), INTENT(IN) :: ddate
24      INTEGER, INTENT(OUT) :: kyea
25      INTEGER, INTENT(OUT) :: kmon
26      INTEGER, INTENT(OUT) :: kday
27      INTEGER, INTENT(OUT) :: khou
28      INTEGER, INTENT(OUT) :: kmin
29      INTEGER, INTENT(OUT) :: ksec
30      !! * Local declarations
31      INTEGER :: iyymmdd
32      INTEGER :: ihhmmss
33     
34      iyymmdd = INT( ddate )
35      ihhmmss = NINT( ( ddate - iyymmdd ) * 1000000 )
36      kyea = iyymmdd/10000
37      kmon = iyymmdd / 100 - 100 * kyea
38      kday = MOD( iyymmdd, 100 )
39      khou = ihhmmss/10000
40      kmin = ihhmmss / 100 - 100 * khou
41      ksec = MOD( ihhmmss, 100 )
42     
43   END SUBROUTINE ddatetoymdhms
Note: See TracBrowser for help on using the repository browser.