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.
Changeset 4772 for branches/2014/dev_r4650_UKMO7_STARTHOUR/NEMOGCM/NEMO/OPA_SRC/OBS/diaobs.F90 – NEMO

Ignore:
Timestamp:
2014-09-17T19:19:59+02:00 (10 years ago)
Author:
djlea
Message:

Changes to allow hour start time. First version.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2014/dev_r4650_UKMO7_STARTHOUR/NEMOGCM/NEMO/OPA_SRC/OBS/diaobs.F90

    r4624 r4772  
    14141414   END SUBROUTINE dia_obs_dealloc 
    14151415 
    1416    SUBROUTINE ini_date( ddobsini ) 
    1417       !!---------------------------------------------------------------------- 
    1418       !!                    ***  ROUTINE ini_date  *** 
     1416   SUBROUTINE calc_date( kstp, ddobs ) 
     1417      !!---------------------------------------------------------------------- 
     1418      !!                    ***  ROUTINE calc_date  *** 
    14191419      !!           
    1420       !! ** Purpose : Get initial data in double precision YYYYMMDD.HHMMSS format 
    1421       !! 
    1422       !! ** Method  : Get initial data in double precision YYYYMMDD.HHMMSS format 
    1423       !! 
    1424       !! ** Action  : Get initial data in double precision YYYYMMDD.HHMMSS format 
     1420      !! ** Purpose : Get date in double precision YYYYMMDD.HHMMSS format 
     1421      !! 
     1422      !! ** Method  : Get date in double precision YYYYMMDD.HHMMSS format 
     1423      !! 
     1424      !! ** Action  : Get date in double precision YYYYMMDD.HHMMSS format 
    14251425      !! 
    14261426      !! History : 
     
    14301430      !!        !  06-10  (G. Smith) Calculates initial date the same as method for final date 
    14311431      !!        !  10-05  (D. Lea) Update to month length calculation for NEMO vn3.2 
     1432      !!        !  2014-09  (D. Lea) New generic routine now deals with arbitrary start hour  
    14321433      !!---------------------------------------------------------------------- 
    14331434      USE phycst, ONLY : &            ! Physical constants 
     
    14411442 
    14421443      !! * Arguments 
    1443       REAL(KIND=dp), INTENT(OUT) :: ddobsini                         ! Initial date in YYYYMMDD.HHMMSS 
     1444      REAL(KIND=dp), INTENT(OUT) :: ddobs                        ! Date in YYYYMMDD.HHMMSS 
     1445      INTEGER :: kstp 
    14441446 
    14451447      !! * Local declarations 
     
    14561458      !!---------------------------------------------------------------------- 
    14571459      !! Initial date initialization (year, month, day, hour, minute) 
    1458       !! (This assumes that the initial date is for 00z)) 
    14591460      !!---------------------------------------------------------------------- 
    14601461      iyea =   ndate0 / 10000 
    14611462      imon = ( ndate0 - iyea * 10000 ) / 100 
    14621463      iday =   ndate0 - iyea * 10000 - imon * 100 
    1463       ihou = 0 
     1464      ihou = nn_time0 
    14641465      imin = 0 
    14651466 
     
    14671468      !! Compute number of days + number of hours + min since initial time 
    14681469      !!---------------------------------------------------------------------- 
    1469       iday = iday + ( nit000 -1 ) * rdt / rday 
    1470       zdayfrc = ( nit000 -1 ) * rdt / rday 
     1470      zdayfrc = kstp * rdt / rday 
    14711471      zdayfrc = zdayfrc - aint(zdayfrc) 
    1472       ihou = int( zdayfrc * 24 ) 
    1473       imin = int( (zdayfrc * 24 - ihou) * 60 ) 
     1472      imin = imin + int( zdayfrc * 24 * 60 )  
     1473      DO WHILE (imin >= 60)  
     1474        imin=imin-60 
     1475        ihou=ihou+1 
     1476      END DO 
     1477      DO WHILE (ihou >= 24) 
     1478        ihou=ihou-24 
     1479        iday=iday+1 
     1480      END DO  
     1481      iday = iday + kstp * rdt / rday  
    14741482 
    14751483      !!----------------------------------------------------------------------- 
     
    14921500      !! Convert it into YYYYMMDD.HHMMSS format. 
    14931501      !!---------------------------------------------------------------------- 
    1494       ddobsini = iyea * 10000_dp + imon * 100_dp + & 
    1495          &       iday + ihou * 0.01_dp + imin * 0.0001_dp 
    1496  
    1497  
    1498    END SUBROUTINE ini_date 
    1499  
    1500    SUBROUTINE fin_date( ddobsfin ) 
    1501       !!---------------------------------------------------------------------- 
    1502       !!                    ***  ROUTINE fin_date  *** 
     1502      ddobs = iyea * 10000_dp + imon * 100_dp + & 
     1503         &    iday + ihou * 0.01_dp + imin * 0.0001_dp 
     1504 
     1505   END SUBROUTINE calc_date 
     1506 
     1507   SUBROUTINE ini_date( ddobsini ) 
     1508      !!---------------------------------------------------------------------- 
     1509      !!                    ***  ROUTINE ini_date  *** 
    15031510      !!           
    1504       !! ** Purpose : Get final data in double precision YYYYMMDD.HHMMSS format 
    1505       !! 
    1506       !! ** Method  : Get final data in double precision YYYYMMDD.HHMMSS format 
    1507       !! 
    1508       !! ** Action  : Get final data in double precision YYYYMMDD.HHMMSS format 
     1511      !! ** Purpose : Get initial date in double precision YYYYMMDD.HHMMSS format 
     1512      !! 
     1513      !! ** Method  :  
     1514      !! 
     1515      !! ** Action  :  
    15091516      !! 
    15101517      !! History : 
     
    15131520      !!        !  06-10  (A. Weaver) Cleaning 
    15141521      !!        !  10-05  (D. Lea) Update to month length calculation for NEMO vn3.2 
    1515       !!---------------------------------------------------------------------- 
    1516       USE phycst, ONLY : &            ! Physical constants 
    1517          & rday 
    1518 !      USE daymod, ONLY : &            ! Time variables 
    1519 !         & nmonth_len                 
    1520       USE dom_oce, ONLY : &           ! Ocean space and time domain variables 
    1521          & rdt 
     1522      !!        !  2014-09  (D. Lea) Change to call generic routine calc_date 
     1523      !!---------------------------------------------------------------------- 
     1524 
     1525      IMPLICIT NONE 
     1526 
     1527      !! * Arguments 
     1528      REAL(KIND=dp), INTENT(OUT) :: ddobsini                   ! Initial date in YYYYMMDD.HHMMSS 
     1529 
     1530      CALL calc_date( nit000 - 1, ddobsini ) 
     1531 
     1532   END SUBROUTINE ini_date 
     1533 
     1534   SUBROUTINE fin_date( ddobsfin ) 
     1535      !!---------------------------------------------------------------------- 
     1536      !!                    ***  ROUTINE fin_date  *** 
     1537      !!           
     1538      !! ** Purpose : Get final date in double precision YYYYMMDD.HHMMSS format 
     1539      !! 
     1540      !! ** Method  :  
     1541      !! 
     1542      !! ** Action  :  
     1543      !! 
     1544      !! History : 
     1545      !!        !  06-03  (K. Mogensen)  Original code 
     1546      !!        !  06-05  (K. Mogensen)  Reformatted 
     1547      !!        !  06-10  (A. Weaver) Cleaning 
     1548      !!        !  10-05  (D. Lea) Update to month length calculation for NEMO vn3.2 
     1549      !!        !  2014-09  (D. Lea) Change to call generic routine calc_date 
     1550      !!---------------------------------------------------------------------- 
    15221551 
    15231552      IMPLICIT NONE 
     
    15261555      REAL(KIND=dp), INTENT(OUT) :: ddobsfin                   ! Final date in YYYYMMDD.HHMMSS 
    15271556 
    1528       !! * Local declarations 
    1529       INTEGER :: iyea        ! date - (year, month, day, hour, minute) 
    1530       INTEGER :: imon 
    1531       INTEGER :: iday 
    1532       INTEGER :: ihou 
    1533       INTEGER :: imin 
    1534       INTEGER :: imday         ! Number of days in month. 
    1535       REAL(KIND=wp) :: zdayfrc       ! Fraction of day 
    1536           
    1537       INTEGER, DIMENSION(12) ::   imonth_len    !: length in days of the months of the current year 
    1538              
    1539       !----------------------------------------------------------------------- 
    1540       ! Initial date initialization (year, month, day, hour, minute) 
    1541       ! (This assumes that the initial date is for 00z) 
    1542       !----------------------------------------------------------------------- 
    1543       iyea =   ndate0 / 10000 
    1544       imon = ( ndate0 - iyea * 10000 ) / 100 
    1545       iday =   ndate0 - iyea * 10000 - imon * 100 
    1546       ihou = 0 
    1547       imin = 0 
    1548        
    1549       !----------------------------------------------------------------------- 
    1550       ! Compute number of days + number of hours + min since initial time 
    1551       !----------------------------------------------------------------------- 
    1552       iday    = iday +  nitend  * rdt / rday 
    1553       zdayfrc =  nitend  * rdt / rday 
    1554       zdayfrc = zdayfrc - AINT( zdayfrc ) 
    1555       ihou    = INT( zdayfrc * 24 ) 
    1556       imin    = INT( ( zdayfrc * 24 - ihou ) * 60 ) 
    1557  
    1558       !----------------------------------------------------------------------- 
    1559       ! Convert number of days (iday) into a real date 
    1560       !---------------------------------------------------------------------- 
    1561  
    1562       CALL calc_month_len( iyea, imonth_len ) 
    1563        
    1564       DO WHILE ( iday > imonth_len(imon) ) 
    1565          iday = iday - imonth_len(imon) 
    1566          imon = imon + 1  
    1567          IF ( imon > 12 ) THEN 
    1568             imon = 1 
    1569             iyea = iyea + 1 
    1570             CALL calc_month_len( iyea, imonth_len )  ! update month lengths 
    1571          ENDIF 
    1572       END DO 
    1573  
    1574       !----------------------------------------------------------------------- 
    1575       ! Convert it into YYYYMMDD.HHMMSS format 
    1576       !----------------------------------------------------------------------- 
    1577       ddobsfin = iyea * 10000_dp + imon * 100_dp    + iday & 
    1578          &     + ihou * 0.01_dp  + imin * 0.0001_dp 
    1579  
    1580     END SUBROUTINE fin_date 
    1581      
     1557      CALL calc_date( nitend, ddobsfin ) 
     1558 
     1559   END SUBROUTINE fin_date 
     1560    
    15821561END MODULE diaobs 
Note: See TracChangeset for help on using the changeset viewer.