diff --git a/FV3/atmos_cubed_sphere/tools/coarse_grained_diagnostics.F90 b/FV3/atmos_cubed_sphere/tools/coarse_grained_diagnostics.F90 index e4fc7b077..e6697a252 100644 --- a/FV3/atmos_cubed_sphere/tools/coarse_grained_diagnostics.F90 +++ b/FV3/atmos_cubed_sphere/tools/coarse_grained_diagnostics.F90 @@ -716,12 +716,7 @@ subroutine fv_coarse_diag(Atm, Time, zvir) call get_need_nd_work_array(3, need_3d_work_array) call get_need_mass_array(Atm(tile_count)%coarse_graining%strategy, need_mass_array) call get_need_height_array(need_height_array) - - if (trim(Atm(tile_count)%coarse_graining%strategy) .eq. PRESSURE_LEVEL) then - call get_need_masked_area_array(need_masked_area_array) - else - need_masked_area_array = .false. - endif + call get_need_masked_area_array(Atm(tile_count)%coarse_graining%strategy, need_masked_area_array) call get_fine_array_bounds(is, ie, js, je) call get_coarse_array_bounds(is_coarse, ie_coarse, js_coarse, je_coarse) @@ -1014,17 +1009,18 @@ subroutine get_need_mass_array(coarsening_strategy, need_mass_array) character(len=64), intent(in) :: coarsening_strategy logical, intent(out) :: need_mass_array + logical :: valid_axes, valid_id, valid_reduction_method, valid_strategy integer :: index need_mass_array = .false. + valid_strategy = trim(coarsening_strategy) .eq. MODEL_LEVEL + if (.not. valid_strategy) return do index = 1, DIAG_SIZE - if ((coarse_diagnostics(index)%axes == 3) .and. & - (trim(coarse_diagnostics(index)%reduction_method) .eq. MASS_WEIGHTED) .and. & - (coarse_diagnostics(index)%id > 0) .and. & - (trim(coarsening_strategy) .eq. MODEL_LEVEL)) then - need_mass_array = .true. - exit - endif + valid_axes = coarse_diagnostics(index)%axes .eq. 3 + valid_id = coarse_diagnostics(index)%id .gt. 0 + valid_reduction_method = trim(coarse_diagnostics(index)%reduction_method) .eq. MASS_WEIGHTED + need_mass_array = valid_axes .and. valid_id .and. valid_reduction_method + if (need_mass_array) exit enddo end subroutine get_need_mass_array @@ -1046,13 +1042,16 @@ subroutine get_need_height_array(need_height_array) enddo end subroutine get_need_height_array - subroutine get_need_masked_area_array(need_masked_area_array) + subroutine get_need_masked_area_array(coarsening_strategy, need_masked_area_array) + character(len=64), intent(in) :: coarsening_strategy logical, intent(out) :: need_masked_area_array - logical :: valid_axes, valid_id + logical :: valid_axes, valid_id, valid_strategy integer :: index need_masked_area_array = .false. + valid_strategy = trim(coarsening_strategy) .eq. PRESSURE_LEVEL + if (.not. valid_strategy) return do index = 1, DIAG_SIZE valid_axes = coarse_diagnostics(index)%axes .eq. 3 valid_id = coarse_diagnostics(index)%id .gt. 0 diff --git a/FV3/atmos_cubed_sphere/tools/coarse_grained_restart_files.F90 b/FV3/atmos_cubed_sphere/tools/coarse_grained_restart_files.F90 index 9704e9efa..d3ffeef6b 100644 --- a/FV3/atmos_cubed_sphere/tools/coarse_grained_restart_files.F90 +++ b/FV3/atmos_cubed_sphere/tools/coarse_grained_restart_files.F90 @@ -473,13 +473,11 @@ subroutine coarse_grain_fv_tracer_restart_data_on_pressure_levels( & real, intent(in), dimension(is:ie,js:je,1:npz) :: masked_area_weights real, allocatable :: remapped(:,:,:) - character(len=64) :: tracer_name integer :: n_tracer allocate(remapped(is:ie,js:je,1:npz)) do n_tracer = 1, n_prognostic_tracers - call get_tracer_names(MODEL_ATMOS, n_tracer, tracer_name) call vertically_remap_field(phalf(is:ie,js:je,1:npz+1), & Atm%q(is:ie,js:je,1:npz,n_tracer), coarse_phalf_on_fine, Atm%ptop, remapped) call weighted_block_average(masked_area_weights, &