gtool5 Fortran 90/95 Library 1.0.0-rc5
日本語
Loading...
Searching...
No Matches
dccaldateeval.f90 File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine dccaldateevalymdhms1 (year, month, day, hour, min, sec, elapse_sec, cal, date, err)
 Evaluate date.
subroutine dccaldateevalymdhms2 (year, month, day, hour, min, sec, elapse_time, units, cal, date, err)
subroutine dccaldateevalid1 (init_date, elapse_sec, cal, date, err)
subroutine dccaldateevalid2 (init_date, elapse_time, units, cal, date, err)
subroutine dccaldateevalym2ym1 (year1, month1, day1, hour1, min1, sec1, elapse_sec, year2, month2, day2, hour2, min2, sec2, cal, err)
subroutine dccaldateevalym2ym2 (year1, month1, day1, hour1, min1, sec1, elapse_time, units, year2, month2, day2, hour2, min2, sec2, cal, err)
real(dp) function dccaldateevalsecofyear1 (elapse_sec, date, cal)
real(dp) function dccaldateevaldayofyear1 (elapse_sec, date, cal)
real(dp) function dccaldateevalsecofday1 (elapse_sec, date, cal)

Function/Subroutine Documentation

◆ dccaldateevaldayofyear1()

real(dp) function dccaldateevaldayofyear1 ( real(dp), intent(in) elapse_sec,
type(dc_cal_date), intent(in), optional, target date,
type(dc_cal), intent(in), optional, target cal )

Evaluate day of year

Evaluate day of year.

If an optional argument date is omitted, information of date that is stored in the "dc_calendar" is used as date of origin. If date is not omitted, information of the variable is used as date of origin.

If an optional argument cal is omitted, information of calendar that is stored in the "dc_calendar" is used for conversion of elapsed seconds elapse_sec into year-month-day etc. If cal is not omitted, information of the variable is used.

Parameters
[in]elapse_secElapsed seconds from date
[in]dateAn object that stores information of date of origin
[in]calAn object that stores information of calendar
Returns
Day of year

Definition at line 1318 of file dccaldateeval.f90.

1323 use dc_types, only: dp
1324 implicit none
1325 real(DP), intent(in):: elapse_sec
1326 type(DC_CAL_DATE), intent(in), optional, target:: date
1327 type(DC_CAL), intent(in), optional, target:: cal
1328 real(DP):: result
1329
1330 ! 作業変数
1331 ! Work variables
1332 !
1333 integer:: year, month, day, hour, min
1334 integer:: stat
1335 real(DP):: sec
1336 type(DC_CAL_DATE), pointer:: datep =>null()
1337 type(DC_CAL), pointer:: calp =>null()
1338
1339continue
1340
1341 ! オブジェクトのポインタ割付
1342 ! Associate pointer of an object
1343 !
1344 if ( present( date ) ) then
1345 datep => date
1346 else
1347 datep => default_date
1348 end if
1349
1350 if ( present( cal ) ) then
1351 calp => cal
1352 else
1353 calp => default_cal
1354 if ( .not. calp % initialized ) call default_cal_set
1355 end if
1356
1357 ! 初期設定のチェック
1358 ! Check initialization
1359 !
1360 result = 0.0
1361 if ( .not. datep % initialized ) return
1362 if ( .not. calp % initialized ) return
1363
1364 ! 経過時間を与えた場合の日時を取得
1365 ! Inquire date and time when elapse time is given
1366 !
1367 call dccaldateinquire( year, month, day, hour, min, sec, & ! (out)
1368 & elapse_sec = elapse_sec, date = date , cal = calp ) ! (in)
1369
1370 ! 年初めからの通日を取得
1371 ! Day of year is inquire
1372 !
1373 stat = dccaldate_ym2d( year, month, day, calp, & ! (in)
1374 & result ) ! (out)
1375 if ( stat /= 0 ) return
1376
Interface declarations for dc_calendar procedures.
Internal module for dc_calendar.
type(dc_cal), target, save, public default_cal
Default calendar object
type(dc_cal_date), target, save, public default_date
Default date object
integer function, public dccaldate_normalize(year, month, day, hour, min, sec, cal)
integer function, public dccaldate_ym2d(year, month, day, cal, day_of_year)
subroutine, public default_cal_set
Derived types and parameters of calendar and date.
Provides kind type parameter values.
Definition dc_types.f90:55
integer, parameter, public dp
Double Precision Real number
Definition dc_types.f90:92

References dc_calendar_internal::dccaldate_normalize(), dc_calendar_internal::dccaldate_ym2d(), dc_calendar_internal::default_cal, dc_calendar_internal::default_cal_set(), dc_calendar_internal::default_date, and dc_types::dp.

Here is the call graph for this function:

◆ dccaldateevalid1()

subroutine dccaldateevalid1 ( type(dc_cal_date), intent(in) init_date,
real(dp), intent(in) elapse_sec,
type(dc_cal), intent(in), optional, target cal,
type(dc_cal_date), intent(out), optional, target date,
logical, intent(out), optional err )

Evaluate and set date from initial date object with elapsed seconds

Evaluate and set date.

If an optional argument date is omitted, the date setting is stored to a "dc_calendar_types#DC_CAL_DATE" variable that is saved in the "dc_calendar". When date is omitted in subsequent procedures, the internal date is used. If date is not omitted, the settings is stored to the date. In order to use the date setting, use the "dc_calendar_types#DC_CAL_DATE" variable to subsequent procedures.

If an optional argument cal is omitted, information of calendar that is stored in the "dc_calendar" is used for conversion of elapsed seconds elapse_sec into year-month-day etc. If cal is not omitted, information of the variable is used.

Parameters
[in]init_dateAn object that stores information of date of origin
[in]elapse_secElapsed seconds from init_date
[in]calAn object that stores information of calendar
[out]dateAn object that stores information of date and time after elapsed time
[out]errException handling flag

Definition at line 478 of file dccaldateeval.f90.

479
484 use dc_message, only: messagenotify
485 use dc_trace, only: beginsub, endsub
488 use dc_types, only: string, dp, token
489 implicit none
490 type(DC_CAL_DATE), intent(in):: init_date
491 real(DP), intent(in):: elapse_sec
492 type(DC_CAL), intent(in), optional, target:: cal
493 type(DC_CAL_DATE), intent(out), optional, target:: date
494 logical, intent(out), optional:: err
495
496 ! 作業変数
497 ! Work variables
498 !
499 integer:: wyear, wmonth, wday, whour, wmin
500 real(DP):: wsec
501 character(TOKEN):: wzone
502 type(DC_CAL_DATE), pointer:: datep =>null()
503 type(DC_CAL), pointer:: calp =>null()
504 character(STRING):: e_date_str, e_cal_str
505 integer:: stat
506 character(STRING):: cause_c
507 character(*), parameter:: subname = 'DCCalDateEvalID1'
508continue
509 call beginsub( subname )
510 stat = dc_noerr
511 cause_c = ''
512
513 ! オブジェクトのポインタ割付
514 ! Associate pointer of an object
515 !
516 if ( present( date ) ) then
517 datep => date
518 else
519 datep => default_date
520 end if
521
522 if ( present( cal ) ) then
523 calp => cal
524 else
525 calp => default_cal
526 if ( .not. calp % initialized ) call default_cal_set
527 end if
528
529 ! 初期設定のチェック
530 ! Check initialization
531 !
532!!$ if ( .not. datep % initialized ) then
533!!$ stat = DC_ENOTINIT
534!!$ cause_c = 'DC_CAL_DATE'
535!!$ goto 999
536!!$ end if
537
538 if ( .not. calp % initialized ) then
539 stat = dc_enotinit
540 cause_c = 'DC_CAL'
541 goto 999
542 end if
543
544 ! 各要素への値の参照
545 ! Refer elements
546 !
547 wyear = init_date % year
548 wmonth = init_date % month
549 wday = init_date % day
550 whour = init_date % hour
551 wmin = init_date % min
552 wsec = init_date % sec
553 wzone = init_date % zone
554
555 ! 経過時間(秒)の追加
556 ! Add elapsed time (seconds)
557 !
558!!$ if ( elapse_sec < 0.0_DP ) then
559!!$ stat = DC_ENEGATIVE
560!!$ cause_c = 'elapse_sec'
561!!$ goto 999
562!!$ end if
563
564 wsec = wsec + elapse_sec
565
566 ! 日時の正規化
567 ! Normalize date and time
568 !
569 stat = dccaldate_normalize( wyear, wmonth, wday, whour, wmin, wsec, & ! (inout)
570 & calp ) ! (in)
571 if ( stat == dc_einconsistcaldate ) then
572 e_cal_str = dccaltochar( calp )
573 e_date_str = dccaldatetochar( wyear, wmonth, wday, whour, wmin, wsec, zone = "" )
574 call messagenotify('W', subname, 'cal=<%c> and date=<%c> are inconsistency', &
575 & c1 = trim(e_cal_str), c2 = trim(e_date_str) )
576 goto 999
577 end if
578
579 ! オブジェクトの作成
580 ! Create an object
581 !
582 call dccaldatecreate( &
583 & wyear, wmonth, wday, whour, wmin, wsec, & ! (in)
584 & datep, zone = wzone, err = err ) ! (out) optional
585 if ( present(err) ) then
586 if ( err ) then
587 stat = dc_ebaddate
588 goto 999
589 end if
590 end if
591
592 ! 終了処理, 例外処理
593 ! Termination and Exception handling
594 !
595999 continue
596 nullify( calp, datep )
597 call storeerror( stat, subname, err, cause_c )
598 call endsub( subname )
Error handling module.
Definition dc_error.f90:454
subroutine, public storeerror(number, where, err, cause_c, cause_i)
Definition dc_error.f90:891
integer, parameter, public dc_enotinit
-400 or less: DC utilities errors
Definition dc_error.f90:534
integer, parameter, public dc_noerr
Error storage variables
Definition dc_error.f90:468
integer, parameter, public dc_ebaddate
Definition dc_error.f90:552
integer, parameter, public dc_einconsistcaldate
Definition dc_error.f90:553
Message output module.
Debug tracing module.
Definition dc_trace.f90:150
subroutine, public beginsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca, version)
Definition dc_trace.f90:457
subroutine, public endsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca)
Definition dc_trace.f90:580
integer, parameter, public token
Character length for word, token
Definition dc_types.f90:128
integer, parameter, public string
Character length for string
Definition dc_types.f90:137

References dc_trace::beginsub(), dc_error::dc_ebaddate, dc_error::dc_einconsistcaldate, dc_error::dc_enotinit, dc_error::dc_noerr, dc_calendar_internal::dccaldate_normalize(), dc_calendar_internal::default_cal, dc_calendar_internal::default_cal_set(), dc_calendar_internal::default_date, dc_types::dp, dc_trace::endsub(), dc_error::storeerror(), dc_types::string, and dc_types::token.

Here is the call graph for this function:

◆ dccaldateevalid2()

subroutine dccaldateevalid2 ( type(dc_cal_date), intent(in) init_date,
real(dp), intent(in) elapse_time,
character(*), intent(in) units,
type(dc_cal), intent(in), optional, target cal,
type(dc_cal_date), intent(out), optional, target date,
logical, intent(out), optional err )

Evaluate and set date from initial date object with elapsed time and units

Evaluate and set date.

If an optional argument date is omitted, the date setting is stored to a "dc_calendar_types#DC_CAL_DATE" variable that is saved in the "dc_calendar". When date is omitted in subsequent procedures, the internal date is used. If date is not omitted, the settings is stored to the date. In order to use the date setting, use the "dc_calendar_types#DC_CAL_DATE" variable to subsequent procedures.

If an optional argument cal is omitted, information of calendar that is stored in the "dc_calendar" is used for conversion of elapsed time elapse_time into year-month-day etc. If cal is not omitted, information of the variable is used.

Parameters
[in]init_dateAn object that stores information of date of origin
[in]elapse_timeElapsed time from init_date. Unit is specified as units.
[in]unitsUnit of elapse_time
[in]calAn object that stores information of calendar
[out]dateAn object that stores information of date and time after elapsed time
[out]errException handling flag

Definition at line 655 of file dccaldateeval.f90.

661 use dc_message, only: messagenotify
662 use dc_trace, only: beginsub, endsub
665 use dc_types, only: string, dp, token
666 implicit none
667 type(DC_CAL_DATE), intent(in):: init_date
668 real(DP), intent(in):: elapse_time
669 character(*), intent(in):: units
670 type(DC_CAL), intent(in), optional, target:: cal
671 type(DC_CAL_DATE), intent(out), optional, target:: date
672 logical, intent(out), optional:: err
673
674 ! 作業変数
675 ! Work variables
676 !
677 integer:: wyear, wmonth, wday, whour, wmin
678 real(DP):: wsec
679 character(TOKEN):: wzone
680 type(DC_CAL_DATE), pointer:: datep =>null()
681 type(DC_CAL), pointer:: calp =>null()
682 character(STRING):: e_date_str, e_cal_str
683 integer:: tusym
684 integer:: stat
685 character(STRING):: cause_c
686 character(*), parameter:: subname = 'DCCalDateEvalID2'
687continue
688 call beginsub( subname )
689 stat = dc_noerr
690 cause_c = ''
691
692 ! オブジェクトのポインタ割付
693 ! Associate pointer of an object
694 !
695 if ( present( date ) ) then
696 datep => date
697 else
698 datep => default_date
699 end if
700
701 if ( present( cal ) ) then
702 calp => cal
703 else
704 calp => default_cal
705 if ( .not. calp % initialized ) call default_cal_set
706 end if
707
708 ! 初期設定のチェック
709 ! Check initialization
710 !
711!!$ if ( .not. datep % initialized ) then
712!!$ stat = DC_ENOTINIT
713!!$ cause_c = 'DC_CAL_DATE'
714!!$ goto 999
715!!$ end if
716
717 if ( .not. calp % initialized ) then
718 stat = dc_enotinit
719 cause_c = 'DC_CAL'
720 goto 999
721 end if
722
723 ! 各要素への値の参照
724 ! Refer elements
725 !
726 wyear = init_date % year
727 wmonth = init_date % month
728 wday = init_date % day
729 whour = init_date % hour
730 wmin = init_date % min
731 wsec = init_date % sec
732 wzone = init_date % zone
733
734 ! 経過時間(秒)の追加
735 ! Add elapsed time (seconds)
736 !
737!!$ if ( elapse_time < 0.0_DP ) then
738!!$ stat = DC_ENEGATIVE
739!!$ cause_c = 'elapse_time'
740!!$ goto 999
741!!$ end if
742
743 tusym = dccaldate_str2usym(units)
744 select case(tusym)
745 case(unit_symbol_day)
746 wsec = wsec + elapse_time * calp % hour_in_day &
747 & * calp % min_in_hour &
748 & * calp % sec_in_min
749 case(unit_symbol_hour)
750 wsec = wsec + elapse_time * calp % min_in_hour &
751 & * calp % sec_in_min
752 case(unit_symbol_min)
753 wsec = wsec + elapse_time * calp % sec_in_min
754 case(unit_symbol_sec)
755 wsec = wsec + elapse_time
756 case default
757 cause_c = units
758 call messagenotify('W', subname, 'units=<%c> is invalid. (ONLY day,hrs,min,sec are valid)', &
759 & c1 = trim(units) )
760 stat = dc_ebadunit
761 goto 999
762 end select
763
764 ! 日時の正規化
765 ! Normalize date and time
766 !
767 stat = dccaldate_normalize( wyear, wmonth, wday, whour, wmin, wsec, & ! (inout)
768 & calp ) ! (in)
769 if ( stat == dc_einconsistcaldate ) then
770 e_cal_str = dccaltochar( calp )
771 e_date_str = dccaldatetochar( wyear, wmonth, wday, whour, wmin, wsec, zone = "" )
772 call messagenotify('W', subname, 'cal=<%c> and date=<%c> are inconsistency', &
773 & c1 = trim(e_cal_str), c2 = trim(e_date_str) )
774 goto 999
775 end if
776
777 ! オブジェクトの作成
778 ! Create an object
779 !
780 call dccaldatecreate( &
781 & wyear, wmonth, wday, whour, wmin, wsec, & ! (in)
782 & datep, zone = wzone, err = err ) ! (out) optional
783 if ( present(err) ) then
784 if ( err ) then
785 stat = dc_ebaddate
786 goto 999
787 end if
788 end if
789
790 ! 終了処理, 例外処理
791 ! Termination and Exception handling
792 !
793999 continue
794 nullify( calp, datep )
795 call storeerror( stat, subname, err, cause_c )
796 call endsub( subname )
integer function, public dccaldate_str2usym(str)
integer, parameter, public unit_symbol_sec
integer, parameter, public unit_symbol_hour
integer, parameter, public unit_symbol_day
integer, parameter, public unit_symbol_min
integer, parameter, public dc_ebadunit
Definition dc_error.f90:536

References dc_trace::beginsub(), dc_error::dc_ebaddate, dc_error::dc_ebadunit, dc_error::dc_einconsistcaldate, dc_error::dc_enotinit, dc_error::dc_noerr, dc_calendar_internal::dccaldate_normalize(), dc_calendar_internal::dccaldate_str2usym(), dc_calendar_internal::default_cal, dc_calendar_internal::default_cal_set(), dc_calendar_internal::default_date, dc_types::dp, dc_trace::endsub(), dc_error::storeerror(), dc_types::string, dc_types::token, dc_calendar_types::unit_symbol_day, dc_calendar_types::unit_symbol_hour, dc_calendar_types::unit_symbol_min, and dc_calendar_types::unit_symbol_sec.

Here is the call graph for this function:

◆ dccaldateevalsecofday1()

real(dp) function dccaldateevalsecofday1 ( real(dp), intent(in) elapse_sec,
type(dc_cal_date), intent(in), optional, target date,
type(dc_cal), intent(in), optional, target cal )

Evaluate second of day

Evaluate second of day.

If an optional argument date is omitted, information of date that is stored in the "dc_calendar" is used as date of origin. If date is not omitted, information of the variable is used as date of origin.

If an optional argument cal is omitted, information of calendar that is stored in the "dc_calendar" is used for conversion of elapsed seconds elapse_sec into year-month-day etc. If cal is not omitted, information of the variable is used.

Parameters
[in]elapse_secElapsed seconds from date
[in]dateAn object that stores information of date of origin
[in]calAn object that stores information of calendar
Returns
Second of day

Definition at line 1423 of file dccaldateeval.f90.

1428 use dc_types, only: dp
1429 implicit none
1430 real(DP), intent(in):: elapse_sec
1431 type(DC_CAL_DATE), intent(in), optional, target:: date
1432 type(DC_CAL), intent(in), optional, target:: cal
1433 real(DP):: result
1434
1435 ! 作業変数
1436 ! Work variables
1437 !
1438 type(DC_CAL_DATE), pointer:: datep =>null()
1439 type(DC_CAL), pointer:: calp =>null()
1440 integer:: year, month, day, hour, min
1441 real(DP):: sec
1442continue
1443
1444 ! オブジェクトのポインタ割付
1445 ! Associate pointer of an object
1446 !
1447 if ( present( date ) ) then
1448 datep => date
1449 else
1450 datep => default_date
1451 end if
1452
1453 if ( present( cal ) ) then
1454 calp => cal
1455 else
1456 calp => default_cal
1457 if ( .not. calp % initialized ) call default_cal_set
1458 end if
1459
1460 ! 初期設定のチェック
1461 ! Check initialization
1462 !
1463 result = 0.0
1464 if ( .not. datep % initialized ) return
1465 if ( .not. calp % initialized ) return
1466
1467 ! 経過時間を与えた場合の日時を取得
1468 ! Inquire date and time when elapse time is given
1469 !
1470 call dccaldateinquire( year, month, day, hour, min, sec, & ! (out)
1471 & elapse_sec = elapse_sec, date = date , cal = calp ) ! (in)
1472
1473 ! 通秒へ変換
1474 ! Convert into sec of year
1475 !
1476 result = &
1477 & hour * calp % min_in_hour &
1478 & * calp % sec_in_min &
1479 & + min * calp % sec_in_min &
1480 & + sec
1481

References dc_calendar_internal::dccaldate_normalize(), dc_calendar_internal::dccaldate_ym2d(), dc_calendar_internal::default_cal, dc_calendar_internal::default_cal_set(), dc_calendar_internal::default_date, and dc_types::dp.

Here is the call graph for this function:

◆ dccaldateevalsecofyear1()

real(dp) function dccaldateevalsecofyear1 ( real(dp), intent(in) elapse_sec,
type(dc_cal_date), intent(in), optional, target date,
type(dc_cal), intent(in), optional, target cal )

Evaluate second of year

Evaluate second of year.

If an optional argument date is omitted, information of date that is stored in the "dc_calendar" is used as date of origin. If date is not omitted, information of the variable is used as date of origin.

If an optional argument cal is omitted, information of calendar that is stored in the "dc_calendar" is used for conversion of elapsed seconds elapse_sec into year-month-day etc. If cal is not omitted, information of the variable is used.

Parameters
[in]elapse_secElapsed seconds from date
[in]dateAn object that stores information of date of origin
[in]calAn object that stores information of calendar
Returns
Second of year

Definition at line 1202 of file dccaldateeval.f90.

1207 use dc_types, only: dp
1208 implicit none
1209 real(DP), intent(in):: elapse_sec
1210 type(DC_CAL_DATE), intent(in), optional, target:: date
1211 type(DC_CAL), intent(in), optional, target:: cal
1212 real(DP):: result
1213
1214 ! 作業変数
1215 ! Work variables
1216 !
1217 real(DP):: day_of_year
1218 type(DC_CAL_DATE), pointer:: datep =>null()
1219 type(DC_CAL), pointer:: calp =>null()
1220 integer:: year, month, day, hour, min
1221 integer:: stat
1222 real(DP):: sec
1223continue
1224
1225 ! オブジェクトのポインタ割付
1226 ! Associate pointer of an object
1227 !
1228 if ( present( date ) ) then
1229 datep => date
1230 else
1231 datep => default_date
1232 end if
1233
1234 if ( present( cal ) ) then
1235 calp => cal
1236 else
1237 calp => default_cal
1238 if ( .not. calp % initialized ) call default_cal_set
1239 end if
1240
1241 ! 初期設定のチェック
1242 ! Check initialization
1243 !
1244 result = 0.0
1245 if ( .not. datep % initialized ) return
1246 if ( .not. calp % initialized ) return
1247
1248 ! 経過時間を与えた場合の日時を取得
1249 ! Inquire date and time when elapse time is given
1250 !
1251 call dccaldateinquire( year, month, day, hour, min, sec, & ! (out)
1252 & elapse_sec = elapse_sec, date = date , cal = calp ) ! (in)
1253
1254 ! 年初めからの通日を取得
1255 ! Day of year is inquire
1256 !
1257 stat = dccaldate_ym2d( year, month, day, calp, & ! (in)
1258 & day_of_year ) ! (out)
1259 if ( stat /= 0 ) return
1260
1261 ! 通秒へ変換
1262 ! Convert into sec of year
1263 !
1264 result = ( day_of_year - 1 ) * calp % hour_in_day &
1265 & * calp % min_in_hour &
1266 & * calp % sec_in_min &
1267 & + hour * calp % min_in_hour &
1268 & * calp % sec_in_min &
1269 & + min * calp % sec_in_min &
1270 & + sec
1271

References dc_calendar_internal::dccaldate_normalize(), dc_calendar_internal::dccaldate_ym2d(), dc_calendar_internal::default_cal, dc_calendar_internal::default_cal_set(), dc_calendar_internal::default_date, and dc_types::dp.

Here is the call graph for this function:

◆ dccaldateevalym2ym1()

subroutine dccaldateevalym2ym1 ( integer, intent(in) year1,
integer, intent(in) month1,
integer, intent(in) day1,
integer, intent(in) hour1,
integer, intent(in) min1,
real(dp), intent(in) sec1,
real(dp), intent(in) elapse_sec,
integer, intent(out) year2,
integer, intent(out) month2,
integer, intent(out) day2,
integer, intent(out) hour2,
integer, intent(out) min2,
real(dp), intent(out) sec2,
type(dc_cal), intent(in), optional, target cal,
logical, intent(out), optional err )

Evaluate date and return as individual variables with elapsed seconds

Evaluate and set date.

If an optional argument cal is omitted, information of calendar that is stored in the "dc_calendar" is used for conversion of elapsed seconds elapse_sec into year-month-day etc. If cal is not omitted, information of the variable is used.

Parameters
[in]year1Year of origin
[in]month1Month of origin
[in]day1Day of origin
[in]hour1Hour of origin
[in]min1Minute of origin
[in]sec1Second of origin
[in]elapse_secElapsed seconds from year1sec1
[out]year2Year after elapsed time
[out]month2Month after elapsed time
[out]day2Day after elapsed time
[out]hour2Hour after elapsed time
[out]min2Minute after elapsed time
[out]sec2Second after elapsed time
[in]calAn object that stores information of calendar
[out]errException handling flag

Definition at line 854 of file dccaldateeval.f90.

863 use dc_message, only: messagenotify
864 use dc_trace, only: beginsub, endsub
867 use dc_types, only: string, dp
868 implicit none
869 integer, intent(in):: year1
870 integer, intent(in):: month1
871 integer, intent(in):: day1
872 integer, intent(in):: hour1
873 integer, intent(in):: min1
874 real(DP), intent(in):: sec1
875 real(DP), intent(in):: elapse_sec
876 integer, intent(out):: year2
877 integer, intent(out):: month2
878 integer, intent(out):: day2
879 integer, intent(out):: hour2
880 integer, intent(out):: min2
881 real(DP), intent(out):: sec2
882 type(DC_CAL), intent(in), optional, target:: cal
883 logical, intent(out), optional:: err
884
885 ! 作業変数
886 ! Work variables
887 !
888 type(DC_CAL), pointer:: calp =>null()
889 character(STRING):: e_date_str, e_cal_str
890 integer:: stat
891 character(STRING):: cause_c
892 character(*), parameter:: subname = 'DCCalDateEvalYM2YM1'
893continue
894 call beginsub( subname )
895 stat = dc_noerr
896 cause_c = ''
897
898 ! オブジェクトのポインタ割付
899 ! Associate pointer of an object
900 !
901 if ( present( cal ) ) then
902 calp => cal
903 else
904 calp => default_cal
905 if ( .not. calp % initialized ) call default_cal_set
906 end if
907
908 ! 初期設定のチェック
909 ! Check initialization
910 !
911!!$ if ( .not. datep % initialized ) then
912!!$ stat = DC_ENOTINIT
913!!$ cause_c = 'DC_CAL_DATE'
914!!$ goto 999
915!!$ end if
916
917 if ( .not. calp % initialized ) then
918 stat = dc_enotinit
919 cause_c = 'DC_CAL'
920 goto 999
921 end if
922
923 ! 各要素への値の参照
924 ! Refer elements
925 !
926 year2 = year1
927 month2 = month1
928 day2 = day1
929 hour2 = hour1
930 min2 = min1
931 sec2 = sec1
932
933 ! 経過時間(秒)の追加
934 ! Add elapsed time (seconds)
935 !
936!!$ if ( elapse_sec < 0.0_DP ) then
937!!$ stat = DC_ENEGATIVE
938!!$ cause_c = 'elapse_sec'
939!!$ goto 999
940!!$ end if
941
942 sec2 = sec2 + elapse_sec
943
944 ! 日時の正規化
945 ! Normalize date and time
946 !
947 stat = dccaldate_normalize( year2, month2, day2, hour2, min2, sec2, & ! (inout)
948 & calp ) ! (in)
949 if ( stat == dc_einconsistcaldate ) then
950 e_cal_str = dccaltochar( calp )
951 e_date_str = dccaldatetochar( year2, month2, day2, hour2, min2, sec2, zone = "" )
952 call messagenotify('W', subname, 'cal=<%c> and date=<%c> are inconsistency', &
953 & c1 = trim(e_cal_str), c2 = trim(e_date_str) )
954 goto 999
955 end if
956
957 ! 終了処理, 例外処理
958 ! Termination and Exception handling
959 !
960999 continue
961 nullify( calp )
962 call storeerror( stat, subname, err, cause_c )
963 call endsub( subname )

References dc_trace::beginsub(), dc_error::dc_einconsistcaldate, dc_error::dc_enotinit, dc_error::dc_noerr, dc_calendar_internal::dccaldate_normalize(), dc_calendar_internal::default_cal, dc_calendar_internal::default_cal_set(), dc_types::dp, dc_trace::endsub(), dc_error::storeerror(), and dc_types::string.

Here is the call graph for this function:

◆ dccaldateevalym2ym2()

subroutine dccaldateevalym2ym2 ( integer, intent(in) year1,
integer, intent(in) month1,
integer, intent(in) day1,
integer, intent(in) hour1,
integer, intent(in) min1,
real(dp), intent(in) sec1,
real(dp), intent(in) elapse_time,
character(*), intent(in) units,
integer, intent(out) year2,
integer, intent(out) month2,
integer, intent(out) day2,
integer, intent(out) hour2,
integer, intent(out) min2,
real(dp), intent(out) sec2,
type(dc_cal), intent(in), optional, target cal,
logical, intent(out), optional err )

Evaluate date and return as individual variables with elapsed time and units

Evaluate and set date.

If an optional argument cal is omitted, information of calendar that is stored in the "dc_calendar" is used for conversion of elapsed time elapse_time into year-month-day etc. If cal is not omitted, information of the variable is used.

Parameters
[in]year1Year of origin
[in]month1Month of origin
[in]day1Day of origin
[in]hour1Hour of origin
[in]min1Minute of origin
[in]sec1Second of origin
[in]elapse_timeElapsed time from year1sec1. Unit is specified as units.
[in]unitsUnit of elapse_time
[out]year2Year after elapsed time
[out]month2Month after elapsed time
[out]day2Day after elapsed time
[out]hour2Hour after elapsed time
[out]min2Minute after elapsed time
[out]sec2Second after elapsed time
[in]calAn object that stores information of calendar
[out]errException handling flag

Definition at line 1023 of file dccaldateeval.f90.

1028 use dc_calendar_types, only: dc_cal, dc_cal_date, &
1033 use dc_message, only: messagenotify
1034 use dc_trace, only: beginsub, endsub
1035 use dc_error, only: storeerror, dc_noerr, dc_enotinit, &
1037 use dc_types, only: string, dp
1038 implicit none
1039
1040 integer, intent(in):: year1
1041 integer, intent(in):: month1
1042 integer, intent(in):: day1
1043 integer, intent(in):: hour1
1044 integer, intent(in):: min1
1045 real(DP), intent(in):: sec1
1046 real(DP), intent(in):: elapse_time
1047 character(*), intent(in):: units
1048 integer, intent(out):: year2
1049 integer, intent(out):: month2
1050 integer, intent(out):: day2
1051 integer, intent(out):: hour2
1052 integer, intent(out):: min2
1053 real(DP), intent(out):: sec2
1054 type(DC_CAL), intent(in), optional, target:: cal
1055 logical, intent(out), optional:: err
1056
1057 ! 作業変数
1058 ! Work variables
1059 !
1060 type(DC_CAL), pointer:: calp =>null()
1061 character(STRING):: e_date_str, e_cal_str
1062 integer:: tusym
1063 integer:: stat
1064 character(STRING):: cause_c
1065 character(*), parameter:: subname = 'DCCalDateEvalYM2YM1'
1066continue
1067 call beginsub( subname )
1068 stat = dc_noerr
1069 cause_c = ''
1070
1071 ! オブジェクトのポインタ割付
1072 ! Associate pointer of an object
1073 !
1074 if ( present( cal ) ) then
1075 calp => cal
1076 else
1077 calp => default_cal
1078 if ( .not. calp % initialized ) call default_cal_set
1079 end if
1080
1081 ! 初期設定のチェック
1082 ! Check initialization
1083 !
1084!!$ if ( .not. datep % initialized ) then
1085!!$ stat = DC_ENOTINIT
1086!!$ cause_c = 'DC_CAL_DATE'
1087!!$ goto 999
1088!!$ end if
1089
1090 if ( .not. calp % initialized ) then
1091 stat = dc_enotinit
1092 cause_c = 'DC_CAL'
1093 goto 999
1094 end if
1095
1096 ! 各要素への値の参照
1097 ! Refer elements
1098 !
1099 year2 = year1
1100 month2 = month1
1101 day2 = day1
1102 hour2 = hour1
1103 min2 = min1
1104 sec2 = sec1
1105
1106 ! 経過時間(秒)の追加
1107 ! Add elapsed time (seconds)
1108 !
1109!!$ if ( elapse_time < 0.0_DP ) then
1110!!$ stat = DC_ENEGATIVE
1111!!$ cause_c = 'elapse_time'
1112!!$ goto 999
1113!!$ end if
1114
1115 tusym = dccaldate_str2usym(units)
1116 select case(tusym)
1117 case(unit_symbol_day)
1118 sec2 = sec2 + elapse_time * calp % hour_in_day &
1119 & * calp % min_in_hour &
1120 & * calp % sec_in_min
1121 case(unit_symbol_hour)
1122 sec2 = sec2 + elapse_time * calp % min_in_hour &
1123 & * calp % sec_in_min
1124 case(unit_symbol_min)
1125 sec2 = sec2 + elapse_time * calp % sec_in_min
1126 case(unit_symbol_sec)
1127 sec2 = sec2 + elapse_time
1128 case default
1129 cause_c = units
1130 call messagenotify('W', subname, 'units=<%c> is invalid. (ONLY day,hour,min,sec are valid)', &
1131 & c1 = trim(units) )
1132 stat = dc_ebadunit
1133 goto 999
1134 end select
1135
1136 ! 日時の正規化
1137 ! Normalize date and time
1138 !
1139 stat = dccaldate_normalize( year2, month2, day2, hour2, min2, sec2, & ! (inout)
1140 & calp ) ! (in)
1141 if ( stat == dc_einconsistcaldate ) then
1142 e_cal_str = dccaltochar( calp )
1143 e_date_str = dccaldatetochar( year2, month2, day2, hour2, min2, sec2, zone = "" )
1144 call messagenotify('W', subname, 'cal=<%c> and date=<%c> are inconsistency', &
1145 & c1 = trim(e_cal_str), c2 = trim(e_date_str) )
1146 goto 999
1147 end if
1148
1149 ! 終了処理, 例外処理
1150 ! Termination and Exception handling
1151 !
1152999 continue
1153 nullify( calp )
1154 call storeerror( stat, subname, err, cause_c )
1155 call endsub( subname )

References dc_trace::beginsub(), dc_error::dc_ebadunit, dc_error::dc_einconsistcaldate, dc_error::dc_enotinit, dc_error::dc_noerr, dc_calendar_internal::dccaldate_normalize(), dc_calendar_internal::dccaldate_str2usym(), dc_calendar_internal::default_cal, dc_calendar_internal::default_cal_set(), dc_types::dp, dc_trace::endsub(), dc_error::storeerror(), dc_types::string, dc_calendar_types::unit_symbol_day, dc_calendar_types::unit_symbol_hour, dc_calendar_types::unit_symbol_min, and dc_calendar_types::unit_symbol_sec.

Here is the call graph for this function:

◆ dccaldateevalymdhms1()

subroutine dccaldateevalymdhms1 ( integer, intent(in) year,
integer, intent(in) month,
integer, intent(in) day,
integer, intent(in) hour,
integer, intent(in) min,
real(dp), intent(in) sec,
real(dp), intent(in) elapse_sec,
type(dc_cal), intent(in), optional, target cal,
type(dc_cal_date), intent(out), optional, target date,
logical, intent(out), optional err )

Evaluate date.

Author
Yasuhiro MORIKAWA

Procedures described in this file are provided from "dc_calendar" module.

Evaluate and set date with elapsed seconds

Evaluate and set date.

If an optional argument date is omitted, the date setting is stored to a "dc_calendar_types#DC_CAL_DATE" variable that is saved in the "dc_calendar". When date is omitted in subsequent procedures, the internal date is used. If date is not omitted, the settings is stored to the date. In order to use the date setting, use the "dc_calendar_types#DC_CAL_DATE" variable to subsequent procedures.

If an optional argument cal is omitted, information of calendar that is stored in the "dc_calendar" is used for conversion of elapsed seconds elapse_sec into year-month-day etc. If cal is not omitted, information of the variable is used.

Parameters
[in]yearYear of origin
[in]monthMonth of origin
[in]dayDay of origin
[in]hourHour of origin
[in]minMinute of origin
[in]secSecond of origin
[in]elapse_secElapsed seconds from yearsec
[in]calAn object that stores information of calendar
[out]dateAn object that stores information of date and time after elapsed time
[out]errException handling flag

Definition at line 86 of file dccaldateeval.f90.

88
93 use dc_message, only: messagenotify
94 use dc_trace, only: beginsub, endsub
97 use dc_types, only: string, dp
98 implicit none
99 integer, intent(in):: year
100 integer, intent(in):: month
101 integer, intent(in):: day
102 integer, intent(in):: hour
103 integer, intent(in):: min
104 real(DP), intent(in):: sec
105 real(DP), intent(in):: elapse_sec
106 type(DC_CAL), intent(in), optional, target:: cal
107 type(DC_CAL_DATE), intent(out), optional, target:: date
108 logical, intent(out), optional:: err
109
110 ! 作業変数
111 ! Work variables
112 !
113 integer:: wyear, wmonth, wday, whour, wmin
114 real(DP):: wsec
115 type(DC_CAL_DATE), pointer:: datep =>null()
116 type(DC_CAL), pointer:: calp =>null()
117 character(STRING):: e_date_str, e_cal_str
118 integer:: stat
119 character(STRING):: cause_c
120 character(*), parameter:: subname = 'DCCalDateEvalYMDHMS1'
121continue
122 call beginsub( subname )
123 stat = dc_noerr
124 cause_c = ''
125
126 ! オブジェクトのポインタ割付
127 ! Associate pointer of an object
128 !
129 if ( present( date ) ) then
130 datep => date
131 else
132 datep => default_date
133 end if
134
135 if ( present( cal ) ) then
136 calp => cal
137 else
138 calp => default_cal
139 if ( .not. calp % initialized ) call default_cal_set
140 end if
141
142 ! 初期設定のチェック
143 ! Check initialization
144 !
145!!$ if ( .not. datep % initialized ) then
146!!$ stat = DC_ENOTINIT
147!!$ cause_c = 'DC_CAL_DATE'
148!!$ goto 999
149!!$ end if
150
151 if ( .not. calp % initialized ) then
152 stat = dc_enotinit
153 cause_c = 'DC_CAL'
154 goto 999
155 end if
156
157 ! 各要素への値の参照
158 ! Refer elements
159 !
160 wyear = year
161 wmonth = month
162 wday = day
163 whour = hour
164 wmin = min
165 wsec = sec
166
167 ! 経過時間(秒)の追加
168 ! Add elapsed time (seconds)
169 !
170!!$ if ( elapse_sec < 0.0_DP ) then
171!!$ stat = DC_ENEGATIVE
172!!$ cause_c = 'elapse_sec'
173!!$ goto 999
174!!$ end if
175
176 wsec = wsec + elapse_sec
177
178 ! 日時の正規化
179 ! Normalize date and time
180 !
181 stat = dccaldate_normalize( wyear, wmonth, wday, whour, wmin, wsec, & ! (inout)
182 & calp ) ! (in)
183 if ( stat == dc_einconsistcaldate ) then
184 e_cal_str = dccaltochar( calp )
185 e_date_str = dccaldatetochar( wyear, wmonth, wday, whour, wmin, wsec, zone = "" )
186 call messagenotify('W', subname, 'cal=<%c> and date=<%c> are inconsistency', &
187 & c1 = trim(e_cal_str), c2 = trim(e_date_str) )
188 goto 999
189 end if
190
191 ! オブジェクトの作成
192 ! Create an object
193 !
194 call dccaldatecreate( &
195 & wyear, wmonth, wday, whour, wmin, wsec, & ! (in)
196 & datep, zone = "", err = err ) ! (out) optional
197 if ( present(err) ) then
198 if ( err ) then
199 stat = dc_ebaddate
200 goto 999
201 end if
202 end if
203
204 ! 終了処理, 例外処理
205 ! Termination and Exception handling
206 !
207999 continue
208 nullify( calp, datep )
209 call storeerror( stat, subname, err, cause_c )
210 call endsub( subname )

References dc_trace::beginsub(), dc_error::dc_ebaddate, dc_error::dc_einconsistcaldate, dc_error::dc_enotinit, dc_error::dc_noerr, dc_calendar_internal::dccaldate_normalize(), dc_calendar_internal::default_cal, dc_calendar_internal::default_cal_set(), dc_calendar_internal::default_date, dc_types::dp, dc_trace::endsub(), dc_error::storeerror(), and dc_types::string.

Here is the call graph for this function:

◆ dccaldateevalymdhms2()

subroutine dccaldateevalymdhms2 ( integer, intent(in) year,
integer, intent(in) month,
integer, intent(in) day,
integer, intent(in) hour,
integer, intent(in) min,
real(dp), intent(in) sec,
real(dp), intent(in) elapse_time,
character(*), intent(in) units,
type(dc_cal), intent(in), optional, target cal,
type(dc_cal_date), intent(out), optional, target date,
logical, intent(out), optional err )

Evaluate and set date with elapsed time and units

Evaluate and set date.

If an optional argument date is omitted, the date setting is stored to a "dc_calendar_types#DC_CAL_DATE" variable that is saved in the "dc_calendar". When date is omitted in subsequent procedures, the internal date is used. If date is not omitted, the settings is stored to the date. In order to use the date setting, use the "dc_calendar_types#DC_CAL_DATE" variable to subsequent procedures.

If an optional argument cal is omitted, information of calendar that is stored in the "dc_calendar" is used for conversion of elapsed time elapse_time into year-month-day etc. If cal is not omitted, information of the variable is used.

Parameters
[in]yearYear of origin
[in]monthMonth of origin
[in]dayDay of origin
[in]hourHour of origin
[in]minMinute of origin
[in]secSecond of origin
[in]elapse_timeElapsed time from yearsec. Unit is specified as units.
[in]unitsUnit of elapse_time
[in]calAn object that stores information of calendar
[out]dateAn object that stores information of date and time after elapsed time
[out]errException handling flag

Definition at line 277 of file dccaldateeval.f90.

279
285 use dc_message, only: messagenotify
286 use dc_trace, only: beginsub, endsub
289 use dc_types, only: string, dp
290 implicit none
291 integer, intent(in):: year
292 integer, intent(in):: month
293 integer, intent(in):: day
294 integer, intent(in):: hour
295 integer, intent(in):: min
296 real(DP), intent(in):: sec
297 real(DP), intent(in):: elapse_time
298 character(*), intent(in):: units
299 type(DC_CAL), intent(in), optional, target:: cal
300 type(DC_CAL_DATE), intent(out), optional, target:: date
301 logical, intent(out), optional:: err
302
303 ! 作業変数
304 ! Work variables
305 !
306 integer:: wyear, wmonth, wday, whour, wmin
307 real(DP):: wsec
308 type(DC_CAL_DATE), pointer:: datep =>null()
309 type(DC_CAL), pointer:: calp =>null()
310 character(STRING):: e_date_str, e_cal_str
311 integer:: tusym
312 integer:: stat
313 character(STRING):: cause_c
314 character(*), parameter:: subname = 'DCCalDateEvalYMDHMS2'
315continue
316 call beginsub( subname )
317 stat = dc_noerr
318 cause_c = ''
319
320 ! オブジェクトのポインタ割付
321 ! Associate pointer of an object
322 !
323 if ( present( date ) ) then
324 datep => date
325 else
326 datep => default_date
327 end if
328
329 if ( present( cal ) ) then
330 calp => cal
331 else
332 calp => default_cal
333 if ( .not. calp % initialized ) call default_cal_set
334 end if
335
336 ! 初期設定のチェック
337 ! Check initialization
338 !
339!!$ if ( .not. datep % initialized ) then
340!!$ stat = DC_ENOTINIT
341!!$ cause_c = 'DC_CAL_DATE'
342!!$ goto 999
343!!$ end if
344
345 if ( .not. calp % initialized ) then
346 stat = dc_enotinit
347 cause_c = 'DC_CAL'
348 goto 999
349 end if
350
351 ! 各要素への値の参照
352 ! Refer elements
353 !
354 wyear = year
355 wmonth = month
356 wday = day
357 whour = hour
358 wmin = min
359 wsec = sec
360
361 ! 経過時間(秒)の追加
362 ! Add elapsed time (seconds)
363 !
364!!$ if ( elapse_time < 0.0_DP ) then
365!!$ stat = DC_ENEGATIVE
366!!$ cause_c = 'elapse_time'
367!!$ goto 999
368!!$ end if
369
370 tusym = dccaldate_str2usym(units)
371 select case(tusym)
372 case(unit_symbol_day)
373 wsec = wsec + elapse_time * calp % hour_in_day &
374 & * calp % min_in_hour &
375 & * calp % sec_in_min
376 case(unit_symbol_hour)
377 wsec = wsec + elapse_time * calp % min_in_hour &
378 & * calp % sec_in_min
379 case(unit_symbol_min)
380 wsec = wsec + elapse_time * calp % sec_in_min
381 case(unit_symbol_sec)
382 wsec = wsec + elapse_time
383 case default
384 cause_c = units
385 call messagenotify('W', subname, 'units=<%c> is invalid. (ONLY day,hrs,min,sec are valid)', &
386 & c1 = trim(units) )
387 stat = dc_ebadunit
388 goto 999
389 end select
390
391 ! 日時の正規化
392 ! Normalize date and time
393 !
394 stat = dccaldate_normalize( wyear, wmonth, wday, whour, wmin, wsec, & ! (inout)
395 & calp ) ! (in)
396 if ( stat == dc_einconsistcaldate ) then
397 e_cal_str = dccaltochar( calp )
398 e_date_str = dccaldatetochar( wyear, wmonth, wday, whour, wmin, wsec, zone = "" )
399 call messagenotify('W', subname, 'cal=<%c> and date=<%c> are inconsistency', &
400 & c1 = trim(e_cal_str), c2 = trim(e_date_str) )
401 goto 999
402 end if
403
404 ! オブジェクトの作成
405 ! Create an object
406 !
407 call dccaldatecreate( &
408 & wyear, wmonth, wday, whour, wmin, wsec, & ! (in)
409 & datep, zone = "", err = err ) ! (out) optional
410 if ( present(err) ) then
411 if ( err ) then
412 stat = dc_ebaddate
413 goto 999
414 end if
415 end if
416
417 ! 終了処理, 例外処理
418 ! Termination and Exception handling
419 !
420999 continue
421 nullify( calp, datep )
422 call storeerror( stat, subname, err, cause_c )
423 call endsub( subname )

References dc_trace::beginsub(), dc_error::dc_ebaddate, dc_error::dc_ebadunit, dc_error::dc_einconsistcaldate, dc_error::dc_enotinit, dc_error::dc_noerr, dc_calendar_internal::dccaldate_normalize(), dc_calendar_internal::dccaldate_str2usym(), dc_calendar_internal::default_cal, dc_calendar_internal::default_cal_set(), dc_calendar_internal::default_date, dc_types::dp, dc_trace::endsub(), dc_error::storeerror(), dc_types::string, dc_calendar_types::unit_symbol_day, dc_calendar_types::unit_symbol_hour, dc_calendar_types::unit_symbol_min, and dc_calendar_types::unit_symbol_sec.

Here is the call graph for this function: