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

Go to the source code of this file.

Functions/Subroutines

recursive subroutine historyputrealex (varname, array, arraysize, history, range, time, quiet, difftime, timed, time_average_store, err)
 データ出力
 
recursive subroutine historyputdoubleex (varname, array, arraysize, history, range, time, quiet, difftime, timed, time_average_store, err)
 データ出力
 
recursive subroutine historyputintex (varname, array, arraysize, history, range, time, quiet, difftime, timed, time_average_store, err)
 データ出力
 
recursive subroutine historyputcharex (varname, array, arraysize, history, range, time, quiet, difftime, timed, time_average_store, err)
 データ出力
 
subroutine historyputaxismpireal (varname, array, history, err)
 
subroutine historyputaxismpidouble (varname, array, history, err)
 
subroutine historyputaxismpiint (varname, array, history, err)
 
subroutine historyputdouble0 (varname, value, history, range, time, quiet, difftime, timed, time_average_store, err)
 データ出力
 
subroutine historyputdouble1 (varname, array, history, range, time, quiet, difftime, timed, time_average_store, err)
 
subroutine historyputdouble2 (varname, array, history, range, time, quiet, difftime, timed, time_average_store, err)
 
subroutine historyputdouble3 (varname, array, history, range, time, quiet, difftime, timed, time_average_store, err)
 
subroutine historyputdouble4 (varname, array, history, range, time, quiet, difftime, timed, time_average_store, err)
 
subroutine historyputdouble5 (varname, array, history, range, time, quiet, difftime, timed, time_average_store, err)
 
subroutine historyputdouble6 (varname, array, history, range, time, quiet, difftime, timed, time_average_store, err)
 
subroutine historyputdouble7 (varname, array, history, range, time, quiet, difftime, timed, time_average_store, err)
 
subroutine historyputreal0 (varname, value, history, range, time, quiet, difftime, timed, time_average_store, err)
 
subroutine historyputreal1 (varname, array, history, range, time, quiet, difftime, timed, time_average_store, err)
 
subroutine historyputreal2 (varname, array, history, range, time, quiet, difftime, timed, time_average_store, err)
 
subroutine historyputreal3 (varname, array, history, range, time, quiet, difftime, timed, time_average_store, err)
 
subroutine historyputreal4 (varname, array, history, range, time, quiet, difftime, timed, time_average_store, err)
 
subroutine historyputreal5 (varname, array, history, range, time, quiet, difftime, timed, time_average_store, err)
 
subroutine historyputreal6 (varname, array, history, range, time, quiet, difftime, timed, time_average_store, err)
 
subroutine historyputreal7 (varname, array, history, range, time, quiet, difftime, timed, time_average_store, err)
 
subroutine historyputint0 (varname, value, history, range, time, quiet, difftime, timed, time_average_store, err)
 
subroutine historyputint1 (varname, array, history, range, time, quiet, difftime, timed, time_average_store, err)
 
subroutine historyputint2 (varname, array, history, range, time, quiet, difftime, timed, time_average_store, err)
 
subroutine historyputint3 (varname, array, history, range, time, quiet, difftime, timed, time_average_store, err)
 
subroutine historyputint4 (varname, array, history, range, time, quiet, difftime, timed, time_average_store, err)
 
subroutine historyputint5 (varname, array, history, range, time, quiet, difftime, timed, time_average_store, err)
 
subroutine historyputint6 (varname, array, history, range, time, quiet, difftime, timed, time_average_store, err)
 
subroutine historyputint7 (varname, array, history, range, time, quiet, difftime, timed, time_average_store, err)
 
subroutine historyputchar0 (varname, value, history, range, time, quiet, difftime, timed, time_average_store, err)
 
subroutine timegoahead (varname, var, head, history, err)
 

Function/Subroutine Documentation

◆ historyputaxismpidouble()

subroutine historyputaxismpidouble ( character(*), intent(in)  varname,
real(dp), dimension(:), intent(in)  array,
type(gt_history), intent(inout), optional, target  history,
logical, intent(out), optional  err 
)

Definition at line 2552 of file historyput.f90.

2554 !
2555 ! MPI 使用時に, 各々のノード上のデータを単一ファイルに
2556 ! 集約して出力する場合には,
2557 ! このサブルーチンに領域全体の座標データを与えてください.
2558 ! また, HistoryCreate のオプショナル論理型引数 *flag_mpi_gather*
2559 ! に .true. を与えてください.
2560 !
2561 ! HistoryPut よりも後に使用してください
2562 ! HistoryAddVariable, HistoryAddAttr よりも前に使用してください.
2563 !
2564 ! When MPI is used, if data on each node is integrated and
2565 ! output to one file, give data of axes in whole area to
2566 ! this subroutine.
2567 ! And give .true. to optional logical argument *flag_mpi_gather*
2568 ! in "HistoryCreate".
2569 !
2570 ! Use this subroutine after "HistoryPut", and
2571 ! before "HistoryAddVariable", "HistoryAddAttr".
2572 !
2574 use gtdata_generic, only: create, put_attr, put
2575 use gtdata_types, only: gt_variable
2576 use dc_error, only: storeerror, dc_noerr, dc_enotinit, &
2578 use dc_url, only: urlmerge
2579 use dc_date_generic, only: evalbyunit
2580 use dc_date_types, only: dc_difftime
2581 use dc_string, only: tochar, lchar, strhead
2582 use dc_message, only: messagenotify
2585 use dc_trace, only: beginsub, endsub, dbgmessage
2586 use dc_types, only: string, dp
2587 implicit none
2588 character(*), intent(in):: varname
2589 ! 座標変数の名称.
2590 !
2591 ! ここで指定するものは, HistoryCreate の
2592 ! 引数 *dims* で既に指定されてい
2593 ! なければなりません.
2594 !
2595 ! Name of dimensional variable.
2596 !
2597 ! This name must be specified by
2598 ! an argument *dims* in "HistoryCreate".
2599 !
2600 real(DP), intent(in):: array(:)
2601 ! 座標データ.
2602 !
2603 ! Data of axes.
2604 type(GT_HISTORY), intent(inout), optional, target:: history
2605 ! 出力ファイルの設定に関する情報を
2606 ! 格納した GT_HISTORY 型変数
2607 !
2608 ! ここに指定するものは,
2609 ! HistoryCreate によって初期設定
2610 ! されていなければなりません.
2611 !
2612 ! A "GT_HISTORY" type variable that
2613 ! stores information about configuration of
2614 ! an output file
2615 !
2616 ! This must be initialized by
2617 ! "HistoryCreate".
2618 !
2619 logical, intent(out), optional:: err
2620 ! 例外処理用フラグ.
2621 ! デフォルトでは, この手続き内でエラーが
2622 ! 生じた場合, プログラムは強制終了します.
2623 ! 引数 *err* が与えられる場合,
2624 ! プログラムは強制終了せず, 代わりに
2625 ! *err* に .true. が代入されます.
2626 !
2627 ! Exception handling flag.
2628 ! By default, when error occur in
2629 ! this procedure, the program aborts.
2630 ! If this *err* argument is given,
2631 ! .true. is substituted to *err* and
2632 ! the program does not abort.
2633 type(GT_HISTORY), pointer:: hst =>null()
2634 integer:: dimord, dimsize, numdims, i, j, attr_size
2635 type(GT_HISTORY_ATTR), pointer:: attrs(:) =>null()
2636 character(STRING):: dimname
2637 character(STRING):: name, longname, units, xtype, origin_str, url
2638 real(DP):: origin_work
2639 integer:: stat
2640 character(STRING):: cause_c
2641 character(*), parameter:: subname = "HistoryPutAxisMPIDouble"
2642 continue
2643 call beginsub(subname, 'varname=%c', c1 = trim(varname) )
2644 stat = dc_noerr
2645 cause_c = ""
2646 if (present(history)) then
2647 hst => history
2648 else
2649 hst => default
2650 endif
2651 if ( .not. hst % initialized ) then
2652 stat = dc_enotinit
2653 cause_c = 'GT_HISTORY'
2654 goto 999
2655 end if
2656 call dbgmessage( 'mpi_gather=<%b>', l = (/ hst % mpi_gather /) )
2657 if ( .not. hst % mpi_gather ) then
2658 goto 999
2659 else
2660 numdims = size( hst % dimvars )
2661 dimord = -1
2662 do i = 1, numdims
2663 call historyaxisinquire( &
2664 & hst % mpi_fileinfo % axes(i), & ! (in)
2665 & name = dimname ) ! (out)
2666 if ( trim(varname) == trim(dimname) ) then
2667 dimord = i
2668 exit
2669 end if
2670 end do
2671 if ( dimord < 1 ) then
2672 stat = gt_ebaddimname
2673 cause_c = varname
2674 goto 999
2675 end if
2676 dimsize = size( array )
2677 if ( associated( hst % mpi_dimdata_all( dimord ) % a_Axis ) ) then
2678 deallocate( hst % mpi_dimdata_all( dimord ) % a_Axis )
2679 end if
2680 allocate( hst % mpi_dimdata_all( dimord ) % a_Axis(dimsize) )
2681 hst % mpi_dimdata_all( dimord ) % a_Axis = array
2682 hst % mpi_dimdata_all( dimord ) % length = dimsize
2683 end if
2684 ! 全ての (時刻以外の) 座標データが登録されたらファイル出力
2685 ! Output file if data of all axes (excluding time) are registered
2686 !
2687 numdims = size( hst % dimvars )
2688 do i = 1, numdims
2689 if ( hst % unlimited_index == i ) cycle
2690 if ( hst % time_nv_index == i ) cycle
2691 if ( hst % mpi_dimdata_all( i ) % length < 1 ) goto 999
2692 end do
2693 if ( hst % mpi_myrank /= 0 ) goto 2000
2694 if ( hst % mpi_fileinfo % already_output ) goto 999
2695 do i = 1, numdims
2696 call historyaxisinquire( hst % mpi_fileinfo % axes(i), & ! (in)
2697 & name, dimsize, longname, units, xtype ) ! (out)
2698 url = urlmerge(file = hst % mpi_fileinfo % file, var = name)
2699 ! 座標の長さを, このサブルーチンで取得したものに修正
2700 ! Length of axes is modified to one that is gotten by this subroutine
2701 !
2702 if ( hst % unlimited_index /= i ) then
2703 dimsize = hst % mpi_dimdata_all( i ) % length
2704 end if
2705 ! ファイル作成
2706 ! Create file
2707 !
2708 call create( &
2709 & hst % dimvars(i), trim(url), &
2710 & dimsize, xtype = xtype, &
2711 & overwrite = hst % mpi_fileinfo % overwrite )
2712 ! 属性の付加
2713 ! Add attributes
2714 !
2715 call put_attr(hst % dimvars(i), '+Conventions', trim(hst % mpi_fileinfo % conventions ))
2716 if ( hst % mpi_fileinfo % gtver_add ) then
2717 call put_attr(hst % dimvars(i), '+gt_version', trim(hst % mpi_fileinfo % gt_version ))
2718 endif
2719 ! title, source, institution, history, long_name, units 属性の付加
2720 call put_attr(hst % dimvars(i), '+title', hst % mpi_fileinfo % title)
2721 call put_attr(hst % dimvars(i), '+source', hst % mpi_fileinfo % source)
2722 call put_attr(hst % dimvars(i), '+institution', trim(hst % mpi_fileinfo % institution))
2723 call put_attr(hst % dimvars(i), '+history', trim(hst % mpi_fileinfo % nc_history))
2724 call put_attr(hst % dimvars(i), 'long_name', longname)
2725 call put_attr(hst % dimvars(i), 'units', units)
2726 origin_work = hst % origin
2727! origin_work = EvalByUnit( hst % origin, '', hst % unlimited_units_symbol )
2728 origin_str = trim( tochar( origin_work ) ) // &
2729 & ' [' // trim( hst % unlimited_units ) // ']'
2730 ! 座標データの出力
2731 ! Output data of axes
2732 !
2733 if ( hst % unlimited_index /= i ) then
2734 call put(hst % dimvars(i), &
2735 & hst % mpi_dimdata_all( i ) % a_Axis, dimsize )
2736 hst % dim_value_written(i) = .true.
2737 end if
2738 ! 座標の属性の付加
2739 ! Add attributes of axes
2740 !
2741 attrs => hst % mpi_dimdata_all(i) % attrs
2742 if ( associated( attrs ) ) then
2743 attr_size = size( attrs )
2744 do j = 1, attr_size
2745 if ( strhead( 'char', trim(lchar(attrs(j)%attrtype))) ) then
2746 call put_attr(hst % dimvars(i), &
2747 & attrs(j) % attrname, trim( attrs(j) % Charvalue ) )
2748 elseif ( strhead( 'int', trim(lchar(attrs(j)%attrtype))) ) then
2749 if ( attrs(j)%array ) then
2750 call dbgmessage('Intarray(:) is selected.')
2751 call put_attr(hst % dimvars(i), &
2752 & attrs(j) % attrname, attrs(j) % Intarray )
2753 else
2754 call dbgmessage('Intvalue is selected')
2755 call put_attr(hst % dimvars(i), &
2756 & attrs(j) % attrname, (/attrs(j) % Intvalue/) )
2757 endif
2758 elseif ( strhead( 'real', trim(lchar(attrs(j)%attrtype))) ) then
2759 if ( attrs(j)%array ) then
2760 call dbgmessage('Realarray(:) is selected.')
2761 call put_attr(hst % dimvars(i), &
2762 & attrs(j) % attrname, attrs(j) % Realarray )
2763 else
2764 call dbgmessage('Realvalue is selected')
2765 call put_attr(hst % dimvars(i), &
2766 & attrs(j) % attrname, (/attrs(j) % Realvalue/) )
2767 endif
2768 elseif ( strhead( 'double', trim(lchar(attrs(j)%attrtype))) ) then
2769 if ( attrs(j)%array ) then
2770 call dbgmessage('Doublearray(:) is selected.')
2771 call put_attr(hst % dimvars(i), &
2772 & attrs(j) % attrname, attrs(j) % Doublearray )
2773 else
2774 call dbgmessage('Doublevalue is selected')
2775 call put_attr(hst % dimvars(i), &
2776 & attrs(j) % attrname, (/attrs(j) % Doublevalue/) )
2777 endif
2778 elseif ( strhead( 'logical', trim(lchar(attrs(j)%attrtype))) ) then
2779 call put_attr(hst % dimvars(i), &
2780 & attrs(j) % attrname, attrs(j) % Logicalvalue )
2781 else
2782 call dbgmessage('attrtype=<%c>=<%c>is Invalid.' , &
2783 & c1=trim(attrs(j)%attrtype) , &
2784 & c2=trim(lchar(attrs(j)%attrtype)) )
2785 endif
2786 end do
2787 end if
2788 end do
2789 if ( .not. hst % mpi_fileinfo % quiet ) then
2790 call messagenotify('M', subname, &
2791 & '"%c" is created (origin=%c)', &
2792 & c1 = trim( hst % mpi_fileinfo % file ), &
2793 & c2 = trim( origin_str ) )
2794 end if
27952000 continue
2796 hst % mpi_fileinfo % already_output = .true.
2797 ! 終了処理, 例外処理
2798 ! Termination and Exception handling
2799 !
2800999 continue
2801 call storeerror( stat, subname, err, cause_c )
2802 call endsub(subname)
Interface declarations for procedures provided from dc_date.
Derived types and parameters for date and time.
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_noerr
Error storage variables
Definition dc_error.f90:468
integer, parameter, public dc_enotinit
-400 or less: DC utilities errors
Definition dc_error.f90:534
integer, parameter, public gt_ebaddimname
Definition dc_error.f90:511
Message output module.
Handling character types.
Definition dc_string.f90:83
Debug tracing module.
Definition dc_trace.f90:150
subroutine, public dbgmessage(fmt, i, r, d, l, n, c1, c2, c3, ca)
Definition dc_trace.f90:680
subroutine, public beginsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca, version)
Definition dc_trace.f90:476
subroutine, public endsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca)
Definition dc_trace.f90:599
Provides kind type parameter values.
Definition dc_types.f90:55
integer, parameter, public dp
Double Precision Real number
Definition dc_types.f90:92
integer, parameter, public string
Character length for string
Definition dc_types.f90:137
Variable URL string parser.
Definition dc_url.f90:61
type(gt_history), target, save, public default

References dc_trace::beginsub(), dc_trace::dbgmessage(), dc_error::dc_enotinit, dc_error::dc_noerr, gtool_history_internal::default, dc_types::dp, dc_trace::endsub(), dc_error::gt_ebaddimname, dc_error::storeerror(), and dc_types::string.

Here is the call graph for this function:

◆ historyputaxismpiint()

subroutine historyputaxismpiint ( character(*), intent(in)  varname,
integer, dimension(:), intent(in)  array,
type(gt_history), intent(inout), optional, target  history,
logical, intent(out), optional  err 
)

Definition at line 2804 of file historyput.f90.

2806 !
2807 ! MPI 使用時に, 各々のノード上のデータを単一ファイルに
2808 ! 集約して出力する場合には,
2809 ! このサブルーチンに領域全体の座標データを与えてください.
2810 ! また, HistoryCreate のオプショナル論理型引数 *flag_mpi_gather*
2811 ! に .true. を与えてください.
2812 !
2813 ! HistoryPut よりも後に使用してください
2814 ! HistoryAddVariable, HistoryAddAttr よりも前に使用してください.
2815 !
2816 ! When MPI is used, if data on each node is integrated and
2817 ! output to one file, give data of axes in whole area to
2818 ! this subroutine.
2819 ! And give .true. to optional logical argument *flag_mpi_gather*
2820 ! in "HistoryCreate".
2821 !
2822 ! Use this subroutine after "HistoryPut", and
2823 ! before "HistoryAddVariable", "HistoryAddAttr".
2824 !
2826 use gtdata_generic, only: create, put_attr, put
2827 use gtdata_types, only: gt_variable
2828 use dc_error, only: storeerror, dc_noerr, dc_enotinit, &
2830 use dc_url, only: urlmerge
2831 use dc_date_generic, only: evalbyunit
2832 use dc_date_types, only: dc_difftime
2833 use dc_string, only: tochar, lchar, strhead
2834 use dc_message, only: messagenotify
2837 use dc_trace, only: beginsub, endsub, dbgmessage
2838 use dc_types, only: string, dp
2839 implicit none
2840 character(*), intent(in):: varname
2841 integer, intent(in):: array(:)
2842 type(GT_HISTORY), intent(inout), optional, target:: history
2843 logical, intent(out), optional:: err
2844 type(GT_HISTORY), pointer:: hst =>null()
2845 integer:: dimord, dimsize, numdims, i, j, attr_size
2846 type(GT_HISTORY_ATTR), pointer:: attrs(:) =>null()
2847 character(STRING):: dimname
2848 character(STRING):: name, longname, units, xtype, origin_str, url
2849 real(DP):: origin_work
2850 integer:: stat
2851 character(STRING):: cause_c
2852 character(*), parameter:: subname = "HistoryPutAxisMPIInt"
2853 continue
2854 call beginsub(subname, 'varname=%c', c1 = trim(varname) )
2855 stat = dc_noerr
2856 cause_c = ""
2857 if (present(history)) then
2858 hst => history
2859 else
2860 hst => default
2861 endif
2862 if ( .not. hst % initialized ) then
2863 stat = dc_enotinit
2864 cause_c = 'GT_HISTORY'
2865 goto 999
2866 end if
2867 call dbgmessage( 'mpi_gather=<%b>', l = (/ hst % mpi_gather /) )
2868 if ( .not. hst % mpi_gather ) then
2869 goto 999
2870 else
2871 numdims = size( hst % dimvars )
2872 dimord = -1
2873 do i = 1, numdims
2874 call historyaxisinquire( &
2875 & hst % mpi_fileinfo % axes(i), & ! (in)
2876 & name = dimname ) ! (out)
2877 if ( trim(varname) == trim(dimname) ) then
2878 dimord = i
2879 exit
2880 end if
2881 end do
2882 if ( dimord < 1 ) then
2883 stat = gt_ebaddimname
2884 cause_c = varname
2885 goto 999
2886 end if
2887 dimsize = size( array )
2888 if ( associated( hst % mpi_dimdata_all( dimord ) % a_Axis ) ) then
2889 deallocate( hst % mpi_dimdata_all( dimord ) % a_Axis )
2890 end if
2891 allocate( hst % mpi_dimdata_all( dimord ) % a_Axis(dimsize) )
2892 hst % mpi_dimdata_all( dimord ) % a_Axis = array
2893 hst % mpi_dimdata_all( dimord ) % length = dimsize
2894 end if
2895 ! 全ての (時刻以外の) 座標データが登録されたらファイル出力
2896 ! Output file if data of all axes (excluding time) are registered
2897 !
2898 numdims = size( hst % dimvars )
2899 do i = 1, numdims
2900 if ( hst % unlimited_index == i ) cycle
2901 if ( hst % time_nv_index == i ) cycle
2902 if ( hst % mpi_dimdata_all( i ) % length < 1 ) goto 999
2903 end do
2904 if ( hst % mpi_myrank /= 0 ) goto 2000
2905 if ( hst % mpi_fileinfo % already_output ) goto 999
2906 do i = 1, numdims
2907 call historyaxisinquire( hst % mpi_fileinfo % axes(i), & ! (in)
2908 & name, dimsize, longname, units, xtype ) ! (out)
2909 url = urlmerge(file = hst % mpi_fileinfo % file, var = name)
2910 ! 座標の長さを, このサブルーチンで取得したものに修正
2911 ! Length of axes is modified to one that is gotten by this subroutine
2912 !
2913 if ( hst % unlimited_index /= i ) then
2914 dimsize = hst % mpi_dimdata_all( i ) % length
2915 end if
2916 ! ファイル作成
2917 ! Create file
2918 !
2919 call create( &
2920 & hst % dimvars(i), trim(url), &
2921 & dimsize, xtype = xtype, &
2922 & overwrite = hst % mpi_fileinfo % overwrite )
2923 ! 属性の付加
2924 ! Add attributes
2925 !
2926 call put_attr(hst % dimvars(i), '+Conventions', trim(hst % mpi_fileinfo % conventions ))
2927 if ( hst % mpi_fileinfo % gtver_add ) then
2928 call put_attr(hst % dimvars(i), '+gt_version', trim(hst % mpi_fileinfo % gt_version ))
2929 endif
2930 ! title, source, institution, history, long_name, units 属性の付加
2931 call put_attr(hst % dimvars(i), '+title', hst % mpi_fileinfo % title)
2932 call put_attr(hst % dimvars(i), '+source', hst % mpi_fileinfo % source)
2933 call put_attr(hst % dimvars(i), '+institution', trim(hst % mpi_fileinfo % institution))
2934 call put_attr(hst % dimvars(i), '+history', trim(hst % mpi_fileinfo % nc_history))
2935 call put_attr(hst % dimvars(i), 'long_name', longname)
2936 call put_attr(hst % dimvars(i), 'units', units)
2937 origin_work = hst % origin
2938! origin_work = EvalByUnit( hst % origin, '', hst % unlimited_units_symbol )
2939 origin_str = trim( tochar( origin_work ) ) // &
2940 & ' [' // trim( hst % unlimited_units ) // ']'
2941 ! 座標データの出力
2942 ! Output data of axes
2943 !
2944 if ( hst % unlimited_index /= i ) then
2945 call put(hst % dimvars(i), &
2946 & hst % mpi_dimdata_all( i ) % a_Axis, dimsize )
2947 hst % dim_value_written(i) = .true.
2948 end if
2949 ! 座標の属性の付加
2950 ! Add attributes of axes
2951 !
2952 attrs => hst % mpi_dimdata_all(i) % attrs
2953 if ( associated( attrs ) ) then
2954 attr_size = size( attrs )
2955 do j = 1, attr_size
2956 if ( strhead( 'char', trim(lchar(attrs(j)%attrtype))) ) then
2957 call put_attr(hst % dimvars(i), &
2958 & attrs(j) % attrname, trim( attrs(j) % Charvalue ) )
2959 elseif ( strhead( 'int', trim(lchar(attrs(j)%attrtype))) ) then
2960 if ( attrs(j)%array ) then
2961 call dbgmessage('Intarray(:) is selected.')
2962 call put_attr(hst % dimvars(i), &
2963 & attrs(j) % attrname, attrs(j) % Intarray )
2964 else
2965 call dbgmessage('Intvalue is selected')
2966 call put_attr(hst % dimvars(i), &
2967 & attrs(j) % attrname, (/attrs(j) % Intvalue/) )
2968 endif
2969 elseif ( strhead( 'real', trim(lchar(attrs(j)%attrtype))) ) then
2970 if ( attrs(j)%array ) then
2971 call dbgmessage('Realarray(:) is selected.')
2972 call put_attr(hst % dimvars(i), &
2973 & attrs(j) % attrname, attrs(j) % Realarray )
2974 else
2975 call dbgmessage('Realvalue is selected')
2976 call put_attr(hst % dimvars(i), &
2977 & attrs(j) % attrname, (/attrs(j) % Realvalue/) )
2978 endif
2979 elseif ( strhead( 'double', trim(lchar(attrs(j)%attrtype))) ) then
2980 if ( attrs(j)%array ) then
2981 call dbgmessage('Doublearray(:) is selected.')
2982 call put_attr(hst % dimvars(i), &
2983 & attrs(j) % attrname, attrs(j) % Doublearray )
2984 else
2985 call dbgmessage('Doublevalue is selected')
2986 call put_attr(hst % dimvars(i), &
2987 & attrs(j) % attrname, (/attrs(j) % Doublevalue/) )
2988 endif
2989 elseif ( strhead( 'logical', trim(lchar(attrs(j)%attrtype))) ) then
2990 call put_attr(hst % dimvars(i), &
2991 & attrs(j) % attrname, attrs(j) % Logicalvalue )
2992 else
2993 call dbgmessage('attrtype=<%c>=<%c>is Invalid.' , &
2994 & c1=trim(attrs(j)%attrtype) , &
2995 & c2=trim(lchar(attrs(j)%attrtype)) )
2996 endif
2997 end do
2998 end if
2999 end do
3000 if ( .not. hst % mpi_fileinfo % quiet ) then
3001 call messagenotify('M', subname, &
3002 & '"%c" is created (origin=%c)', &
3003 & c1 = trim( hst % mpi_fileinfo % file ), &
3004 & c2 = trim( origin_str ) )
3005 end if
30062000 continue
3007 hst % mpi_fileinfo % already_output = .true.
3008 ! 終了処理, 例外処理
3009 ! Termination and Exception handling
3010 !
3011999 continue
3012 call storeerror( stat, subname, err, cause_c )
3013 call endsub(subname)

References dc_trace::beginsub(), dc_trace::dbgmessage(), dc_error::dc_enotinit, dc_error::dc_noerr, gtool_history_internal::default, dc_types::dp, dc_trace::endsub(), dc_error::gt_ebaddimname, dc_error::storeerror(), and dc_types::string.

Here is the call graph for this function:

◆ historyputaxismpireal()

subroutine historyputaxismpireal ( character(*), intent(in)  varname,
real, dimension(:), intent(in)  array,
type(gt_history), intent(inout), optional, target  history,
logical, intent(out), optional  err 
)

Definition at line 2341 of file historyput.f90.

2343 !
2344 ! MPI 使用時に, 各々のノード上のデータを単一ファイルに
2345 ! 集約して出力する場合には,
2346 ! このサブルーチンに領域全体の座標データを与えてください.
2347 ! また, HistoryCreate のオプショナル論理型引数 *flag_mpi_gather*
2348 ! に .true. を与えてください.
2349 !
2350 ! HistoryPut よりも後に使用してください
2351 ! HistoryAddVariable, HistoryAddAttr よりも前に使用してください.
2352 !
2353 ! When MPI is used, if data on each node is integrated and
2354 ! output to one file, give data of axes in whole area to
2355 ! this subroutine.
2356 ! And give .true. to optional logical argument *flag_mpi_gather*
2357 ! in "HistoryCreate".
2358 !
2359 ! Use this subroutine after "HistoryPut", and
2360 ! before "HistoryAddVariable", "HistoryAddAttr".
2361 !
2363 use gtdata_generic, only: create, put_attr, put
2364 use gtdata_types, only: gt_variable
2365 use dc_error, only: storeerror, dc_noerr, dc_enotinit, &
2367 use dc_url, only: urlmerge
2368 use dc_date_generic, only: evalbyunit
2369 use dc_date_types, only: dc_difftime
2370 use dc_string, only: tochar, lchar, strhead
2371 use dc_message, only: messagenotify
2374 use dc_trace, only: beginsub, endsub, dbgmessage
2375 use dc_types, only: string, dp
2376 implicit none
2377 character(*), intent(in):: varname
2378 real, intent(in):: array(:)
2379 type(GT_HISTORY), intent(inout), optional, target:: history
2380 logical, intent(out), optional:: err
2381 type(GT_HISTORY), pointer:: hst =>null()
2382 integer:: dimord, dimsize, numdims, i, j, attr_size
2383 type(GT_HISTORY_ATTR), pointer:: attrs(:) =>null()
2384 character(STRING):: dimname
2385 character(STRING):: name, longname, units, xtype, origin_str, url
2386 real(DP):: origin_work
2387 integer:: stat
2388 character(STRING):: cause_c
2389 character(*), parameter:: subname = "HistoryPutAxisMPIReal"
2390 continue
2391 call beginsub(subname, 'varname=%c', c1 = trim(varname) )
2392 stat = dc_noerr
2393 cause_c = ""
2394 if (present(history)) then
2395 hst => history
2396 else
2397 hst => default
2398 endif
2399 if ( .not. hst % initialized ) then
2400 stat = dc_enotinit
2401 cause_c = 'GT_HISTORY'
2402 goto 999
2403 end if
2404 call dbgmessage( 'mpi_gather=<%b>', l = (/ hst % mpi_gather /) )
2405 if ( .not. hst % mpi_gather ) then
2406 goto 999
2407 else
2408 numdims = size( hst % dimvars )
2409 dimord = -1
2410 do i = 1, numdims
2411 call historyaxisinquire( &
2412 & hst % mpi_fileinfo % axes(i), & ! (in)
2413 & name = dimname ) ! (out)
2414 if ( trim(varname) == trim(dimname) ) then
2415 dimord = i
2416 exit
2417 end if
2418 end do
2419 if ( dimord < 1 ) then
2420 stat = gt_ebaddimname
2421 cause_c = varname
2422 goto 999
2423 end if
2424 dimsize = size( array )
2425 if ( associated( hst % mpi_dimdata_all( dimord ) % a_Axis ) ) then
2426 deallocate( hst % mpi_dimdata_all( dimord ) % a_Axis )
2427 end if
2428 allocate( hst % mpi_dimdata_all( dimord ) % a_Axis(dimsize) )
2429 hst % mpi_dimdata_all( dimord ) % a_Axis = array
2430 hst % mpi_dimdata_all( dimord ) % length = dimsize
2431 end if
2432 ! 全ての (時刻以外の) 座標データが登録されたらファイル出力
2433 ! Output file if data of all axes (excluding time) are registered
2434 !
2435 numdims = size( hst % dimvars )
2436 do i = 1, numdims
2437 if ( hst % unlimited_index == i ) cycle
2438 if ( hst % time_nv_index == i ) cycle
2439 if ( hst % mpi_dimdata_all( i ) % length < 1 ) goto 999
2440 end do
2441 if ( hst % mpi_myrank /= 0 ) goto 2000
2442 if ( hst % mpi_fileinfo % already_output ) goto 999
2443 do i = 1, numdims
2444 call historyaxisinquire( hst % mpi_fileinfo % axes(i), & ! (in)
2445 & name, dimsize, longname, units, xtype ) ! (out)
2446 url = urlmerge(file = hst % mpi_fileinfo % file, var = name)
2447 ! 座標の長さを, このサブルーチンで取得したものに修正
2448 ! Length of axes is modified to one that is gotten by this subroutine
2449 !
2450 if ( hst % unlimited_index /= i ) then
2451 dimsize = hst % mpi_dimdata_all( i ) % length
2452 end if
2453 ! ファイル作成
2454 ! Create file
2455 !
2456 call create( &
2457 & hst % dimvars(i), trim(url), &
2458 & dimsize, xtype = xtype, &
2459 & overwrite = hst % mpi_fileinfo % overwrite )
2460 ! 属性の付加
2461 ! Add attributes
2462 !
2463 call put_attr(hst % dimvars(i), '+Conventions', trim(hst % mpi_fileinfo % conventions ))
2464 if ( hst % mpi_fileinfo % gtver_add ) then
2465 call put_attr(hst % dimvars(i), '+gt_version', trim(hst % mpi_fileinfo % gt_version ))
2466 endif
2467 ! title, source, institution, history, long_name, units 属性の付加
2468 call put_attr(hst % dimvars(i), '+title', hst % mpi_fileinfo % title)
2469 call put_attr(hst % dimvars(i), '+source', hst % mpi_fileinfo % source)
2470 call put_attr(hst % dimvars(i), '+institution', trim(hst % mpi_fileinfo % institution))
2471 call put_attr(hst % dimvars(i), '+history', trim(hst % mpi_fileinfo % nc_history))
2472 call put_attr(hst % dimvars(i), 'long_name', longname)
2473 call put_attr(hst % dimvars(i), 'units', units)
2474 origin_work = hst % origin
2475! origin_work = EvalByUnit( hst % origin, '', hst % unlimited_units_symbol )
2476 origin_str = trim( tochar( origin_work ) ) // &
2477 & ' [' // trim( hst % unlimited_units ) // ']'
2478 ! 座標データの出力
2479 ! Output data of axes
2480 !
2481 if ( hst % unlimited_index /= i ) then
2482 call put(hst % dimvars(i), &
2483 & hst % mpi_dimdata_all( i ) % a_Axis, dimsize )
2484 hst % dim_value_written(i) = .true.
2485 end if
2486 ! 座標の属性の付加
2487 ! Add attributes of axes
2488 !
2489 attrs => hst % mpi_dimdata_all(i) % attrs
2490 if ( associated( attrs ) ) then
2491 attr_size = size( attrs )
2492 do j = 1, attr_size
2493 if ( strhead( 'char', trim(lchar(attrs(j)%attrtype))) ) then
2494 call put_attr(hst % dimvars(i), &
2495 & attrs(j) % attrname, trim( attrs(j) % Charvalue ) )
2496 elseif ( strhead( 'int', trim(lchar(attrs(j)%attrtype))) ) then
2497 if ( attrs(j)%array ) then
2498 call dbgmessage('Intarray(:) is selected.')
2499 call put_attr(hst % dimvars(i), &
2500 & attrs(j) % attrname, attrs(j) % Intarray )
2501 else
2502 call dbgmessage('Intvalue is selected')
2503 call put_attr(hst % dimvars(i), &
2504 & attrs(j) % attrname, (/attrs(j) % Intvalue/) )
2505 endif
2506 elseif ( strhead( 'real', trim(lchar(attrs(j)%attrtype))) ) then
2507 if ( attrs(j)%array ) then
2508 call dbgmessage('Realarray(:) is selected.')
2509 call put_attr(hst % dimvars(i), &
2510 & attrs(j) % attrname, attrs(j) % Realarray )
2511 else
2512 call dbgmessage('Realvalue is selected')
2513 call put_attr(hst % dimvars(i), &
2514 & attrs(j) % attrname, (/attrs(j) % Realvalue/) )
2515 endif
2516 elseif ( strhead( 'double', trim(lchar(attrs(j)%attrtype))) ) then
2517 if ( attrs(j)%array ) then
2518 call dbgmessage('Doublearray(:) is selected.')
2519 call put_attr(hst % dimvars(i), &
2520 & attrs(j) % attrname, attrs(j) % Doublearray )
2521 else
2522 call dbgmessage('Doublevalue is selected')
2523 call put_attr(hst % dimvars(i), &
2524 & attrs(j) % attrname, (/attrs(j) % Doublevalue/) )
2525 endif
2526 elseif ( strhead( 'logical', trim(lchar(attrs(j)%attrtype))) ) then
2527 call put_attr(hst % dimvars(i), &
2528 & attrs(j) % attrname, attrs(j) % Logicalvalue )
2529 else
2530 call dbgmessage('attrtype=<%c>=<%c>is Invalid.' , &
2531 & c1=trim(attrs(j)%attrtype) , &
2532 & c2=trim(lchar(attrs(j)%attrtype)) )
2533 endif
2534 end do
2535 end if
2536 end do
2537 if ( .not. hst % mpi_fileinfo % quiet ) then
2538 call messagenotify('M', subname, &
2539 & '"%c" is created (origin=%c)', &
2540 & c1 = trim( hst % mpi_fileinfo % file ), &
2541 & c2 = trim( origin_str ) )
2542 end if
25432000 continue
2544 hst % mpi_fileinfo % already_output = .true.
2545 ! 終了処理, 例外処理
2546 ! Termination and Exception handling
2547 !
2548999 continue
2549 call storeerror( stat, subname, err, cause_c )
2550 call endsub(subname)

References dc_trace::beginsub(), dc_trace::dbgmessage(), dc_error::dc_enotinit, dc_error::dc_noerr, gtool_history_internal::default, dc_types::dp, dc_trace::endsub(), dc_error::gt_ebaddimname, dc_error::storeerror(), and dc_types::string.

Here is the call graph for this function:

◆ historyputchar0()

subroutine historyputchar0 ( character(*), intent(in)  varname,
character(*), intent(in)  value,
type(gt_history), intent(inout), optional, target  history,
character(*), intent(in), optional  range,
real, intent(in), optional  time,
logical, intent(in), optional  quiet,
type(dc_difftime), intent(in), optional  difftime,
real(dp), intent(in), optional  timed,
logical, intent(in), optional  time_average_store,
logical, intent(out), optional  err 
)

Definition at line 4524 of file historyput.f90.

4527 !
4528 !
4530 use dc_date_types, only: dc_difftime
4531 use dc_types, only: dp
4532 use dc_trace, only: beginsub, endsub, dbgmessage
4533 implicit none
4534 character(*), intent(in):: varname
4535 character(*), intent(in):: value
4536 type(GT_HISTORY), intent(inout), optional, target:: history
4537 character(*), intent(in), optional:: range
4538 real, intent(in), optional:: time
4539 logical, intent(in), optional:: quiet
4540 type(DC_DIFFTIME), intent(in), optional:: difftime
4541 real(DP), intent(in), optional:: timed
4542 logical, intent(in), optional:: time_average_store
4543 logical, intent(out), optional:: err
4544 interface historyputcharex
4545 subroutine historyputcharex( &
4546 & varname, array, arraysize, history, range, &
4547 & time, quiet, difftime, timed, time_average_store, err )
4549 use dc_date_types, only: dc_difftime
4550 use dc_types, only: dp
4551 character(*), intent(in):: varname
4552 integer, intent(in):: arraysize
4553 character(*), intent(in):: array(arraysize)
4554 type(GT_HISTORY), intent(inout), target, optional:: history
4555 character(*), intent(in), optional:: range
4556 real, intent(in), optional:: time
4557 logical, intent(in), optional:: quiet
4558 type(DC_DIFFTIME), intent(in), optional:: difftime
4559 real(DP), intent(in), optional:: timed
4560 logical, intent(in), optional:: time_average_store
4561 logical, intent(out), optional:: err
4562 end subroutine historyputcharex
4563 end interface
4564 character(*), parameter:: subname = "HistoryPutChar0"
4565 continue
4566 call beginsub(subname)
4567 call historyputcharex( &
4568 & varname, & ! (in)
4569 & (/value/), 1, & ! (in)
4570 & history = history, & ! (inout) optional
4571 & range = range, & ! (in) optional
4572 & time = time, & ! (in) optional
4573 & quiet = quiet, & ! (in) optional
4574 & difftime = difftime, & ! (in) optional
4575 & timed = timed, & ! (in) optional
4576 & time_average_store = &
4577 & time_average_store, & ! (in) optional
4578 & err = err ) ! (out) optional
4579 call endsub(subname)
recursive subroutine historyputcharex(varname, array, arraysize, history, range, time, quiet, difftime, timed, time_average_store, err)
データ出力

References dc_trace::beginsub(), dc_trace::dbgmessage(), dc_types::dp, dc_trace::endsub(), and historyputcharex().

Here is the call graph for this function:

◆ historyputcharex()

recursive subroutine historyputcharex ( character(*), intent(in)  varname,
character(*), dimension(arraysize), intent(in)  array,
integer, intent(in)  arraysize,
type(gt_history), intent(inout), optional, target  history,
character(*), intent(in), optional  range,
real, intent(in), optional  time,
logical, intent(in), optional  quiet,
type(dc_difftime), intent(in), optional  difftime,
real(dp), intent(in), optional  timed,
logical, intent(in), optional  time_average_store,
logical, intent(out), optional  err 
)

データ出力

Parameters
[in]varname

iline 1

こちらは配列サイズを指定する必要があるため、 HistoryPut を利用してください。

Definition at line 2053 of file historyput.f90.

2056 !
2061 !
2066 use gtdata_generic, only: put, gtvarsync, slice, inquire, &
2068 use gtdata_types, only: gt_variable
2069 use dc_types, only: string, dp
2070 use dc_string, only: stoa, printf, tochar, joinchar
2074 use dc_message, only: messagenotify
2075 use dc_url, only: urlsplit, urlmerge
2076 use dc_date_types, only: dc_difftime
2077 use dc_date_generic, only: operator(==), dcdifftimecreate, &
2078 & mod, operator(-), evalbyunit, operator(/), tochar
2079 use dc_trace, only: beginsub, endsub, dbgmessage
2080 use mpi
2081 implicit none
2082 character(*), intent(in):: varname
2083 integer, intent(in):: arraysize
2084 character(*), intent(in):: array(arraysize)
2085 type(GT_HISTORY), intent(inout), target, optional:: history
2086 character(*), intent(in), optional:: range
2087 ! gtool4 のコンマ記法による
2088 ! データの出力範囲指定
2089 !
2090 ! このオプションを用いる
2091 ! 際には、必ず *HistorySetTime*
2092 ! によって明示的に時刻の設定
2093 ! を行ってください。
2094 ! また、*HistoryGet* と異なり、
2095 ! 時刻に関する範囲指定は
2096 ! 行なえません。
2097 !
2098 ! 書式に関する詳細は
2099 ! {gtool4 netCDF 規約}[link:../xref.htm#label-6]
2100 ! の「5.4 コンマ記法」を参照して
2101 ! ください。
2102 real, intent(in), optional:: time
2103 !
2104 ! 時刻. (単精度実数型)
2105 !
2106 ! この引数を与える場合,
2107 ! 出力するかどうかをプログラムが
2108 ! 自動的に判断します.
2109 ! *time* に与えられた数値が
2110 ! HistoryCreate に与えた *interval*
2111 ! で割り切れる場合には出力が行われます.
2112 !
2113 ! HistoryAddVariable で
2114 ! *time_average* (または *average*)
2115 ! に .true. を与えた場合には,
2116 ! *time*, *difftime*
2117 ! のどちらの引数も与えない場合に,
2118 ! プログラムはエラーを発生させます.
2119 !
2120 ! また, この引数と *range* は併用できません.
2121 ! 併用した場合には,
2122 ! プログラムはエラーを発生させます.
2123 !
2124 logical, intent(in), optional:: quiet
2125 ! .false. を与えた場合,
2126 ! このサブルーチンが呼ばれる毎に
2127 ! ファイル名と時刻が表示されます.
2128 ! デフォルトは .true. です.
2129 !
2130 ! If ".false." is given,
2131 ! a filename and time is displayed
2132 ! when this subroutine is called.
2133 ! Default value is ".true.".
2134 !
2135 type(DC_DIFFTIME), intent(in), optional:: difftime
2136 !
2137 ! 時刻 (dc_date_types::DC_DIFFTIME 型)
2138 !
2139 ! 効果は *time* と同様です.
2140 !
2141 real(DP), intent(in), optional:: timed
2142 !
2143 ! 時刻 (倍精度実数型)
2144 !
2145 ! 効果は *time* と同様です.
2146 !
2147 logical, intent(in), optional:: time_average_store
2148 !
2149 ! 平均値の出力フラグ.
2150 ! この値に .true. を与えた場合には,
2151 ! 出力せずに与えられた値を一旦蓄えます.
2152 ! .false. を与えた場合には,
2153 ! *time* もしくは *difftime* と
2154 ! HistoryCreate に与えた *interval* に
2155 ! 関わらず出力を行います.
2156 !
2157 ! HistoryAddVariable で
2158 ! *time_average* (または *average*)
2159 ! に .true. を与えない場合は無効です.
2160 !
2161 ! *time* と *difftime*
2162 ! のどちらかを同時に与える必要があります.
2163 !
2164 logical, intent(out), optional:: err
2165 ! 例外処理用フラグ.
2166 ! デフォルトでは, この手続き内でエラーが
2167 ! 生じた場合, プログラムは強制終了します.
2168 ! 引数 *err* が与えられる場合,
2169 ! プログラムは強制終了せず, 代わりに
2170 ! *err* に .true. が代入されます.
2171 !
2172 ! Exception handling flag.
2173 ! By default, when error occur in
2174 ! this procedure, the program aborts.
2175 ! If this *err* argument is given,
2176 ! .true. is substituted to *err* and
2177 ! the program does not abort.
2178 type(GT_VARIABLE):: var, timevar
2179 character(STRING):: url, file, time_str
2180 real:: time_value(1:1)
2181 type(GT_HISTORY), pointer:: hst =>null()
2182 integer :: v_ord
2183 character(STRING):: avr_msg
2184 integer:: stat
2185 integer:: err_mpi
2186 character(STRING):: cause_c
2187 interface timegoahead
2188 subroutine timegoahead( varname, var, head, history, err )
2189 use gtdata_types, only: gt_variable
2191 character(len = *), intent(in):: varname
2192 type(GT_VARIABLE), intent(out):: var
2193 real, intent(in):: head
2194 type(GT_HISTORY), intent(inout), optional, target:: history
2195 logical, intent(out), optional:: err
2196 end subroutine timegoahead
2197 end interface
2198 character(*), parameter:: subname = "HistoryPutCharEx"
2199 continue
2200 call beginsub(subname, 'varname=%a range=%a', &
2201 & ca=stoa(varname, present_select('', '(no-range)', range)))
2202 stat = dc_noerr
2203 cause_c = ""
2204 if (present(history)) then
2205 hst => history
2206 else
2207 hst => default
2208 endif
2209 !-----------------------------------------------------------------
2210 ! 初期設定のチェック
2211 ! Check initialization
2212 !-----------------------------------------------------------------
2213 if ( .not. hst % initialized ) then
2214 stat = dc_enotinit
2215 cause_c = 'GT_HISTORY'
2216 goto 999
2217 end if
2218 !-----------------------------------------------------------------
2219 ! time と range の同時使用の禁止
2220 ! Permit concurrent use of "time" and "range"
2221 !-----------------------------------------------------------------
2222 if ( ( present(time) .or. present(difftime) .or. present(timed) ) &
2223 & .and. present_and_not_empty(range) ) then
2224 call messagenotify('W', subname, &
2225 & '(varname=%c) "range" and "time" or "timed" or "difftime" are not suppored at the same time', &
2226 & c1 = trim(varname) )
2227 stat = usr_errno
2228 cause_c = '"range" and "time" or "timed" or "difftime" are not suppored at the same time'
2229 goto 999
2230 end if
2231 !-----------------------------------------------------------------
2232 ! hst 内の varname 変数の変数番号を取得
2233 ! Get variable number of "varname" in "hst"
2234 !-----------------------------------------------------------------
2235 if ( .not. hst % mpi_gather ) then
2236 v_ord = lookup_variable_ord(hst, varname)
2237 else
2238 if ( hst % mpi_myrank == 0 ) then
2239 v_ord = lookup_variable_ord(hst, varname)
2240 end if
2241 call mpi_bcast( v_ord, 1, mpi_integer, 0, mpi_comm_world, err_mpi )
2242 call dbgmessage('v_ord=<%d> is shared on all nodes.', i = (/v_ord/) )
2243 end if
2244 if ( present(time_average_store) ) then
2245 continue
2246 end if
2247 !-----------------------------------------------------------------
2248 ! 初期時刻の設定
2249 ! Configure initial time
2250 !-----------------------------------------------------------------
2251 if ( .not. hst % origin_setting ) then
2252 if ( present(difftime) ) then
2253 hst % origin = evalbyunit( difftime, '', hst % unlimited_units_symbol )
2254 hst % time_bnds = evalbyunit( difftime, '', hst % unlimited_units_symbol )
2255 hst % origin_setting = .true.
2256 elseif ( present(timed) ) then
2257 hst % origin = timed
2258 hst % time_bnds = timed
2259 hst % origin_setting = .true.
2260 elseif ( present(time) ) then
2261 hst % origin = time
2262 hst % time_bnds = time
2263 hst % origin_setting = .true.
2264 end if
2265!!$ if ( present(difftime) ) then
2266!!$ hst % origin = difftime
2267!!$ hst % time_bnds = EvalByUnit( difftime, '', hst % unlimited_units_symbol )
2268!!$ hst % origin_setting = .true.
2269!!$ elseif ( present(timed) ) then
2270!!$ call DCDiffTimeCreate( hst % origin, & ! (out)
2271!!$ & real(timed), '', hst % unlimited_units_symbol ) ! (in)
2272!!$ hst % time_bnds = timed
2273!!$ hst % origin_setting = .true.
2274!!$ elseif ( present(time) ) then
2275!!$ call DCDiffTimeCreate( hst % origin, & ! (out)
2276!!$ & time, '', hst % unlimited_units_symbol ) ! (in)
2277!!$ hst % time_bnds = time
2278!!$ hst % origin_setting = .true.
2279!!$ end if
2280 end if
2281 avr_msg = ''
2282 !-----------------------------------------------------------------
2283 ! 時刻を1つ進めて, データ出力
2284 ! Progress one time, and output data
2285 !-----------------------------------------------------------------
2286 if ( .not. hst % mpi_gather &
2287 & .or. ( hst % mpi_gather .and. &
2288 & hst % mpi_myrank == 0 .and. &
2289 & hst % mpi_fileinfo % already_output) ) then
2290 call timegoahead( &
2291 & varname = varname, & ! (in)
2292 & head = 0.0, & ! (in)
2293 & var = var, & ! (out)
2294 & history = history, & ! (inout)
2295 & err = err ) ! (out)
2296 if (present_and_not_empty(range)) then
2297 call dbgmessage('varname=<%c> is string. so range is ignoread.', &
2298 & c1=trim(varname))
2299 end if
2300 call put(var, array, arraysize)
2301 call gtvarsync(var)
2302 end if
2303 !-----------------------------------------------------------------
2304 ! メッセージ出力
2305 ! Output messages
2306 !-----------------------------------------------------------------
2307 if ( .not. hst % mpi_gather &
2308 & .or. ( hst % mpi_gather .and. &
2309 & hst % mpi_myrank == 0 .and. &
2310 & hst % mpi_fileinfo % already_output ) ) then
2311 if ( present_and_false(quiet) ) then
2312 call inquire( hst % dimvars(1), & ! (in)
2313 & url = url ) ! (out)
2314 call urlsplit( fullname = url, & ! (in)
2315 & file = file ) ! (out)
2316 if ( hst % unlimited_index < 1 ) then
2317 time_str = ''
2318 else
2319 timevar = hst % dimvars(hst % unlimited_index)
2320 call slice( timevar, & ! (in)
2321 & 1, start = hst % count(v_ord), count = 1 ) ! (in)
2322 call get( timevar, & ! (inout)
2323 & time_value, & ! (out)
2324 & 1, & ! (in)
2325 & err ) ! (out)
2326 time_str = '(time=' // trim( tochar( time_value(1) )) // ')'
2327 end if
2328 call messagenotify('M', 'HistoryPut', &
2329 & '"%a" => "%a" %a %a', &
2330 & ca = stoa( varname, file, time_str, avr_msg ) )
2331 end if
2332 end if
2333 !-----------------------------------------------------------------
2334 ! 終了処理, 例外処理
2335 ! Termination and Exception handling
2336 !-----------------------------------------------------------------
2337999 continue
2338 call storeerror( stat, subname, err, cause_c )
2339 call endsub(subname)
subroutine timegoahead(varname, var, head, history, err)
integer, parameter, public usr_errno
-1000 or less: User-defined errors
Definition dc_error.f90:579
Judge optional control parameters.
logical function, public present_and_false(arg)
logical function, public present_and_not_empty(arg)
logical function, public present_and_true(arg)
character(string) function, public joinchar(carray, expr)

References dc_trace::beginsub(), dc_trace::dbgmessage(), dc_error::dc_enotinit, dc_error::dc_noerr, gtool_history_internal::default, dc_types::dp, dc_trace::endsub(), dc_string::joinchar(), dc_present::present_and_false(), dc_present::present_and_not_empty(), dc_present::present_and_true(), dc_error::storeerror(), dc_types::string, timegoahead(), and dc_error::usr_errno.

Here is the call graph for this function:

◆ historyputdouble0()

subroutine historyputdouble0 ( character(*), intent(in)  varname,
real(dp), intent(in)  value,
type(gt_history), intent(inout), optional, target  history,
character(*), intent(in), optional  range,
real, intent(in), optional  time,
logical, intent(in), optional  quiet,
type(dc_difftime), intent(in), optional  difftime,
real(dp), intent(in), optional  timed,
logical, intent(in), optional  time_average_store,
logical, intent(out), optional  err 
)

データ出力

Parameters
[in]varname

iline 1

gtool4 データ内の変数へデータの出力を行います。 このサブルーチンを用いる前に、HistoryCreate による初期設定が必要です。

HistoryPut は複数のサブルーチンの総称名です。value に 変数 (整数型、単精度実数型、倍精度実数型、文字型) もしくは 1 〜 7 次元の配列 (整数型、単精度実数型、倍精度実数型) を与えることが可能です。 下記の同名のサブルーチンを参照ください。 ただし、多次元配列を与える際の引数キーワードには array を用いてください。

HistoryPut を最初に呼んだ時、時間次元の変数は HistoryCreate の origin の値に設定されます。

ある変数 varname に対して HistoryPut を複数回呼ぶと、 HistoryCreate の interval × HistoryPut を呼んだ回数、 の分だけ 時間次元の変数の値が増やされます。 ただし、時間平均値を出力する場合は例外です。 以下の時間平均に関する項目を参照ください。

これらの時間次元の変数の値を明示的に設定したい場合は HistorySetTime を用いるか、HistoryPut 自身で時間次元の変数へ値 を出力してください。

時間平均について

時間平均については HistoryAddVariable を参照ください。

Definition at line 3015 of file historyput.f90.

3018 !
3019 !
3050 !
3051 !
3053 use dc_date_types, only: dc_difftime
3054 use dc_types, only: dp
3055 use dc_trace, only: beginsub, endsub, dbgmessage
3056 implicit none
3057 character(*), intent(in):: varname
3058 ! 変数の名前
3059 !
3060 ! ただし、ここで指定するもの
3061 ! は、 HistoryCreateの *dims*
3062 ! または HistoryAddVariable や
3063 ! HistoryCopyVariable の
3064 ! *varname* で既に指定されてい
3065 ! なければなりません。
3066 !
3067 real(DP), intent(in):: value
3068 ! 変数が出力するデータ
3069 !
3070 ! 型は単精度実数型でも
3071 ! 倍精度実数型でもよいですが、
3072 ! HistoryAddVariable の
3073 ! *xtype* で指定した
3074 ! データ型と異なる
3075 ! 型を渡した場合、xtype で
3076 ! 指定した型に変換されます。
3077 !
3078 type(GT_HISTORY), intent(inout), optional, target:: history
3079 ! 出力ファイルの設定に関する情報を
3080 ! 格納した構造体
3081 !
3082 ! ここに指定するものは、
3083 ! HistoryCreate によって初期設定
3084 ! されていなければなりません。
3085 !
3086 character(*), intent(in), optional:: range
3087 ! gtool4 のコンマ記法による
3088 ! データの出力範囲指定
3089 !
3090 ! このオプションを用いる
3091 ! 際には、必ず *HistorySetTime*
3092 ! によって明示的に時刻の設定
3093 ! を行ってください。
3094 ! また、*HistoryGet* と異なり、
3095 ! 時刻に関する範囲指定は
3096 ! 行なえません。
3097 !
3098 ! 書式に関する詳細は
3099 ! {gtool4 netCDF 規約}[link:../xref.htm#label-6]
3100 ! の「5.4 コンマ記法」を参照して
3101 ! ください。
3102 real, intent(in), optional:: time
3103 !
3104 ! 時刻. (単精度実数型)
3105 !
3106 ! この引数を与える場合,
3107 ! 出力するかどうかをプログラムが
3108 ! 自動的に判断します.
3109 ! *time* に与えられた数値が
3110 ! HistoryCreate に与えた *interval*
3111 ! で割り切れる場合には出力が行われます.
3112 !
3113 ! HistoryAddVariable で
3114 ! *time_average* (または *average*)
3115 ! に .true. を与えた場合には,
3116 ! *time*, *difftime*
3117 ! のどちらの引数も与えない場合に,
3118 ! プログラムはエラーを発生させます.
3119 !
3120 ! この引数と *difftime*, *time_average_store*
3121 ! が同時に与えられた場合,
3122 ! *time_average_store* が優先されます.
3123 !
3124 ! また, この引数と *range* は併用できません.
3125 ! 併用した場合には,
3126 ! プログラムはエラーを発生させます.
3127 !
3128 logical, intent(in), optional:: quiet
3129 ! .true. を与えた場合,
3130 ! メッセージ出力が抑制されます.
3131 !
3132 ! If ".true." is given,
3133 ! messages are suppressed.
3134 !
3135 type(DC_DIFFTIME), intent(in), optional:: difftime
3136 !
3137 ! 時刻 (dc_date_types::DC_DIFFTIME 型)
3138 !
3139 ! 効果は *time* と同様です.
3140 real(DP), intent(in), optional:: timed
3141 !
3142 ! 時刻 (倍精度実数型)
3143 !
3144 ! 効果は *time* と同様です.
3145 logical, intent(in), optional:: time_average_store
3146 !
3147 ! 平均値の出力フラグ.
3148 ! この値に .true. を与えた場合には,
3149 ! 出力せずに与えられた値を一旦蓄えます.
3150 ! .false. を与えた場合には,
3151 ! *time* もしくは *difftime* と
3152 ! HistoryCreate に与えた *interval* に
3153 ! 関わらず出力を行います.
3154 !
3155 ! HistoryAddVariable で
3156 ! *time_average* (または *average*)
3157 ! に .true. を与えない場合は無効です.
3158 !
3159 ! *time* と *difftime*
3160 ! のどちらかを同時に与える必要があります.
3161 !
3162 logical, intent(out), optional:: err
3163 ! 例外処理用フラグ.
3164 ! デフォルトでは, この手続き内でエラーが
3165 ! 生じた場合, プログラムは強制終了します.
3166 ! 引数 *err* が与えられる場合,
3167 ! プログラムは強制終了せず, 代わりに
3168 ! *err* に .true. が代入されます.
3169 !
3170 ! Exception handling flag.
3171 ! By default, when error occur in
3172 ! this procedure, the program aborts.
3173 ! If this *err* argument is given,
3174 ! .true. is substituted to *err* and
3175 ! the program does not abort.
3176 interface historyputdoubleex
3177 subroutine historyputdoubleex( &
3178 & varname, array, arraysize, history, range, &
3179 & time, quiet, difftime, timed, time_average_store, err )
3181 use dc_date_types, only: dc_difftime
3182 use dc_types, only: dp
3183 character(*), intent(in):: varname
3184 integer, intent(in):: arraysize
3185 real(DP), intent(in):: array(arraysize)
3186 type(GT_HISTORY), intent(inout), target, optional:: history
3187 character(*), intent(in), optional:: range
3188 real, intent(in), optional:: time
3189 logical, intent(in), optional:: quiet
3190 type(DC_DIFFTIME), intent(in), optional:: difftime
3191 real(DP), intent(in), optional:: timed
3192 logical, intent(in), optional:: time_average_store
3193 logical, intent(out), optional:: err
3194 end subroutine historyputdoubleex
3195 end interface
3196 character(*), parameter:: subname = "HistoryPutDouble0"
3197 continue
3198 call beginsub(subname)
3199 call historyputdoubleex( &
3200 & varname, & ! (in)
3201 & (/value/), 1, & ! (in)
3202 & history = history, & ! (inout) optional
3203 & range = range, & ! (in) optional
3204 & time = time, & ! (in) optional
3205 & quiet = quiet, & ! (in) optional
3206 & difftime = difftime, & ! (in) optional
3207 & timed = timed, & ! (in) optional
3208 & time_average_store = &
3209 & time_average_store, & ! (in) optional
3210 & err = err ) ! (out) optional
3211 call endsub(subname)
recursive subroutine historyputdoubleex(varname, array, arraysize, history, range, time, quiet, difftime, timed, time_average_store, err)
データ出力

References dc_trace::beginsub(), dc_trace::dbgmessage(), dc_types::dp, dc_trace::endsub(), and historyputdoubleex().

Here is the call graph for this function:

◆ historyputdouble1()

subroutine historyputdouble1 ( character(*), intent(in)  varname,
real(dp), dimension(:), intent(in)  array,
type(gt_history), intent(inout), optional, target  history,
character(*), intent(in), optional  range,
real, intent(in), optional  time,
logical, intent(in), optional  quiet,
type(dc_difftime), intent(in), optional  difftime,
real(dp), intent(in), optional  timed,
logical, intent(in), optional  time_average_store,
logical, intent(out), optional  err 
)

Definition at line 3213 of file historyput.f90.

3216 !
3217 !
3219 use dc_date_types, only: dc_difftime
3220 use dc_types, only: dp
3221 use dc_trace, only: beginsub, endsub, dbgmessage
3222 implicit none
3223 character(*), intent(in):: varname
3224 real(DP), intent(in):: array(:)
3225 type(GT_HISTORY), intent(inout), optional, target:: history
3226 character(*), intent(in), optional:: range
3227 real, intent(in), optional:: time
3228 logical, intent(in), optional:: quiet
3229 type(DC_DIFFTIME), intent(in), optional:: difftime
3230 real(DP), intent(in), optional:: timed
3231 logical, intent(in), optional:: time_average_store
3232 logical, intent(out), optional:: err
3233 interface historyputdoubleex
3234 subroutine historyputdoubleex( &
3235 & varname, array, arraysize, history, range, &
3236 & time, quiet, difftime, timed, time_average_store, err )
3238 use dc_date_types, only: dc_difftime
3239 use dc_types, only: dp
3240 character(*), intent(in):: varname
3241 integer, intent(in):: arraysize
3242 real(DP), intent(in):: array(arraysize)
3243 type(GT_HISTORY), intent(inout), target, optional:: history
3244 character(*), intent(in), optional:: range
3245 real, intent(in), optional:: time
3246 logical, intent(in), optional:: quiet
3247 type(DC_DIFFTIME), intent(in), optional:: difftime
3248 real(DP), intent(in), optional:: timed
3249 logical, intent(in), optional:: time_average_store
3250 logical, intent(out), optional:: err
3251 end subroutine historyputdoubleex
3252 end interface
3253 character(*), parameter:: subname = "HistoryPutDouble1"
3254 continue
3255 call beginsub(subname)
3256 call historyputdoubleex( &
3257 & varname, & ! (in)
3258 & pack(array, .true.), size(array), & ! (in)
3259 & history = history, & ! (inout) optional
3260 & range = range, & ! (in) optional
3261 & time = time, & ! (in) optional
3262 & quiet = quiet, & ! (in) optional
3263 & difftime = difftime, & ! (in) optional
3264 & timed = timed, & ! (in) optional
3265 & time_average_store = &
3266 & time_average_store, & ! (in) optional
3267 & err = err ) ! (out) optional
3268 call endsub(subname)

References dc_trace::beginsub(), dc_trace::dbgmessage(), dc_types::dp, dc_trace::endsub(), and historyputdoubleex().

Here is the call graph for this function:

◆ historyputdouble2()

subroutine historyputdouble2 ( character(*), intent(in)  varname,
real(dp), dimension(:,:), intent(in)  array,
type(gt_history), intent(inout), optional, target  history,
character(*), intent(in), optional  range,
real, intent(in), optional  time,
logical, intent(in), optional  quiet,
type(dc_difftime), intent(in), optional  difftime,
real(dp), intent(in), optional  timed,
logical, intent(in), optional  time_average_store,
logical, intent(out), optional  err 
)

Definition at line 3270 of file historyput.f90.

3273 !
3274 !
3276 use dc_date_types, only: dc_difftime
3277 use dc_types, only: dp
3278 use dc_trace, only: beginsub, endsub, dbgmessage
3279 implicit none
3280 character(*), intent(in):: varname
3281 real(DP), intent(in):: array(:,:)
3282 type(GT_HISTORY), intent(inout), optional, target:: history
3283 character(*), intent(in), optional:: range
3284 real, intent(in), optional:: time
3285 logical, intent(in), optional:: quiet
3286 type(DC_DIFFTIME), intent(in), optional:: difftime
3287 real(DP), intent(in), optional:: timed
3288 logical, intent(in), optional:: time_average_store
3289 logical, intent(out), optional:: err
3290 interface historyputdoubleex
3291 subroutine historyputdoubleex( &
3292 & varname, array, arraysize, history, range, &
3293 & time, quiet, difftime, timed, time_average_store, err )
3295 use dc_date_types, only: dc_difftime
3296 use dc_types, only: dp
3297 character(*), intent(in):: varname
3298 integer, intent(in):: arraysize
3299 real(DP), intent(in):: array(arraysize)
3300 type(GT_HISTORY), intent(inout), target, optional:: history
3301 character(*), intent(in), optional:: range
3302 real, intent(in), optional:: time
3303 logical, intent(in), optional:: quiet
3304 type(DC_DIFFTIME), intent(in), optional:: difftime
3305 real(DP), intent(in), optional:: timed
3306 logical, intent(in), optional:: time_average_store
3307 logical, intent(out), optional:: err
3308 end subroutine historyputdoubleex
3309 end interface
3310 character(*), parameter:: subname = "HistoryPutDouble2"
3311 continue
3312 call beginsub(subname)
3313 call historyputdoubleex( &
3314 & varname, & ! (in)
3315 & pack(array, .true.), size(array), & ! (in)
3316 & history = history, & ! (inout) optional
3317 & range = range, & ! (in) optional
3318 & time = time, & ! (in) optional
3319 & quiet = quiet, & ! (in) optional
3320 & difftime = difftime, & ! (in) optional
3321 & timed = timed, & ! (in) optional
3322 & time_average_store = &
3323 & time_average_store, & ! (in) optional
3324 & err = err ) ! (out) optional
3325 call endsub(subname)

References dc_trace::beginsub(), dc_trace::dbgmessage(), dc_types::dp, dc_trace::endsub(), and historyputdoubleex().

Here is the call graph for this function:

◆ historyputdouble3()

subroutine historyputdouble3 ( character(*), intent(in)  varname,
real(dp), dimension(:,:,:), intent(in)  array,
type(gt_history), intent(inout), optional, target  history,
character(*), intent(in), optional  range,
real, intent(in), optional  time,
logical, intent(in), optional  quiet,
type(dc_difftime), intent(in), optional  difftime,
real(dp), intent(in), optional  timed,
logical, intent(in), optional  time_average_store,
logical, intent(out), optional  err 
)

Definition at line 3327 of file historyput.f90.

3330 !
3331 !
3333 use dc_date_types, only: dc_difftime
3334 use dc_types, only: dp
3335 use dc_trace, only: beginsub, endsub, dbgmessage
3336 implicit none
3337 character(*), intent(in):: varname
3338 real(DP), intent(in):: array(:,:,:)
3339 type(GT_HISTORY), intent(inout), optional, target:: history
3340 character(*), intent(in), optional:: range
3341 real, intent(in), optional:: time
3342 logical, intent(in), optional:: quiet
3343 type(DC_DIFFTIME), intent(in), optional:: difftime
3344 real(DP), intent(in), optional:: timed
3345 logical, intent(in), optional:: time_average_store
3346 logical, intent(out), optional:: err
3347 interface historyputdoubleex
3348 subroutine historyputdoubleex( &
3349 & varname, array, arraysize, history, range, &
3350 & time, quiet, difftime, timed, time_average_store, err )
3352 use dc_date_types, only: dc_difftime
3353 use dc_types, only: dp
3354 character(*), intent(in):: varname
3355 integer, intent(in):: arraysize
3356 real(DP), intent(in):: array(arraysize)
3357 type(GT_HISTORY), intent(inout), target, optional:: history
3358 character(*), intent(in), optional:: range
3359 real, intent(in), optional:: time
3360 logical, intent(in), optional:: quiet
3361 type(DC_DIFFTIME), intent(in), optional:: difftime
3362 real(DP), intent(in), optional:: timed
3363 logical, intent(in), optional:: time_average_store
3364 logical, intent(out), optional:: err
3365 end subroutine historyputdoubleex
3366 end interface
3367 character(*), parameter:: subname = "HistoryPutDouble3"
3368 continue
3369 call beginsub(subname)
3370 call historyputdoubleex( &
3371 & varname, & ! (in)
3372 & pack(array, .true.), size(array), & ! (in)
3373 & history = history, & ! (inout) optional
3374 & range = range, & ! (in) optional
3375 & time = time, & ! (in) optional
3376 & quiet = quiet, & ! (in) optional
3377 & difftime = difftime, & ! (in) optional
3378 & timed = timed, & ! (in) optional
3379 & time_average_store = &
3380 & time_average_store, & ! (in) optional
3381 & err = err ) ! (out) optional
3382 call endsub(subname)

References dc_trace::beginsub(), dc_trace::dbgmessage(), dc_types::dp, dc_trace::endsub(), and historyputdoubleex().

Here is the call graph for this function:

◆ historyputdouble4()

subroutine historyputdouble4 ( character(*), intent(in)  varname,
real(dp), dimension(:,:,:,:), intent(in)  array,
type(gt_history), intent(inout), optional, target  history,
character(*), intent(in), optional  range,
real, intent(in), optional  time,
logical, intent(in), optional  quiet,
type(dc_difftime), intent(in), optional  difftime,
real(dp), intent(in), optional  timed,
logical, intent(in), optional  time_average_store,
logical, intent(out), optional  err 
)

Definition at line 3384 of file historyput.f90.

3387 !
3388 !
3390 use dc_date_types, only: dc_difftime
3391 use dc_types, only: dp
3392 use dc_trace, only: beginsub, endsub, dbgmessage
3393 implicit none
3394 character(*), intent(in):: varname
3395 real(DP), intent(in):: array(:,:,:,:)
3396 type(GT_HISTORY), intent(inout), optional, target:: history
3397 character(*), intent(in), optional:: range
3398 real, intent(in), optional:: time
3399 logical, intent(in), optional:: quiet
3400 type(DC_DIFFTIME), intent(in), optional:: difftime
3401 real(DP), intent(in), optional:: timed
3402 logical, intent(in), optional:: time_average_store
3403 logical, intent(out), optional:: err
3404 interface historyputdoubleex
3405 subroutine historyputdoubleex( &
3406 & varname, array, arraysize, history, range, &
3407 & time, quiet, difftime, timed, time_average_store, err )
3409 use dc_date_types, only: dc_difftime
3410 use dc_types, only: dp
3411 character(*), intent(in):: varname
3412 integer, intent(in):: arraysize
3413 real(DP), intent(in):: array(arraysize)
3414 type(GT_HISTORY), intent(inout), target, optional:: history
3415 character(*), intent(in), optional:: range
3416 real, intent(in), optional:: time
3417 logical, intent(in), optional:: quiet
3418 type(DC_DIFFTIME), intent(in), optional:: difftime
3419 real(DP), intent(in), optional:: timed
3420 logical, intent(in), optional:: time_average_store
3421 logical, intent(out), optional:: err
3422 end subroutine historyputdoubleex
3423 end interface
3424 character(*), parameter:: subname = "HistoryPutDouble4"
3425 continue
3426 call beginsub(subname)
3427 call historyputdoubleex( &
3428 & varname, & ! (in)
3429 & pack(array, .true.), size(array), & ! (in)
3430 & history = history, & ! (inout) optional
3431 & range = range, & ! (in) optional
3432 & time = time, & ! (in) optional
3433 & quiet = quiet, & ! (in) optional
3434 & difftime = difftime, & ! (in) optional
3435 & timed = timed, & ! (in) optional
3436 & time_average_store = &
3437 & time_average_store, & ! (in) optional
3438 & err = err ) ! (out) optional
3439 call endsub(subname)

References dc_trace::beginsub(), dc_trace::dbgmessage(), dc_types::dp, dc_trace::endsub(), and historyputdoubleex().

Here is the call graph for this function:

◆ historyputdouble5()

subroutine historyputdouble5 ( character(*), intent(in)  varname,
real(dp), dimension(:,:,:,:,:), intent(in)  array,
type(gt_history), intent(inout), optional, target  history,
character(*), intent(in), optional  range,
real, intent(in), optional  time,
logical, intent(in), optional  quiet,
type(dc_difftime), intent(in), optional  difftime,
real(dp), intent(in), optional  timed,
logical, intent(in), optional  time_average_store,
logical, intent(out), optional  err 
)

Definition at line 3441 of file historyput.f90.

3444 !
3445 !
3447 use dc_date_types, only: dc_difftime
3448 use dc_types, only: dp
3449 use dc_trace, only: beginsub, endsub, dbgmessage
3450 implicit none
3451 character(*), intent(in):: varname
3452 real(DP), intent(in):: array(:,:,:,:,:)
3453 type(GT_HISTORY), intent(inout), optional, target:: history
3454 character(*), intent(in), optional:: range
3455 real, intent(in), optional:: time
3456 logical, intent(in), optional:: quiet
3457 type(DC_DIFFTIME), intent(in), optional:: difftime
3458 real(DP), intent(in), optional:: timed
3459 logical, intent(in), optional:: time_average_store
3460 logical, intent(out), optional:: err
3461 interface historyputdoubleex
3462 subroutine historyputdoubleex( &
3463 & varname, array, arraysize, history, range, &
3464 & time, quiet, difftime, timed, time_average_store, err )
3466 use dc_date_types, only: dc_difftime
3467 use dc_types, only: dp
3468 character(*), intent(in):: varname
3469 integer, intent(in):: arraysize
3470 real(DP), intent(in):: array(arraysize)
3471 type(GT_HISTORY), intent(inout), target, optional:: history
3472 character(*), intent(in), optional:: range
3473 real, intent(in), optional:: time
3474 logical, intent(in), optional:: quiet
3475 type(DC_DIFFTIME), intent(in), optional:: difftime
3476 real(DP), intent(in), optional:: timed
3477 logical, intent(in), optional:: time_average_store
3478 logical, intent(out), optional:: err
3479 end subroutine historyputdoubleex
3480 end interface
3481 character(*), parameter:: subname = "HistoryPutDouble5"
3482 continue
3483 call beginsub(subname)
3484 call historyputdoubleex( &
3485 & varname, & ! (in)
3486 & pack(array, .true.), size(array), & ! (in)
3487 & history = history, & ! (inout) optional
3488 & range = range, & ! (in) optional
3489 & time = time, & ! (in) optional
3490 & quiet = quiet, & ! (in) optional
3491 & difftime = difftime, & ! (in) optional
3492 & timed = timed, & ! (in) optional
3493 & time_average_store = &
3494 & time_average_store, & ! (in) optional
3495 & err = err ) ! (out) optional
3496 call endsub(subname)

References dc_trace::beginsub(), dc_trace::dbgmessage(), dc_types::dp, dc_trace::endsub(), and historyputdoubleex().

Here is the call graph for this function:

◆ historyputdouble6()

subroutine historyputdouble6 ( character(*), intent(in)  varname,
real(dp), dimension(:,:,:,:,:,:), intent(in)  array,
type(gt_history), intent(inout), optional, target  history,
character(*), intent(in), optional  range,
real, intent(in), optional  time,
logical, intent(in), optional  quiet,
type(dc_difftime), intent(in), optional  difftime,
real(dp), intent(in), optional  timed,
logical, intent(in), optional  time_average_store,
logical, intent(out), optional  err 
)

Definition at line 3498 of file historyput.f90.

3501 !
3502 !
3504 use dc_date_types, only: dc_difftime
3505 use dc_types, only: dp
3506 use dc_trace, only: beginsub, endsub, dbgmessage
3507 implicit none
3508 character(*), intent(in):: varname
3509 real(DP), intent(in):: array(:,:,:,:,:,:)
3510 type(GT_HISTORY), intent(inout), optional, target:: history
3511 character(*), intent(in), optional:: range
3512 real, intent(in), optional:: time
3513 logical, intent(in), optional:: quiet
3514 type(DC_DIFFTIME), intent(in), optional:: difftime
3515 real(DP), intent(in), optional:: timed
3516 logical, intent(in), optional:: time_average_store
3517 logical, intent(out), optional:: err
3518 interface historyputdoubleex
3519 subroutine historyputdoubleex( &
3520 & varname, array, arraysize, history, range, &
3521 & time, quiet, difftime, timed, time_average_store, err )
3523 use dc_date_types, only: dc_difftime
3524 use dc_types, only: dp
3525 character(*), intent(in):: varname
3526 integer, intent(in):: arraysize
3527 real(DP), intent(in):: array(arraysize)
3528 type(GT_HISTORY), intent(inout), target, optional:: history
3529 character(*), intent(in), optional:: range
3530 real, intent(in), optional:: time
3531 logical, intent(in), optional:: quiet
3532 type(DC_DIFFTIME), intent(in), optional:: difftime
3533 real(DP), intent(in), optional:: timed
3534 logical, intent(in), optional:: time_average_store
3535 logical, intent(out), optional:: err
3536 end subroutine historyputdoubleex
3537 end interface
3538 character(*), parameter:: subname = "HistoryPutDouble6"
3539 continue
3540 call beginsub(subname)
3541 call historyputdoubleex( &
3542 & varname, & ! (in)
3543 & pack(array, .true.), size(array), & ! (in)
3544 & history = history, & ! (inout) optional
3545 & range = range, & ! (in) optional
3546 & time = time, & ! (in) optional
3547 & quiet = quiet, & ! (in) optional
3548 & difftime = difftime, & ! (in) optional
3549 & timed = timed, & ! (in) optional
3550 & time_average_store = &
3551 & time_average_store, & ! (in) optional
3552 & err = err ) ! (out) optional
3553 call endsub(subname)

References dc_trace::beginsub(), dc_trace::dbgmessage(), dc_types::dp, dc_trace::endsub(), and historyputdoubleex().

Here is the call graph for this function:

◆ historyputdouble7()

subroutine historyputdouble7 ( character(*), intent(in)  varname,
real(dp), dimension(:,:,:,:,:,:,:), intent(in)  array,
type(gt_history), intent(inout), optional, target  history,
character(*), intent(in), optional  range,
real, intent(in), optional  time,
logical, intent(in), optional  quiet,
type(dc_difftime), intent(in), optional  difftime,
real(dp), intent(in), optional  timed,
logical, intent(in), optional  time_average_store,
logical, intent(out), optional  err 
)

Definition at line 3555 of file historyput.f90.

3558 !
3559 !
3561 use dc_date_types, only: dc_difftime
3562 use dc_types, only: dp
3563 use dc_trace, only: beginsub, endsub, dbgmessage
3564 implicit none
3565 character(*), intent(in):: varname
3566 real(DP), intent(in):: array(:,:,:,:,:,:,:)
3567 type(GT_HISTORY), intent(inout), optional, target:: history
3568 character(*), intent(in), optional:: range
3569 real, intent(in), optional:: time
3570 logical, intent(in), optional:: quiet
3571 type(DC_DIFFTIME), intent(in), optional:: difftime
3572 real(DP), intent(in), optional:: timed
3573 logical, intent(in), optional:: time_average_store
3574 logical, intent(out), optional:: err
3575 interface historyputdoubleex
3576 subroutine historyputdoubleex( &
3577 & varname, array, arraysize, history, range, &
3578 & time, quiet, difftime, timed, time_average_store, err )
3580 use dc_date_types, only: dc_difftime
3581 use dc_types, only: dp
3582 character(*), intent(in):: varname
3583 integer, intent(in):: arraysize
3584 real(DP), intent(in):: array(arraysize)
3585 type(GT_HISTORY), intent(inout), target, optional:: history
3586 character(*), intent(in), optional:: range
3587 real, intent(in), optional:: time
3588 logical, intent(in), optional:: quiet
3589 type(DC_DIFFTIME), intent(in), optional:: difftime
3590 real(DP), intent(in), optional:: timed
3591 logical, intent(in), optional:: time_average_store
3592 logical, intent(out), optional:: err
3593 end subroutine historyputdoubleex
3594 end interface
3595 character(*), parameter:: subname = "HistoryPutDouble7"
3596 continue
3597 call beginsub(subname)
3598 call historyputdoubleex( &
3599 & varname, & ! (in)
3600 & pack(array, .true.), size(array), & ! (in)
3601 & history = history, & ! (inout) optional
3602 & range = range, & ! (in) optional
3603 & time = time, & ! (in) optional
3604 & quiet = quiet, & ! (in) optional
3605 & difftime = difftime, & ! (in) optional
3606 & timed = timed, & ! (in) optional
3607 & time_average_store = &
3608 & time_average_store, & ! (in) optional
3609 & err = err ) ! (out) optional
3610 call endsub(subname)

References dc_trace::beginsub(), dc_trace::dbgmessage(), dc_types::dp, dc_trace::endsub(), and historyputdoubleex().

Here is the call graph for this function:

◆ historyputdoubleex()

recursive subroutine historyputdoubleex ( character(*), intent(in)  varname,
real(dp), dimension(arraysize), intent(in)  array,
integer, intent(in)  arraysize,
type(gt_history), intent(inout), optional, target  history,
character(*), intent(in), optional  range,
real, intent(in), optional  time,
logical, intent(in), optional  quiet,
type(dc_difftime), intent(in), optional  difftime,
real(dp), intent(in), optional  timed,
logical, intent(in), optional  time_average_store,
logical, intent(out), optional  err 
)

データ出力

Parameters
[in]varname

iline 1

こちらは配列サイズを指定する必要があるため、 HistoryPut を利用してください。

Definition at line 709 of file historyput.f90.

712 !
717 !
722 use gtdata_generic, only: put, gtvarsync, slice, inquire, &
724 use gtdata_types, only: gt_variable
725 use dc_types, only: string, dp, dp_eps
726 use dc_string, only: stoa, printf, tochar, joinchar
730 use dc_message, only: messagenotify
731 use dc_url, only: urlsplit, urlmerge
732 use dc_date_types, only: dc_difftime
733 use dc_date_generic, only: operator(==), dcdifftimecreate, &
734 & mod, operator(-), evalbyunit, operator(/), tochar
736 use mpi
737 implicit none
738 character(*), intent(in):: varname
739 integer, intent(in):: arraysize
740 real(DP), intent(in):: array(arraysize)
741 type(GT_HISTORY), intent(inout), target, optional:: history
742 character(*), intent(in), optional:: range
743 ! gtool4 のコンマ記法による
744 ! データの出力範囲指定
745 !
746 ! このオプションを用いる
747 ! 際には、必ず *HistorySetTime*
748 ! によって明示的に時刻の設定
749 ! を行ってください。
750 ! また、*HistoryGet* と異なり、
751 ! 時刻に関する範囲指定は
752 ! 行なえません。
753 !
754 ! 書式に関する詳細は
755 ! {gtool4 netCDF 規約}[link:../xref.htm#label-6]
756 ! の「5.4 コンマ記法」を参照して
757 ! ください。
758 real, intent(in), optional:: time
759 !
760 ! 時刻. (単精度実数型)
761 !
762 ! この引数を与える場合,
763 ! 出力するかどうかをプログラムが
764 ! 自動的に判断します.
765 ! *time* に与えられた数値が
766 ! HistoryCreate に与えた *interval*
767 ! で割り切れる場合には出力が行われます.
768 !
769 ! HistoryAddVariable で
770 ! *time_average* (または *average*)
771 ! に .true. を与えた場合には,
772 ! *time*, *difftime*
773 ! のどちらの引数も与えない場合に,
774 ! プログラムはエラーを発生させます.
775 !
776 ! また, この引数と *range* は併用できません.
777 ! 併用した場合には,
778 ! プログラムはエラーを発生させます.
779 !
780 logical, intent(in), optional:: quiet
781 ! .false. を与えた場合,
782 ! このサブルーチンが呼ばれる毎に
783 ! ファイル名と時刻が表示されます.
784 ! デフォルトは .true. です.
785 !
786 ! If ".false." is given,
787 ! a filename and time is displayed
788 ! when this subroutine is called.
789 ! Default value is ".true.".
790 !
791 type(DC_DIFFTIME), intent(in), optional:: difftime
792 !
793 ! 時刻 (dc_date_types::DC_DIFFTIME 型)
794 !
795 ! 効果は *time* と同様です.
796 !
797 real(DP), intent(in), optional:: timed
798 !
799 ! 時刻 (倍精度実数型)
800 !
801 ! 効果は *time* と同様です.
802 !
803 logical, intent(in), optional:: time_average_store
804 !
805 ! 平均値の出力フラグ.
806 ! この値に .true. を与えた場合には,
807 ! 出力せずに与えられた値を一旦蓄えます.
808 ! .false. を与えた場合には,
809 ! *time* もしくは *difftime* と
810 ! HistoryCreate に与えた *interval* に
811 ! 関わらず出力を行います.
812 !
813 ! HistoryAddVariable で
814 ! *time_average* (または *average*)
815 ! に .true. を与えない場合は無効です.
816 !
817 ! *time* と *difftime*
818 ! のどちらかを同時に与える必要があります.
819 !
820 logical, intent(out), optional:: err
821 ! 例外処理用フラグ.
822 ! デフォルトでは, この手続き内でエラーが
823 ! 生じた場合, プログラムは強制終了します.
824 ! 引数 *err* が与えられる場合,
825 ! プログラムは強制終了せず, 代わりに
826 ! *err* に .true. が代入されます.
827 !
828 ! Exception handling flag.
829 ! By default, when error occur in
830 ! this procedure, the program aborts.
831 ! If this *err* argument is given,
832 ! .true. is substituted to *err* and
833 ! the program does not abort.
834 type(GT_VARIABLE):: var, timevar
835 character(STRING):: url, file, time_str
836 real:: time_value(1:1)
837 type(GT_HISTORY), pointer:: hst =>null()
838 integer :: v_ord
839 character(STRING):: avr_msg
840 real(DP), target:: array_work(arraysize)
841 real(DP), pointer:: array_work2(:) =>null()
842 integer:: arraysize_work2
843 integer, allocatable:: start(:), count(:), stride(:)
844 integer :: i, dims
845 logical :: slice_err
846 character(STRING):: time_name
847 character(*), parameter:: bnds_suffix = '_bnds'
848 type(GT_VARIABLE):: bndsvar
849 integer:: bnds_ord, time_count, bnds_rank
850 logical:: output_step
851 real(DP):: timedw
852! type(DC_DIFFTIME):: difftimew
853 real(DP):: avr_coef
854 integer, allocatable:: array_overwrap(:)
855 integer:: new_index
856 integer:: numdims, dimord, dimsize, dimsize_max, allcount, ra
857 character(STRING):: dimname
858 integer:: st_mpi(MPI_STATUS_SIZE)
859 real(DP), allocatable:: array_mpi_tmp(:)
860 real(DP), allocatable:: array_mpi_all(:,:)
861 integer:: stat
862 integer:: err_mpi
863 character(STRING):: cause_c
864 interface timegoahead
865 subroutine timegoahead( varname, var, head, history, err )
866 use gtdata_types, only: gt_variable
868 character(len = *), intent(in):: varname
869 type(GT_VARIABLE), intent(out):: var
870 real, intent(in):: head
871 type(GT_HISTORY), intent(inout), optional, target:: history
872 logical, intent(out), optional:: err
873 end subroutine timegoahead
874 end interface
875 character(*), parameter:: subname = "HistoryPutDoubleEx"
876 continue
877 call beginsub(subname, 'varname=%a range=%a', &
878 & ca=stoa(varname, present_select('', '(no-range)', range)))
879 stat = dc_noerr
880 cause_c = ""
881 if (present(history)) then
882 hst => history
883 else
884 hst => default
885 endif
886 !-----------------------------------------------------------------
887 ! 初期設定のチェック
888 ! Check initialization
889 !-----------------------------------------------------------------
890 if ( .not. hst % initialized ) then
891 stat = dc_enotinit
892 cause_c = 'GT_HISTORY'
893 goto 999
894 end if
895 !-----------------------------------------------------------------
896 ! time と range の同時使用の禁止
897 ! Permit concurrent use of "time" and "range"
898 !-----------------------------------------------------------------
899 if ( ( present(time) .or. present(difftime) .or. present(timed) ) &
900 & .and. present_and_not_empty(range) ) then
901 call messagenotify('W', subname, &
902 & '(varname=%c) "range" and "time" or "timed" or "difftime" are not suppored at the same time', &
903 & c1 = trim(varname) )
904 stat = usr_errno
905 cause_c = '"range" and "time" or "timed" or "difftime" are not suppored at the same time'
906 goto 999
907 end if
908 !-----------------------------------------------------------------
909 ! hst 内の varname 変数の変数番号を取得
910 ! Get variable number of "varname" in "hst"
911 !-----------------------------------------------------------------
912 if ( .not. hst % mpi_gather ) then
913 v_ord = lookup_variable_ord(hst, varname)
914 else
915 if ( hst % mpi_myrank == 0 ) then
916 v_ord = lookup_variable_ord(hst, varname)
917 end if
918 call mpi_bcast( v_ord, 1, mpi_integer, 0, mpi_comm_world, err_mpi )
919 call dbgmessage('v_ord=<%d> is shared on all nodes.', i = (/v_ord/) )
920 end if
921 timedw = 0.0_dp
922 !-----------------------------------------------------------------
923 ! 時間平均値のためのデータ格納
924 ! Store data for time average value
925 !-----------------------------------------------------------------
926 if ( present(difftime) ) then
927 timedw = evalbyunit( difftime, '', hst % unlimited_units_symbol )
928 elseif ( present(timed) ) then
929 timedw = timed
930 elseif ( present(time) ) then
931 timedw = time
932 end if
933 if ( v_ord > 0 ) then
934 !
935 ! var_avr_count == -1: 平均処理は行わない.
936 ! var_avr_count >= 0: 平均処理を行う.
937 !
938 ! これらは HistoryAddVariable で指定される.
939 !
940 if ( hst % var_avr_count( v_ord ) > -1 ) then
941 ! 時刻が指定されない場合には平均処理が不可能なため
942 ! エラー発生. dc_error のエラーメッセージだけでは多少
943 ! 不親切なので, エラー直前に下記の警告メッセージ表示.
944 !
945 if ( .not. present(time) &
946 & .and. .not. present(timed) &
947 & .and. .not. present(difftime) ) then
948 call messagenotify('W', subname, &
949 & '(varname=%c) arguments "time" or "timed" or "difftime" are needed ' // &
950 & 'when "time_average=.true." is specified to "HistoryAddVariable"', &
951 & c1 = trim(varname) )
952 stat = dc_earglack
953 cause_c = 'time'
954 goto 999
955 end if
956 ! 与えられたデータのサイズと内部で積算しているデータのサイズが
957 ! 一致しない場合にもエラーを発生.
958 ! データサイズは HistoryPut -> HistoryPutEx の際に
959 ! 全て 1 次元化しているため, 単純に配列サイズでのみ判定.
960 ! dc_error のエラーメッセージだけでは多少
961 ! 不親切なので, エラー直前に下記の警告メッセージ表示.
962 !
963 if ( arraysize /= hst % var_avr_data( v_ord ) % length ) then
964 call messagenotify('W', subname, &
965 & '(varname=%c) size of array should be (%d). size of array is (%d)', &
966 & i = (/hst % var_avr_data( v_ord ) % length, arraysize/), &
967 & c1 = trim(varname) )
969 cause_c = 'array'
970 goto 999
971 end if
972 ! この if 〜 end if では以下の動作を行う.
973 !
974 ! * 平均処理時の係数 (avr_coef) の算出
975 ! * 係数を算出するための以下の値の設定
976 ! * 基本時間間隔 (var_avr_baseint)
977 ! * 前回出力の時刻 (var_avr_prevtime)
978 ! * 初回出力の判定を行うラベル (var_avr_firstput) の設定
979 !
980 ! 1 度目に呼ばれた場合はとりあえず係数を 1.0 にするとともに,
981 ! prevtime に現在時刻を保管
982 !
983 if ( hst % var_avr_firstput( v_ord ) ) then
984 if ( hst % var_avr_count( v_ord ) == 0 ) then
985 avr_coef = 1.0_dp
986 hst % var_avr_prevtime( v_ord ) = timedw
987 else
988 hst % var_avr_baseint( v_ord ) = &
989 & timedw - hst % var_avr_prevtime( v_ord )
990 avr_coef = 1.0_dp
991 hst % var_avr_prevtime( v_ord ) = timedw
992 hst % var_avr_firstput( v_ord ) = .false.
993 end if
994 ! 2 度目以降に呼ばれた場合
995 !
996 else
997 ! 前回出力を行った (var_avr_count == 0 に初期化された)
998 ! 場合には baseint に前回時刻と今回時刻の差を設定.
999 ! avr_coef には 1 を設定.
1000 ! 最後に prevtime に今回の時刻を保管.
1001 !
1002 if ( hst % var_avr_count( v_ord ) == 0 ) then
1003 hst % var_avr_baseint( v_ord ) = &
1004 & timedw - hst % var_avr_prevtime( v_ord )
1005 avr_coef = 1.0_dp
1006 hst % var_avr_prevtime( v_ord ) = timedw
1007 ! var_avr_count > 0 (平均処理されるデータが蓄積されている)
1008 ! 場合には avr_coef には前回時刻と今回時刻の差の,
1009 ! baseint からの比を設定する.
1010 ! 最後に prevtime に今回の時刻を保管.
1011 !
1012 else
1013 avr_coef = ( timedw - hst % var_avr_prevtime( v_ord ) ) &
1014 & / hst % var_avr_baseint( v_ord )
1015 hst % var_avr_prevtime( v_ord ) = timedw
1016 end if
1017 end if
1018 ! 積算値 a_DataAvr に, 今回のデータに係数を掛けたもの
1019 ! を加算する.
1020 !
1021 hst % var_avr_data( v_ord ) % a_DataAvr = &
1022 & hst % var_avr_data( v_ord ) % a_DataAvr + array * avr_coef
1023 ! 積算カウント var_avr_count に +1 し,
1024 ! 係数の積算値 var_avr_coefsum に今回設定された
1025 ! 係数を加算する.
1026 !
1027 hst % var_avr_count( v_ord ) = &
1028 & hst % var_avr_count( v_ord ) + 1
1029 hst % var_avr_coefsum( v_ord ) = &
1030 & hst % var_avr_coefsum( v_ord ) + avr_coef
1031 ! time_bnds(2) に今回の時刻を設定する.
1032 ! (毎回上書きされる).
1033 !
1034 if ( present(difftime) ) then
1035 hst % time_bnds(2:2) = evalbyunit( difftime, '', hst % unlimited_units_symbol )
1036 elseif ( present (timed) ) then
1037 hst % time_bnds(2:2) = timed
1038 else
1039 hst % time_bnds(2:2) = time
1040 end if
1041 end if
1042 end if
1043 !-----------------------------------------------------------------
1044 ! 初期時刻の設定
1045 ! Configure initial time
1046 !-----------------------------------------------------------------
1047 if ( .not. hst % origin_setting ) then
1048 if ( present(difftime) ) then
1049 hst % origin = evalbyunit( difftime, '', hst % unlimited_units_symbol )
1050 hst % time_bnds = evalbyunit( difftime, '', hst % unlimited_units_symbol )
1051 hst % origin_setting = .true.
1052 elseif ( present(timed) ) then
1053 hst % origin = timed
1054 hst % time_bnds = timed
1055 hst % origin_setting = .true.
1056 elseif ( present(time) ) then
1057 hst % origin = time
1058 hst % time_bnds = time
1059 hst % origin_setting = .true.
1060 end if
1061!!$ if ( present(difftime) ) then
1062!!$ hst % origin = difftime
1063!!$ hst % time_bnds = EvalByUnit( difftime, '', hst % unlimited_units_symbol )
1064!!$ hst % origin_setting = .true.
1065!!$ elseif ( present(timed) ) then
1066!!$ call DCDiffTimeCreate( hst % origin, & ! (out)
1067!!$ & real(timed), '', hst % unlimited_units_symbol ) ! (in)
1068!!$ hst % time_bnds = timed
1069!!$ hst % origin_setting = .true.
1070!!$ elseif ( present(time) ) then
1071!!$ call DCDiffTimeCreate( hst % origin, & ! (out)
1072!!$ & time, '', hst % unlimited_units_symbol ) ! (in)
1073!!$ hst % time_bnds = time
1074!!$ hst % origin_setting = .true.
1075!!$ end if
1076 end if
1077 !-----------------------------------------------------------------
1078 ! 時刻の自動チェック
1079 ! Check time automatically
1080 !-----------------------------------------------------------------
1081 output_step = .true.
1082 if ( present_and_false(time_average_store) ) then
1083 output_step = .true.
1084 elseif ( present_and_true(time_average_store) ) then
1085 output_step = .false.
1086 elseif ( present(difftime) .or. present(timed) .or. present(time) ) then
1087 output_step = .false.
1088 if ( abs( hst % interval ) < dp_eps ) then
1089 output_step = .true.
1090 else
1091 if ( abs( mod( timedw - hst % origin, hst % interval ) ) < dp_eps ) then
1092 output_step = .true.
1093 end if
1094 end if
1095 end if
1096 !-------------------------
1097 ! 時間平均値出力のための情報処理
1098 ! Information processing for output time-averaged value
1099 if ( .not. output_step ) then
1100 goto 999
1101 else
1102 array_work = array
1103 avr_msg = ''
1104 if ( v_ord > 0 ) then
1105 if ( hst % var_avr_count( v_ord ) > -1 ) then
1106 if ( present_and_false(quiet) ) then
1107 avr_msg = '(time average of ' // trim( tochar(hst % var_avr_count( v_ord )) ) // ' step data)'
1108 end if
1109 !-------------------
1110 ! 蓄えた値の時間平均化
1111 ! Average stored value in time direction
1112 ! a_DataAvr に蓄えられた値を係数の積算値で割って,
1113 ! これを出力値とする.
1114 !
1115 array_work = real( &
1116 & ( hst % var_avr_data( v_ord ) % a_DataAvr ) / ( hst % var_avr_coefsum( v_ord ) ), &
1117 & kind = kind(array_work) )
1118 ! 積算値, 積算カウント, 係数の積算値をクリアする.
1119 !
1120 hst % var_avr_data( v_ord ) % a_DataAvr = 0.0
1121 hst % var_avr_count( v_ord ) = 0
1122 hst % var_avr_coefsum( v_ord ) = 0.0_dp
1123 hst % var_avr_firstput( v_ord ) = .false.
1124 end if
1125 end if
1126 end if
1127 if ( .not. hst % mpi_gather ) then
1128 array_work2 => array_work
1129 arraysize_work2 = arraysize
1130 else
1131 !-----------------------------------------------------------------
1132 ! MPI 使用時に, 座標軸のデータが与えられた場合には, そのデータを保管.
1133 ! If data of axis is given, the data is stored when MPI is used
1134 !-----------------------------------------------------------------
1135 numdims = size( hst % mpi_fileinfo % axes )
1136 if ( hst % mpi_myrank == 0 ) then
1137 dimord = 0
1138 do i = 1, numdims
1139 call historyaxisinquire( &
1140 & hst % mpi_fileinfo % axes(i), & ! (in)
1141 & name = dimname ) ! (out)
1142 if ( trim(varname) == trim(dimname) ) then
1143 dimord = i
1144 exit
1145 end if
1146 end do
1147 call mpi_bcast( dimord, 1, mpi_integer, 0, mpi_comm_world, err_mpi )
1148 else
1149 call mpi_bcast( dimord, 1, mpi_integer, 0, mpi_comm_world, err_mpi )
1150 end if
1151 if ( dimord > 0 ) then
1152 call historyaxisinquire( &
1153 & hst % mpi_fileinfo % axes(dimord), & ! (in)
1154 & size = dimsize_max ) ! (out)
1155 dimsize = size( array )
1156 if ( dimsize > dimsize_max .and. hst % unlimited_index /= dimord ) then
1157 call messagenotify('W', subname, &
1158 & 'dim=<%c> data size (%d) exceeds size of the dim (%d) by HistoryCreate. ' // &
1159 & 'the data will be trancated. ', &
1160 & i = (/ dimsize, dimsize_max /), c1 = trim(varname) )
1161 dimsize = dimsize_max
1162 end if
1163 if ( associated( hst % mpi_dimdata_each( dimord ) % a_Axis ) ) then
1164 deallocate( hst % mpi_dimdata_each( dimord ) % a_Axis )
1165 end if
1166 allocate( hst % mpi_dimdata_each( dimord ) % a_Axis(dimsize) )
1167 hst % mpi_dimdata_each( dimord ) % a_Axis = array(1:dimsize)
1168 hst % mpi_dimdata_each( dimord ) % length = dimsize
1169 end if
1170 !-----------------------------------------------------------------
1171 ! MPI 使用時に, 従属変数のデータが与えられた場合, データ集約の情報を整理.
1172 ! If data of dependent variables is given,
1173 ! information for integration is arranged when MPI is used
1174 !-----------------------------------------------------------------
1175 if ( v_ord > 0 ) then
1176 if ( .not. associated( hst % mpi_gthr_info ) ) then
1177 call gtmpi_axis_register( hst, err ) ! (inout)
1178 end if
1179 if ( present_and_true( err ) ) goto 999
1180 if ( .not. associated( hst % mpi_vars_index( v_ord ) % allcount ) ) then
1181 call gtmpi_vars_mkindex( hst, v_ord, err ) ! (inout)
1182 end if
1183 if ( present_and_true( err ) ) goto 999
1184 end if
1185 !-----------------------------------------------------------------
1186 ! MPI 使用時は, 各ノードのデータを rank == 0 へ集約する.
1187 ! Data on each node is integrated when MPI is used
1188 !-----------------------------------------------------------------
1189 if ( v_ord > 0 ) then
1190 arraysize_work2 = hst % mpi_vars_index(v_ord) % allcount_all
1191 if ( arraysize_work2 < 1 ) arraysize_work2 = 1
1192 if ( hst % mpi_myrank == 0 ) then
1193 do ra = 1, hst % mpi_nprocs - 1
1194 allcount = hst % mpi_vars_index(v_ord) % allcount(ra)
1195 call mpi_send( allcount, 1, mpi_integer, ra, 0, mpi_comm_world, err_mpi )
1196 end do
1197 else
1198 call mpi_recv( allcount, 1, mpi_integer, 0, 0, mpi_comm_world, st_mpi, err_mpi )
1199 end if
1200 if ( hst % mpi_myrank /= 0 ) then
1201 call mpi_send( array_work, allcount, &
1202 & mpi_double_precision, 0, 0, mpi_comm_world, err_mpi )
1203 else
1204 allocate( array_mpi_all(0: hst % mpi_nprocs - 1, arraysize_work2 ) )
1205 allocate( array_mpi_tmp( arraysize_work2 ) )
1206 array_mpi_all(:,:) = 0.0_dp
1207 array_mpi_tmp(:) = 0.0_dp
1208 allcount = hst % mpi_vars_index(v_ord) % allcount(0)
1209 array_mpi_all(0,1:allcount) = array_work
1210 do ra = 1, hst % mpi_nprocs - 1
1211 allcount = hst % mpi_vars_index(v_ord) % allcount(ra)
1212 call mpi_recv( array_mpi_tmp(1:allcount), allcount, &
1213 & mpi_double_precision, ra, 0, mpi_comm_world, st_mpi, err_mpi )
1214 array_mpi_all(ra,1:allcount) = array_mpi_tmp(1:allcount)
1215 end do
1216 allocate( array_work2( arraysize_work2 ) )
1217 allocate( array_overwrap( arraysize_work2 ) )
1218 array_work2 = 0.0_dp
1219 array_overwrap(:) = 0
1220 do ra = 0, hst % mpi_nprocs - 1
1221 do i = 1, hst % mpi_vars_index(v_ord) % allcount(ra)
1222 new_index = hst % mpi_vars_index(v_ord) % each2all(ra, i)
1223 array_work2( new_index ) = &
1224 & array_work2( new_index ) + array_mpi_all( ra, i )
1225 array_overwrap( new_index ) = array_overwrap( new_index ) + 1
1226 end do
1227 end do
1228 where ( array_overwrap == 0 )
1229 array_overwrap = 1
1230 end where
1231 array_work2(:) = array_work2(:) / array_overwrap(:)
1232 deallocate( array_mpi_all, array_mpi_tmp, array_overwrap )
1233 ! array_work2 はデータ出力の後に割り付け解除される.
1234 end if
1235 else
1236 array_work2 => array_work
1237 arraysize_work2 = arraysize
1238 end if
1239 end if
1240 !-----------------------------------------------------------------
1241 ! 時刻を1つ進めて, データ出力
1242 ! Progress one time, and output data
1243 !-----------------------------------------------------------------
1244 if ( .not. hst % mpi_gather &
1245 & .or. ( hst % mpi_gather .and. &
1246 & hst % mpi_myrank == 0 .and. &
1247 & hst % mpi_fileinfo % already_output) ) then
1248 call timegoahead( &
1249 & varname = varname, & ! (in)
1250 & head = real(array_work2(1)), & ! (in)
1251 & var = var, & ! (out)
1252 & history = history, & ! (inout)
1253 & err = err ) ! (out)
1254 call inquire( var, & ! (in)
1255 & alldims=dims ) ! (out)
1256 if (present_and_not_empty(range) .and. (dims < 1)) then
1257 call dbgmessage('varname=<%c> has no dimension. so range is ignoread.', &
1258 & c1=trim(varname))
1259 end if
1260 if (.not. (present_and_not_empty(range) .and. (dims > 0))) then
1261 ! range 無しの普通の出力の場合
1262 call put(var, array_work2, arraysize_work2)
1263 else
1264 ! range があり, 且つ varname がちゃんと次元を持っている場合
1265 !
1266 ! 元々の start, count, stride を保持. データを与えた後に復元する.
1267 allocate(start(dims), count(dims), stride(dims))
1268 do i = 1, dims
1269 call get_slice(var, i, start(i), count(i), stride(i))
1270 end do
1271 slice_err = .false. ! 不要だが Slice の引用仕様として必要なため
1272 call slice(var, range, slice_err)
1273 call put(var, array_work2, arraysize_work2)
1274 ! 復元
1275 do i = 1, dims
1276 call slice(var, i, start(i), count(i), stride(i))
1277 end do
1278 deallocate(start, count, stride)
1279 end if
1280 call gtvarsync(var)
1281 if ( hst % mpi_gather .and. v_ord > 0 ) then
1282 deallocate( array_work2 )
1283 end if
1284 end if
1285 !-----------------------------------------------------------------
1286 ! "time_bnds" 変数への出力
1287 ! Output to "time_bnds" variable
1288 !-----------------------------------------------------------------
1289 if ( .not. hst % mpi_gather &
1290 & .or. ( hst % mpi_gather .and. &
1291 & hst % mpi_myrank == 0 .and. &
1292 & hst % mpi_fileinfo % already_output ) ) then
1293 if ( v_ord > 0 ) then
1294 if ( hst % var_avr_count( v_ord ) > -1 ) then
1295 !-------------------
1296 ! 時間次元の名前とファイル名を取得
1297 ! Get name of time dimension, and filename
1298 timevar = hst % dimvars( hst % unlimited_index )
1299 call inquire( &
1300 & var = timevar, & ! (in)
1301 & url = url, & ! (out)
1302 & name = time_name ) ! (out)
1303 call urlsplit( fullname = url, & ! (in)
1304 & file = file ) ! (out)
1305 !-------------------
1306 ! "time_bnds" 変数の取得
1307 ! Get "time_bnds" variable
1308 call open( var = bndsvar, &
1309 & url = urlmerge(file=file, var=trim(time_name) // bnds_suffix) )
1310 bnds_ord = lookup_variable_ord( hst, trim(time_name) // bnds_suffix)
1311 !-------------------
1312 ! "time_bnds" 変数への出力
1313 ! Output to "time_bnds" variable
1314 call inquire( &
1315 & var = bndsvar, & ! (in)
1316 & rank = bnds_rank ) ! (out)
1317 time_count = 1
1318 if ( bnds_rank > 1 ) then
1319 call inquire( &
1320 & var = bndsvar, & ! (in)
1321 & dimord = hst % growable_indices(bnds_ord), & ! (in)
1322 & allcount = time_count ) ! (out)
1323 end if
1324 if ( (hst % time_bnds_output_count < 1) &
1325 & .or. (hst % time_bnds_output_count < time_count) ) then
1326 call slice(bndsvar, hst % growable_indices(bnds_ord), & ! (in)
1327 & start=hst % time_bnds_output_count+1, count=1) ! (in)
1328 call put(bndsvar, hst % time_bnds, 2)
1329 hst % time_bnds_output_count = hst % time_bnds_output_count + 1
1330 end if
1331 call close( var = bndsvar ) ! (inout)
1332 if ( present(difftime) ) then
1333 hst % time_bnds(1:1) = &
1334 & evalbyunit( difftime, '', hst % unlimited_units_symbol )
1335 elseif ( present(timed) ) then
1336 hst % time_bnds(1:1) = timed
1337 else
1338 hst % time_bnds(1:1) = time
1339 end if
1340 end if
1341 end if
1342 end if
1343 !-----------------------------------------------------------------
1344 ! メッセージ出力
1345 ! Output messages
1346 !-----------------------------------------------------------------
1347 if ( .not. hst % mpi_gather &
1348 & .or. ( hst % mpi_gather .and. &
1349 & hst % mpi_myrank == 0 .and. &
1350 & hst % mpi_fileinfo % already_output ) ) then
1351 if ( present_and_false(quiet) ) then
1352 call inquire( hst % dimvars(1), & ! (in)
1353 & url = url ) ! (out)
1354 call urlsplit( fullname = url, & ! (in)
1355 & file = file ) ! (out)
1356 if ( hst % unlimited_index < 1 ) then
1357 time_str = ''
1358 else
1359 timevar = hst % dimvars(hst % unlimited_index)
1360 call slice( timevar, & ! (in)
1361 & 1, start = hst % count(v_ord), count = 1 ) ! (in)
1362 call get( timevar, & ! (inout)
1363 & time_value, & ! (out)
1364 & 1, & ! (in)
1365 & err ) ! (out)
1366 time_str = '(time=' // trim( tochar( time_value(1) )) // ')'
1367 end if
1368 call messagenotify('M', 'HistoryPut', &
1369 & '"%a" => "%a" %a %a', &
1370 & ca = stoa( varname, file, time_str, avr_msg ) )
1371 end if
1372 end if
1373 !-----------------------------------------------------------------
1374 ! 終了処理, 例外処理
1375 ! Termination and Exception handling
1376 !-----------------------------------------------------------------
1377999 continue
1378 call storeerror( stat, subname, err, cause_c )
1379 call endsub(subname)
integer, parameter, public dc_earglack
Definition dc_error.f90:546
integer, parameter, public gt_eargsizemismatch
Definition dc_error.f90:515
real(dp), parameter, public dp_eps
Machine epsilon for dobule precision real number.
Definition dc_types.f90:97

References dc_trace::beginsub(), dc_trace::dbgmessage(), dc_error::dc_earglack, dc_error::dc_enotinit, dc_error::dc_noerr, gtool_history_internal::default, dc_types::dp, dc_types::dp_eps, dc_trace::endsub(), dc_error::gt_eargsizemismatch, dc_string::joinchar(), dc_present::present_and_false(), dc_present::present_and_not_empty(), dc_present::present_and_true(), dc_error::storeerror(), dc_types::string, timegoahead(), and dc_error::usr_errno.

Here is the call graph for this function:

◆ historyputint0()

subroutine historyputint0 ( character(*), intent(in)  varname,
integer, intent(in)  value,
type(gt_history), intent(inout), optional, target  history,
character(*), intent(in), optional  range,
real, intent(in), optional  time,
logical, intent(in), optional  quiet,
type(dc_difftime), intent(in), optional  difftime,
real(dp), intent(in), optional  timed,
logical, intent(in), optional  time_average_store,
logical, intent(out), optional  err 
)

Definition at line 4068 of file historyput.f90.

4071 !
4072 !
4074 use dc_date_types, only: dc_difftime
4075 use dc_types, only: dp
4076 use dc_trace, only: beginsub, endsub, dbgmessage
4077 implicit none
4078 character(*), intent(in):: varname
4079 integer, intent(in):: value
4080 type(GT_HISTORY), intent(inout), optional, target:: history
4081 character(*), intent(in), optional:: range
4082 real, intent(in), optional:: time
4083 logical, intent(in), optional:: quiet
4084 type(DC_DIFFTIME), intent(in), optional:: difftime
4085 real(DP), intent(in), optional:: timed
4086 logical, intent(in), optional:: time_average_store
4087 logical, intent(out), optional:: err
4088 interface historyputintex
4089 subroutine historyputintex( &
4090 & varname, array, arraysize, history, range, &
4091 & time, quiet, difftime, timed, time_average_store, err )
4093 use dc_date_types, only: dc_difftime
4094 use dc_types, only: dp
4095 character(*), intent(in):: varname
4096 integer, intent(in):: arraysize
4097 integer, intent(in):: array(arraysize)
4098 type(GT_HISTORY), intent(inout), target, optional:: history
4099 character(*), intent(in), optional:: range
4100 real, intent(in), optional:: time
4101 logical, intent(in), optional:: quiet
4102 type(DC_DIFFTIME), intent(in), optional:: difftime
4103 real(DP), intent(in), optional:: timed
4104 logical, intent(in), optional:: time_average_store
4105 logical, intent(out), optional:: err
4106 end subroutine historyputintex
4107 end interface
4108 character(*), parameter:: subname = "HistoryPutInt0"
4109 continue
4110 call beginsub(subname)
4111 call historyputintex( &
4112 & varname, & ! (in)
4113 & (/value/), 1, & ! (in)
4114 & history = history, & ! (inout) optional
4115 & range = range, & ! (in) optional
4116 & time = time, & ! (in) optional
4117 & quiet = quiet, & ! (in) optional
4118 & difftime = difftime, & ! (in) optional
4119 & timed = timed, & ! (in) optional
4120 & time_average_store = &
4121 & time_average_store, & ! (in) optional
4122 & err = err ) ! (out) optional
4123 call endsub(subname)
recursive subroutine historyputintex(varname, array, arraysize, history, range, time, quiet, difftime, timed, time_average_store, err)
データ出力

References dc_trace::beginsub(), dc_trace::dbgmessage(), dc_types::dp, dc_trace::endsub(), and historyputintex().

Here is the call graph for this function:

◆ historyputint1()

subroutine historyputint1 ( character(*), intent(in)  varname,
integer, dimension(:), intent(in)  array,
type(gt_history), intent(inout), optional, target  history,
character(*), intent(in), optional  range,
real, intent(in), optional  time,
logical, intent(in), optional  quiet,
type(dc_difftime), intent(in), optional  difftime,
real(dp), intent(in), optional  timed,
logical, intent(in), optional  time_average_store,
logical, intent(out), optional  err 
)

Definition at line 4125 of file historyput.f90.

4128 !
4129 !
4131 use dc_date_types, only: dc_difftime
4132 use dc_types, only: dp
4133 use dc_trace, only: beginsub, endsub, dbgmessage
4134 implicit none
4135 character(*), intent(in):: varname
4136 integer, intent(in):: array(:)
4137 type(GT_HISTORY), intent(inout), optional, target:: history
4138 character(*), intent(in), optional:: range
4139 real, intent(in), optional:: time
4140 logical, intent(in), optional:: quiet
4141 type(DC_DIFFTIME), intent(in), optional:: difftime
4142 real(DP), intent(in), optional:: timed
4143 logical, intent(in), optional:: time_average_store
4144 logical, intent(out), optional:: err
4145 interface historyputintex
4146 subroutine historyputintex( &
4147 & varname, array, arraysize, history, range, &
4148 & time, quiet, difftime, timed, time_average_store, err )
4150 use dc_date_types, only: dc_difftime
4151 use dc_types, only: dp
4152 character(*), intent(in):: varname
4153 integer, intent(in):: arraysize
4154 integer, intent(in):: array(arraysize)
4155 type(GT_HISTORY), intent(inout), target, optional:: history
4156 character(*), intent(in), optional:: range
4157 real, intent(in), optional:: time
4158 logical, intent(in), optional:: quiet
4159 type(DC_DIFFTIME), intent(in), optional:: difftime
4160 real(DP), intent(in), optional:: timed
4161 logical, intent(in), optional:: time_average_store
4162 logical, intent(out), optional:: err
4163 end subroutine historyputintex
4164 end interface
4165 character(*), parameter:: subname = "HistoryPutInt1"
4166 continue
4167 call beginsub(subname)
4168 call historyputintex( &
4169 & varname, & ! (in)
4170 & pack(array, .true.), size(array), & ! (in)
4171 & history = history, & ! (inout) optional
4172 & range = range, & ! (in) optional
4173 & time = time, & ! (in) optional
4174 & quiet = quiet, & ! (in) optional
4175 & difftime = difftime, & ! (in) optional
4176 & timed = timed, & ! (in) optional
4177 & time_average_store = &
4178 & time_average_store, & ! (in) optional
4179 & err = err ) ! (out) optional
4180 call endsub(subname)

References dc_trace::beginsub(), dc_trace::dbgmessage(), dc_types::dp, dc_trace::endsub(), and historyputintex().

Here is the call graph for this function:

◆ historyputint2()

subroutine historyputint2 ( character(*), intent(in)  varname,
integer, dimension(:,:), intent(in)  array,
type(gt_history), intent(inout), optional, target  history,
character(*), intent(in), optional  range,
real, intent(in), optional  time,
logical, intent(in), optional  quiet,
type(dc_difftime), intent(in), optional  difftime,
real(dp), intent(in), optional  timed,
logical, intent(in), optional  time_average_store,
logical, intent(out), optional  err 
)

Definition at line 4182 of file historyput.f90.

4185 !
4186 !
4188 use dc_date_types, only: dc_difftime
4189 use dc_types, only: dp
4190 use dc_trace, only: beginsub, endsub, dbgmessage
4191 implicit none
4192 character(*), intent(in):: varname
4193 integer, intent(in):: array(:,:)
4194 type(GT_HISTORY), intent(inout), optional, target:: history
4195 character(*), intent(in), optional:: range
4196 real, intent(in), optional:: time
4197 logical, intent(in), optional:: quiet
4198 type(DC_DIFFTIME), intent(in), optional:: difftime
4199 real(DP), intent(in), optional:: timed
4200 logical, intent(in), optional:: time_average_store
4201 logical, intent(out), optional:: err
4202 interface historyputintex
4203 subroutine historyputintex( &
4204 & varname, array, arraysize, history, range, &
4205 & time, quiet, difftime, timed, time_average_store, err )
4207 use dc_date_types, only: dc_difftime
4208 use dc_types, only: dp
4209 character(*), intent(in):: varname
4210 integer, intent(in):: arraysize
4211 integer, intent(in):: array(arraysize)
4212 type(GT_HISTORY), intent(inout), target, optional:: history
4213 character(*), intent(in), optional:: range
4214 real, intent(in), optional:: time
4215 logical, intent(in), optional:: quiet
4216 type(DC_DIFFTIME), intent(in), optional:: difftime
4217 real(DP), intent(in), optional:: timed
4218 logical, intent(in), optional:: time_average_store
4219 logical, intent(out), optional:: err
4220 end subroutine historyputintex
4221 end interface
4222 character(*), parameter:: subname = "HistoryPutInt2"
4223 continue
4224 call beginsub(subname)
4225 call historyputintex( &
4226 & varname, & ! (in)
4227 & pack(array, .true.), size(array), & ! (in)
4228 & history = history, & ! (inout) optional
4229 & range = range, & ! (in) optional
4230 & time = time, & ! (in) optional
4231 & quiet = quiet, & ! (in) optional
4232 & difftime = difftime, & ! (in) optional
4233 & timed = timed, & ! (in) optional
4234 & time_average_store = &
4235 & time_average_store, & ! (in) optional
4236 & err = err ) ! (out) optional
4237 call endsub(subname)

References dc_trace::beginsub(), dc_trace::dbgmessage(), dc_types::dp, dc_trace::endsub(), and historyputintex().

Here is the call graph for this function:

◆ historyputint3()

subroutine historyputint3 ( character(*), intent(in)  varname,
integer, dimension(:,:,:), intent(in)  array,
type(gt_history), intent(inout), optional, target  history,
character(*), intent(in), optional  range,
real, intent(in), optional  time,
logical, intent(in), optional  quiet,
type(dc_difftime), intent(in), optional  difftime,
real(dp), intent(in), optional  timed,
logical, intent(in), optional  time_average_store,
logical, intent(out), optional  err 
)

Definition at line 4239 of file historyput.f90.

4242 !
4243 !
4245 use dc_date_types, only: dc_difftime
4246 use dc_types, only: dp
4247 use dc_trace, only: beginsub, endsub, dbgmessage
4248 implicit none
4249 character(*), intent(in):: varname
4250 integer, intent(in):: array(:,:,:)
4251 type(GT_HISTORY), intent(inout), optional, target:: history
4252 character(*), intent(in), optional:: range
4253 real, intent(in), optional:: time
4254 logical, intent(in), optional:: quiet
4255 type(DC_DIFFTIME), intent(in), optional:: difftime
4256 real(DP), intent(in), optional:: timed
4257 logical, intent(in), optional:: time_average_store
4258 logical, intent(out), optional:: err
4259 interface historyputintex
4260 subroutine historyputintex( &
4261 & varname, array, arraysize, history, range, &
4262 & time, quiet, difftime, timed, time_average_store, err )
4264 use dc_date_types, only: dc_difftime
4265 use dc_types, only: dp
4266 character(*), intent(in):: varname
4267 integer, intent(in):: arraysize
4268 integer, intent(in):: array(arraysize)
4269 type(GT_HISTORY), intent(inout), target, optional:: history
4270 character(*), intent(in), optional:: range
4271 real, intent(in), optional:: time
4272 logical, intent(in), optional:: quiet
4273 type(DC_DIFFTIME), intent(in), optional:: difftime
4274 real(DP), intent(in), optional:: timed
4275 logical, intent(in), optional:: time_average_store
4276 logical, intent(out), optional:: err
4277 end subroutine historyputintex
4278 end interface
4279 character(*), parameter:: subname = "HistoryPutInt3"
4280 continue
4281 call beginsub(subname)
4282 call historyputintex( &
4283 & varname, & ! (in)
4284 & pack(array, .true.), size(array), & ! (in)
4285 & history = history, & ! (inout) optional
4286 & range = range, & ! (in) optional
4287 & time = time, & ! (in) optional
4288 & quiet = quiet, & ! (in) optional
4289 & difftime = difftime, & ! (in) optional
4290 & timed = timed, & ! (in) optional
4291 & time_average_store = &
4292 & time_average_store, & ! (in) optional
4293 & err = err ) ! (out) optional
4294 call endsub(subname)

References dc_trace::beginsub(), dc_trace::dbgmessage(), dc_types::dp, dc_trace::endsub(), and historyputintex().

Here is the call graph for this function:

◆ historyputint4()

subroutine historyputint4 ( character(*), intent(in)  varname,
integer, dimension(:,:,:,:), intent(in)  array,
type(gt_history), intent(inout), optional, target  history,
character(*), intent(in), optional  range,
real, intent(in), optional  time,
logical, intent(in), optional  quiet,
type(dc_difftime), intent(in), optional  difftime,
real(dp), intent(in), optional  timed,
logical, intent(in), optional  time_average_store,
logical, intent(out), optional  err 
)

Definition at line 4296 of file historyput.f90.

4299 !
4300 !
4302 use dc_date_types, only: dc_difftime
4303 use dc_types, only: dp
4304 use dc_trace, only: beginsub, endsub, dbgmessage
4305 implicit none
4306 character(*), intent(in):: varname
4307 integer, intent(in):: array(:,:,:,:)
4308 type(GT_HISTORY), intent(inout), optional, target:: history
4309 character(*), intent(in), optional:: range
4310 real, intent(in), optional:: time
4311 logical, intent(in), optional:: quiet
4312 type(DC_DIFFTIME), intent(in), optional:: difftime
4313 real(DP), intent(in), optional:: timed
4314 logical, intent(in), optional:: time_average_store
4315 logical, intent(out), optional:: err
4316 interface historyputintex
4317 subroutine historyputintex( &
4318 & varname, array, arraysize, history, range, &
4319 & time, quiet, difftime, timed, time_average_store, err )
4321 use dc_date_types, only: dc_difftime
4322 use dc_types, only: dp
4323 character(*), intent(in):: varname
4324 integer, intent(in):: arraysize
4325 integer, intent(in):: array(arraysize)
4326 type(GT_HISTORY), intent(inout), target, optional:: history
4327 character(*), intent(in), optional:: range
4328 real, intent(in), optional:: time
4329 logical, intent(in), optional:: quiet
4330 type(DC_DIFFTIME), intent(in), optional:: difftime
4331 real(DP), intent(in), optional:: timed
4332 logical, intent(in), optional:: time_average_store
4333 logical, intent(out), optional:: err
4334 end subroutine historyputintex
4335 end interface
4336 character(*), parameter:: subname = "HistoryPutInt4"
4337 continue
4338 call beginsub(subname)
4339 call historyputintex( &
4340 & varname, & ! (in)
4341 & pack(array, .true.), size(array), & ! (in)
4342 & history = history, & ! (inout) optional
4343 & range = range, & ! (in) optional
4344 & time = time, & ! (in) optional
4345 & quiet = quiet, & ! (in) optional
4346 & difftime = difftime, & ! (in) optional
4347 & timed = timed, & ! (in) optional
4348 & time_average_store = &
4349 & time_average_store, & ! (in) optional
4350 & err = err ) ! (out) optional
4351 call endsub(subname)

References dc_trace::beginsub(), dc_trace::dbgmessage(), dc_types::dp, dc_trace::endsub(), and historyputintex().

Here is the call graph for this function:

◆ historyputint5()

subroutine historyputint5 ( character(*), intent(in)  varname,
integer, dimension(:,:,:,:,:), intent(in)  array,
type(gt_history), intent(inout), optional, target  history,
character(*), intent(in), optional  range,
real, intent(in), optional  time,
logical, intent(in), optional  quiet,
type(dc_difftime), intent(in), optional  difftime,
real(dp), intent(in), optional  timed,
logical, intent(in), optional  time_average_store,
logical, intent(out), optional  err 
)

Definition at line 4353 of file historyput.f90.

4356 !
4357 !
4359 use dc_date_types, only: dc_difftime
4360 use dc_types, only: dp
4361 use dc_trace, only: beginsub, endsub, dbgmessage
4362 implicit none
4363 character(*), intent(in):: varname
4364 integer, intent(in):: array(:,:,:,:,:)
4365 type(GT_HISTORY), intent(inout), optional, target:: history
4366 character(*), intent(in), optional:: range
4367 real, intent(in), optional:: time
4368 logical, intent(in), optional:: quiet
4369 type(DC_DIFFTIME), intent(in), optional:: difftime
4370 real(DP), intent(in), optional:: timed
4371 logical, intent(in), optional:: time_average_store
4372 logical, intent(out), optional:: err
4373 interface historyputintex
4374 subroutine historyputintex( &
4375 & varname, array, arraysize, history, range, &
4376 & time, quiet, difftime, timed, time_average_store, err )
4378 use dc_date_types, only: dc_difftime
4379 use dc_types, only: dp
4380 character(*), intent(in):: varname
4381 integer, intent(in):: arraysize
4382 integer, intent(in):: array(arraysize)
4383 type(GT_HISTORY), intent(inout), target, optional:: history
4384 character(*), intent(in), optional:: range
4385 real, intent(in), optional:: time
4386 logical, intent(in), optional:: quiet
4387 type(DC_DIFFTIME), intent(in), optional:: difftime
4388 real(DP), intent(in), optional:: timed
4389 logical, intent(in), optional:: time_average_store
4390 logical, intent(out), optional:: err
4391 end subroutine historyputintex
4392 end interface
4393 character(*), parameter:: subname = "HistoryPutInt5"
4394 continue
4395 call beginsub(subname)
4396 call historyputintex( &
4397 & varname, & ! (in)
4398 & pack(array, .true.), size(array), & ! (in)
4399 & history = history, & ! (inout) optional
4400 & range = range, & ! (in) optional
4401 & time = time, & ! (in) optional
4402 & quiet = quiet, & ! (in) optional
4403 & difftime = difftime, & ! (in) optional
4404 & timed = timed, & ! (in) optional
4405 & time_average_store = &
4406 & time_average_store, & ! (in) optional
4407 & err = err ) ! (out) optional
4408 call endsub(subname)

References dc_trace::beginsub(), dc_trace::dbgmessage(), dc_types::dp, dc_trace::endsub(), and historyputintex().

Here is the call graph for this function:

◆ historyputint6()

subroutine historyputint6 ( character(*), intent(in)  varname,
integer, dimension(:,:,:,:,:,:), intent(in)  array,
type(gt_history), intent(inout), optional, target  history,
character(*), intent(in), optional  range,
real, intent(in), optional  time,
logical, intent(in), optional  quiet,
type(dc_difftime), intent(in), optional  difftime,
real(dp), intent(in), optional  timed,
logical, intent(in), optional  time_average_store,
logical, intent(out), optional  err 
)

Definition at line 4410 of file historyput.f90.

4413 !
4414 !
4416 use dc_date_types, only: dc_difftime
4417 use dc_types, only: dp
4418 use dc_trace, only: beginsub, endsub, dbgmessage
4419 implicit none
4420 character(*), intent(in):: varname
4421 integer, intent(in):: array(:,:,:,:,:,:)
4422 type(GT_HISTORY), intent(inout), optional, target:: history
4423 character(*), intent(in), optional:: range
4424 real, intent(in), optional:: time
4425 logical, intent(in), optional:: quiet
4426 type(DC_DIFFTIME), intent(in), optional:: difftime
4427 real(DP), intent(in), optional:: timed
4428 logical, intent(in), optional:: time_average_store
4429 logical, intent(out), optional:: err
4430 interface historyputintex
4431 subroutine historyputintex( &
4432 & varname, array, arraysize, history, range, &
4433 & time, quiet, difftime, timed, time_average_store, err )
4435 use dc_date_types, only: dc_difftime
4436 use dc_types, only: dp
4437 character(*), intent(in):: varname
4438 integer, intent(in):: arraysize
4439 integer, intent(in):: array(arraysize)
4440 type(GT_HISTORY), intent(inout), target, optional:: history
4441 character(*), intent(in), optional:: range
4442 real, intent(in), optional:: time
4443 logical, intent(in), optional:: quiet
4444 type(DC_DIFFTIME), intent(in), optional:: difftime
4445 real(DP), intent(in), optional:: timed
4446 logical, intent(in), optional:: time_average_store
4447 logical, intent(out), optional:: err
4448 end subroutine historyputintex
4449 end interface
4450 character(*), parameter:: subname = "HistoryPutInt6"
4451 continue
4452 call beginsub(subname)
4453 call historyputintex( &
4454 & varname, & ! (in)
4455 & pack(array, .true.), size(array), & ! (in)
4456 & history = history, & ! (inout) optional
4457 & range = range, & ! (in) optional
4458 & time = time, & ! (in) optional
4459 & quiet = quiet, & ! (in) optional
4460 & difftime = difftime, & ! (in) optional
4461 & timed = timed, & ! (in) optional
4462 & time_average_store = &
4463 & time_average_store, & ! (in) optional
4464 & err = err ) ! (out) optional
4465 call endsub(subname)

References dc_trace::beginsub(), dc_trace::dbgmessage(), dc_types::dp, dc_trace::endsub(), and historyputintex().

Here is the call graph for this function:

◆ historyputint7()

subroutine historyputint7 ( character(*), intent(in)  varname,
integer, dimension(:,:,:,:,:,:,:), intent(in)  array,
type(gt_history), intent(inout), optional, target  history,
character(*), intent(in), optional  range,
real, intent(in), optional  time,
logical, intent(in), optional  quiet,
type(dc_difftime), intent(in), optional  difftime,
real(dp), intent(in), optional  timed,
logical, intent(in), optional  time_average_store,
logical, intent(out), optional  err 
)

Definition at line 4467 of file historyput.f90.

4470 !
4471 !
4473 use dc_date_types, only: dc_difftime
4474 use dc_types, only: dp
4475 use dc_trace, only: beginsub, endsub, dbgmessage
4476 implicit none
4477 character(*), intent(in):: varname
4478 integer, intent(in):: array(:,:,:,:,:,:,:)
4479 type(GT_HISTORY), intent(inout), optional, target:: history
4480 character(*), intent(in), optional:: range
4481 real, intent(in), optional:: time
4482 logical, intent(in), optional:: quiet
4483 type(DC_DIFFTIME), intent(in), optional:: difftime
4484 real(DP), intent(in), optional:: timed
4485 logical, intent(in), optional:: time_average_store
4486 logical, intent(out), optional:: err
4487 interface historyputintex
4488 subroutine historyputintex( &
4489 & varname, array, arraysize, history, range, &
4490 & time, quiet, difftime, timed, time_average_store, err )
4492 use dc_date_types, only: dc_difftime
4493 use dc_types, only: dp
4494 character(*), intent(in):: varname
4495 integer, intent(in):: arraysize
4496 integer, intent(in):: array(arraysize)
4497 type(GT_HISTORY), intent(inout), target, optional:: history
4498 character(*), intent(in), optional:: range
4499 real, intent(in), optional:: time
4500 logical, intent(in), optional:: quiet
4501 type(DC_DIFFTIME), intent(in), optional:: difftime
4502 real(DP), intent(in), optional:: timed
4503 logical, intent(in), optional:: time_average_store
4504 logical, intent(out), optional:: err
4505 end subroutine historyputintex
4506 end interface
4507 character(*), parameter:: subname = "HistoryPutInt7"
4508 continue
4509 call beginsub(subname)
4510 call historyputintex( &
4511 & varname, & ! (in)
4512 & pack(array, .true.), size(array), & ! (in)
4513 & history = history, & ! (inout) optional
4514 & range = range, & ! (in) optional
4515 & time = time, & ! (in) optional
4516 & quiet = quiet, & ! (in) optional
4517 & difftime = difftime, & ! (in) optional
4518 & timed = timed, & ! (in) optional
4519 & time_average_store = &
4520 & time_average_store, & ! (in) optional
4521 & err = err ) ! (out) optional
4522 call endsub(subname)

References dc_trace::beginsub(), dc_trace::dbgmessage(), dc_types::dp, dc_trace::endsub(), and historyputintex().

Here is the call graph for this function:

◆ historyputintex()

recursive subroutine historyputintex ( character(*), intent(in)  varname,
integer, dimension(arraysize), intent(in)  array,
integer, intent(in)  arraysize,
type(gt_history), intent(inout), optional, target  history,
character(*), intent(in), optional  range,
real, intent(in), optional  time,
logical, intent(in), optional  quiet,
type(dc_difftime), intent(in), optional  difftime,
real(dp), intent(in), optional  timed,
logical, intent(in), optional  time_average_store,
logical, intent(out), optional  err 
)

データ出力

Parameters
[in]varname

iline 1

こちらは配列サイズを指定する必要があるため、 HistoryPut を利用してください。

Definition at line 1381 of file historyput.f90.

1384 !
1389 !
1394 use gtdata_generic, only: put, gtvarsync, slice, inquire, &
1396 use gtdata_types, only: gt_variable
1397 use dc_types, only: string, dp, dp_eps
1398 use dc_string, only: stoa, printf, tochar, joinchar
1402 use dc_message, only: messagenotify
1403 use dc_url, only: urlsplit, urlmerge
1404 use dc_date_types, only: dc_difftime
1405 use dc_date_generic, only: operator(==), dcdifftimecreate, &
1406 & mod, operator(-), evalbyunit, operator(/), tochar
1407 use dc_trace, only: beginsub, endsub, dbgmessage
1408 use mpi
1409 implicit none
1410 character(*), intent(in):: varname
1411 integer, intent(in):: arraysize
1412 integer, intent(in):: array(arraysize)
1413 type(GT_HISTORY), intent(inout), target, optional:: history
1414 character(*), intent(in), optional:: range
1415 ! gtool4 のコンマ記法による
1416 ! データの出力範囲指定
1417 !
1418 ! このオプションを用いる
1419 ! 際には、必ず *HistorySetTime*
1420 ! によって明示的に時刻の設定
1421 ! を行ってください。
1422 ! また、*HistoryGet* と異なり、
1423 ! 時刻に関する範囲指定は
1424 ! 行なえません。
1425 !
1426 ! 書式に関する詳細は
1427 ! {gtool4 netCDF 規約}[link:../xref.htm#label-6]
1428 ! の「5.4 コンマ記法」を参照して
1429 ! ください。
1430 real, intent(in), optional:: time
1431 !
1432 ! 時刻. (単精度実数型)
1433 !
1434 ! この引数を与える場合,
1435 ! 出力するかどうかをプログラムが
1436 ! 自動的に判断します.
1437 ! *time* に与えられた数値が
1438 ! HistoryCreate に与えた *interval*
1439 ! で割り切れる場合には出力が行われます.
1440 !
1441 ! HistoryAddVariable で
1442 ! *time_average* (または *average*)
1443 ! に .true. を与えた場合には,
1444 ! *time*, *difftime*
1445 ! のどちらの引数も与えない場合に,
1446 ! プログラムはエラーを発生させます.
1447 !
1448 ! また, この引数と *range* は併用できません.
1449 ! 併用した場合には,
1450 ! プログラムはエラーを発生させます.
1451 !
1452 logical, intent(in), optional:: quiet
1453 ! .false. を与えた場合,
1454 ! このサブルーチンが呼ばれる毎に
1455 ! ファイル名と時刻が表示されます.
1456 ! デフォルトは .true. です.
1457 !
1458 ! If ".false." is given,
1459 ! a filename and time is displayed
1460 ! when this subroutine is called.
1461 ! Default value is ".true.".
1462 !
1463 type(DC_DIFFTIME), intent(in), optional:: difftime
1464 !
1465 ! 時刻 (dc_date_types::DC_DIFFTIME 型)
1466 !
1467 ! 効果は *time* と同様です.
1468 !
1469 real(DP), intent(in), optional:: timed
1470 !
1471 ! 時刻 (倍精度実数型)
1472 !
1473 ! 効果は *time* と同様です.
1474 !
1475 logical, intent(in), optional:: time_average_store
1476 !
1477 ! 平均値の出力フラグ.
1478 ! この値に .true. を与えた場合には,
1479 ! 出力せずに与えられた値を一旦蓄えます.
1480 ! .false. を与えた場合には,
1481 ! *time* もしくは *difftime* と
1482 ! HistoryCreate に与えた *interval* に
1483 ! 関わらず出力を行います.
1484 !
1485 ! HistoryAddVariable で
1486 ! *time_average* (または *average*)
1487 ! に .true. を与えない場合は無効です.
1488 !
1489 ! *time* と *difftime*
1490 ! のどちらかを同時に与える必要があります.
1491 !
1492 logical, intent(out), optional:: err
1493 ! 例外処理用フラグ.
1494 ! デフォルトでは, この手続き内でエラーが
1495 ! 生じた場合, プログラムは強制終了します.
1496 ! 引数 *err* が与えられる場合,
1497 ! プログラムは強制終了せず, 代わりに
1498 ! *err* に .true. が代入されます.
1499 !
1500 ! Exception handling flag.
1501 ! By default, when error occur in
1502 ! this procedure, the program aborts.
1503 ! If this *err* argument is given,
1504 ! .true. is substituted to *err* and
1505 ! the program does not abort.
1506 type(GT_VARIABLE):: var, timevar
1507 character(STRING):: url, file, time_str
1508 real:: time_value(1:1)
1509 type(GT_HISTORY), pointer:: hst =>null()
1510 integer :: v_ord
1511 character(STRING):: avr_msg
1512 integer, target:: array_work(arraysize)
1513 integer, pointer:: array_work2(:) =>null()
1514 integer:: arraysize_work2
1515 integer, allocatable:: start(:), count(:), stride(:)
1516 integer :: i, dims
1517 logical :: slice_err
1518 character(STRING):: time_name
1519 character(*), parameter:: bnds_suffix = '_bnds'
1520 type(GT_VARIABLE):: bndsvar
1521 integer:: bnds_ord, time_count, bnds_rank
1522 logical:: output_step
1523 real(DP):: timedw
1524! type(DC_DIFFTIME):: difftimew
1525 real(DP):: avr_coef
1526 integer, allocatable:: array_overwrap(:)
1527 integer:: new_index
1528 integer:: numdims, dimord, dimsize, dimsize_max, allcount, ra
1529 character(STRING):: dimname
1530 integer:: st_mpi(MPI_STATUS_SIZE)
1531 integer, allocatable:: array_mpi_tmp(:)
1532 integer, allocatable:: array_mpi_all(:,:)
1533 integer:: stat
1534 integer:: err_mpi
1535 character(STRING):: cause_c
1536 interface timegoahead
1537 subroutine timegoahead( varname, var, head, history, err )
1538 use gtdata_types, only: gt_variable
1540 character(len = *), intent(in):: varname
1541 type(GT_VARIABLE), intent(out):: var
1542 real, intent(in):: head
1543 type(GT_HISTORY), intent(inout), optional, target:: history
1544 logical, intent(out), optional:: err
1545 end subroutine timegoahead
1546 end interface
1547 character(*), parameter:: subname = "HistoryPutIntEx"
1548 continue
1549 call beginsub(subname, 'varname=%a range=%a', &
1550 & ca=stoa(varname, present_select('', '(no-range)', range)))
1551 stat = dc_noerr
1552 cause_c = ""
1553 if (present(history)) then
1554 hst => history
1555 else
1556 hst => default
1557 endif
1558 !-----------------------------------------------------------------
1559 ! 初期設定のチェック
1560 ! Check initialization
1561 !-----------------------------------------------------------------
1562 if ( .not. hst % initialized ) then
1563 stat = dc_enotinit
1564 cause_c = 'GT_HISTORY'
1565 goto 999
1566 end if
1567 !-----------------------------------------------------------------
1568 ! time と range の同時使用の禁止
1569 ! Permit concurrent use of "time" and "range"
1570 !-----------------------------------------------------------------
1571 if ( ( present(time) .or. present(difftime) .or. present(timed) ) &
1572 & .and. present_and_not_empty(range) ) then
1573 call messagenotify('W', subname, &
1574 & '(varname=%c) "range" and "time" or "timed" or "difftime" are not suppored at the same time', &
1575 & c1 = trim(varname) )
1576 stat = usr_errno
1577 cause_c = '"range" and "time" or "timed" or "difftime" are not suppored at the same time'
1578 goto 999
1579 end if
1580 !-----------------------------------------------------------------
1581 ! hst 内の varname 変数の変数番号を取得
1582 ! Get variable number of "varname" in "hst"
1583 !-----------------------------------------------------------------
1584 if ( .not. hst % mpi_gather ) then
1585 v_ord = lookup_variable_ord(hst, varname)
1586 else
1587 if ( hst % mpi_myrank == 0 ) then
1588 v_ord = lookup_variable_ord(hst, varname)
1589 end if
1590 call mpi_bcast( v_ord, 1, mpi_integer, 0, mpi_comm_world, err_mpi )
1591 call dbgmessage('v_ord=<%d> is shared on all nodes.', i = (/v_ord/) )
1592 end if
1593 timedw = 0.0_dp
1594 !-----------------------------------------------------------------
1595 ! 時間平均値のためのデータ格納
1596 ! Store data for time average value
1597 !-----------------------------------------------------------------
1598 if ( present(difftime) ) then
1599 timedw = evalbyunit( difftime, '', hst % unlimited_units_symbol )
1600 elseif ( present(timed) ) then
1601 timedw = timed
1602 elseif ( present(time) ) then
1603 timedw = time
1604 end if
1605 if ( v_ord > 0 ) then
1606 !
1607 ! var_avr_count == -1: 平均処理は行わない.
1608 ! var_avr_count >= 0: 平均処理を行う.
1609 !
1610 ! これらは HistoryAddVariable で指定される.
1611 !
1612 if ( hst % var_avr_count( v_ord ) > -1 ) then
1613 ! 時刻が指定されない場合には平均処理が不可能なため
1614 ! エラー発生. dc_error のエラーメッセージだけでは多少
1615 ! 不親切なので, エラー直前に下記の警告メッセージ表示.
1616 !
1617 if ( .not. present(time) &
1618 & .and. .not. present(timed) &
1619 & .and. .not. present(difftime) ) then
1620 call messagenotify('W', subname, &
1621 & '(varname=%c) arguments "time" or "timed" or "difftime" are needed ' // &
1622 & 'when "time_average=.true." is specified to "HistoryAddVariable"', &
1623 & c1 = trim(varname) )
1624 stat = dc_earglack
1625 cause_c = 'time'
1626 goto 999
1627 end if
1628 ! 与えられたデータのサイズと内部で積算しているデータのサイズが
1629 ! 一致しない場合にもエラーを発生.
1630 ! データサイズは HistoryPut -> HistoryPutEx の際に
1631 ! 全て 1 次元化しているため, 単純に配列サイズでのみ判定.
1632 ! dc_error のエラーメッセージだけでは多少
1633 ! 不親切なので, エラー直前に下記の警告メッセージ表示.
1634 !
1635 if ( arraysize /= hst % var_avr_data( v_ord ) % length ) then
1636 call messagenotify('W', subname, &
1637 & '(varname=%c) size of array should be (%d). size of array is (%d)', &
1638 & i = (/hst % var_avr_data( v_ord ) % length, arraysize/), &
1639 & c1 = trim(varname) )
1640 stat = gt_eargsizemismatch
1641 cause_c = 'array'
1642 goto 999
1643 end if
1644 ! この if 〜 end if では以下の動作を行う.
1645 !
1646 ! * 平均処理時の係数 (avr_coef) の算出
1647 ! * 係数を算出するための以下の値の設定
1648 ! * 基本時間間隔 (var_avr_baseint)
1649 ! * 前回出力の時刻 (var_avr_prevtime)
1650 ! * 初回出力の判定を行うラベル (var_avr_firstput) の設定
1651 !
1652 ! 1 度目に呼ばれた場合はとりあえず係数を 1.0 にするとともに,
1653 ! prevtime に現在時刻を保管
1654 !
1655 if ( hst % var_avr_firstput( v_ord ) ) then
1656 if ( hst % var_avr_count( v_ord ) == 0 ) then
1657 avr_coef = 1.0_dp
1658 hst % var_avr_prevtime( v_ord ) = timedw
1659 else
1660 hst % var_avr_baseint( v_ord ) = &
1661 & timedw - hst % var_avr_prevtime( v_ord )
1662 avr_coef = 1.0_dp
1663 hst % var_avr_prevtime( v_ord ) = timedw
1664 hst % var_avr_firstput( v_ord ) = .false.
1665 end if
1666 ! 2 度目以降に呼ばれた場合
1667 !
1668 else
1669 ! 前回出力を行った (var_avr_count == 0 に初期化された)
1670 ! 場合には baseint に前回時刻と今回時刻の差を設定.
1671 ! avr_coef には 1 を設定.
1672 ! 最後に prevtime に今回の時刻を保管.
1673 !
1674 if ( hst % var_avr_count( v_ord ) == 0 ) then
1675 hst % var_avr_baseint( v_ord ) = &
1676 & timedw - hst % var_avr_prevtime( v_ord )
1677 avr_coef = 1.0_dp
1678 hst % var_avr_prevtime( v_ord ) = timedw
1679 ! var_avr_count > 0 (平均処理されるデータが蓄積されている)
1680 ! 場合には avr_coef には前回時刻と今回時刻の差の,
1681 ! baseint からの比を設定する.
1682 ! 最後に prevtime に今回の時刻を保管.
1683 !
1684 else
1685 avr_coef = ( timedw - hst % var_avr_prevtime( v_ord ) ) &
1686 & / hst % var_avr_baseint( v_ord )
1687 hst % var_avr_prevtime( v_ord ) = timedw
1688 end if
1689 end if
1690 ! 積算値 a_DataAvr に, 今回のデータに係数を掛けたもの
1691 ! を加算する.
1692 !
1693 hst % var_avr_data( v_ord ) % a_DataAvr = &
1694 & hst % var_avr_data( v_ord ) % a_DataAvr + array * avr_coef
1695 ! 積算カウント var_avr_count に +1 し,
1696 ! 係数の積算値 var_avr_coefsum に今回設定された
1697 ! 係数を加算する.
1698 !
1699 hst % var_avr_count( v_ord ) = &
1700 & hst % var_avr_count( v_ord ) + 1
1701 hst % var_avr_coefsum( v_ord ) = &
1702 & hst % var_avr_coefsum( v_ord ) + avr_coef
1703 ! time_bnds(2) に今回の時刻を設定する.
1704 ! (毎回上書きされる).
1705 !
1706 if ( present(difftime) ) then
1707 hst % time_bnds(2:2) = evalbyunit( difftime, '', hst % unlimited_units_symbol )
1708 elseif ( present (timed) ) then
1709 hst % time_bnds(2:2) = timed
1710 else
1711 hst % time_bnds(2:2) = time
1712 end if
1713 end if
1714 end if
1715 !-----------------------------------------------------------------
1716 ! 初期時刻の設定
1717 ! Configure initial time
1718 !-----------------------------------------------------------------
1719 if ( .not. hst % origin_setting ) then
1720 if ( present(difftime) ) then
1721 hst % origin = evalbyunit( difftime, '', hst % unlimited_units_symbol )
1722 hst % time_bnds = evalbyunit( difftime, '', hst % unlimited_units_symbol )
1723 hst % origin_setting = .true.
1724 elseif ( present(timed) ) then
1725 hst % origin = timed
1726 hst % time_bnds = timed
1727 hst % origin_setting = .true.
1728 elseif ( present(time) ) then
1729 hst % origin = time
1730 hst % time_bnds = time
1731 hst % origin_setting = .true.
1732 end if
1733!!$ if ( present(difftime) ) then
1734!!$ hst % origin = difftime
1735!!$ hst % time_bnds = EvalByUnit( difftime, '', hst % unlimited_units_symbol )
1736!!$ hst % origin_setting = .true.
1737!!$ elseif ( present(timed) ) then
1738!!$ call DCDiffTimeCreate( hst % origin, & ! (out)
1739!!$ & real(timed), '', hst % unlimited_units_symbol ) ! (in)
1740!!$ hst % time_bnds = timed
1741!!$ hst % origin_setting = .true.
1742!!$ elseif ( present(time) ) then
1743!!$ call DCDiffTimeCreate( hst % origin, & ! (out)
1744!!$ & time, '', hst % unlimited_units_symbol ) ! (in)
1745!!$ hst % time_bnds = time
1746!!$ hst % origin_setting = .true.
1747!!$ end if
1748 end if
1749 !-----------------------------------------------------------------
1750 ! 時刻の自動チェック
1751 ! Check time automatically
1752 !-----------------------------------------------------------------
1753 output_step = .true.
1754 if ( present_and_false(time_average_store) ) then
1755 output_step = .true.
1756 elseif ( present_and_true(time_average_store) ) then
1757 output_step = .false.
1758 elseif ( present(difftime) .or. present(timed) .or. present(time) ) then
1759 output_step = .false.
1760 if ( abs( hst % interval ) < dp_eps ) then
1761 output_step = .true.
1762 else
1763 if ( abs( mod( timedw - hst % origin, hst % interval ) ) < dp_eps ) then
1764 output_step = .true.
1765 end if
1766 end if
1767 end if
1768 !-------------------------
1769 ! 時間平均値出力のための情報処理
1770 ! Information processing for output time-averaged value
1771 if ( .not. output_step ) then
1772 goto 999
1773 else
1774 array_work = array
1775 avr_msg = ''
1776 if ( v_ord > 0 ) then
1777 if ( hst % var_avr_count( v_ord ) > -1 ) then
1778 if ( present_and_false(quiet) ) then
1779 avr_msg = '(time average of ' // trim( tochar(hst % var_avr_count( v_ord )) ) // ' step data)'
1780 end if
1781 !-------------------
1782 ! 蓄えた値の時間平均化
1783 ! Average stored value in time direction
1784 ! a_DataAvr に蓄えられた値を係数の積算値で割って,
1785 ! これを出力値とする.
1786 !
1787 array_work = int( &
1788 & ( hst % var_avr_data( v_ord ) % a_DataAvr ) / ( hst % var_avr_coefsum( v_ord ) ), &
1789 & kind = kind(array_work) )
1790 ! 積算値, 積算カウント, 係数の積算値をクリアする.
1791 !
1792 hst % var_avr_data( v_ord ) % a_DataAvr = 0.0
1793 hst % var_avr_count( v_ord ) = 0
1794 hst % var_avr_coefsum( v_ord ) = 0.0_dp
1795 hst % var_avr_firstput( v_ord ) = .false.
1796 end if
1797 end if
1798 end if
1799 if ( .not. hst % mpi_gather ) then
1800 array_work2 => array_work
1801 arraysize_work2 = arraysize
1802 else
1803 !-----------------------------------------------------------------
1804 ! MPI 使用時に, 座標軸のデータが与えられた場合には, そのデータを保管.
1805 ! If data of axis is given, the data is stored when MPI is used
1806 !-----------------------------------------------------------------
1807 numdims = size( hst % mpi_fileinfo % axes )
1808 if ( hst % mpi_myrank == 0 ) then
1809 dimord = 0
1810 do i = 1, numdims
1811 call historyaxisinquire( &
1812 & hst % mpi_fileinfo % axes(i), & ! (in)
1813 & name = dimname ) ! (out)
1814 if ( trim(varname) == trim(dimname) ) then
1815 dimord = i
1816 exit
1817 end if
1818 end do
1819 call mpi_bcast( dimord, 1, mpi_integer, 0, mpi_comm_world, err_mpi )
1820 else
1821 call mpi_bcast( dimord, 1, mpi_integer, 0, mpi_comm_world, err_mpi )
1822 end if
1823 if ( dimord > 0 ) then
1824 call historyaxisinquire( &
1825 & hst % mpi_fileinfo % axes(dimord), & ! (in)
1826 & size = dimsize_max ) ! (out)
1827 dimsize = size( array )
1828 if ( dimsize > dimsize_max .and. hst % unlimited_index /= dimord ) then
1829 call messagenotify('W', subname, &
1830 & 'dim=<%c> data size (%d) exceeds size of the dim (%d) by HistoryCreate. ' // &
1831 & 'the data will be trancated. ', &
1832 & i = (/ dimsize, dimsize_max /), c1 = trim(varname) )
1833 dimsize = dimsize_max
1834 end if
1835 if ( associated( hst % mpi_dimdata_each( dimord ) % a_Axis ) ) then
1836 deallocate( hst % mpi_dimdata_each( dimord ) % a_Axis )
1837 end if
1838 allocate( hst % mpi_dimdata_each( dimord ) % a_Axis(dimsize) )
1839 hst % mpi_dimdata_each( dimord ) % a_Axis = array(1:dimsize)
1840 hst % mpi_dimdata_each( dimord ) % length = dimsize
1841 end if
1842 !-----------------------------------------------------------------
1843 ! MPI 使用時に, 従属変数のデータが与えられた場合, データ集約の情報を整理.
1844 ! If data of dependent variables is given,
1845 ! information for integration is arranged when MPI is used
1846 !-----------------------------------------------------------------
1847 if ( v_ord > 0 ) then
1848 if ( .not. associated( hst % mpi_gthr_info ) ) then
1849 call gtmpi_axis_register( hst, err ) ! (inout)
1850 end if
1851 if ( present_and_true( err ) ) goto 999
1852 if ( .not. associated( hst % mpi_vars_index( v_ord ) % allcount ) ) then
1853 call gtmpi_vars_mkindex( hst, v_ord, err ) ! (inout)
1854 end if
1855 if ( present_and_true( err ) ) goto 999
1856 end if
1857 !-----------------------------------------------------------------
1858 ! MPI 使用時は, 各ノードのデータを rank == 0 へ集約する.
1859 ! Data on each node is integrated when MPI is used
1860 !-----------------------------------------------------------------
1861 if ( v_ord > 0 ) then
1862 arraysize_work2 = hst % mpi_vars_index(v_ord) % allcount_all
1863 if ( arraysize_work2 < 1 ) arraysize_work2 = 1
1864 if ( hst % mpi_myrank == 0 ) then
1865 do ra = 1, hst % mpi_nprocs - 1
1866 allcount = hst % mpi_vars_index(v_ord) % allcount(ra)
1867 call mpi_send( allcount, 1, mpi_integer, ra, 0, mpi_comm_world, err_mpi )
1868 end do
1869 else
1870 call mpi_recv( allcount, 1, mpi_integer, 0, 0, mpi_comm_world, st_mpi, err_mpi )
1871 end if
1872 if ( hst % mpi_myrank /= 0 ) then
1873 call mpi_send( array_work, allcount, &
1874 & mpi_integer, 0, 0, mpi_comm_world, err_mpi )
1875 else
1876 allocate( array_mpi_all(0: hst % mpi_nprocs - 1, arraysize_work2 ) )
1877 allocate( array_mpi_tmp( arraysize_work2 ) )
1878 array_mpi_all(:,:) = 0
1879 array_mpi_tmp(:) = 0
1880 allcount = hst % mpi_vars_index(v_ord) % allcount(0)
1881 array_mpi_all(0,1:allcount) = array_work
1882 do ra = 1, hst % mpi_nprocs - 1
1883 allcount = hst % mpi_vars_index(v_ord) % allcount(ra)
1884 call mpi_recv( array_mpi_tmp(1:allcount), allcount, &
1885 & mpi_integer, ra, 0, mpi_comm_world, st_mpi, err_mpi )
1886 array_mpi_all(ra,1:allcount) = array_mpi_tmp(1:allcount)
1887 end do
1888 allocate( array_work2( arraysize_work2 ) )
1889 allocate( array_overwrap( arraysize_work2 ) )
1890 array_work2 = 0
1891 array_overwrap(:) = 0
1892 do ra = 0, hst % mpi_nprocs - 1
1893 do i = 1, hst % mpi_vars_index(v_ord) % allcount(ra)
1894 new_index = hst % mpi_vars_index(v_ord) % each2all(ra, i)
1895 array_work2( new_index ) = &
1896 & array_work2( new_index ) + array_mpi_all( ra, i )
1897 array_overwrap( new_index ) = array_overwrap( new_index ) + 1
1898 end do
1899 end do
1900 where ( array_overwrap == 0 )
1901 array_overwrap = 1
1902 end where
1903 array_work2(:) = array_work2(:) / array_overwrap(:)
1904 deallocate( array_mpi_all, array_mpi_tmp, array_overwrap )
1905 ! array_work2 はデータ出力の後に割り付け解除される.
1906 end if
1907 else
1908 array_work2 => array_work
1909 arraysize_work2 = arraysize
1910 end if
1911 end if
1912 !-----------------------------------------------------------------
1913 ! 時刻を1つ進めて, データ出力
1914 ! Progress one time, and output data
1915 !-----------------------------------------------------------------
1916 if ( .not. hst % mpi_gather &
1917 & .or. ( hst % mpi_gather .and. &
1918 & hst % mpi_myrank == 0 .and. &
1919 & hst % mpi_fileinfo % already_output) ) then
1920 call timegoahead( &
1921 & varname = varname, & ! (in)
1922 & head = real(array_work2(1)), & ! (in)
1923 & var = var, & ! (out)
1924 & history = history, & ! (inout)
1925 & err = err ) ! (out)
1926 call inquire( var, & ! (in)
1927 & alldims=dims ) ! (out)
1928 if (present_and_not_empty(range) .and. (dims < 1)) then
1929 call dbgmessage('varname=<%c> has no dimension. so range is ignoread.', &
1930 & c1=trim(varname))
1931 end if
1932 if (.not. (present_and_not_empty(range) .and. (dims > 0))) then
1933 ! range 無しの普通の出力の場合
1934 call put(var, array_work2, arraysize_work2)
1935 else
1936 ! range があり, 且つ varname がちゃんと次元を持っている場合
1937 !
1938 ! 元々の start, count, stride を保持. データを与えた後に復元する.
1939 allocate(start(dims), count(dims), stride(dims))
1940 do i = 1, dims
1941 call get_slice(var, i, start(i), count(i), stride(i))
1942 end do
1943 slice_err = .false. ! 不要だが Slice の引用仕様として必要なため
1944 call slice(var, range, slice_err)
1945 call put(var, array_work2, arraysize_work2)
1946 ! 復元
1947 do i = 1, dims
1948 call slice(var, i, start(i), count(i), stride(i))
1949 end do
1950 deallocate(start, count, stride)
1951 end if
1952 call gtvarsync(var)
1953 if ( hst % mpi_gather .and. v_ord > 0 ) then
1954 deallocate( array_work2 )
1955 end if
1956 end if
1957 !-----------------------------------------------------------------
1958 ! "time_bnds" 変数への出力
1959 ! Output to "time_bnds" variable
1960 !-----------------------------------------------------------------
1961 if ( .not. hst % mpi_gather &
1962 & .or. ( hst % mpi_gather .and. &
1963 & hst % mpi_myrank == 0 .and. &
1964 & hst % mpi_fileinfo % already_output ) ) then
1965 if ( v_ord > 0 ) then
1966 if ( hst % var_avr_count( v_ord ) > -1 ) then
1967 !-------------------
1968 ! 時間次元の名前とファイル名を取得
1969 ! Get name of time dimension, and filename
1970 timevar = hst % dimvars( hst % unlimited_index )
1971 call inquire( &
1972 & var = timevar, & ! (in)
1973 & url = url, & ! (out)
1974 & name = time_name ) ! (out)
1975 call urlsplit( fullname = url, & ! (in)
1976 & file = file ) ! (out)
1977 !-------------------
1978 ! "time_bnds" 変数の取得
1979 ! Get "time_bnds" variable
1980 call open( var = bndsvar, &
1981 & url = urlmerge(file=file, var=trim(time_name) // bnds_suffix) )
1982 bnds_ord = lookup_variable_ord( hst, trim(time_name) // bnds_suffix)
1983 !-------------------
1984 ! "time_bnds" 変数への出力
1985 ! Output to "time_bnds" variable
1986 call inquire( &
1987 & var = bndsvar, & ! (in)
1988 & rank = bnds_rank ) ! (out)
1989 time_count = 1
1990 if ( bnds_rank > 1 ) then
1991 call inquire( &
1992 & var = bndsvar, & ! (in)
1993 & dimord = hst % growable_indices(bnds_ord), & ! (in)
1994 & allcount = time_count ) ! (out)
1995 end if
1996 if ( (hst % time_bnds_output_count < 1) &
1997 & .or. (hst % time_bnds_output_count < time_count) ) then
1998 call slice(bndsvar, hst % growable_indices(bnds_ord), & ! (in)
1999 & start=hst % time_bnds_output_count+1, count=1) ! (in)
2000 call put(bndsvar, hst % time_bnds, 2)
2001 hst % time_bnds_output_count = hst % time_bnds_output_count + 1
2002 end if
2003 call close( var = bndsvar ) ! (inout)
2004 if ( present(difftime) ) then
2005 hst % time_bnds(1:1) = &
2006 & evalbyunit( difftime, '', hst % unlimited_units_symbol )
2007 elseif ( present(timed) ) then
2008 hst % time_bnds(1:1) = timed
2009 else
2010 hst % time_bnds(1:1) = time
2011 end if
2012 end if
2013 end if
2014 end if
2015 !-----------------------------------------------------------------
2016 ! メッセージ出力
2017 ! Output messages
2018 !-----------------------------------------------------------------
2019 if ( .not. hst % mpi_gather &
2020 & .or. ( hst % mpi_gather .and. &
2021 & hst % mpi_myrank == 0 .and. &
2022 & hst % mpi_fileinfo % already_output ) ) then
2023 if ( present_and_false(quiet) ) then
2024 call inquire( hst % dimvars(1), & ! (in)
2025 & url = url ) ! (out)
2026 call urlsplit( fullname = url, & ! (in)
2027 & file = file ) ! (out)
2028 if ( hst % unlimited_index < 1 ) then
2029 time_str = ''
2030 else
2031 timevar = hst % dimvars(hst % unlimited_index)
2032 call slice( timevar, & ! (in)
2033 & 1, start = hst % count(v_ord), count = 1 ) ! (in)
2034 call get( timevar, & ! (inout)
2035 & time_value, & ! (out)
2036 & 1, & ! (in)
2037 & err ) ! (out)
2038 time_str = '(time=' // trim( tochar( time_value(1) )) // ')'
2039 end if
2040 call messagenotify('M', 'HistoryPut', &
2041 & '"%a" => "%a" %a %a', &
2042 & ca = stoa( varname, file, time_str, avr_msg ) )
2043 end if
2044 end if
2045 !-----------------------------------------------------------------
2046 ! 終了処理, 例外処理
2047 ! Termination and Exception handling
2048 !-----------------------------------------------------------------
2049999 continue
2050 call storeerror( stat, subname, err, cause_c )
2051 call endsub(subname)

References dc_trace::beginsub(), dc_trace::dbgmessage(), dc_error::dc_earglack, dc_error::dc_enotinit, dc_error::dc_noerr, gtool_history_internal::default, dc_types::dp, dc_types::dp_eps, dc_trace::endsub(), dc_error::gt_eargsizemismatch, dc_string::joinchar(), dc_present::present_and_false(), dc_present::present_and_not_empty(), dc_present::present_and_true(), dc_error::storeerror(), dc_types::string, timegoahead(), and dc_error::usr_errno.

Here is the call graph for this function:

◆ historyputreal0()

subroutine historyputreal0 ( character(*), intent(in)  varname,
real, intent(in)  value,
type(gt_history), intent(inout), optional, target  history,
character(*), intent(in), optional  range,
real, intent(in), optional  time,
logical, intent(in), optional  quiet,
type(dc_difftime), intent(in), optional  difftime,
real(dp), intent(in), optional  timed,
logical, intent(in), optional  time_average_store,
logical, intent(out), optional  err 
)

Definition at line 3612 of file historyput.f90.

3615 !
3616 !
3618 use dc_date_types, only: dc_difftime
3619 use dc_types, only: dp
3620 use dc_trace, only: beginsub, endsub, dbgmessage
3621 implicit none
3622 character(*), intent(in):: varname
3623 real, intent(in):: value
3624 type(GT_HISTORY), intent(inout), optional, target:: history
3625 character(*), intent(in), optional:: range
3626 real, intent(in), optional:: time
3627 logical, intent(in), optional:: quiet
3628 type(DC_DIFFTIME), intent(in), optional:: difftime
3629 real(DP), intent(in), optional:: timed
3630 logical, intent(in), optional:: time_average_store
3631 logical, intent(out), optional:: err
3632 interface historyputrealex
3633 subroutine historyputrealex( &
3634 & varname, array, arraysize, history, range, &
3635 & time, quiet, difftime, timed, time_average_store, err )
3637 use dc_date_types, only: dc_difftime
3638 use dc_types, only: dp
3639 character(*), intent(in):: varname
3640 integer, intent(in):: arraysize
3641 real, intent(in):: array(arraysize)
3642 type(GT_HISTORY), intent(inout), target, optional:: history
3643 character(*), intent(in), optional:: range
3644 real, intent(in), optional:: time
3645 logical, intent(in), optional:: quiet
3646 type(DC_DIFFTIME), intent(in), optional:: difftime
3647 real(DP), intent(in), optional:: timed
3648 logical, intent(in), optional:: time_average_store
3649 logical, intent(out), optional:: err
3650 end subroutine historyputrealex
3651 end interface
3652 character(*), parameter:: subname = "HistoryPutReal0"
3653 continue
3654 call beginsub(subname)
3655 call historyputrealex( &
3656 & varname, & ! (in)
3657 & (/value/), 1, & ! (in)
3658 & history = history, & ! (inout) optional
3659 & range = range, & ! (in) optional
3660 & time = time, & ! (in) optional
3661 & quiet = quiet, & ! (in) optional
3662 & difftime = difftime, & ! (in) optional
3663 & timed = timed, & ! (in) optional
3664 & time_average_store = &
3665 & time_average_store, & ! (in) optional
3666 & err = err ) ! (out) optional
3667 call endsub(subname)
recursive subroutine historyputrealex(varname, array, arraysize, history, range, time, quiet, difftime, timed, time_average_store, err)
データ出力

References dc_trace::beginsub(), dc_trace::dbgmessage(), dc_types::dp, dc_trace::endsub(), and historyputrealex().

Here is the call graph for this function:

◆ historyputreal1()

subroutine historyputreal1 ( character(*), intent(in)  varname,
real, dimension(:), intent(in)  array,
type(gt_history), intent(inout), optional, target  history,
character(*), intent(in), optional  range,
real, intent(in), optional  time,
logical, intent(in), optional  quiet,
type(dc_difftime), intent(in), optional  difftime,
real(dp), intent(in), optional  timed,
logical, intent(in), optional  time_average_store,
logical, intent(out), optional  err 
)

Definition at line 3669 of file historyput.f90.

3672 !
3673 !
3675 use dc_date_types, only: dc_difftime
3676 use dc_types, only: dp
3677 use dc_trace, only: beginsub, endsub, dbgmessage
3678 implicit none
3679 character(*), intent(in):: varname
3680 real, intent(in):: array(:)
3681 type(GT_HISTORY), intent(inout), optional, target:: history
3682 character(*), intent(in), optional:: range
3683 real, intent(in), optional:: time
3684 logical, intent(in), optional:: quiet
3685 type(DC_DIFFTIME), intent(in), optional:: difftime
3686 real(DP), intent(in), optional:: timed
3687 logical, intent(in), optional:: time_average_store
3688 logical, intent(out), optional:: err
3689 interface historyputrealex
3690 subroutine historyputrealex( &
3691 & varname, array, arraysize, history, range, &
3692 & time, quiet, difftime, timed, time_average_store, err )
3694 use dc_date_types, only: dc_difftime
3695 use dc_types, only: dp
3696 character(*), intent(in):: varname
3697 integer, intent(in):: arraysize
3698 real, intent(in):: array(arraysize)
3699 type(GT_HISTORY), intent(inout), target, optional:: history
3700 character(*), intent(in), optional:: range
3701 real, intent(in), optional:: time
3702 logical, intent(in), optional:: quiet
3703 type(DC_DIFFTIME), intent(in), optional:: difftime
3704 real(DP), intent(in), optional:: timed
3705 logical, intent(in), optional:: time_average_store
3706 logical, intent(out), optional:: err
3707 end subroutine historyputrealex
3708 end interface
3709 character(*), parameter:: subname = "HistoryPutReal1"
3710 continue
3711 call beginsub(subname)
3712 call historyputrealex( &
3713 & varname, & ! (in)
3714 & pack(array, .true.), size(array), & ! (in)
3715 & history = history, & ! (inout) optional
3716 & range = range, & ! (in) optional
3717 & time = time, & ! (in) optional
3718 & quiet = quiet, & ! (in) optional
3719 & difftime = difftime, & ! (in) optional
3720 & timed = timed, & ! (in) optional
3721 & time_average_store = &
3722 & time_average_store, & ! (in) optional
3723 & err = err ) ! (out) optional
3724 call endsub(subname)

References dc_trace::beginsub(), dc_trace::dbgmessage(), dc_types::dp, dc_trace::endsub(), and historyputrealex().

Here is the call graph for this function:

◆ historyputreal2()

subroutine historyputreal2 ( character(*), intent(in)  varname,
real, dimension(:,:), intent(in)  array,
type(gt_history), intent(inout), optional, target  history,
character(*), intent(in), optional  range,
real, intent(in), optional  time,
logical, intent(in), optional  quiet,
type(dc_difftime), intent(in), optional  difftime,
real(dp), intent(in), optional  timed,
logical, intent(in), optional  time_average_store,
logical, intent(out), optional  err 
)

Definition at line 3726 of file historyput.f90.

3729 !
3730 !
3732 use dc_date_types, only: dc_difftime
3733 use dc_types, only: dp
3734 use dc_trace, only: beginsub, endsub, dbgmessage
3735 implicit none
3736 character(*), intent(in):: varname
3737 real, intent(in):: array(:,:)
3738 type(GT_HISTORY), intent(inout), optional, target:: history
3739 character(*), intent(in), optional:: range
3740 real, intent(in), optional:: time
3741 logical, intent(in), optional:: quiet
3742 type(DC_DIFFTIME), intent(in), optional:: difftime
3743 real(DP), intent(in), optional:: timed
3744 logical, intent(in), optional:: time_average_store
3745 logical, intent(out), optional:: err
3746 interface historyputrealex
3747 subroutine historyputrealex( &
3748 & varname, array, arraysize, history, range, &
3749 & time, quiet, difftime, timed, time_average_store, err )
3751 use dc_date_types, only: dc_difftime
3752 use dc_types, only: dp
3753 character(*), intent(in):: varname
3754 integer, intent(in):: arraysize
3755 real, intent(in):: array(arraysize)
3756 type(GT_HISTORY), intent(inout), target, optional:: history
3757 character(*), intent(in), optional:: range
3758 real, intent(in), optional:: time
3759 logical, intent(in), optional:: quiet
3760 type(DC_DIFFTIME), intent(in), optional:: difftime
3761 real(DP), intent(in), optional:: timed
3762 logical, intent(in), optional:: time_average_store
3763 logical, intent(out), optional:: err
3764 end subroutine historyputrealex
3765 end interface
3766 character(*), parameter:: subname = "HistoryPutReal2"
3767 continue
3768 call beginsub(subname)
3769 call historyputrealex( &
3770 & varname, & ! (in)
3771 & pack(array, .true.), size(array), & ! (in)
3772 & history = history, & ! (inout) optional
3773 & range = range, & ! (in) optional
3774 & time = time, & ! (in) optional
3775 & quiet = quiet, & ! (in) optional
3776 & difftime = difftime, & ! (in) optional
3777 & timed = timed, & ! (in) optional
3778 & time_average_store = &
3779 & time_average_store, & ! (in) optional
3780 & err = err ) ! (out) optional
3781 call endsub(subname)

References dc_trace::beginsub(), dc_trace::dbgmessage(), dc_types::dp, dc_trace::endsub(), and historyputrealex().

Here is the call graph for this function:

◆ historyputreal3()

subroutine historyputreal3 ( character(*), intent(in)  varname,
real, dimension(:,:,:), intent(in)  array,
type(gt_history), intent(inout), optional, target  history,
character(*), intent(in), optional  range,
real, intent(in), optional  time,
logical, intent(in), optional  quiet,
type(dc_difftime), intent(in), optional  difftime,
real(dp), intent(in), optional  timed,
logical, intent(in), optional  time_average_store,
logical, intent(out), optional  err 
)

Definition at line 3783 of file historyput.f90.

3786 !
3787 !
3789 use dc_date_types, only: dc_difftime
3790 use dc_types, only: dp
3791 use dc_trace, only: beginsub, endsub, dbgmessage
3792 implicit none
3793 character(*), intent(in):: varname
3794 real, intent(in):: array(:,:,:)
3795 type(GT_HISTORY), intent(inout), optional, target:: history
3796 character(*), intent(in), optional:: range
3797 real, intent(in), optional:: time
3798 logical, intent(in), optional:: quiet
3799 type(DC_DIFFTIME), intent(in), optional:: difftime
3800 real(DP), intent(in), optional:: timed
3801 logical, intent(in), optional:: time_average_store
3802 logical, intent(out), optional:: err
3803 interface historyputrealex
3804 subroutine historyputrealex( &
3805 & varname, array, arraysize, history, range, &
3806 & time, quiet, difftime, timed, time_average_store, err )
3808 use dc_date_types, only: dc_difftime
3809 use dc_types, only: dp
3810 character(*), intent(in):: varname
3811 integer, intent(in):: arraysize
3812 real, intent(in):: array(arraysize)
3813 type(GT_HISTORY), intent(inout), target, optional:: history
3814 character(*), intent(in), optional:: range
3815 real, intent(in), optional:: time
3816 logical, intent(in), optional:: quiet
3817 type(DC_DIFFTIME), intent(in), optional:: difftime
3818 real(DP), intent(in), optional:: timed
3819 logical, intent(in), optional:: time_average_store
3820 logical, intent(out), optional:: err
3821 end subroutine historyputrealex
3822 end interface
3823 character(*), parameter:: subname = "HistoryPutReal3"
3824 continue
3825 call beginsub(subname)
3826 call historyputrealex( &
3827 & varname, & ! (in)
3828 & pack(array, .true.), size(array), & ! (in)
3829 & history = history, & ! (inout) optional
3830 & range = range, & ! (in) optional
3831 & time = time, & ! (in) optional
3832 & quiet = quiet, & ! (in) optional
3833 & difftime = difftime, & ! (in) optional
3834 & timed = timed, & ! (in) optional
3835 & time_average_store = &
3836 & time_average_store, & ! (in) optional
3837 & err = err ) ! (out) optional
3838 call endsub(subname)

References dc_trace::beginsub(), dc_trace::dbgmessage(), dc_types::dp, dc_trace::endsub(), and historyputrealex().

Here is the call graph for this function:

◆ historyputreal4()

subroutine historyputreal4 ( character(*), intent(in)  varname,
real, dimension(:,:,:,:), intent(in)  array,
type(gt_history), intent(inout), optional, target  history,
character(*), intent(in), optional  range,
real, intent(in), optional  time,
logical, intent(in), optional  quiet,
type(dc_difftime), intent(in), optional  difftime,
real(dp), intent(in), optional  timed,
logical, intent(in), optional  time_average_store,
logical, intent(out), optional  err 
)

Definition at line 3840 of file historyput.f90.

3843 !
3844 !
3846 use dc_date_types, only: dc_difftime
3847 use dc_types, only: dp
3848 use dc_trace, only: beginsub, endsub, dbgmessage
3849 implicit none
3850 character(*), intent(in):: varname
3851 real, intent(in):: array(:,:,:,:)
3852 type(GT_HISTORY), intent(inout), optional, target:: history
3853 character(*), intent(in), optional:: range
3854 real, intent(in), optional:: time
3855 logical, intent(in), optional:: quiet
3856 type(DC_DIFFTIME), intent(in), optional:: difftime
3857 real(DP), intent(in), optional:: timed
3858 logical, intent(in), optional:: time_average_store
3859 logical, intent(out), optional:: err
3860 interface historyputrealex
3861 subroutine historyputrealex( &
3862 & varname, array, arraysize, history, range, &
3863 & time, quiet, difftime, timed, time_average_store, err )
3865 use dc_date_types, only: dc_difftime
3866 use dc_types, only: dp
3867 character(*), intent(in):: varname
3868 integer, intent(in):: arraysize
3869 real, intent(in):: array(arraysize)
3870 type(GT_HISTORY), intent(inout), target, optional:: history
3871 character(*), intent(in), optional:: range
3872 real, intent(in), optional:: time
3873 logical, intent(in), optional:: quiet
3874 type(DC_DIFFTIME), intent(in), optional:: difftime
3875 real(DP), intent(in), optional:: timed
3876 logical, intent(in), optional:: time_average_store
3877 logical, intent(out), optional:: err
3878 end subroutine historyputrealex
3879 end interface
3880 character(*), parameter:: subname = "HistoryPutReal4"
3881 continue
3882 call beginsub(subname)
3883 call historyputrealex( &
3884 & varname, & ! (in)
3885 & pack(array, .true.), size(array), & ! (in)
3886 & history = history, & ! (inout) optional
3887 & range = range, & ! (in) optional
3888 & time = time, & ! (in) optional
3889 & quiet = quiet, & ! (in) optional
3890 & difftime = difftime, & ! (in) optional
3891 & timed = timed, & ! (in) optional
3892 & time_average_store = &
3893 & time_average_store, & ! (in) optional
3894 & err = err ) ! (out) optional
3895 call endsub(subname)

References dc_trace::beginsub(), dc_trace::dbgmessage(), dc_types::dp, dc_trace::endsub(), and historyputrealex().

Here is the call graph for this function:

◆ historyputreal5()

subroutine historyputreal5 ( character(*), intent(in)  varname,
real, dimension(:,:,:,:,:), intent(in)  array,
type(gt_history), intent(inout), optional, target  history,
character(*), intent(in), optional  range,
real, intent(in), optional  time,
logical, intent(in), optional  quiet,
type(dc_difftime), intent(in), optional  difftime,
real(dp), intent(in), optional  timed,
logical, intent(in), optional  time_average_store,
logical, intent(out), optional  err 
)

Definition at line 3897 of file historyput.f90.

3900 !
3901 !
3903 use dc_date_types, only: dc_difftime
3904 use dc_types, only: dp
3905 use dc_trace, only: beginsub, endsub, dbgmessage
3906 implicit none
3907 character(*), intent(in):: varname
3908 real, intent(in):: array(:,:,:,:,:)
3909 type(GT_HISTORY), intent(inout), optional, target:: history
3910 character(*), intent(in), optional:: range
3911 real, intent(in), optional:: time
3912 logical, intent(in), optional:: quiet
3913 type(DC_DIFFTIME), intent(in), optional:: difftime
3914 real(DP), intent(in), optional:: timed
3915 logical, intent(in), optional:: time_average_store
3916 logical, intent(out), optional:: err
3917 interface historyputrealex
3918 subroutine historyputrealex( &
3919 & varname, array, arraysize, history, range, &
3920 & time, quiet, difftime, timed, time_average_store, err )
3922 use dc_date_types, only: dc_difftime
3923 use dc_types, only: dp
3924 character(*), intent(in):: varname
3925 integer, intent(in):: arraysize
3926 real, intent(in):: array(arraysize)
3927 type(GT_HISTORY), intent(inout), target, optional:: history
3928 character(*), intent(in), optional:: range
3929 real, intent(in), optional:: time
3930 logical, intent(in), optional:: quiet
3931 type(DC_DIFFTIME), intent(in), optional:: difftime
3932 real(DP), intent(in), optional:: timed
3933 logical, intent(in), optional:: time_average_store
3934 logical, intent(out), optional:: err
3935 end subroutine historyputrealex
3936 end interface
3937 character(*), parameter:: subname = "HistoryPutReal5"
3938 continue
3939 call beginsub(subname)
3940 call historyputrealex( &
3941 & varname, & ! (in)
3942 & pack(array, .true.), size(array), & ! (in)
3943 & history = history, & ! (inout) optional
3944 & range = range, & ! (in) optional
3945 & time = time, & ! (in) optional
3946 & quiet = quiet, & ! (in) optional
3947 & difftime = difftime, & ! (in) optional
3948 & timed = timed, & ! (in) optional
3949 & time_average_store = &
3950 & time_average_store, & ! (in) optional
3951 & err = err ) ! (out) optional
3952 call endsub(subname)

References dc_trace::beginsub(), dc_trace::dbgmessage(), dc_types::dp, dc_trace::endsub(), and historyputrealex().

Here is the call graph for this function:

◆ historyputreal6()

subroutine historyputreal6 ( character(*), intent(in)  varname,
real, dimension(:,:,:,:,:,:), intent(in)  array,
type(gt_history), intent(inout), optional, target  history,
character(*), intent(in), optional  range,
real, intent(in), optional  time,
logical, intent(in), optional  quiet,
type(dc_difftime), intent(in), optional  difftime,
real(dp), intent(in), optional  timed,
logical, intent(in), optional  time_average_store,
logical, intent(out), optional  err 
)

Definition at line 3954 of file historyput.f90.

3957 !
3958 !
3960 use dc_date_types, only: dc_difftime
3961 use dc_types, only: dp
3962 use dc_trace, only: beginsub, endsub, dbgmessage
3963 implicit none
3964 character(*), intent(in):: varname
3965 real, intent(in):: array(:,:,:,:,:,:)
3966 type(GT_HISTORY), intent(inout), optional, target:: history
3967 character(*), intent(in), optional:: range
3968 real, intent(in), optional:: time
3969 logical, intent(in), optional:: quiet
3970 type(DC_DIFFTIME), intent(in), optional:: difftime
3971 real(DP), intent(in), optional:: timed
3972 logical, intent(in), optional:: time_average_store
3973 logical, intent(out), optional:: err
3974 interface historyputrealex
3975 subroutine historyputrealex( &
3976 & varname, array, arraysize, history, range, &
3977 & time, quiet, difftime, timed, time_average_store, err )
3979 use dc_date_types, only: dc_difftime
3980 use dc_types, only: dp
3981 character(*), intent(in):: varname
3982 integer, intent(in):: arraysize
3983 real, intent(in):: array(arraysize)
3984 type(GT_HISTORY), intent(inout), target, optional:: history
3985 character(*), intent(in), optional:: range
3986 real, intent(in), optional:: time
3987 logical, intent(in), optional:: quiet
3988 type(DC_DIFFTIME), intent(in), optional:: difftime
3989 real(DP), intent(in), optional:: timed
3990 logical, intent(in), optional:: time_average_store
3991 logical, intent(out), optional:: err
3992 end subroutine historyputrealex
3993 end interface
3994 character(*), parameter:: subname = "HistoryPutReal6"
3995 continue
3996 call beginsub(subname)
3997 call historyputrealex( &
3998 & varname, & ! (in)
3999 & pack(array, .true.), size(array), & ! (in)
4000 & history = history, & ! (inout) optional
4001 & range = range, & ! (in) optional
4002 & time = time, & ! (in) optional
4003 & quiet = quiet, & ! (in) optional
4004 & difftime = difftime, & ! (in) optional
4005 & timed = timed, & ! (in) optional
4006 & time_average_store = &
4007 & time_average_store, & ! (in) optional
4008 & err = err ) ! (out) optional
4009 call endsub(subname)

References dc_trace::beginsub(), dc_trace::dbgmessage(), dc_types::dp, dc_trace::endsub(), and historyputrealex().

Here is the call graph for this function:

◆ historyputreal7()

subroutine historyputreal7 ( character(*), intent(in)  varname,
real, dimension(:,:,:,:,:,:,:), intent(in)  array,
type(gt_history), intent(inout), optional, target  history,
character(*), intent(in), optional  range,
real, intent(in), optional  time,
logical, intent(in), optional  quiet,
type(dc_difftime), intent(in), optional  difftime,
real(dp), intent(in), optional  timed,
logical, intent(in), optional  time_average_store,
logical, intent(out), optional  err 
)

Definition at line 4011 of file historyput.f90.

4014 !
4015 !
4017 use dc_date_types, only: dc_difftime
4018 use dc_types, only: dp
4019 use dc_trace, only: beginsub, endsub, dbgmessage
4020 implicit none
4021 character(*), intent(in):: varname
4022 real, intent(in):: array(:,:,:,:,:,:,:)
4023 type(GT_HISTORY), intent(inout), optional, target:: history
4024 character(*), intent(in), optional:: range
4025 real, intent(in), optional:: time
4026 logical, intent(in), optional:: quiet
4027 type(DC_DIFFTIME), intent(in), optional:: difftime
4028 real(DP), intent(in), optional:: timed
4029 logical, intent(in), optional:: time_average_store
4030 logical, intent(out), optional:: err
4031 interface historyputrealex
4032 subroutine historyputrealex( &
4033 & varname, array, arraysize, history, range, &
4034 & time, quiet, difftime, timed, time_average_store, err )
4036 use dc_date_types, only: dc_difftime
4037 use dc_types, only: dp
4038 character(*), intent(in):: varname
4039 integer, intent(in):: arraysize
4040 real, intent(in):: array(arraysize)
4041 type(GT_HISTORY), intent(inout), target, optional:: history
4042 character(*), intent(in), optional:: range
4043 real, intent(in), optional:: time
4044 logical, intent(in), optional:: quiet
4045 type(DC_DIFFTIME), intent(in), optional:: difftime
4046 real(DP), intent(in), optional:: timed
4047 logical, intent(in), optional:: time_average_store
4048 logical, intent(out), optional:: err
4049 end subroutine historyputrealex
4050 end interface
4051 character(*), parameter:: subname = "HistoryPutReal7"
4052 continue
4053 call beginsub(subname)
4054 call historyputrealex( &
4055 & varname, & ! (in)
4056 & pack(array, .true.), size(array), & ! (in)
4057 & history = history, & ! (inout) optional
4058 & range = range, & ! (in) optional
4059 & time = time, & ! (in) optional
4060 & quiet = quiet, & ! (in) optional
4061 & difftime = difftime, & ! (in) optional
4062 & timed = timed, & ! (in) optional
4063 & time_average_store = &
4064 & time_average_store, & ! (in) optional
4065 & err = err ) ! (out) optional
4066 call endsub(subname)

References dc_trace::beginsub(), dc_trace::dbgmessage(), dc_types::dp, dc_trace::endsub(), and historyputrealex().

Here is the call graph for this function:

◆ historyputrealex()

recursive subroutine historyputrealex ( character(*), intent(in)  varname,
real, dimension(arraysize), intent(in)  array,
integer, intent(in)  arraysize,
type(gt_history), intent(inout), optional, target  history,
character(*), intent(in), optional  range,
real, intent(in), optional  time,
logical, intent(in), optional  quiet,
type(dc_difftime), intent(in), optional  difftime,
real(dp), intent(in), optional  timed,
logical, intent(in), optional  time_average_store,
logical, intent(out), optional  err 
)

データ出力

Parameters
[in]varname

iline 1

こちらは配列サイズを指定する必要があるため、 HistoryPut を利用してください。

Definition at line 37 of file historyput.f90.

40 !
45 !
52 use gtdata_types, only: gt_variable
53 use dc_types, only: string, dp, dp_eps
54 use dc_string, only: stoa, printf, tochar, joinchar
58 use dc_message, only: messagenotify
59 use dc_url, only: urlsplit, urlmerge
60 use dc_date_types, only: dc_difftime
61 use dc_date_generic, only: operator(==), dcdifftimecreate, &
62 & mod, operator(-), evalbyunit, operator(/), tochar
64 use mpi
65 implicit none
66 character(*), intent(in):: varname
67 integer, intent(in):: arraysize
68 real, intent(in):: array(arraysize)
69 type(GT_HISTORY), intent(inout), target, optional:: history
70 character(*), intent(in), optional:: range
71 ! gtool4 のコンマ記法による
72 ! データの出力範囲指定
73 !
74 ! このオプションを用いる
75 ! 際には、必ず *HistorySetTime*
76 ! によって明示的に時刻の設定
77 ! を行ってください。
78 ! また、*HistoryGet* と異なり、
79 ! 時刻に関する範囲指定は
80 ! 行なえません。
81 !
82 ! 書式に関する詳細は
83 ! {gtool4 netCDF 規約}[link:../xref.htm#label-6]
84 ! の「5.4 コンマ記法」を参照して
85 ! ください。
86 real, intent(in), optional:: time
87 !
88 ! 時刻. (単精度実数型)
89 !
90 ! この引数を与える場合,
91 ! 出力するかどうかをプログラムが
92 ! 自動的に判断します.
93 ! *time* に与えられた数値が
94 ! HistoryCreate に与えた *interval*
95 ! で割り切れる場合には出力が行われます.
96 !
97 ! HistoryAddVariable で
98 ! *time_average* (または *average*)
99 ! に .true. を与えた場合には,
100 ! *time*, *difftime*
101 ! のどちらの引数も与えない場合に,
102 ! プログラムはエラーを発生させます.
103 !
104 ! また, この引数と *range* は併用できません.
105 ! 併用した場合には,
106 ! プログラムはエラーを発生させます.
107 !
108 logical, intent(in), optional:: quiet
109 ! .false. を与えた場合,
110 ! このサブルーチンが呼ばれる毎に
111 ! ファイル名と時刻が表示されます.
112 ! デフォルトは .true. です.
113 !
114 ! If ".false." is given,
115 ! a filename and time is displayed
116 ! when this subroutine is called.
117 ! Default value is ".true.".
118 !
119 type(DC_DIFFTIME), intent(in), optional:: difftime
120 !
121 ! 時刻 (dc_date_types::DC_DIFFTIME 型)
122 !
123 ! 効果は *time* と同様です.
124 !
125 real(DP), intent(in), optional:: timed
126 !
127 ! 時刻 (倍精度実数型)
128 !
129 ! 効果は *time* と同様です.
130 !
131 logical, intent(in), optional:: time_average_store
132 !
133 ! 平均値の出力フラグ.
134 ! この値に .true. を与えた場合には,
135 ! 出力せずに与えられた値を一旦蓄えます.
136 ! .false. を与えた場合には,
137 ! *time* もしくは *difftime* と
138 ! HistoryCreate に与えた *interval* に
139 ! 関わらず出力を行います.
140 !
141 ! HistoryAddVariable で
142 ! *time_average* (または *average*)
143 ! に .true. を与えない場合は無効です.
144 !
145 ! *time* と *difftime*
146 ! のどちらかを同時に与える必要があります.
147 !
148 logical, intent(out), optional:: err
149 ! 例外処理用フラグ.
150 ! デフォルトでは, この手続き内でエラーが
151 ! 生じた場合, プログラムは強制終了します.
152 ! 引数 *err* が与えられる場合,
153 ! プログラムは強制終了せず, 代わりに
154 ! *err* に .true. が代入されます.
155 !
156 ! Exception handling flag.
157 ! By default, when error occur in
158 ! this procedure, the program aborts.
159 ! If this *err* argument is given,
160 ! .true. is substituted to *err* and
161 ! the program does not abort.
162 type(GT_VARIABLE):: var, timevar
163 character(STRING):: url, file, time_str
164 real:: time_value(1:1)
165 type(GT_HISTORY), pointer:: hst =>null()
166 integer :: v_ord
167 character(STRING):: avr_msg
168 real, target:: array_work(arraysize)
169 real, pointer:: array_work2(:) =>null()
170 integer:: arraysize_work2
171 integer, allocatable:: start(:), count(:), stride(:)
172 integer :: i, dims
173 logical :: slice_err
174 character(STRING):: time_name
175 character(*), parameter:: bnds_suffix = '_bnds'
176 type(GT_VARIABLE):: bndsvar
177 integer:: bnds_ord, time_count, bnds_rank
178 logical:: output_step
179 real(DP):: timedw
180! type(DC_DIFFTIME):: difftimew
181 real(DP):: avr_coef
182 integer, allocatable:: array_overwrap(:)
183 integer:: new_index
184 integer:: numdims, dimord, dimsize, dimsize_max, allcount, ra
185 character(STRING):: dimname
186 integer:: st_mpi(MPI_STATUS_SIZE)
187 real, allocatable:: array_mpi_tmp(:)
188 real, allocatable:: array_mpi_all(:,:)
189 integer:: stat
190 integer:: err_mpi
191 character(STRING):: cause_c
192 interface timegoahead
193 subroutine timegoahead( varname, var, head, history, err )
194 use gtdata_types, only: gt_variable
196 character(len = *), intent(in):: varname
197 type(GT_VARIABLE), intent(out):: var
198 real, intent(in):: head
199 type(GT_HISTORY), intent(inout), optional, target:: history
200 logical, intent(out), optional:: err
201 end subroutine timegoahead
202 end interface
203 character(*), parameter:: subname = "HistoryPutRealEx"
204 continue
205 call beginsub(subname, 'varname=%a range=%a', &
206 & ca=stoa(varname, present_select('', '(no-range)', range)))
207 stat = dc_noerr
208 cause_c = ""
209 if (present(history)) then
210 hst => history
211 else
212 hst => default
213 endif
214 !-----------------------------------------------------------------
215 ! 初期設定のチェック
216 ! Check initialization
217 !-----------------------------------------------------------------
218 if ( .not. hst % initialized ) then
219 stat = dc_enotinit
220 cause_c = 'GT_HISTORY'
221 goto 999
222 end if
223 !-----------------------------------------------------------------
224 ! time と range の同時使用の禁止
225 ! Permit concurrent use of "time" and "range"
226 !-----------------------------------------------------------------
227 if ( ( present(time) .or. present(difftime) .or. present(timed) ) &
228 & .and. present_and_not_empty(range) ) then
229 call messagenotify('W', subname, &
230 & '(varname=%c) "range" and "time" or "timed" or "difftime" are not suppored at the same time', &
231 & c1 = trim(varname) )
232 stat = usr_errno
233 cause_c = '"range" and "time" or "timed" or "difftime" are not suppored at the same time'
234 goto 999
235 end if
236 !-----------------------------------------------------------------
237 ! hst 内の varname 変数の変数番号を取得
238 ! Get variable number of "varname" in "hst"
239 !-----------------------------------------------------------------
240 if ( .not. hst % mpi_gather ) then
241 v_ord = lookup_variable_ord(hst, varname)
242 else
243 if ( hst % mpi_myrank == 0 ) then
244 v_ord = lookup_variable_ord(hst, varname)
245 end if
246 call mpi_bcast( v_ord, 1, mpi_integer, 0, mpi_comm_world, err_mpi )
247 call dbgmessage('v_ord=<%d> is shared on all nodes.', i = (/v_ord/) )
248 end if
249 timedw = 0.0_dp
250 !-----------------------------------------------------------------
251 ! 時間平均値のためのデータ格納
252 ! Store data for time average value
253 !-----------------------------------------------------------------
254 if ( present(difftime) ) then
255 timedw = evalbyunit( difftime, '', hst % unlimited_units_symbol )
256 elseif ( present(timed) ) then
257 timedw = timed
258 elseif ( present(time) ) then
259 timedw = time
260 end if
261 if ( v_ord > 0 ) then
262 !
263 ! var_avr_count == -1: 平均処理は行わない.
264 ! var_avr_count >= 0: 平均処理を行う.
265 !
266 ! これらは HistoryAddVariable で指定される.
267 !
268 if ( hst % var_avr_count( v_ord ) > -1 ) then
269 ! 時刻が指定されない場合には平均処理が不可能なため
270 ! エラー発生. dc_error のエラーメッセージだけでは多少
271 ! 不親切なので, エラー直前に下記の警告メッセージ表示.
272 !
273 if ( .not. present(time) &
274 & .and. .not. present(timed) &
275 & .and. .not. present(difftime) ) then
276 call messagenotify('W', subname, &
277 & '(varname=%c) arguments "time" or "timed" or "difftime" are needed ' // &
278 & 'when "time_average=.true." is specified to "HistoryAddVariable"', &
279 & c1 = trim(varname) )
280 stat = dc_earglack
281 cause_c = 'time'
282 goto 999
283 end if
284 ! 与えられたデータのサイズと内部で積算しているデータのサイズが
285 ! 一致しない場合にもエラーを発生.
286 ! データサイズは HistoryPut -> HistoryPutEx の際に
287 ! 全て 1 次元化しているため, 単純に配列サイズでのみ判定.
288 ! dc_error のエラーメッセージだけでは多少
289 ! 不親切なので, エラー直前に下記の警告メッセージ表示.
290 !
291 if ( arraysize /= hst % var_avr_data( v_ord ) % length ) then
292 call messagenotify('W', subname, &
293 & '(varname=%c) size of array should be (%d). size of array is (%d)', &
294 & i = (/hst % var_avr_data( v_ord ) % length, arraysize/), &
295 & c1 = trim(varname) )
297 cause_c = 'array'
298 goto 999
299 end if
300 ! この if 〜 end if では以下の動作を行う.
301 !
302 ! * 平均処理時の係数 (avr_coef) の算出
303 ! * 係数を算出するための以下の値の設定
304 ! * 基本時間間隔 (var_avr_baseint)
305 ! * 前回出力の時刻 (var_avr_prevtime)
306 ! * 初回出力の判定を行うラベル (var_avr_firstput) の設定
307 !
308 ! 1 度目に呼ばれた場合はとりあえず係数を 1.0 にするとともに,
309 ! prevtime に現在時刻を保管
310 !
311 if ( hst % var_avr_firstput( v_ord ) ) then
312 if ( hst % var_avr_count( v_ord ) == 0 ) then
313 avr_coef = 1.0_dp
314 hst % var_avr_prevtime( v_ord ) = timedw
315 else
316 hst % var_avr_baseint( v_ord ) = &
317 & timedw - hst % var_avr_prevtime( v_ord )
318 avr_coef = 1.0_dp
319 hst % var_avr_prevtime( v_ord ) = timedw
320 hst % var_avr_firstput( v_ord ) = .false.
321 end if
322 ! 2 度目以降に呼ばれた場合
323 !
324 else
325 ! 前回出力を行った (var_avr_count == 0 に初期化された)
326 ! 場合には baseint に前回時刻と今回時刻の差を設定.
327 ! avr_coef には 1 を設定.
328 ! 最後に prevtime に今回の時刻を保管.
329 !
330 if ( hst % var_avr_count( v_ord ) == 0 ) then
331 hst % var_avr_baseint( v_ord ) = &
332 & timedw - hst % var_avr_prevtime( v_ord )
333 avr_coef = 1.0_dp
334 hst % var_avr_prevtime( v_ord ) = timedw
335 ! var_avr_count > 0 (平均処理されるデータが蓄積されている)
336 ! 場合には avr_coef には前回時刻と今回時刻の差の,
337 ! baseint からの比を設定する.
338 ! 最後に prevtime に今回の時刻を保管.
339 !
340 else
341 avr_coef = ( timedw - hst % var_avr_prevtime( v_ord ) ) &
342 & / hst % var_avr_baseint( v_ord )
343 hst % var_avr_prevtime( v_ord ) = timedw
344 end if
345 end if
346 ! 積算値 a_DataAvr に, 今回のデータに係数を掛けたもの
347 ! を加算する.
348 !
349 hst % var_avr_data( v_ord ) % a_DataAvr = &
350 & hst % var_avr_data( v_ord ) % a_DataAvr + array * avr_coef
351 ! 積算カウント var_avr_count に +1 し,
352 ! 係数の積算値 var_avr_coefsum に今回設定された
353 ! 係数を加算する.
354 !
355 hst % var_avr_count( v_ord ) = &
356 & hst % var_avr_count( v_ord ) + 1
357 hst % var_avr_coefsum( v_ord ) = &
358 & hst % var_avr_coefsum( v_ord ) + avr_coef
359 ! time_bnds(2) に今回の時刻を設定する.
360 ! (毎回上書きされる).
361 !
362 if ( present(difftime) ) then
363 hst % time_bnds(2:2) = evalbyunit( difftime, '', hst % unlimited_units_symbol )
364 elseif ( present (timed) ) then
365 hst % time_bnds(2:2) = timed
366 else
367 hst % time_bnds(2:2) = time
368 end if
369 end if
370 end if
371 !-----------------------------------------------------------------
372 ! 初期時刻の設定
373 ! Configure initial time
374 !-----------------------------------------------------------------
375 if ( .not. hst % origin_setting ) then
376 if ( present(difftime) ) then
377 hst % origin = evalbyunit( difftime, '', hst % unlimited_units_symbol )
378 hst % time_bnds = evalbyunit( difftime, '', hst % unlimited_units_symbol )
379 hst % origin_setting = .true.
380 elseif ( present(timed) ) then
381 hst % origin = timed
382 hst % time_bnds = timed
383 hst % origin_setting = .true.
384 elseif ( present(time) ) then
385 hst % origin = time
386 hst % time_bnds = time
387 hst % origin_setting = .true.
388 end if
389!!$ if ( present(difftime) ) then
390!!$ hst % origin = difftime
391!!$ hst % time_bnds = EvalByUnit( difftime, '', hst % unlimited_units_symbol )
392!!$ hst % origin_setting = .true.
393!!$ elseif ( present(timed) ) then
394!!$ call DCDiffTimeCreate( hst % origin, & ! (out)
395!!$ & real(timed), '', hst % unlimited_units_symbol ) ! (in)
396!!$ hst % time_bnds = timed
397!!$ hst % origin_setting = .true.
398!!$ elseif ( present(time) ) then
399!!$ call DCDiffTimeCreate( hst % origin, & ! (out)
400!!$ & time, '', hst % unlimited_units_symbol ) ! (in)
401!!$ hst % time_bnds = time
402!!$ hst % origin_setting = .true.
403!!$ end if
404 end if
405 !-----------------------------------------------------------------
406 ! 時刻の自動チェック
407 ! Check time automatically
408 !-----------------------------------------------------------------
409 output_step = .true.
410 if ( present_and_false(time_average_store) ) then
411 output_step = .true.
412 elseif ( present_and_true(time_average_store) ) then
413 output_step = .false.
414 elseif ( present(difftime) .or. present(timed) .or. present(time) ) then
415 output_step = .false.
416 if ( abs( hst % interval ) < dp_eps ) then
417 output_step = .true.
418 else
419 if ( abs( mod( timedw - hst % origin, hst % interval ) ) < dp_eps ) then
420 output_step = .true.
421 end if
422 end if
423 end if
424 !-------------------------
425 ! 時間平均値出力のための情報処理
426 ! Information processing for output time-averaged value
427 if ( .not. output_step ) then
428 goto 999
429 else
430 array_work = array
431 avr_msg = ''
432 if ( v_ord > 0 ) then
433 if ( hst % var_avr_count( v_ord ) > -1 ) then
434 if ( present_and_false(quiet) ) then
435 avr_msg = '(time average of ' // trim( tochar(hst % var_avr_count( v_ord )) ) // ' step data)'
436 end if
437 !-------------------
438 ! 蓄えた値の時間平均化
439 ! Average stored value in time direction
440 ! a_DataAvr に蓄えられた値を係数の積算値で割って,
441 ! これを出力値とする.
442 !
443 array_work = real( &
444 & ( hst % var_avr_data( v_ord ) % a_DataAvr ) / ( hst % var_avr_coefsum( v_ord ) ), &
445 & kind = kind(array_work) )
446 ! 積算値, 積算カウント, 係数の積算値をクリアする.
447 !
448 hst % var_avr_data( v_ord ) % a_DataAvr = 0.0
449 hst % var_avr_count( v_ord ) = 0
450 hst % var_avr_coefsum( v_ord ) = 0.0_dp
451 hst % var_avr_firstput( v_ord ) = .false.
452 end if
453 end if
454 end if
455 if ( .not. hst % mpi_gather ) then
456 array_work2 => array_work
457 arraysize_work2 = arraysize
458 else
459 !-----------------------------------------------------------------
460 ! MPI 使用時に, 座標軸のデータが与えられた場合には, そのデータを保管.
461 ! If data of axis is given, the data is stored when MPI is used
462 !-----------------------------------------------------------------
463 numdims = size( hst % mpi_fileinfo % axes )
464 if ( hst % mpi_myrank == 0 ) then
465 dimord = 0
466 do i = 1, numdims
467 call historyaxisinquire( &
468 & hst % mpi_fileinfo % axes(i), & ! (in)
469 & name = dimname ) ! (out)
470 if ( trim(varname) == trim(dimname) ) then
471 dimord = i
472 exit
473 end if
474 end do
475 call mpi_bcast( dimord, 1, mpi_integer, 0, mpi_comm_world, err_mpi )
476 else
477 call mpi_bcast( dimord, 1, mpi_integer, 0, mpi_comm_world, err_mpi )
478 end if
479 if ( dimord > 0 ) then
480 call historyaxisinquire( &
481 & hst % mpi_fileinfo % axes(dimord), & ! (in)
482 & size = dimsize_max ) ! (out)
483 dimsize = size( array )
484 if ( dimsize > dimsize_max .and. hst % unlimited_index /= dimord ) then
485 call messagenotify('W', subname, &
486 & 'dim=<%c> data size (%d) exceeds size of the dim (%d) by HistoryCreate. ' // &
487 & 'the data will be trancated. ', &
488 & i = (/ dimsize, dimsize_max /), c1 = trim(varname) )
489 dimsize = dimsize_max
490 end if
491 if ( associated( hst % mpi_dimdata_each( dimord ) % a_Axis ) ) then
492 deallocate( hst % mpi_dimdata_each( dimord ) % a_Axis )
493 end if
494 allocate( hst % mpi_dimdata_each( dimord ) % a_Axis(dimsize) )
495 hst % mpi_dimdata_each( dimord ) % a_Axis = array(1:dimsize)
496 hst % mpi_dimdata_each( dimord ) % length = dimsize
497 end if
498 !-----------------------------------------------------------------
499 ! MPI 使用時に, 従属変数のデータが与えられた場合, データ集約の情報を整理.
500 ! If data of dependent variables is given,
501 ! information for integration is arranged when MPI is used
502 !-----------------------------------------------------------------
503 if ( v_ord > 0 ) then
504 if ( .not. associated( hst % mpi_gthr_info ) ) then
505 call gtmpi_axis_register( hst, err ) ! (inout)
506 end if
507 if ( present_and_true( err ) ) goto 999
508 if ( .not. associated( hst % mpi_vars_index( v_ord ) % allcount ) ) then
509 call gtmpi_vars_mkindex( hst, v_ord, err ) ! (inout)
510 end if
511 if ( present_and_true( err ) ) goto 999
512 end if
513 !-----------------------------------------------------------------
514 ! MPI 使用時は, 各ノードのデータを rank == 0 へ集約する.
515 ! Data on each node is integrated when MPI is used
516 !-----------------------------------------------------------------
517 if ( v_ord > 0 ) then
518 arraysize_work2 = hst % mpi_vars_index(v_ord) % allcount_all
519 if ( arraysize_work2 < 1 ) arraysize_work2 = 1
520 if ( hst % mpi_myrank == 0 ) then
521 do ra = 1, hst % mpi_nprocs - 1
522 allcount = hst % mpi_vars_index(v_ord) % allcount(ra)
523 call mpi_send( allcount, 1, mpi_integer, ra, 0, mpi_comm_world, err_mpi )
524 end do
525 else
526 call mpi_recv( allcount, 1, mpi_integer, 0, 0, mpi_comm_world, st_mpi, err_mpi )
527 end if
528 if ( hst % mpi_myrank /= 0 ) then
529 call mpi_send( array_work, allcount, &
530 & mpi_real, 0, 0, mpi_comm_world, err_mpi )
531 else
532 allocate( array_mpi_all(0: hst % mpi_nprocs - 1, arraysize_work2 ) )
533 allocate( array_mpi_tmp( arraysize_work2 ) )
534 array_mpi_all(:,:) = 0.0
535 array_mpi_tmp(:) = 0.0
536 allcount = hst % mpi_vars_index(v_ord) % allcount(0)
537 array_mpi_all(0,1:allcount) = array_work
538 do ra = 1, hst % mpi_nprocs - 1
539 allcount = hst % mpi_vars_index(v_ord) % allcount(ra)
540 call mpi_recv( array_mpi_tmp(1:allcount), allcount, &
541 & mpi_real, ra, 0, mpi_comm_world, st_mpi, err_mpi )
542 array_mpi_all(ra,1:allcount) = array_mpi_tmp(1:allcount)
543 end do
544 allocate( array_work2( arraysize_work2 ) )
545 allocate( array_overwrap( arraysize_work2 ) )
546 array_work2 = 0.0
547 array_overwrap(:) = 0
548 do ra = 0, hst % mpi_nprocs - 1
549 do i = 1, hst % mpi_vars_index(v_ord) % allcount(ra)
550 new_index = hst % mpi_vars_index(v_ord) % each2all(ra, i)
551 array_work2( new_index ) = &
552 & array_work2( new_index ) + array_mpi_all( ra, i )
553 array_overwrap( new_index ) = array_overwrap( new_index ) + 1
554 end do
555 end do
556 where ( array_overwrap == 0 )
557 array_overwrap = 1
558 end where
559 array_work2(:) = array_work2(:) / array_overwrap(:)
560 deallocate( array_mpi_all, array_mpi_tmp, array_overwrap )
561 ! array_work2 はデータ出力の後に割り付け解除される.
562 end if
563 else
564 array_work2 => array_work
565 arraysize_work2 = arraysize
566 end if
567 end if
568 !-----------------------------------------------------------------
569 ! 時刻を1つ進めて, データ出力
570 ! Progress one time, and output data
571 !-----------------------------------------------------------------
572 if ( .not. hst % mpi_gather &
573 & .or. ( hst % mpi_gather .and. &
574 & hst % mpi_myrank == 0 .and. &
575 & hst % mpi_fileinfo % already_output) ) then
576 call timegoahead( &
577 & varname = varname, & ! (in)
578 & head = real(array_work2(1)), & ! (in)
579 & var = var, & ! (out)
580 & history = history, & ! (inout)
581 & err = err ) ! (out)
582 call inquire( var, & ! (in)
583 & alldims=dims ) ! (out)
584 if (present_and_not_empty(range) .and. (dims < 1)) then
585 call dbgmessage('varname=<%c> has no dimension. so range is ignoread.', &
586 & c1=trim(varname))
587 end if
588 if (.not. (present_and_not_empty(range) .and. (dims > 0))) then
589 ! range 無しの普通の出力の場合
590 call put(var, array_work2, arraysize_work2)
591 else
592 ! range があり, 且つ varname がちゃんと次元を持っている場合
593 !
594 ! 元々の start, count, stride を保持. データを与えた後に復元する.
595 allocate(start(dims), count(dims), stride(dims))
596 do i = 1, dims
597 call get_slice(var, i, start(i), count(i), stride(i))
598 end do
599 slice_err = .false. ! 不要だが Slice の引用仕様として必要なため
600 call slice(var, range, slice_err)
601 call put(var, array_work2, arraysize_work2)
602 ! 復元
603 do i = 1, dims
604 call slice(var, i, start(i), count(i), stride(i))
605 end do
606 deallocate(start, count, stride)
607 end if
608 call gtvarsync(var)
609 if ( hst % mpi_gather .and. v_ord > 0 ) then
610 deallocate( array_work2 )
611 end if
612 end if
613 !-----------------------------------------------------------------
614 ! "time_bnds" 変数への出力
615 ! Output to "time_bnds" variable
616 !-----------------------------------------------------------------
617 if ( .not. hst % mpi_gather &
618 & .or. ( hst % mpi_gather .and. &
619 & hst % mpi_myrank == 0 .and. &
620 & hst % mpi_fileinfo % already_output ) ) then
621 if ( v_ord > 0 ) then
622 if ( hst % var_avr_count( v_ord ) > -1 ) then
623 !-------------------
624 ! 時間次元の名前とファイル名を取得
625 ! Get name of time dimension, and filename
626 timevar = hst % dimvars( hst % unlimited_index )
627 call inquire( &
628 & var = timevar, & ! (in)
629 & url = url, & ! (out)
630 & name = time_name ) ! (out)
631 call urlsplit( fullname = url, & ! (in)
632 & file = file ) ! (out)
633 !-------------------
634 ! "time_bnds" 変数の取得
635 ! Get "time_bnds" variable
636 call open( var = bndsvar, &
637 & url = urlmerge(file=file, var=trim(time_name) // bnds_suffix) )
638 bnds_ord = lookup_variable_ord( hst, trim(time_name) // bnds_suffix)
639 !-------------------
640 ! "time_bnds" 変数への出力
641 ! Output to "time_bnds" variable
642 call inquire( &
643 & var = bndsvar, & ! (in)
644 & rank = bnds_rank ) ! (out)
645 time_count = 1
646 if ( bnds_rank > 1 ) then
647 call inquire( &
648 & var = bndsvar, & ! (in)
649 & dimord = hst % growable_indices(bnds_ord), & ! (in)
650 & allcount = time_count ) ! (out)
651 end if
652 if ( (hst % time_bnds_output_count < 1) &
653 & .or. (hst % time_bnds_output_count < time_count) ) then
654 call slice(bndsvar, hst % growable_indices(bnds_ord), & ! (in)
655 & start=hst % time_bnds_output_count+1, count=1) ! (in)
656 call put(bndsvar, hst % time_bnds, 2)
657 hst % time_bnds_output_count = hst % time_bnds_output_count + 1
658 end if
659 call close( var = bndsvar ) ! (inout)
660 if ( present(difftime) ) then
661 hst % time_bnds(1:1) = &
662 & evalbyunit( difftime, '', hst % unlimited_units_symbol )
663 elseif ( present(timed) ) then
664 hst % time_bnds(1:1) = timed
665 else
666 hst % time_bnds(1:1) = time
667 end if
668 end if
669 end if
670 end if
671 !-----------------------------------------------------------------
672 ! メッセージ出力
673 ! Output messages
674 !-----------------------------------------------------------------
675 if ( .not. hst % mpi_gather &
676 & .or. ( hst % mpi_gather .and. &
677 & hst % mpi_myrank == 0 .and. &
678 & hst % mpi_fileinfo % already_output ) ) then
679 if ( present_and_false(quiet) ) then
680 call inquire( hst % dimvars(1), & ! (in)
681 & url = url ) ! (out)
682 call urlsplit( fullname = url, & ! (in)
683 & file = file ) ! (out)
684 if ( hst % unlimited_index < 1 ) then
685 time_str = ''
686 else
687 timevar = hst % dimvars(hst % unlimited_index)
688 call slice( timevar, & ! (in)
689 & 1, start = hst % count(v_ord), count = 1 ) ! (in)
690 call get( timevar, & ! (inout)
691 & time_value, & ! (out)
692 & 1, & ! (in)
693 & err ) ! (out)
694 time_str = '(time=' // trim( tochar( time_value(1) )) // ')'
695 end if
696 call messagenotify('M', 'HistoryPut', &
697 & '"%a" => "%a" %a %a', &
698 & ca = stoa( varname, file, time_str, avr_msg ) )
699 end if
700 end if
701 !-----------------------------------------------------------------
702 ! 終了処理, 例外処理
703 ! Termination and Exception handling
704 !-----------------------------------------------------------------
705999 continue
706 call storeerror( stat, subname, err, cause_c )
707 call endsub(subname)

References dc_trace::beginsub(), dc_trace::dbgmessage(), dc_error::dc_earglack, dc_error::dc_enotinit, dc_error::dc_noerr, gtool_history_internal::default, dc_types::dp, dc_types::dp_eps, dc_trace::endsub(), dc_error::gt_eargsizemismatch, dc_string::joinchar(), dc_present::present_and_false(), dc_present::present_and_not_empty(), dc_present::present_and_true(), dc_error::storeerror(), dc_types::string, timegoahead(), and dc_error::usr_errno.

Here is the call graph for this function:

◆ timegoahead()

subroutine timegoahead ( character(len = *), intent(in)  varname,
type(gt_variable), intent(out)  var,
real, intent(in)  head,
type(gt_history), intent(inout), optional, target  history,
logical, intent(out), optional  err 
)

Definition at line 4581 of file historyput.f90.

4582 !
4583 ! *history* 内の (省略された場合は gtool_history 内に内包
4584 ! される GT_HISTORY 変数) の変数名 *varname* の時間を1つ分
4585 ! 進め、その最新の時間断面で切り取った変数 ID を *var* に返します。
4586 !
4587 !--
4588 ! そのデフォルトでは変数ごとにカウンタを設置し、呼んだ数だけ
4589 ! 「時刻」方向を進め、時刻データを入力する。
4590 ! これに対し、HistorySetTime で時刻の変数に一度でもスカラ値を投入
4591 ! すると、明示的にそれを設定したときにだけ時刻が進むようになる。
4592 ! このルーチンでは後退はできない。
4593 !
4594 ! [詳細]
4595 ! 変数名 varname に対応する変数 ID var を探査し、その変数が
4596 ! 時間次元に依存する場合には hst % count の値を1つ増やす (時間を進める)。
4597 ! そして、hst % origin と hst % interval から時間次元データに値を与える。
4598 !
4599 ! なお、HistorySetTime で既に値が設定され、hst % count の値が
4600 ! 増やされる場合には、こちらでは hst % count の値を変更しない。
4601 ! データも入力しない。
4602 !++
4606 use gtdata_types, only: gt_variable
4607 use dc_types, only: string, dp
4608 use dc_error, only: storeerror, nf90_enotvar, dc_noerr
4609 use,non_intrinsic :: dc_date_generic, only: evalbyunit, operator(+), operator(*), &
4610 & dcdifftimecreate, min, max, evalsec, dcdifftimeputline
4611 use dc_date_types, only: dc_difftime
4612 use dc_trace, only: beginsub, endsub, dbgmessage
4613 implicit none
4614 character(len = *), intent(in) :: varname
4615 type(GT_VARIABLE), intent(out) :: var
4616 real, intent(in):: head
4617 type(GT_HISTORY), intent(inout), optional, target:: history
4618 logical, intent(out), optional :: err
4619 !
4620 type(GT_HISTORY), pointer:: hst =>null()
4621 type(GT_VARIABLE) :: timevar
4622 real, pointer:: time(:) =>null()
4623 integer:: v_ord ! varname の history における次元添字番号
4624 integer:: d_ord
4625 integer:: timestart, rest
4626 integer:: stat
4627 logical:: get_err
4628 real(DP):: curtime
4629! type(DC_DIFFTIME):: headdiff
4630 character(STRING):: cause_c, subname_r
4631 character(*), parameter:: subname = "TimeGoAhead"
4632 continue
4633 call beginsub(subname, 'varname=%c head=%r', &
4634 & c1=trim(varname), r=(/head/))
4635 stat = dc_noerr
4636 cause_c = ''
4637 subname_r = subname
4638 if (present(history)) then
4639 hst => history
4640 else
4641 hst => default
4642 endif
4643 ! hst 内での変数 varname の変数 ID を var に、
4644 ! hst における変数添字を v_ord に取得
4645 var = lookup_variable( hst, varname, & ! (in)
4646 & ord = v_ord ) ! (out)
4647 if (v_ord == 0) goto 1000
4648 ! 変数 v_ord に時間次元が無い場合は終了
4649 if (hst % growable_indices(v_ord) == 0) then
4650 goto 999
4651 endif
4652 if (hst % dim_value_written(hst % unlimited_index)) then
4653 !-----------------------
4654 ! HistorySetTime を利用する場合
4655 !
4656 ! 時間次元に既に値が書き込まれている場合は count を増やさない
4657 !
4658 call slice(var, hst % growable_indices(v_ord), & ! (in)
4659 & start=hst % count(1), count=1) ! (in)
4660 else
4661 !-----------------------
4662 ! HistorySetTime を利用しない場合
4663 !
4664 ! 時間次元に値が書き込まれていない場合, count を増やす
4665 ! (history % interval を利用する)
4666 !
4667 hst % count(v_ord) = hst % count(v_ord) + 1
4668 call slice(var, hst % growable_indices(v_ord), & ! (in)
4669 & start=hst % count(v_ord), count=1) ! (in)
4670 !-----------------------
4671 ! 時間次元変数へのデータ出力
4672 !
4673 ! 変数の count と時間次元変数の count を比較し,
4674 ! 変数の count が大きい場合, 時間次元変数の count も
4675 ! 同値になるようデータを出力する.
4676 !
4677 timevar = hst % dimvars(hst % unlimited_index)
4678 call get_slice(timevar, 1, start=timestart)
4679 call dbgmessage('map(timevar)start is <%d>. map(%c)start is <%d>', &
4680 & i=(/timestart, hst % count(v_ord)/), &
4681 & c1=trim(varname) )
4682 call get(timevar, time, get_err)
4683 call dbgmessage('time(%d)=<%*r>, err=<%b>', &
4684 & i=(/size(time)/), r=(/time(:)/), &
4685 & l=(/get_err/), n=(/size(time)/) )
4686 if (get_err .or. hst % count(v_ord) == 1 .and. timestart == 1) then
4687 !---------------------
4688 ! 時間次元のデータの初期値作成
4689 !
4690 ! 時間次元のデータがまだ作成されていない場合、
4691 ! 初期値となるデータを作成
4692 call slice(timevar, 1, start=1, count=1)
4693 curtime = hst % origin
4694! curtime = EvalByUnit( hst % origin, '', hst % unlimited_units_symbol )
4695 call put(timevar, (/curtime/), 1) ! (in)
4696 elseif (hst % count(v_ord) > timestart) then
4697 !---------------------
4698 ! 時間次元のデータの初期値以外を作成
4699 !
4700 ! 変数の count が時間次元の start より大きい場合、
4701 ! hst % interval でその間を埋める。
4702 rest = timestart + 1
4703 do
4704 call slice(timevar, 1, start=rest, count=1)
4705 curtime = hst % origin + hst % interval * (rest - 1)
4706!!$ curtime = EvalByUnit( &
4707!!$ & hst % origin + hst % interval * (rest - 1), &
4708!!$ & '', hst % unlimited_units_symbol )
4709 call put(timevar, (/curtime/), 1 ) ! (in)
4710 rest = rest + 1
4711 if ( rest > hst % count(v_ord) ) exit
4712 enddo
4713 endif
4714 deallocate(time)
4715 endif
4716 goto 999
47171000 continue
4718 !-----------------------------------------------------------------
4719 ! hst 内に次元以外の変数 ID が見つからない場合
4720 !-----------------------------------------------------------------
4721 !
4722 ! 次元 ID を探査
4723 var = lookup_dimension(hst, varname, ord=d_ord)
4724 !-------------------------
4725 ! 次元も含めた変数の中に varname が無い場合は stat に
4726 ! NF90_ENOTVAR (Variable not Found) を返す.
4727 ! (上のサブルーチンが停止させることを想定)
4728 if (d_ord == 0) then
4729 subname_r = 'HistoryPut'
4730 stat = nf90_enotvar
4731 cause_c = 'varname="' // trim(varname) // '" is not found'
4732 goto 999
4733 endif
4734 hst % dim_value_written(d_ord) = .true.
4735 if (d_ord /= hst % unlimited_index) then
4736 goto 999
4737 endif
4738 !-------------------------
4739 ! ややトリッキーだが、count の2番目以降の要素にも時刻を入れて
4740 ! おくことで、HistorySetTime による巻き戻し後にも値を保持する。
4741 hst % count(:) = maxval(hst % count(:)) + 1
4742!!$ call DCDiffTimeCreate( headdiff, & ! (out)
4743!!$ & head, '', hst % unlimited_units_symbol ) ! (in)
4744 ! hst % newest = max(hst % newest, head)
4745 ! hst % oldest = min(hst % oldest, head)
4746 call slice(var, 1, start=hst % count(1), count=1)
4747999 continue
4748 call storeerror(stat, trim(subname_r), err, cause_c)
4749 call endsub(subname)
subroutine dcdifftimeputline(diff, unit, indent)

References dc_trace::beginsub(), dc_trace::dbgmessage(), dc_error::dc_noerr, dcdifftimeputline(), gtool_history_internal::default, dc_types::dp, dc_trace::endsub(), dc_error::storeerror(), and dc_types::string.

Here is the call graph for this function: