00001 !=============================================================================== 00002 ! SVN $Id: shr_date_mod.F90 11998 2008-09-30 05:47:54Z erik $ 00003 ! SVN $URL: https://svn-ccsm-models.cgd.ucar.edu/csm_share/branch_tags/cesm1_0_rel_tags/cesm1_0_rel01_share3_100616/shr/shr_date_mod.F90 $ 00004 !=============================================================================== 00005 !BOP =========================================================================== 00006 ! 00007 ! !MODULE: shr_date_mod -- date/time module, built upon a calendar module 00008 ! 00009 ! !DESCRIPTION: 00010 ! Keeps track of model date, including elapsed seconds in current date. 00011 ! 00012 ! !REVISION HISTORY: 00013 ! 2001-Sep-13 - B. Kauffman - created initial version 00014 ! 00015 ! !REMARKS: 00016 ! This module is independant of a particular calendar, e.g. is ignorant of 00017 ! whether the underlying calendar does or doesn't implement leap years. 00018 ! 00019 ! !INTERFACE: ------------------------------------------------------------------ 00020 00021 module shr_date_mod 00022 00023 ! !USES: 00024 00025 use shr_cal_mod ! underlying calendar 00026 use shr_sys_mod ! system call wrappers 00027 use shr_kind_mod ! kinds 00028 use shr_log_mod, only: s_loglev => shr_log_Level 00029 use shr_log_mod, only: s_logunit => shr_log_Unit 00030 00031 implicit none 00032 00033 private ! except 00034 00035 ! !PUBLIC TYPES: 00036 00037 public :: shr_date 00038 type shr_date 00039 sequence ! place in contiguous memory 00040 private ! no public access to internal components 00041 integer(SHR_KIND_IN) :: y ! calendar year 00042 integer(SHR_KIND_IN) :: m ! calendar month 00043 integer(SHR_KIND_IN) :: d ! calendar day 00044 integer(SHR_KIND_IN) :: s ! elapsed seconds in current day 00045 integer(SHR_KIND_IN) :: cDate ! coded calendar date (yymmdd) 00046 integer(SHR_KIND_IN) :: eDay ! elsapsed days relative to calendar's reference date 00047 integer(SHR_KIND_IN) :: stepInDay ! current time-step in current day 00048 integer(SHR_KIND_IN) :: stepsPerDay ! number of time-steps per day 00049 end type shr_date 00050 00051 ! !PUBLIC MEMBER FUNCTIONS: 00052 00053 public :: shr_date_adv1step ! advance the date one time step 00054 public :: shr_date_advNextDay ! advance date to next day, 0 seconds 00055 public :: shr_date_initYMD ! init date given YMD 00056 public :: shr_date_initEDay ! init date given elapsed days 00057 public :: shr_date_initCDate ! init date given coded date (yymmdd) 00058 public :: shr_date_getYMD ! returns integers yy,mm,dd,sssss 00059 public :: shr_date_getEDay ! returns elased day, sssss 00060 public :: shr_date_getCDate ! returns coded date, ssssS 00061 public :: shr_date_getStepsPerDay ! returns steps per day 00062 public :: shr_date_getStepInDay ! returns step in the day 00063 public :: shr_date_getJulian ! returns julian day number 00064 00065 public :: assignment(=) ! sets (date a) equal to (date b) 00066 public :: operator(==) ! true iff (date a) == (date b) 00067 public :: operator(<) ! true iff (date a) < (date b) 00068 public :: operator(>) ! true iff (date a) > (date b) 00069 00070 ! !PUBLIC DATA MEMBERS: 00071 00072 real(SHR_KIND_R8), parameter,public :: shr_date_secsPerDay = 86400.0_SHR_KIND_R8 ! seconds per day 00073 integer(SHR_KIND_IN), parameter :: shr_date_nsecsPerDay = shr_date_secsPerDay 00074 00075 !EOP 00076 00077 interface assignment(=) 00078 module procedure shr_date_assign 00079 end interface 00080 interface operator(==) 00081 module procedure shr_date_equals 00082 end interface 00083 interface operator(>) 00084 module procedure shr_date_greater 00085 end interface 00086 interface operator(<) 00087 module procedure shr_date_less 00088 end interface 00089 00090 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00091 contains 00092 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00093 00094 !=============================================================================== 00095 !=============================================================================== 00096 00097 subroutine shr_date_assign(a,b) 00098 00099 type(shr_date),intent(out) :: a 00100 type(shr_date),intent(in ) :: b 00101 00102 !------------------------------------------------------------------------------- 00103 ! Make date a equal to date b 00104 !------------------------------------------------------------------------------- 00105 00106 a%y = b%y 00107 a%m = b%m 00108 a%d = b%d 00109 a%s = b%s 00110 a%eday = b%eday 00111 a%cDate = b%cDate 00112 a%stepInDay = b%stepInDay 00113 a%stepsPerDay = b%stepsPerDay 00114 00115 end subroutine shr_date_assign 00116 00117 !=============================================================================== 00118 !=============================================================================== 00119 00120 function shr_date_equals(a,b) 00121 00122 type(shr_date),intent(in) :: a,b 00123 logical :: shr_date_equals 00124 00125 !------------------------------------------------------------------------------- 00126 ! Is date a equal to date b ?? 00127 !------------------------------------------------------------------------------- 00128 00129 if (a%eday == b%eday .and. a%s == b%s) then 00130 shr_date_equals=.true. 00131 else 00132 shr_date_equals =.false. 00133 end if 00134 00135 end function shr_date_equals 00136 00137 !=============================================================================== 00138 !=============================================================================== 00139 00140 function shr_date_greater(a,b) 00141 00142 type(shr_date),intent(in) :: a,b 00143 logical :: shr_date_greater 00144 00145 !------------------------------------------------------------------------------- 00146 ! Is date a greater than date b ?? 00147 !------------------------------------------------------------------------------- 00148 00149 if (a%eday < b%eday) then 00150 shr_date_greater = .false. 00151 else if (a%eday > b%eday) then 00152 shr_date_greater = .true. 00153 else if (a%s > b%s ) then 00154 shr_date_greater = .true. 00155 else 00156 shr_date_greater = .false. 00157 end if 00158 00159 end function shr_date_greater 00160 00161 !=============================================================================== 00162 !=============================================================================== 00163 00164 function shr_date_less(a,b) 00165 00166 type(shr_date),intent(in) :: a,b 00167 logical :: shr_date_less 00168 00169 !------------------------------------------------------------------------------- 00170 ! Is date a less than date b ?? 00171 !------------------------------------------------------------------------------- 00172 00173 if (a%eday < b%eday) then 00174 shr_date_less = .true. 00175 else if (a%eday > b%eday) then 00176 shr_date_less = .false. 00177 else if (a%s < b%s ) then 00178 shr_date_less = .true. 00179 else 00180 shr_date_less = .false. 00181 end if 00182 00183 end function shr_date_less 00184 00185 !=============================================================================== 00186 !BOP =========================================================================== 00187 ! 00188 ! !IROUTINE: shr_date_initYMD - Initialize date given y,m,d, steps per day. 00189 ! 00190 ! !DESCRIPTION: 00191 ! Initialize date given y,m,d, and steps per day. 00192 ! 00193 ! !REVISION HISTORY: 00194 ! 2001-Sep-13 - B. Kauffman - initial version. 00195 ! 00196 ! !INTERFACE: ----------------------------------------------------------------- 00197 00198 type(shr_date) function shr_date_initYMD(y,m,d,ns,sec) 00199 00200 implicit none 00201 00202 ! !INPUT/OUTPUT PARAMETERS: 00203 00204 integer(SHR_KIND_IN),intent(in) :: y ! year 00205 integer(SHR_KIND_IN),intent(in) :: m ! month 00206 integer(SHR_KIND_IN),intent(in) :: d ! day 00207 integer(SHR_KIND_IN),intent(in) :: ns ! number of steps per day. 00208 integer(SHR_KIND_IN),intent(in), optional :: sec ! seconds into day 00209 00210 !EOP 00211 00212 !----- local ----- 00213 type(shr_date) :: date 00214 00215 !------------------------------------------------------------------------------- 00216 ! 00217 !------------------------------------------------------------------------------- 00218 00219 if (shr_cal_validYMD(y,m,d) ) then 00220 date%y = y 00221 date%m = m 00222 date%d = d 00223 date%s = 0 00224 date%stepInDay = 0 00225 date%stepsPerDay = ns 00226 if (present(sec)) then 00227 date%s = sec 00228 date%stepInDay = nint(date%s*ns/shr_date_secsPerDay) 00229 end if 00230 call shr_cal_ymd2date(y,m,d,date%cDate) 00231 call shr_cal_ymd2eDay(y,m,d,date%eDay ) 00232 else 00233 write(s_logunit,*) 'ERROR: invalid y,m,d = ', y,m,d 00234 call shr_sys_abort('(shr_date_initYMD) invalid date') 00235 end if 00236 00237 shr_date_initYMD = date 00238 00239 end function shr_date_initYMD 00240 00241 !=============================================================================== 00242 !BOP =========================================================================== 00243 ! 00244 ! !IROUTINE: shr_date_initEDay - Initialize date given an elapsed day 00245 ! 00246 ! !DESCRIPTION: 00247 ! Initialize date given elapsed days and the number of steps per day. 00248 ! 00249 ! !REVISION HISTORY: 00250 ! 2003-May-27 - B. Kauffman - initial version. 00251 ! 00252 ! !INTERFACE: ----------------------------------------------------------------- 00253 00254 type(shr_date) function shr_date_initEDay(eDay,ns) 00255 00256 implicit none 00257 00258 ! !INPUT/OUTPUT PARAMETERS: 00259 00260 integer(SHR_KIND_IN),intent(in) :: eDay ! elpased days 00261 integer(SHR_KIND_IN),intent(in) :: ns ! number of steps per day. 00262 00263 !EOP 00264 00265 !----- local ----- 00266 type(shr_date) :: date ! date to return 00267 integer(SHR_KIND_IN) :: y,m,d ! year, month, day 00268 00269 !------------------------------------------------------------------------------- 00270 ! 00271 !------------------------------------------------------------------------------- 00272 00273 call shr_cal_eDay2ymd(eDay,y,m,d) ! convert eDay to y,m,d 00274 00275 if ( shr_cal_validYMD(y,m,d) ) then 00276 date = shr_date_initYMD(y,m,d,ns) 00277 else 00278 write(s_logunit,*) 'ERROR: invalid eDay = ', eDay 00279 write(s_logunit,*) 'ERROR: invalid y,m,d = ', y,m,d 00280 call shr_sys_abort('(shr_date_initEDay) invalid eDay') 00281 end if 00282 00283 shr_date_initEDay = date 00284 00285 end function shr_date_initEDay 00286 00287 !=============================================================================== 00288 !BOP =========================================================================== 00289 ! 00290 ! !IROUTINE: shr_date_initCDate - Initialize date given coded date (yymmdd). 00291 ! 00292 ! !DESCRIPTION: 00293 ! Initialize date given coded date (yymmdd) and the number of steps per day. 00294 ! 00295 ! !REVISION HISTORY: 00296 ! 2001-Sep-13 - B. Kauffman - initial version. 00297 ! 00298 ! !INTERFACE: ----------------------------------------------------------------- 00299 00300 type(shr_date) function shr_date_initCDate(cDate,ns,sec) 00301 00302 implicit none 00303 00304 ! !INPUT/OUTPUT PARAMETERS: 00305 00306 integer(SHR_KIND_IN),intent(in) :: cDate ! coded date (yymmdd) 00307 integer(SHR_KIND_IN),intent(in) :: ns ! number of steps per day. 00308 integer(SHR_KIND_IN),intent(in), optional :: sec ! seconds into day 00309 00310 !EOP 00311 00312 !----- local ----- 00313 type(shr_date) :: date ! date to return 00314 integer(SHR_KIND_IN) :: y,m,d ! year, month, day 00315 00316 !------------------------------------------------------------------------------- 00317 ! 00318 !------------------------------------------------------------------------------- 00319 00320 if (shr_cal_validDate(cDate) ) then 00321 call shr_cal_date2ymd(cDate,y,m,d) 00322 date = shr_date_initYMD(y,m,d,ns) 00323 if (present(sec)) then 00324 date = shr_date_initYMD(y,m,d,ns,sec) 00325 end if 00326 else 00327 write(s_logunit,*) 'ERROR: invalid cDate = ', cDate 00328 call shr_sys_abort('(shr_date_initCDate) invalid date') 00329 end if 00330 00331 shr_date_initCDate = date 00332 00333 end function shr_date_initCDate 00334 00335 !=============================================================================== 00336 !BOP =========================================================================== 00337 ! 00338 ! !IROUTINE: shr_date_adv1step - advance the date by one time step 00339 ! 00340 ! !DESCRIPTION: 00341 ! Advance the date by one time step. 00342 ! 00343 ! !REVISION HISTORY: 00344 ! 2001-Sep-13 - B. Kauffman - initial version. 00345 ! 00346 ! !INTERFACE: ----------------------------------------------------------------- 00347 00348 subroutine shr_date_adv1step(date) 00349 00350 implicit none 00351 00352 ! !INPUT/OUTPUT PARAMETERS: 00353 00354 type(shr_date),intent(inout) :: date ! number of elapsed days 00355 00356 !EOP 00357 00358 !------------------------------------------------------------------------------- 00359 ! 00360 !------------------------------------------------------------------------------- 00361 00362 date%stepInDay = date%stepInDay + 1 00363 00364 if (date%stepInDay < date%stepsPerDay) then 00365 date%s = nint((shr_date_secsPerDay*date%stepInDay)/date%stepsPerDay) 00366 else 00367 call shr_date_advNextDay(date) 00368 end if 00369 00370 end subroutine shr_date_adv1step 00371 00372 !=============================================================================== 00373 !BOP =========================================================================== 00374 ! 00375 ! !IROUTINE: shr_date_rev1step - reverse the date by one time step 00376 ! 00377 ! !DESCRIPTION: 00378 ! Reverse the date by one time step. 00379 ! 00380 ! !REVISION HISTORY: 00381 ! 2008-Jul-01 - E. Kluzek - initial version. 00382 ! 00383 ! !INTERFACE: ----------------------------------------------------------------- 00384 00385 subroutine shr_date_rev1step(date) 00386 00387 implicit none 00388 00389 ! !INPUT/OUTPUT PARAMETERS: 00390 00391 type(shr_date),intent(inout) :: date ! number of elapsed days 00392 00393 !EOP 00394 00395 !------------------------------------------------------------------------------- 00396 ! 00397 !------------------------------------------------------------------------------- 00398 00399 date%stepInDay = date%stepInDay - 1 00400 00401 if (date%stepInDay >= 0) then 00402 date%s = nint((shr_date_secsPerDay*date%stepInDay)/date%stepsPerDay) 00403 else 00404 call shr_date_revPrevDay(date) 00405 date%stepInDay = date%stepsPerDay - 1 00406 date%s = nint((shr_date_secsPerDay*date%stepInDay)/date%stepsPerDay) 00407 end if 00408 00409 end subroutine shr_date_rev1step 00410 00411 !=============================================================================== 00412 !BOP =========================================================================== 00413 ! 00414 ! !IROUTINE: shr_date_advNextDay - advance the date to start of next day. 00415 ! 00416 ! !DESCRIPTION: 00417 ! Advance the date to the start of next day. 00418 ! 00419 ! !REVISION HISTORY: 00420 ! 2001-Sep-13 - B. Kauffman - initial version. 00421 ! 00422 ! !INTERFACE: ----------------------------------------------------------------- 00423 00424 subroutine shr_date_advNextDay(date) 00425 00426 implicit none 00427 00428 ! !INPUT/OUTPUT PARAMETERS: 00429 00430 type(shr_date),intent(inout) :: date ! number of elapsed days 00431 00432 !EOP 00433 00434 !------------------------------------------------------------------------------- 00435 ! 00436 !------------------------------------------------------------------------------- 00437 00438 date%eDay = date%eDay + 1 00439 date%stepInDay = 0 00440 date%s = 0 00441 call shr_cal_eDay2ymd (date%eDay,date%y,date%m,date%d) 00442 call shr_cal_eDay2date(date%eDay,date%cDate) 00443 00444 end subroutine shr_date_advNextDay 00445 00446 !=============================================================================== 00447 !BOP =========================================================================== 00448 ! 00449 ! !IROUTINE: shr_date_revPrevDay - reverse the date to start of previous day. 00450 ! 00451 ! !DESCRIPTION: 00452 ! Reverse the date to the start of previous day. 00453 ! 00454 ! !REVISION HISTORY: 00455 ! 2008-Jul-01 - E. Kluzek - initial version. 00456 ! 00457 ! !INTERFACE: ----------------------------------------------------------------- 00458 00459 subroutine shr_date_revPrevDay(date) 00460 00461 implicit none 00462 00463 ! !INPUT/OUTPUT PARAMETERS: 00464 00465 type(shr_date),intent(inout) :: date ! number of elapsed days 00466 00467 !EOP 00468 00469 !------------------------------------------------------------------------------- 00470 ! 00471 !------------------------------------------------------------------------------- 00472 00473 date%eDay = date%eDay - 1 00474 date%stepInDay = 0 00475 date%s = 0 00476 call shr_cal_eDay2ymd (date%eDay,date%y,date%m,date%d) 00477 call shr_cal_eDay2date(date%eDay,date%cDate) 00478 00479 end subroutine shr_date_revPrevDay 00480 00481 !=============================================================================== 00482 !BOP =========================================================================== 00483 ! 00484 ! !IROUTINE: shr_date_getYMD - return yy,mm,dd,ss of date 00485 ! 00486 ! !DESCRIPTION: 00487 ! return yy,mm,dd,ss of date. 00488 ! 00489 ! !REVISION HISTORY: 00490 ! 2001-Sep-13 - B. Kauffman - initial version. 00491 ! 00492 ! !INTERFACE: ----------------------------------------------------------------- 00493 00494 subroutine shr_date_getYMD(date,y,m,d,s) 00495 00496 implicit none 00497 00498 ! !INPUT/OUTPUT PARAMETERS: 00499 00500 type(shr_date),intent(in) :: date ! input date 00501 integer(SHR_KIND_IN),intent(out) :: y ! year 00502 integer(SHR_KIND_IN),intent(out) :: m ! month 00503 integer(SHR_KIND_IN),intent(out) :: d ! day 00504 integer(SHR_KIND_IN),intent(out) :: s ! elapsed seconds on date 00505 00506 !EOP 00507 00508 !------------------------------------------------------------------------------- 00509 ! 00510 !------------------------------------------------------------------------------- 00511 00512 y = date%y 00513 m = date%m 00514 d = date%d 00515 s = date%s 00516 00517 end subroutine shr_date_getYMD 00518 00519 !=============================================================================== 00520 !BOP =========================================================================== 00521 ! 00522 ! !IROUTINE: shr_date_getCDate - return coded date of a date 00523 ! 00524 ! !DESCRIPTION: 00525 ! return coded date of a date 00526 ! 00527 ! !REVISION HISTORY: 00528 ! 2001-Sep-13 - B. Kauffman - initial version. 00529 ! 00530 ! !INTERFACE: ----------------------------------------------------------------- 00531 00532 subroutine shr_date_getCDATE(date,cDate,s,previous) 00533 00534 implicit none 00535 00536 ! !INPUT/OUTPUT PARAMETERS: 00537 00538 type(shr_date),intent(in) :: date ! number of elapsed days 00539 integer(SHR_KIND_IN),intent(out) :: cDate ! coded date 00540 integer(SHR_KIND_IN),intent(out) :: s ! elapsed seconds on date 00541 logical, optional ,intent(in) :: previous ! flag if true return values for previous time step 00542 00543 !EOP 00544 type(shr_date) :: ldate ! local date 00545 00546 !------------------------------------------------------------------------------- 00547 ! 00548 !------------------------------------------------------------------------------- 00549 ldate = date 00550 if ( present(previous) )then 00551 if ( previous )then 00552 call shr_date_rev1step(ldate) 00553 end if 00554 end if 00555 cDate = ldate%cDate 00556 s = ldate%s 00557 00558 end subroutine shr_date_getCDate 00559 00560 !=============================================================================== 00561 !BOP =========================================================================== 00562 ! 00563 ! !IROUTINE: shr_date_getEDay - return elapsed days of a date 00564 ! 00565 ! !DESCRIPTION: 00566 ! return elapsed days of a date 00567 ! 00568 ! !REVISION HISTORY: 00569 ! 2001-Sep-13 - B. Kauffman - initial version. 00570 ! 00571 ! !INTERFACE: ----------------------------------------------------------------- 00572 00573 subroutine shr_date_getEDay(date,eDay,s) 00574 00575 implicit none 00576 00577 ! !INPUT/OUTPUT PARAMETERS: 00578 00579 type(shr_date),intent(in) :: date ! input date 00580 integer(SHR_KIND_IN),intent(out) :: eDay ! elapsed days of date 00581 integer(SHR_KIND_IN),intent(out) :: s ! elapsed seconds on date 00582 00583 !EOP 00584 00585 !------------------------------------------------------------------------------- 00586 ! 00587 !------------------------------------------------------------------------------- 00588 00589 eDay = date%eDay 00590 s = date%s 00591 00592 end subroutine shr_date_getEDay 00593 00594 !=============================================================================== 00595 !BOP =========================================================================== 00596 ! 00597 ! !IROUTINE: shr_date_getStepsPerDay - return elapsed days of a date 00598 ! 00599 ! !DESCRIPTION: 00600 ! return elapsed days of a date 00601 ! 00602 ! !REVISION HISTORY: 00603 ! 2001-Sep-13 - B. Kauffman - initial version. 00604 ! 00605 ! !INTERFACE: ----------------------------------------------------------------- 00606 00607 integer function shr_date_getStepsPerDay(date) 00608 00609 implicit none 00610 00611 ! !INPUT/OUTPUT PARAMETERS: 00612 00613 type(shr_date),intent(in) :: date ! input date 00614 00615 !EOP 00616 00617 !------------------------------------------------------------------------------- 00618 ! 00619 !------------------------------------------------------------------------------- 00620 00621 shr_date_getStepsPerDay = date%stepsPerDay 00622 00623 end function shr_date_getStepsPerDay 00624 00625 !=============================================================================== 00626 !BOP =========================================================================== 00627 ! 00628 ! !IROUTINE: shr_date_getStepInDay - return elapsed days of a date 00629 ! 00630 ! !DESCRIPTION: 00631 ! return timestep in this day 00632 ! 00633 ! !REVISION HISTORY: 00634 ! 2001-Nov-13 - T. Craig - initial version. 00635 ! 00636 ! !INTERFACE: ----------------------------------------------------------------- 00637 00638 integer function shr_date_getStepInDay(date) 00639 00640 implicit none 00641 00642 ! !INPUT/OUTPUT PARAMETERS: 00643 00644 type(shr_date),intent(in) :: date ! input date 00645 00646 !EOP 00647 00648 !------------------------------------------------------------------------------- 00649 ! 00650 !------------------------------------------------------------------------------- 00651 00652 shr_date_getStepInDay = date%StepInDay 00653 00654 end function shr_date_getStepInDay 00655 00656 !=============================================================================== 00657 !BOP =========================================================================== 00658 ! 00659 ! !IROUTINE: shr_date_getJulian - return julian day 00660 ! 00661 ! !DESCRIPTION: 00662 ! return julian day 00663 ! 00664 ! !REVISION HISTORY: 00665 ! 2002-Oct-28 - R. Jacob -initial version 00666 ! 00667 ! !INTERFACE: ----------------------------------------------------------------- 00668 00669 real(SHR_KIND_R8) function shr_date_getJulian(date,shift) 00670 00671 implicit none 00672 00673 ! !INPUT/OUTPUT PARAMETERS: 00674 00675 type(shr_date),intent(in) :: date ! input date 00676 integer(SHR_KIND_IN),intent(in),optional :: shift ! seconds to shift calculation 00677 00678 !EOP 00679 ! local 00680 type(shr_date) :: ldate ! local date 00681 integer(SHR_KIND_IN) :: nsteps ! number of steps to advance 00682 integer(SHR_KIND_IN) :: n ! step index 00683 00684 !------------------------------------------------------------------------------- 00685 ! 00686 !------------------------------------------------------------------------------- 00687 ldate = date 00688 if( present(shift) )then 00689 if ( mod(shift,int(shr_date_nsecsPerDay/date%stepsPerDay) ) /= 0 )then 00690 write(s_logunit,*) 'ERROR: invalid shift = ', shift, ' needs to be divisible by: ', & 00691 shr_date_nsecsPerDay/date%stepsPerDay 00692 call shr_sys_abort('(shr_date_getJulian) invalid amount to shift') 00693 end if 00694 nsteps = shift * date%stepsPerDay / shr_date_nsecsPerDay 00695 do n = 1, nsteps 00696 call shr_date_adv1step( ldate ) 00697 end do 00698 end if 00699 shr_date_getJulian = shr_cal_elapsDaysStrtMonth(ldate%y,ldate%m) & 00700 + ldate%d + ldate%s/shr_date_secsPerDay 00701 00702 end function shr_date_getJulian 00703 00704 !=============================================================================== 00705 !=============================================================================== 00706 00707 end module shr_date_mod