Skip to content

Commit 90433a0

Browse files
committed
src/util/io/output/cable_output_utils.F90: fix cell_methods attribute
1 parent a546402 commit 90433a0

1 file changed

Lines changed: 21 additions & 12 deletions

File tree

src/util/io/output/cable_output_utils.F90

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -476,39 +476,48 @@ function infer_dim_names(output_variable, restart) result(dim_names)
476476
function infer_cell_methods(output_variable) result(cell_methods)
477477
type(cable_output_variable_t), intent(in) :: output_variable
478478
character(len=256) :: cell_methods
479+
character(len=256) :: cell_methods_time, cell_methods_area
479480

480481
if (.not. output_variable%parameter) then
481482
select case (output_variable%aggregation_method)
482483
case ("point")
483-
cell_methods = "time: point"
484+
cell_methods_time = "time: point"
484485
case ("mean")
485-
cell_methods = "time: mean"
486+
cell_methods_time = "time: mean"
486487
case ("sum")
487-
cell_methods = "time: sum"
488+
cell_methods_time = "time: sum"
488489
case ("min")
489-
cell_methods = "time: minimum"
490+
cell_methods_time = "time: minimum"
490491
case ("max")
491-
cell_methods = "time: maximum"
492+
cell_methods_time = "time: maximum"
492493
case default
493494
call cable_abort("Unexpected aggregation method '" // output_variable%aggregation_method // &
494495
"' for variable '" // output_variable%name // "'", __FILE__, __LINE__)
495496
end select
497+
else
498+
cell_methods_time = ""
496499
end if
497500

498501
select case (output_variable%reduction_method)
499-
case ("none", "first_patch_in_grid_cell")
500-
! no additional cell methods
502+
case ("none")
503+
! TODO(Sean): the cell_method for this case should be `area: point where
504+
! pft` where `pft` is a string-valued auxiliary coordinate variable
505+
! describing the labels for all patches:
506+
cell_methods_area = ""
507+
case ("first_patch_in_grid_cell")
508+
! TODO(Sean): the cell_method for this case should be `area: point where
509+
! <area_type>` where `<area_type>` is the area type of the first patch in
510+
! the grid cell:
511+
cell_methods_area = ""
501512
case ("grid_cell_average")
502-
if (len_trim(cell_methods) > 0) then
503-
cell_methods = cell_methods // " area: mean"
504-
else
505-
cell_methods = "area: mean"
506-
end if
513+
cell_methods_area = "area: mean where land"
507514
case default
508515
call cable_abort("Unexpected reduction method '" // output_variable%reduction_method // &
509516
"' for variable '" // output_variable%name // "'", __FILE__, __LINE__)
510517
end select
511518

519+
cell_methods = adjustl(trim(cell_methods_time) // " " // trim(cell_methods_area))
520+
512521
end function
513522

514523
subroutine define_variables(output_file, output_variables, restart)

0 commit comments

Comments
 (0)