dcdatetimecreate.f90
Go to the documentation of this file.
1 !== dc_date_types#DC_DATETIME, dc_date_types#DC_DIFFTIME 型変数の生成
2 !
3 ! Authors:: Yasuhiro MORIKAWA, Eizi TOYODA
4 ! Version:: $Id: dcdatetimecreate.f90,v 1.3 2010-04-11 14:13:51 morikawa Exp $
5 ! Tag Name:: $Name: $
6 ! Copyright:: Copyright (C) GFD Dennou Club, 2000-2006. All rights reserved.
7 ! License:: See COPYRIGHT[link:../../COPYRIGHT]
8 !
9 ! このファイルで提供される手続き群は dc_date モジュールにて提供されます。
10 !
11 
12 subroutine dcdatetimecreate1(time, &
13  & year, mon, day, hour, min, sec, &
14  & zone, zone_hour, zone_min, caltype, caltype_str, day_seconds, &
15  & sclyear, sclmon, sclday, sclsec, err)
16  !
17  ! dc_date_types#DC_DATETIME 型変数の生成を行います.
18  ! 引数 *year*, *mon*, *day*, *hour*, *min*, *sec* の全てを与えない場合,
19  ! このサブルーチンが呼ばれた際の時刻が使用されます.
20  !
21  ! 引数 *caltype* には暦法を設定します.
22  ! dc_date_types#CAL_CYCLIC, dc_date_types#CAL_NOLEAP,
23  ! dc_date_types#CAL_JULIAN, dc_date_types#CAL_GREGORIAN
24  ! のいづれかを与えてください. 引数 *caltype* を指定しない場合, 暦法は
25  ! dc_date_types#CAL_GREGORIAN に設定されます.
26  ! 暦法は *caltype_str* に文字列を与えることでも指定可能です.
27  ! 上記の暦法に対応する文字列は以下の通りです. (大文字小文字は区別しません)
28  !
29  ! dc_date_types#CAL_CYCLIC :: cyclic
30  ! dc_date_types#CAL_NOLEAP :: noleap
31  ! dc_date_types#CAL_JULIAN :: julian
32  ! dc_date_types#CAL_GREGORIAN :: gregorian
33  !
34  ! 引数 *zone* には UTC からの時差を設定します.
35  ! '+09:00' や '-13:00' のように時差を 6 文字で指定してください.
36  ! 引数 *zone* を指定しない場合, date_and_time 組み込みサブルーチン
37  ! によって得られる時差を設定します.
38  ! 時差は *zone_hour* または *zone_min* に整数型を与えることでも
39  ! 指定可能です.
40  !
41  ! 引数 *day_seconds* には 1 日何秒かを設定します. この引数を
42  ! 指定しない場合, dc_date_types#day_seconds の値が用いられます.
43  ! dc_date_types#day_seconds は SetSecOfDay で変更可能です.
44  !
45  ! 引数 *caltype* および, *zone* に不適切な値が与えられた場合,
46  ! エラーを発生させます.
47  ! 引数 *err* を与えている場合には *err* に .true. が返り,
48  ! プログラムは続行します.
49  !
50 
51  use dc_date_generic, only: dcdifftimecreate, &
55  & caltype_default => caltype, &
60  use dc_message, only: messagenotify
61  use dc_trace, only: beginsub, endsub
62  use dc_present, only: present_select
63  use dc_string, only: lchar, cprintf
64  use dc_scaledsec, only: dc_scaled_sec, &
65  & assignment(=), dcscaledsecputline, &
66  & operator(==), operator(>), operator(<), operator(>=), operator(<=), &
67  & operator(+), operator(-), operator(*), operator(/), mod, modulo, &
69  use dc_types, only: dp, string, token
70  implicit none
71  type(dc_datetime), intent(out) :: time
72  integer, intent(in), optional:: year ! 年
73  integer, intent(in), optional:: mon ! 月
74  integer, intent(in), optional:: day ! 日
75  integer, intent(in), optional:: hour ! 時
76  integer, intent(in), optional:: min ! 分
77  real(DP),intent(in), optional:: sec ! 秒
78  character(*), intent(in), optional :: zone ! UTC からの時差
79  integer, intent(in), optional :: zone_hour ! UTC からの時差 (時)
80  integer, intent(in), optional :: zone_min ! UTC からの時差 (分)
81  integer, intent(in), optional:: caltype ! 暦法
82  character(*), intent(in), optional:: caltype_str ! 暦法 (文字型による指定)
83  real(DP),intent(in), optional:: day_seconds ! 1 日の秒数
84  type(dc_scaled_sec), intent(in), optional:: sclyear ! 年 (DC_SCALED_SEC 型)
85  type(dc_scaled_sec), intent(in), optional:: sclmon ! 月 (DC_SCALED_SEC 型)
86  type(dc_scaled_sec), intent(in), optional:: sclday ! 日 (DC_SCALED_SEC 型)
87  type(dc_scaled_sec), intent(in), optional:: sclsec ! 秒 (DC_SCALED_SEC 型)
88  logical, intent(out), optional:: err
89 
90  real(DP):: gcsec
91  integer :: gcday, gcmon, gcyear
92  real(DP):: essec, esds
93  integer :: esday
94  type(dc_scaled_sec):: iday, imon, month, iyear, century, isec
95  character(6) :: izone
96  integer, parameter:: year_default = 0, mon_default = 1
97  integer, parameter:: day_default = 1
98  integer, parameter:: sec_default = 0
99  logical :: current_time_used
100  type(dc_difftime):: zonediff
101  character(TOKEN):: zone_str
102  integer :: stat, cause_i
103  character(STRING) :: cause_c
104  character(*), parameter :: subname = 'DCDateTimeCreate1'
105 continue
106  current_time_used = .not. present(year) &
107  & .and. .not. present(mon) &
108  & .and. .not. present(day) &
109  & .and. .not. present(hour) &
110  & .and. .not. present(min) &
111  & .and. .not. present(sec) &
112  & .and. .not. present(sclyear) &
113  & .and. .not. present(sclmon) &
114  & .and. .not. present(sclday) &
115  & .and. .not. present(sclsec)
116  call beginsub(subname, 'current_time_used=<%y>', l=(/current_time_used/))
117  stat = dc_noerr
118  cause_i = dc_noerr
119  cause_c = ''
120 
121  if ( present(day_seconds) ) then
122  time % day_seconds = day_seconds
123  else
125  time % day_seconds = day_seconds_scl
126  end if
127 
128  call get_current_time(gcyear, gcmon, gcday, gcsec, izone) ! (out)
129  iyear = gcyear
130  imon = gcmon
131  iday = gcday
132  isec = gcsec
133 
134  if (.not. current_time_used) then
135  if ( present(zone_hour) .or. present(zone_min) ) then
136  call dcdifftimecreate( zonediff, & ! (out)
137  & hour = zone_hour, min = zone_min ) ! (in)
138  zone_str = tochar(zonediff)
139  if ( zone_str(1:1) == '-' ) then
140  izone(1:1) = '-'
141  else
142  izone(1:1) = '+'
143  end if
144  izone(2:6) = zone_str(13:17)
145  end if
146  if (present(zone)) then
147  izone = zone
148  end if
149  if ( .not. validzone(izone)) then
150  stat = dc_ebadtimezone
151  cause_c = izone
152  if (present(err)) then
153  call messagenotify('W', subname, &
154  & 'zone=<%c> is invalid.', &
155  & c1=trim(izone))
156  else
157  goto 999
158  end if
159  end if
160 
161  if ( present(sclsec) ) then
162  isec = sclsec
163  elseif( present(sec) ) then
164  isec = sec
165  else
166  isec = sec_default
167  end if
168  if (present(min)) then
169  isec = isec + min * min_seconds
170  end if
171  if (present(hour)) then
172  isec = isec + hour * hour_seconds
173  end if
174 
175  if ( present(sclday) ) then
176  iday = sclday
177  elseif( present(day) ) then
178  iday = day
179  else
180  iday = day_default
181  end if
182 
183  if ( present(sclday) ) then
184  iday = sclday
185  elseif( present(day) ) then
186  iday = day
187  else
188  iday = day_default
189  end if
190  iday = iday + floor(isec / time % day_seconds)
191 
192  if ( present(sclmon) ) then
193  imon = sclmon
194  elseif( present(mon) ) then
195  imon = mon
196  else
197  imon = mon_default
198  end if
199 
200  if ( present(sclyear) ) then
201  iyear = sclyear
202  elseif( present(year) ) then
203  iyear = year
204  else
205  iyear = year_default
206  end if
207  end if
208 
209  time % zone = izone
210  time % sec = modulo(isec, time % day_seconds)
211  time % caltype = caltype_default
212  if (present(caltype_str)) then
213  select case( lchar(trim(caltype_str)) )
214  case('cyclic')
215  time % caltype = cal_cyclic
216  case('noleap')
217  time % caltype = cal_noleap
218  case('julian')
219  time % caltype = cal_julian
220  case('gregorian')
221  time % caltype = cal_gregorian
222  case('')
223  time % caltype = cal_gregorian
224  case default
225  stat = dc_ebadcaltype
226  cause_i = 0
227  call messagenotify('W', subname, &
228  & 'caltype=<%c> is invalid calender type.', &
229  & c1 = trim(caltype_str) )
230  if ( .not. present(err) ) then
231  goto 999
232  end if
233  end select
234  end if
235 
236  if (present(caltype)) then
237  if (validcaltype(caltype)) then
238  time % caltype = caltype
239  else
240  stat = dc_ebadcaltype
241  cause_i = caltype
242  if (present(err)) then
243  call messagenotify('W', subname, &
244  & 'caltype=<%d> is invalid calender type.', &
245  & i=(/caltype/))
246  else
247  goto 999
248  end if
249  end if
250  end if
251  if (time % caltype == cal_cyclic) then
252  time % day = int( iday + imon * cyclic_mdays )
253  goto 999
254  endif
255  month = modulo(imon - 3, year_months) + 3
256  iyear = iyear + int( (imon - month) / year_months )
257  iday = iday + int( (month * 306 - 914) / 10 )
258  if (time % caltype == cal_noleap) then
259  time % day = iday + iyear * 365 + 90
260  else
261  iday = iday + int( (iyear * four_years - modulo(iyear * four_years, 4)) / 4 )
262  if (time % caltype == cal_julian .or. iday < 640116) then
263  time % day = iday + 91
264  else
265  century = (iyear - modulo(iyear, 100)) / 100 + 1
266  time % day = iday - int( (century * 3 - modulo(century * 3, 4)) / 4 ) + 93
267  endif
268  endif
269 
270 
271 999 continue
272  call storeerror(stat, subname, err, cause_c, cause_i)
273  esday = time % day ; essec = time % sec ; esds = time % day_seconds
274  call endsub(subname, 'time (caltype=%d, day=%d, sec=%f, zone=%c, day_seconds=%f)', &
275  & i=(/time % caltype, esday/), d=(/essec, esds/), &
276  & c1=trim(time % zone))
277 
278  contains
279  subroutine get_current_time(jyear, jmon, jday, jsec, jzone)
280  !
281  ! date_and_time 組み込みサブルーチンを用いて, 現在
282  ! 時刻と UTC からの時差を返します.
283  !
284  use dc_types, only: dp
285  use dc_string, only: stod
286  implicit none
287  integer, intent(out) :: jyear, jmon, jday
288  real(DP), intent(out) :: jsec
289  character(*), intent(out) :: jzone
290 
291  integer :: date_time_values(1:8)
292  character(5) :: zone_raw
293  continue
294 
295  call date_and_time(zone=zone_raw, values=date_time_values)
296 
297  jzone = zone_raw(1:3) // ":" // zone_raw(4:5)
298 
299  jyear = date_time_values(1)
300  jmon = date_time_values(2)
301  jday = date_time_values(3)
302  jsec = real(date_time_values(5), DP) * HOUR_SECONDS &
303  & + real(date_time_values(6), DP) * MIN_SECONDS &
304  & + real(date_time_values(7), DP)
305 
306  end subroutine get_current_time
307 
308 end subroutine dcdatetimecreate1
309 
310 
311 subroutine dcdifftimecreate1(diff, &
312  & year, mon, day, hour, min, sec, day_seconds, nondim, &
313  & sclyear, sclmon, sclday, sclsec )
314  !
315  ! dc_date_types#DC_DIFFTIME 型変数の生成を行います.
316  ! 引数 year, mon, day, hour, min, sec, nondim を与えない場合,
317  ! 0 が与えられたことになります.
318  !
319  ! 引数 *day_seconds* には 1 日何秒かを設定します. この引数を
320  ! 指定しない場合, dc_date_types#day_seconds の値が用いられます.
321  ! dc_date_types#day_seconds は SetSecOfDay で変更可能です.
322  !
324  use dc_date_generic, only: validcaltype
325  use dc_date_types, only: dc_difftime, &
326  & day_seconds_default => day_seconds, &
328  use dc_message, only: messagenotify
329  use dc_trace, only: beginsub, endsub, debug
330  use dc_present, only: present_select
331  use dc_scaledsec, only: dc_scaled_sec, &
332  & assignment(=), dcscaledsecputline, &
333  & operator(==), operator(>), operator(<), operator(>=), operator(<=), &
334  & operator(+), operator(-), operator(*), operator(/), mod, modulo, &
335  & abs, int, sign, floor
336  use dc_string, only: cprintf
337  use dc_types, only: dp, string
338  implicit none
339  type(dc_difftime), intent(out) :: diff
340  integer, intent(in), optional:: year ! 年. Year
341  integer, intent(in), optional:: mon ! 月. Month
342  integer, intent(in), optional:: day ! 日. Day
343  integer, intent(in), optional:: hour ! 時. Hour
344  integer, intent(in), optional:: min ! 分. Minute
345  real(DP), intent(in), optional:: sec ! 秒. Second
346  real(DP), intent(in), optional:: day_seconds ! 1 日の秒数
347  real(DP), intent(in), optional:: nondim ! 無次元時間. Nondimensional time
348  type(dc_scaled_sec), intent(in), optional:: sclyear ! 年 (DC_SCALED_SEC 型)
349  type(dc_scaled_sec), intent(in), optional:: sclmon ! 月 (DC_SCALED_SEC 型)
350  type(dc_scaled_sec), intent(in), optional:: sclday ! 日 (DC_SCALED_SEC 型)
351  type(dc_scaled_sec), intent(in), optional:: sclsec ! 秒 (DC_SCALED_SEC 型)
352 
353  type(dc_scaled_sec):: iyear, imon, iday, ihour, imin, isec
354  integer, parameter:: year_default = 0, mon_default = 0
355  integer, parameter:: day_default = 0, hour_default = 0, min_default = 0
356  integer, parameter:: sec_default = 0
357  real(DP):: essec, esds
358  integer :: esmon, esday
359  character(STRING):: endsub_msb
360  logical:: dbg_mode
361  character(*), parameter :: subname = 'DCDiffTimeCreate1'
362 continue
363  call beginsub(subname)
364 
365  if ( present(nondim) ) then
366  diff % nondim_flag = .true.
367  diff % mon = 0
368  diff % day = 0
369  diff % sec = nondim
370  goto 999
371  else
372  diff % nondim_flag = .false.
373  end if
374 
375  if ( present(sclyear) ) then
376  iyear = sclyear
377  elseif( present(year) ) then
378  iyear = year
379  else
380  iyear = year_default
381  end if
382 
383  if ( present(sclmon) ) then
384  imon = sclmon
385  elseif( present(mon) ) then
386  imon = mon
387  else
388  imon = mon_default
389  end if
390 
391  if ( present(sclday) ) then
392  iday = sclday
393  elseif( present(day) ) then
394  iday = day
395  else
396  iday = day_default
397  end if
398 
399  ihour = present_select(.false., hour_default, hour)
400  imin = present_select(.false., min_default, min)
401 
402  if ( present(sclsec) ) then
403  isec = sclsec
404  elseif( present(sec) ) then
405  isec = sec
406  else
407  isec = sec_default
408  end if
409 
410  diff % mon = iyear * year_months + imon
411  diff % day = iday
412  diff % sec = ihour * hour_seconds &
413  & + imin * min_seconds &
414  & + isec
415 
416  if( present(day_seconds) ) then
417  diff % day_seconds = day_seconds
418  else
419  diff % day_seconds = day_seconds_default
420  end if
421 
422  call dcdate_normalize(diff % day, diff % sec, diff % day_seconds, diff % nondim_flag)
423 
424 999 continue
425  call debug( dbg_mode )
426  if ( dbg_mode ) then
427  esmon = diff % mon ; esday = diff % day
428  essec = diff % sec ; esds = diff % day_seconds
429  endsub_msb = &
430  & cprintf( 'mon=%d, day=%d, sec=%f, day_seconds=%f, nondim_flag=%b', &
431  & i = (/ esmon, esday /), d = (/ essec, esds /), &
432  & l = (/ diff % nondim_flag /) )
433  else
434  endsub_msb = ''
435  end if
436  call endsub(subname, 'diff (%c)', c1 = trim(endsub_msb) )
437 end subroutine dcdifftimecreate1
438 
439 
440 subroutine dcdifftimecreate2d(diff, value, unit, unit_symbol, err)
441  !
442  ! dc_date_types#DC_DIFFTIME 型変数の生成を行います.
443  ! 引数 *value* に数値を, *unit* に単位を表す文字列を,
444  ! または *unit_symbol* に単位を表すシンボルを与えてください.
445  !
446  ! unit に指定できるのは以下の文字列です. (大文字小文字は区別しません).
447  !
448  ! 年 :: dc_date_types#UNIT_YEAR
449  ! 月 :: dc_date_types#UNIT_MONTH
450  ! 日 :: dc_date_types#UNIT_DAY
451  ! 時 :: dc_date_types#UNIT_HOUR
452  ! 分 :: dc_date_types#UNIT_MIN
453  ! 秒 :: dc_date_types#UNIT_SEC
454  ! 無次元時間 :: dc_date_types#UNIT_NONDIM
455  !
456  ! これらに該当しない文字列を *unit* に与えた場合, エラーを発生させます.
457  !
458  ! unit_symbol に指定できるのは以下のシンボルです.
459  !
460  ! 年 :: dc_date_types#UNIT_SYMBOL_YEAR
461  ! 月 :: dc_date_types#UNIT_SYMBOL_MONTH
462  ! 日 :: dc_date_types#UNIT_SYMBOL_DAY
463  ! 時 :: dc_date_types#UNIT_SYMBOL_HOUR
464  ! 分 :: dc_date_types#UNIT_SYMBOL_MIN
465  ! 秒 :: dc_date_types#UNIT_SYMBOL_SEC
466  ! 無次元時間 :: dc_date_types#UNIT_SYMBOL_NONDIM
467  !
468  ! これらに該当しないシンボルを *unit_symbol* に与えた場合,
469  ! エラーを発生させます.
470  !
471  ! 引数 *err* を与えている場合には *err* に .true. が返り,
472  ! プログラムは続行します.
473  !
474  use dc_types, only: dp, string
475  use dc_trace, only: beginsub, endsub
477  use dc_string, only: strieq
479  use dc_date_types, only: dc_difftime, &
482  & unit_symbol_err, &
484  use dc_scaledsec, only: dc_scaled_sec, &
485  & assignment(=), dcscaledsecputline, &
486  & operator(==), operator(>), operator(<), operator(>=), operator(<=), &
487  & operator(+), operator(-), operator(*), operator(/), mod, modulo, &
488  & abs, int, sign, floor
489  implicit none
490  type(dc_difftime), intent(out) :: diff
491  real(DP), intent(in) :: value
492  character(*), intent(in) :: unit
493  integer, intent(in), optional :: unit_symbol
494  logical, intent(out), optional :: err
495 
496  real(DP):: essec
497  integer :: esmon, esday
498  integer :: stat, val_int
499  type(dc_scaled_sec):: val_scl, val_dec
500  character(STRING) :: cause_c
501  integer:: symbol
502 
503  character(*), parameter :: subname = 'DCDiffTimeCreate2'
504 continue
505  call beginsub(subname, 'value=%f', d=(/value/))
506  stat = dc_noerr
507  cause_c = ''
508  symbol = unit_symbol_err
509  if ( present(unit_symbol) ) then
510  symbol = unit_symbol
511  else
512  symbol = parsetimeunits(unit)
513  end if
514 
515  if ( symbol == unit_symbol_sec ) then
516  call dcdifftimecreate(diff, sec=value)
517  goto 999
518  elseif ( symbol == unit_symbol_nondim ) then
519  call dcdifftimecreate(diff, nondim=value)
520  goto 999
521  end if
522 
523  val_int = int(value)
524  val_scl = int(value)
525  val_dec = value - int(value)
526 
527  if ( symbol == unit_symbol_min ) then
528  call dcdifftimecreate(diff, min = val_int, sclsec = val_dec * min_seconds)
529  elseif ( symbol == unit_symbol_hour ) then
530  call dcdifftimecreate(diff, hour = val_int, sclsec = val_dec * hour_seconds)
531  elseif ( symbol == unit_symbol_day ) then
532  call dcdifftimecreate(diff, sclday = val_scl, sclsec = val_dec * day_seconds)
533  elseif ( symbol == unit_symbol_month ) then
534  call dcdifftimecreate(diff, sclmon = val_scl, &
535  & sclsec = int(val_dec * cyclic_mdays) * day_seconds)
536  elseif ( symbol == unit_symbol_year ) then
537  call dcdifftimecreate(diff, sclyear = val_scl, &
538  & sclsec = int(val_dec * cyclic_mdays * year_months) * day_seconds)
539  else
540  stat = dc_ebadunit
541  cause_c = unit
542  end if
543 
544 999 continue
545  call storeerror(stat, subname, err, cause_c)
546  esmon = diff % mon ; esday = diff % day ; essec = diff % sec
547  call endsub(subname, 'diff (mon=%d, day=%d, sec=%f)', &
548  & i=(/esmon, esday/), d=(/essec/))
549 end subroutine dcdifftimecreate2d
550 
551 subroutine dcdifftimecreate2r(diff, value, unit, unit_symbol, err)
552  use dc_types, only: dp
554  use dc_date_types, only: dc_difftime
555  implicit none
556  type(dc_difftime), intent(out) :: diff
557  real, intent(in) :: value
558  character(*), intent(in) :: unit
559  integer, intent(in), optional :: unit_symbol
560  logical, intent(out), optional :: err
561 continue
562  call dcdifftimecreate(diff, real( value, DP ), unit, unit_symbol, err)
563 end subroutine dcdifftimecreate2r
564 
565 subroutine dcdifftimecreate2i(diff, value, unit, unit_symbol, err)
566  use dc_types, only: dp
568  use dc_date_types, only: dc_difftime
569  implicit none
570  type(dc_difftime), intent(out) :: diff
571  integer, intent(in) :: value
572  character(*), intent(in) :: unit
573  integer, intent(in), optional :: unit_symbol
574  logical, intent(out), optional :: err
575 continue
576  call dcdifftimecreate(diff, real( value, DP ), unit, unit_symbol, err)
577 end subroutine dcdifftimecreate2i
578 
579 subroutine dcdatetimecreatei(time, sec)
580  !
581  ! dc_date_types#DC_DATETIME 型変数の生成を行います.
582  ! 引数 sec には秒数を与えてください. 年月日, 時分を使って
583  ! 指定を行いたい場合は Create を利用してください.
584  !
585  use dc_types, only: dp
586  use dc_date_types, only: dc_datetime
588  use dc_scaledsec, only: dc_scaled_sec, assignment(=)
589  implicit none
590  type(dc_datetime), intent(out):: time
591  integer, intent(in):: sec
592 continue
593  call dcdatetimecreate(time, sec = real(sec, DP) )
594 end subroutine dcdatetimecreatei
595 
596 subroutine dcdatetimecreater(time, sec)
597  !
598  ! dc_date_types#DC_DATETIME 型変数の生成を行います.
599  ! 引数 sec には秒数を与えてください. 年月日, 時分を使って
600  ! 指定を行いたい場合は Create を利用してください.
601  !
602  use dc_types, only: dp
603  use dc_date_types, only: dc_datetime
605  use dc_scaledsec, only: dc_scaled_sec, assignment(=)
606  implicit none
607  type(dc_datetime), intent(out):: time
608  real, intent(in):: sec
609 continue
610  call dcdatetimecreate(time, sec = real(sec, DP) )
611 end subroutine dcdatetimecreater
612 
613 subroutine dcdatetimecreated(time, sec)
614  use dc_types, only: dp
615  use dc_date_types, only: dc_datetime
617  use dc_scaledsec, only: dc_scaled_sec, assignment(=)
618  implicit none
619  type(dc_datetime), intent(out):: time
620  real(DP), intent(in):: sec
621 continue
622  call dcdatetimecreate(time, sec = sec)
623 end subroutine dcdatetimecreated
624 
625 subroutine dcdifftimecreatei(diff, sec)
626  !
627  ! dc_date_types#DC_DIFFTIME 型変数の生成を行います.
628  ! 引数 sec には秒数を与えてください. 年月日, 時分を使って
629  ! 指定を行いたい場合は Create を利用してください.
630  !
631  use dc_types, only: dp
632  use dc_date_types, only: dc_difftime
634  use dc_scaledsec, only: dc_scaled_sec, assignment(=)
635  implicit none
636  type(dc_difftime), intent(out):: diff
637  integer, intent(in):: sec
638 continue
639  call dcdifftimecreate(diff, sec = real(sec, DP) )
640 end subroutine dcdifftimecreatei
641 
642 subroutine dcdifftimecreater(diff, sec)
643  !
644  ! dc_date_types#DC_DIFFTIME 型変数の生成を行います.
645  ! 引数 sec には秒数を与えてください. 年月日, 時分を使って
646  ! 指定を行いたい場合は Create を利用してください.
647  !
648  use dc_types, only: dp
649  use dc_date_types, only: dc_difftime
651  use dc_scaledsec, only: dc_scaled_sec, assignment(=)
652  implicit none
653  type(dc_difftime), intent(out):: diff
654  real, intent(in):: sec
655 continue
656  call dcdifftimecreate(diff, sec = real(sec, DP) )
657 end subroutine dcdifftimecreater
658 
659 subroutine dcdifftimecreated(diff, sec)
660  use dc_types, only: dp
661  use dc_date_types, only: dc_difftime
663  use dc_scaledsec, only: dc_scaled_sec, assignment(=)
664  implicit none
665  type(dc_difftime), intent(out):: diff
666  real(DP), intent(in):: sec
667 continue
668  call dcdifftimecreate(diff, sec = sec)
669 end subroutine dcdifftimecreated
670 
671 
672 !-----------------------------------------------
673 ! 後方互換用
674 ! For backward compatibility
675 subroutine dcdatetimecreate1_bc(time, &
676  & year, mon, day, hour, min, sec, &
677  & zone, caltype, day_seconds, err)
678  use dc_types, only: dp
679  use dc_date_types, only: dc_datetime
681  type(dc_datetime), intent(out):: time
682  integer, intent(in), optional:: year, mon, day, hour, min
683  real(DP),intent(in), optional:: sec, day_seconds
684  character(*), intent(in), optional :: zone
685  integer, intent(in), optional:: caltype
686  logical, intent(out), optional:: err
687 continue
688  call dcdatetimecreate( time, &
689  & year, mon, day, hour, min, sec, &
690  & zone, caltype, day_seconds = day_seconds, err = err )
691 end subroutine dcdatetimecreate1_bc
692 
693 subroutine dcdifftimecreate1_bc(diff, &
694  & year, mon, day, hour, min, sec, day_seconds)
695  use dc_types, only: dp
696  use dc_date_types, only: dc_difftime
698  type(dc_difftime), intent(out) :: diff
699  integer, intent(in), optional:: year, mon, day, hour, min
700  real(DP),intent(in), optional:: sec, day_seconds
701 continue
702  call dcdifftimecreate( diff, &
703  & year, mon, day, hour, min, sec, day_seconds )
704 end subroutine dcdifftimecreate1_bc
705 
706 subroutine dcdifftimecreate2_bc(diff, value, unit, err)
707  use dc_types, only: dp
708  use dc_date_types, only: dc_difftime
710  type(dc_difftime), intent(out) :: diff
711  real(DP), intent(in) :: value
712  character(*), intent(in) :: unit
713  logical, intent(out), optional :: err
714 continue
715  call dcdifftimecreate( diff, value, unit, err = err )
716 end subroutine dcdifftimecreate2_bc
integer, parameter, public cal_noleap
subroutine dcdatetimecreater(time, sec)
subroutine dcdifftimecreate2d(diff, value, unit, unit_symbol, err)
integer, parameter, public unit_symbol_nondim
integer, parameter, public cal_gregorian
integer, parameter, public unit_symbol_month
integer, parameter, public unit_symbol_err
integer, parameter, public unit_symbol_min
subroutine dcdifftimecreate1_bc(diff, year, mon, day, hour, min, sec, day_seconds)
integer, parameter, public token
単語やキーワードを保持する文字型変数の種別型パラメタ
Definition: dc_types.f90:109
subroutine, public dcdate_set_day_seconds_scl
integer, parameter, public year_months
subroutine dcdatetimecreated(time, sec)
integer, parameter, public dc_ebadtimezone
Definition: dc_error.f90:561
subroutine dcdatetimecreate1(time, year, mon, day, hour, min, sec, zone, zone_hour, zone_min, caltype, caltype_str, day_seconds, sclyear, sclmon, sclday, sclsec, err)
integer, parameter, public unit_symbol_hour
integer, parameter, public cal_julian
subroutine dcdifftimecreated(diff, sec)
integer, parameter, public cal_cyclic
subroutine, public storeerror(number, where, err, cause_c, cause_i)
Definition: dc_error.f90:830
subroutine dcdifftimecreater(diff, sec)
subroutine dcdatetimecreatei(time, sec)
integer, parameter, public dc_noerr
Definition: dc_error.f90:509
real(dp), parameter, public cyclic_mdays
subroutine dcdifftimecreatei(diff, sec)
integer, parameter, public dp
倍精度実数型変数
Definition: dc_types.f90:83
subroutine, public beginsub(name, fmt, i, r, d, L, n, c1, c2, c3, ca, version)
Definition: dc_trace.f90:351
integer, parameter, public hour_seconds
integer, save, public caltype
subroutine dcdifftimecreate2i(diff, value, unit, unit_symbol, err)
integer, parameter, public dc_ebadunit
Definition: dc_error.f90:559
文字型変数の操作.
Definition: dc_string.f90:24
種別型パラメタを提供します。
Definition: dc_types.f90:49
logical, save, public flag_set_day_seconds_scl
integer, parameter, public unit_symbol_sec
integer, parameter, public unit_symbol_day
integer, parameter, public dc_ebadcaltype
Definition: dc_error.f90:560
integer, parameter, public four_years
real(dp), save, public day_seconds
integer, parameter, public unit_symbol_year
subroutine dcdifftimecreate2r(diff, value, unit, unit_symbol, err)
subroutine dcdifftimecreate2_bc(diff, value, unit, err)
subroutine, public dcscaledsecputline(sclsec, unit, indent)
integer, parameter, public min_seconds
type(dc_scaled_sec), save, public day_seconds_scl
subroutine dcdifftimecreate1(diff, year, mon, day, hour, min, sec, day_seconds, nondim, sclyear, sclmon, sclday, sclsec)
subroutine, public endsub(name, fmt, i, r, d, L, n, c1, c2, c3, ca)
Definition: dc_trace.f90:446
subroutine, public dcdate_normalize(day, sec, day_seconds, nondim_flag)
subroutine get_current_time(jyear, jmon, jday, jsec, jzone)
subroutine dcdatetimecreate1_bc(time, year, mon, day, hour, min, sec, zone, caltype, day_seconds, err)
integer, parameter, public string
文字列を保持する 文字型変数の種別型パラメタ
Definition: dc_types.f90:118