Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 40 additions & 1 deletion src/operators/time_average.F90
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,39 @@ recursive subroutine new_data(self)
integer :: i, j, k

call self%source%before_save()

select case (self%method)

case (time_method_minimum)

if (self%n == 0) call self%fill(default_maximum)
select case (self%rank)
case (0)
self%result_0d = min( self%result_0d , self%source_data%p0d )
case (1)
self%result_1d = min( self%result_1d , self%source_data%p1d )
case (2)
self%result_2d = min( self%result_2d , self%source_data%p2d )
case (3)
self%result_3d = min( self%result_3d , self%source_data%p3d )
end select

case (time_method_maximum)

if (self%n == 0) call self%fill(default_minimum)
select case (self%rank)
case (0)
self%result_0d = max( self%result_0d , self%source_data%p0d )
case (1)
self%result_1d = max( self%result_1d , self%source_data%p1d )
case (2)
self%result_2d = max( self%result_2d , self%source_data%p2d )
case (3)
self%result_3d = max( self%result_3d , self%source_data%p3d )
end select

case default

if (self%n == 0) call self%fill(0.0_rk)
select case (self%rank)
case (0)
Expand All @@ -90,6 +123,8 @@ recursive subroutine new_data(self)
self%result_3d(i,j,k) = self%result_3d(i,j,k) + self%source_data%p3d(i,j,k)
end do
end select

end select
self%n = self%n + 1
end subroutine

Expand Down Expand Up @@ -133,10 +168,14 @@ recursive subroutine get_metadata(self, long_name, units, dimensions, minimum, m
select case (self%method)
case (time_method_mean)
call attributes%set('cell_methods', 'time: mean')
case (time_method_minimum)
call attributes%set('cell_methods', 'time: min')
case (time_method_maximum)
call attributes%set('cell_methods', 'time: max')
case default
call attributes%set('cell_methods', 'time: sum')
end select
end if
end subroutine

end module
end module
11 changes: 9 additions & 2 deletions src/output_manager_core.F90
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ module output_manager_core
integer,parameter,public :: time_method_instantaneous = 1
integer,parameter,public :: time_method_mean = 2
integer,parameter,public :: time_method_integrated = 3
integer,parameter,public :: time_method_minimum = 4
integer,parameter,public :: time_method_maximum = 5

integer,parameter,public :: time_unit_none = 0
integer,parameter,public :: time_unit_second = 1
Expand Down Expand Up @@ -377,8 +379,13 @@ subroutine output_variable_settings_initialize(self, settings, parent)
end do
end if

self%time_method = settings%get_integer('time_method', 'treatment of time dimension', options=(/option(time_method_mean, 'mean', 'mean'), &
option(time_method_instantaneous, 'instantaneous', 'point'), option(time_method_integrated, 'integrated', 'integrated')/), default=self%time_method, display=display)
self%time_method = settings%get_integer('time_method', 'treatment of time dimension', &
options=(/ option(time_method_mean, 'mean', 'mean'), &
option(time_method_instantaneous, 'instantaneous', 'point'), &
option(time_method_integrated, 'integrated', 'integrated'), &
option(time_method_minimum, 'minimum', 'minimum'), &
option(time_method_maximum, 'maximum', 'maximum') /), &
default=self%time_method, display=display)
end subroutine output_variable_settings_initialize

recursive subroutine output_variable_settings_finalize(self)
Expand Down