LCOV - code coverage report
Current view: | top level - utils - bnddyi.F90 (source / functions) |  |  | Hit | Total | Coverage
Test: | coverage.info |  | Lines: | 7 | 11 | 63.6 %
Date: | 2024-12-17 22:39:59 |  | Functions: | 1 | 1 | 100.0 %

              Line data    Source code
           1             : module bnddyi_mod
           2             :
           3             : implicit none
           4             :
           5             : private
           6             :
           7             : public :: bnddyi
           8             :
           9             : contains
          10             :
          11       36864 : subroutine bnddyi (ncdate, ncsec, doy)
          12             : !-----------------------------------------------------------------------
          13             : !
          14             : ! Purpose: Convert date and seconds of day to floating point calendar day, for
          15             : !          boundary dataset handling
          16             : !
          17             : ! Method: Use table of days per month to do conversion
          18             : !
          19             : ! Author: CCM Core Group
          20             : !
          21             : !-----------------------------------------------------------------------
          22             :    use shr_kind_mod,     only: r8 => shr_kind_r8
          23             :    use cam_abortutils,   only: endrun
          24             :    use cam_logfile,      only: iulog
          25             : !--------------------------Arguments------------------------------------
          26             : !
          27             : ! Arguments
          28             : !
          29             :    integer, intent(in) :: ncdate      ! Current date as yymmdd or yyyymmdd
          30             :    integer, intent(in) :: ncsec       ! Seconds of day for current date
          31             :
          32             :    real(r8), intent(out) :: doy       ! Day of year
          33             : !
          34             : ! Local Variables
          35             : !
          36             :    integer mnth        ! Month number
          37             :    integer mday        ! Day number of month
          38             :    integer jdcon(12)   ! Starting day number for each month
          39             :    save jdcon
          40             :    data jdcon/0,31,59,90,120,151,181,212,243,273,304,334/
          41             : !
          42             : ! Decode month and day
          43             : !
          44       36864 :    mnth = mod(ncdate,10000)/100
          45       36864 :    if (mnth < 1 .or. mnth > 12) then
          46           0 :       write(iulog,*)'BNDDYI: Bad month index=', mnth
          47           0 :       call endrun
          48             :    end if
          49       36864 :    mday = mod(ncdate,100)
          50       36864 :    doy = jdcon(mnth) + mday + ncsec/86400._r8
          51             :
          52       36864 :    if (doy < 1._r8 .or. doy > 366._r8) then
          53           0 :       write(iulog,*)'BNDDYI: bad day of year = ',doy
          54           0 :       call endrun
          55             :    end if
          56             : !
          57       36864 :    return
          58             : end subroutine bnddyi
          59             :
          60             : end module bnddyi_mod

Generated by: LCOV version 1.14