Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The send_data math (field buffer update) functions. #1131

Merged
merged 49 commits into from
Feb 23, 2023
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
6fa06b7
Added initialization of certain structures to test_output_yaml.F90.
Jul 25, 2022
c7b4687
Added initialization of certain structures to test_output_yaml.F90;
Jul 25, 2022
03b3288
Merge branch 'NOAA-GFDL:main' into main
ngs333 Jul 26, 2022
cca95af
Merge branch 'NOAA-GFDL:main' into main
ngs333 Aug 8, 2022
ab326c5
Merge branch 'NOAA-GFDL:main' into main
ngs333 Aug 27, 2022
92f5067
Merge branch 'NOAA-GFDL:main' into main
ngs333 Aug 30, 2022
bc688a5
Merge branch 'NOAA-GFDL:main' into main
ngs333 Oct 18, 2022
47fb5a4
Merge branch 'NOAA-GFDL:main' into main
ngs333 Nov 15, 2022
46a4b4b
Merge branch 'NOAA-GFDL:main' into main
ngs333 Dec 9, 2022
f120ca2
Adding code from previous work.
Dec 21, 2022
f3ddae9
Added math (field buffer update) functions that use 4D fields to
Jan 4, 2023
a7bc290
First version that compiles (with gcc).
Jan 4, 2023
46c909c
Moved elemental math function to own module (fms_diag_elem_weight_pro…
Jan 5, 2023
cd133a3
Shortening source code line length below 120 lines.
Jan 5, 2023
e860e3d
First compiling version with refactored_send option and refactored
Jan 10, 2023
08cacb8
Fixing code line lenght > 120 chars; Fixing reference to update_bound…
Jan 10, 2023
8f819cb
Changes to replace ALLOCATABLE in certain lower-level functions doing
Jan 11, 2023
4324b3e
First version passing all unit tests but without USE_REFACTORED_SEND.
Jan 18, 2023
79cd026
First version with all unit tests passing with use_refactored_send==t…
Jan 31, 2023
4430ab2
Removing reference to unavailable module from test_disg_update_buffer.
Jan 31, 2023
91049f5
Removing reference to another unavail module in test_diag_update_buffer.
Jan 31, 2023
f8ada45
Removed references to modern diag structures from test_diag_update_bu…
Jan 31, 2023
5dbee60
Removing repeating warning mesage.
Jan 31, 2023
71bbd48
Removing repeating output temporarily used in debugging.
Jan 31, 2023
8eed227
Removing note at end of test (unexplicably) causing unit test failure.
Jan 31, 2023
7e51b8f
Fixing test_diag_update_buffer : setting unitialized vars.
Jan 31, 2023
c9c38d5
Completed working version, but missing removal of copy of field_out in
Feb 2, 2023
8190672
Improved documentation in various places. Improved following of naming
Feb 3, 2023
2b45ca6
Fixing line longer than 120 chars. Improved some comments.
Feb 3, 2023
cfaccac
Merge branch 'NOAA-GFDL:main' into main
ngs333 Feb 3, 2023
acb3f42
Merge branch 'NOAA-GFDL:main' into send_math_legacy_plus
ngs333 Feb 3, 2023
87adf19
Numerous changes based oncode review.
Feb 8, 2023
ca10d14
Merge branch 'send_math_legacy_plus' of https://github.com/ngs333/FMS…
Feb 8, 2023
beebd46
Addresses more items from the review.
Feb 9, 2023
7aba81b
Adding function initialize_for_ut to fmsDiagOutfield_type so
Feb 9, 2023
2b688dc
Changes originating from PR review comments.
Feb 10, 2023
c2615ba
Several modificationsand comment updates based on review.
Feb 12, 2023
39ffc6e
Fixing a line length > 120 columns.
Feb 12, 2023
004ad06
Fixing typo of remaning rmaks to mask in last lint fix push.
Feb 13, 2023
9ff1c78
Fixing more items from PR review.
Feb 13, 2023
95e5e2c
Localized used of dummy arrays for pointer_bounds_remapping issue into
Feb 13, 2023
3a0a674
Fixing whitespace at end of file lint error; reformatting two files to
Feb 14, 2023
f2b5b6d
Updates based on latest review comments, mostly making private the
Feb 22, 2023
8047cea
Merge branch 'main' of https://github.com/ngs333/FMS into send_math_l…
Feb 22, 2023
2653656
Merge branch 'main' of https://github.com/NOAA-GFDL/FMS into send_mat…
Feb 22, 2023
f31d685
Added module fms_diag_bbox_mod; improved comments in
Feb 22, 2023
76a2241
Fixing type in CMakeLists.txt
Feb 22, 2023
1583e90
Modifications from PR review; mostly not setting pointers to null at
Feb 23, 2023
8faab40
Fixing spelling in two comment lines.
Feb 23, 2023
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
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ list(APPEND fms_fortran_src_files
diag_manager/diag_output.F90
diag_manager/diag_table.F90
diag_manager/diag_util.F90
diag_manager/fms_diag_time_reduction.F90
diag_manager/fms_diag_outfield.F90
diag_manager/fms_diag_elem_weight_procs.F90
diag_manager/fms_diag_fieldbuff_update.F90
drifters/cloud_interpolator.F90
drifters/drifters.F90
drifters/drifters_comm.F90
Expand Down Expand Up @@ -292,6 +296,7 @@ foreach(kind ${kinds})
fms
fms2_io/include
mpp/include
diag_manager/include
constants4
constants)
target_compile_definitions(${libTgt}_f PRIVATE "${fms_defs}")
Expand Down Expand Up @@ -328,7 +333,8 @@ foreach(kind ${kinds})
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/fms>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/fms2_io/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/mpp/include>)
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/mpp/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/diag_manager/include>)

target_include_directories(${libTgt} INTERFACE
$<BUILD_INTERFACE:${moduleDir}>
Expand Down
35 changes: 29 additions & 6 deletions diag_manager/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# Ed Hartnett 2/22/19

# Include .h and .mod files.
AM_CPPFLAGS = -I$(top_srcdir)/include
AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/diag_manager/include -I$(top_srcdir)/diag_manager
AM_FCFLAGS = $(FC_MODINC). $(FC_MODOUT)$(MODDIR)

# Build these uninstalled convenience libraries.
Expand All @@ -37,15 +37,31 @@ libdiag_manager_la_SOURCES = \
diag_manager.F90 \
diag_output.F90 \
diag_table.F90 \
diag_util.F90
diag_util.F90 \
fms_diag_time_reduction.F90 \
fms_diag_outfield.F90 \
fms_diag_elem_weight_procs.F90 \
fms_diag_fieldbuff_update.F90 \
include/fms_diag_fieldbuff_update.inc \
include/fms_diag_fieldbuff_update.fh

# Some mods are dependant on other mods in this dir.
diag_axis_mod.$(FC_MODEXT): diag_data_mod.$(FC_MODEXT)
diag_output_mod.$(FC_MODEXT): diag_axis_mod.$(FC_MODEXT) diag_data_mod.$(FC_MODEXT)
diag_util_mod.$(FC_MODEXT): diag_data_mod.$(FC_MODEXT) diag_axis_mod.$(FC_MODEXT) diag_output_mod.$(FC_MODEXT) diag_grid_mod.$(FC_MODEXT)
diag_util_mod.$(FC_MODEXT): diag_data_mod.$(FC_MODEXT) diag_axis_mod.$(FC_MODEXT) diag_output_mod.$(FC_MODEXT) \
diag_grid_mod.$(FC_MODEXT)
diag_table_mod.$(FC_MODEXT): diag_data_mod.$(FC_MODEXT) diag_util_mod.$(FC_MODEXT)
fms_diag_axis_object_mod.$(FC_MODEXT): diag_data_mod.$(FC_MODEXT) fms_diag_time_utils_mod.$(FC_MODEXT)
fms_diag_time_reduction_mod.$(FC_MODEXT): diag_data_mod.$(FC_MODEXT)
fms_diag_elem_weight_procs_mod.$(FC_MODEXT): diag_data_mod.$(FC_MODEXT)
fms_diag_outfield_mod.$(FC_MODEXT): diag_data_mod.$(FC_MODEXT) fms_diag_elem_weight_procs_mod.$(FC_MODEXT)
fms_diag_fieldbuff_update_mod.$(FC_MODEXT): diag_data_mod.$(FC_MODEXT) fms_diag_outfield_mod.$(FC_MODEXT) \
fms_diag_elem_weight_procs_mod.$(FC_MODEXT)
diag_manager_mod.$(FC_MODEXT): diag_axis_mod.$(FC_MODEXT) diag_data_mod.$(FC_MODEXT) diag_util_mod.$(FC_MODEXT) \
diag_output_mod.$(FC_MODEXT) diag_grid_mod.$(FC_MODEXT) diag_table_mod.$(FC_MODEXT)
diag_output_mod.$(FC_MODEXT) diag_grid_mod.$(FC_MODEXT) diag_table_mod.$(FC_MODEXT) \
fms_diag_time_reduction_mod.$(FC_MODEXT) fms_diag_outfield_mod.$(FC_MODEXT) \
fms_diag_fieldbuff_update_mod.$(FC_MODEXT)


# Mod files are built and then installed as headers.
MODFILES = \
Expand All @@ -55,8 +71,15 @@ MODFILES = \
diag_output_mod.$(FC_MODEXT) \
diag_util_mod.$(FC_MODEXT) \
diag_table_mod.$(FC_MODEXT) \
diag_manager_mod.$(FC_MODEXT)
nodist_include_HEADERS = $(MODFILES)
fms_diag_time_reduction_mod.$(FC_MODEXT) \
fms_diag_outfield_mod.$(FC_MODEXT) \
fms_diag_elem_weight_procs_mod.$(FC_MODEXT) \
fms_diag_fieldbuff_update_mod.$(FC_MODEXT) \
diag_manager_mod.$(FC_MODEXT) \
include/fms_diag_fieldbuff_update.inc \
include/fms_diag_fieldbuff_update.fh

nodist_include_HEADERS = $(MODFILES)
BUILT_SOURCES = $(MODFILES)

include $(top_srcdir)/mkmods.mk
37 changes: 36 additions & 1 deletion diag_manager/diag_data.F90
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ MODULE diag_data_mod
INTEGER, allocatable, DIMENSION(:) :: iatt !< INTEGER array to hold value of INTEGER attributes
thomas-robinson marked this conversation as resolved.
Show resolved Hide resolved
END TYPE diag_atttype

!!TODO: coord_type deserves a better name, like coord_interval_type or coord_bbox_type.
!! additionally, consider using a 2D array.
!> @brief Define the region for field output
!> @ingroup diag_data_mod
TYPE coord_type
ngs333 marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -126,6 +128,22 @@ MODULE diag_data_mod
REAL :: zend
END TYPE coord_type

!> @brief Data structure holding intervals (or interval bounds or limits).
!! Used for checking the bounds of the field output buffer arrays.
TYPE, public :: fms_diag_ibounds_type
ngs333 marked this conversation as resolved.
Show resolved Hide resolved
INTEGER :: imin !< Lower i bound.
INTEGER :: imax !< Upper i bound.
INTEGER :: jmin !< Lower j bound.
INTEGER :: jmax !< Upper j bound.
INTEGER :: kmin !< Lower k bound.
INTEGER :: kmax !< Upper k bound.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why aren't these variables private? The type can be public, but shouldn't the variables be private? https://github.com/NOAA-GFDL/FMS/blob/main/CODE_STYLE.md#derived-types

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm leaving this one for last. They are replacing / encapsulating fields that were public. The changes I would have to make to old code would be even more if they were made private. But the other two classes which are introduced in this PR should be changed to have their fields private.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK Done. But for the sake of supporting a simpler unit test, I had to also add this function initialize_for_ut() for fmsDiagOutfield_type. We may want to discuss it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to add documentation about why these variables are public because it goes against the FMS coding standards.

contains
procedure :: reset => ibounds_reset
END TYPE fms_diag_ibounds_type




!> @brief Type to define the diagnostic files that will be written as defined by the diagnostic table.
!> @ingroup diag_data_mod
TYPE file_type
Expand Down Expand Up @@ -240,7 +258,7 @@ MODULE diag_data_mod
TYPE(diag_grid) :: output_grid
LOGICAL :: local_output, need_compute, phys_window, written_once
LOGICAL :: reduced_k_range
INTEGER :: imin, imax, jmin, jmax, kmin, kmax
TYPE(fms_diag_ibounds_type) :: buff_bounds
TYPE(time_type) :: Time_of_prev_field_data
TYPE(diag_atttype), allocatable, dimension(:) :: attributes
INTEGER :: num_attributes
Expand Down Expand Up @@ -327,6 +345,9 @@ MODULE diag_data_mod
!! <TT>.TRUE.</TT> is only supported if the diag_manager_init
!! routine is called with the optional time_init parameter.
LOGICAL :: use_mpp_io = .false. !< false is fms2_io (default); true is mpp_io
LOGICAL :: use_refactored_send = .false. !< Namelist flag to use refactored send_data math funcitons.

!!TODO: leave use_refactored_send as false

! <!-- netCDF variable -->

Expand Down Expand Up @@ -384,6 +405,20 @@ SUBROUTINE diag_data_init()
call write_version_number("DIAG_DATA_MOD", version)
END SUBROUTINE diag_data_init


!> @brief Sets the lower and upper bounds to lower_val and upper_val, respectively.
SUBROUTINE ibounds_reset (this, lower_val, upper_val)
class (fms_diag_ibounds_type), target, intent(inout) :: this !< ibounds instance
integer, intent(in) :: lower_val !< value for the lower bounds in each dimension
integer, intent(in) :: upper_val !< value for the upper bounds in each dimension
this%imin = lower_val
this%jmin = lower_val
this%kmin = lower_val
this%imax = upper_val
this%jmax = upper_val
this%kmax = upper_val
END SUBROUTINE ibounds_reset

END MODULE diag_data_mod
!> @}
! close documentation grouping
110 changes: 107 additions & 3 deletions diag_manager/diag_manager.F90
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,15 @@ MODULE diag_manager_mod
& use_cmor, issue_oor_warnings, oor_warnings_fatal, oor_warning, pack_size,&
& max_out_per_in_field, flush_nc_files, region_out_use_alt_value, max_field_attributes, output_field_type,&
& max_file_attributes, max_axis_attributes, prepend_date, DIAG_FIELD_NOT_FOUND, diag_init_time, diag_data_init,&
& use_mpp_io
& use_mpp_io, use_refactored_send
USE diag_data_mod, ONLY: fileobj, fileobjU, fnum_for_domain, fileobjND
USE diag_table_mod, ONLY: parse_diag_table
USE diag_output_mod, ONLY: get_diag_global_att, set_diag_global_att
USE diag_grid_mod, ONLY: diag_grid_init, diag_grid_end
USE constants_mod, ONLY: SECONDS_PER_DAY
USE fms_diag_outfield_mod, ONLY: fmsDiagOutfieldIndex_type, fmsDiagOutfield_type
USE fms_diag_fieldbuff_update_mod, ONLY: fieldbuff_update, fieldbuff_copy_missvals, &
& fieldbuff_copy_fieldvals

#ifdef use_netCDF
USE netcdf, ONLY: NF90_INT, NF90_FLOAT, NF90_CHAR
Expand Down Expand Up @@ -1449,8 +1452,8 @@ LOGICAL FUNCTION send_data_3d(diag_field_id, field, time, is_in, js_in, ks_in, &
CLASS(*), INTENT(in), OPTIONAL :: weight
TYPE (time_type), INTENT(in), OPTIONAL :: time
INTEGER, INTENT(in), OPTIONAL :: is_in, js_in, ks_in,ie_in,je_in, ke_in
LOGICAL, DIMENSION(:,:,:), INTENT(in), OPTIONAL :: mask
CLASS(*), DIMENSION(:,:,:), INTENT(in), OPTIONAL :: rmask
LOGICAL, DIMENSION(:,:,:), INTENT(in), OPTIONAL, contiguous, target :: mask
CLASS(*), DIMENSION(:,:,:), INTENT(in), OPTIONAL, target :: rmask
CHARACTER(len=*), INTENT(out), OPTIONAL :: err_msg

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lacking descriptions of all arguments if they are not obvious.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ganganoaa We don't require updating old code/variables. It's too onerous on developers because, like you said, it's not obvious what some of the variables are.

REAL :: weight1
Expand Down Expand Up @@ -1486,6 +1489,16 @@ LOGICAL FUNCTION send_data_3d(diag_field_id, field, time, is_in, js_in, ks_in, &

REAL, ALLOCATABLE, DIMENSION(:,:,:) :: field_out !< Local copy of field

REAL(kind=r4_kind), POINTER, DIMENSION(:,:,:) :: rmask_ptr_r4 => null() !< A pointer to r4 type of rmask
REAL(kind=r8_kind), POINTER, DIMENSION(:,:,:) :: rmask_ptr_r8 => null() !<A pointer to r8 type of rmask
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the => null()

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still needs to be fixed

LOGICAL , pointer, DIMENSION(:,:,:) :: mask_ptr => null() !< A pointer to mask

TYPE(fmsDiagOutfieldIndex_type), ALLOCATABLE:: ofield_index_cfg !<Instance used in calling math funcsions.
TYPE(fmsDiagOutfield_type), ALLOCATABLE:: ofield_cfg !<Instance used in calling math funcsions.
LOGICAL :: mf_result !<Logical result returned from some math (buffer udate) functions.
LOGICAL, DIMENSION(1,1,1), target :: mask_dummy
REAL :: rmask_threshold
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this? Should it be a parameter?

Copy link
Contributor Author

@ngs333 ngs333 Feb 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The the current diag_manager send_data_3d, there are several uses of magic numbers 0.5_r4_kind and 0.5_r8_kind. The same value, whatever it is, needs to be passed to one of the math functions. I used READ rmask_threshold to hold and pass the value being used. I will update comments.


! If diag_field_id is < 0 it means that this field is not registered, simply return
IF ( diag_field_id <= 0 ) THEN
send_data_3d = .FALSE.
Expand Down Expand Up @@ -1543,8 +1556,12 @@ LOGICAL FUNCTION send_data_3d(diag_field_id, field, time, is_in, js_in, ks_in, &
SELECT TYPE (rmask)
TYPE IS (real(kind=r4_kind))
WHERE ( rmask < 0.5_r4_kind ) oor_mask = .FALSE.
rmask_threshold = 0.5_r4_kind
rmask_ptr_r4 => rmask
TYPE IS (real(kind=r8_kind))
WHERE ( rmask < 0.5_r8_kind ) oor_mask = .FALSE.
rmask_threshold = 0.5_r8_kind
rmask_ptr_r8 => rmask
CLASS DEFAULT
CALL error_mesg ('diag_manager_mod::send_data_3d',&
& 'The rmask is not one of the supported types of real(kind=4) or real(kind=8)', FATAL)
Expand Down Expand Up @@ -1874,6 +1891,91 @@ LOGICAL FUNCTION send_data_3d(diag_field_id, field, time, is_in, js_in, ks_in, &
END IF
END IF

IF (USE_REFACTORED_SEND) THEN
ALLOCATE( ofield_index_cfg )
CALL ofield_index_cfg%initialize( is, js, ks, ie, je, ke, &
& hi, hj, f1, f2, f3, f4)

ALLOCATE( ofield_cfg )
CALL ofield_cfg%initialize( input_fields(diag_field_id), output_fields(out_num), PRESENT(mask), freq)

IF (PRESENT (mask)) THEN
mask_ptr(1:size(mask,1),1:size(mask,2),1:size(mask,3)) => mask
else
mask_ptr(1:size(mask_dummy,1),1:size(mask_dummy,2),1:size(mask_dummy,3)) => mask_dummy
ENDIF

IF ( average ) THEN
!!TODO (Future work): the copy that is filed_out should not be necessary
mf_result = fieldbuff_update(ofield_cfg, ofield_index_cfg, field_out, sample, &
& output_fields(out_num)%buffer, output_fields(out_num)%counter ,output_fields(out_num)%buff_bounds,&
& output_fields(out_num)%count_0d(sample), output_fields(out_num)%num_elements(sample), &
& mask_ptr, weight1 ,missvalue, &
& input_fields(diag_field_id)%numthreads, input_fields(diag_field_id)%active_omp_level,&
& input_fields(diag_field_id)%issued_mask_ignore_warning, &
& l_start, l_end, err_msg, err_msg_local )
IF (mf_result .eqv. .FALSE.) THEN
DEALLOCATE(ofield_index_cfg)
DEALLOCATE(ofield_cfg)
DEALLOCATE(field_out)
DEALLOCATE(oor_mask)
RETURN
END IF
ELSE !!NOT AVERAGE
mf_result = fieldbuff_copy_fieldvals(ofield_cfg, ofield_index_cfg, field_out, sample, &
& output_fields(out_num)%buffer, output_fields(out_num)%buff_bounds , &
& output_fields(out_num)%count_0d(sample), &
& mask_ptr, missvalue, l_start, l_end, err_msg, err_msg_local)
IF (mf_result .eqv. .FALSE.) THEN
DEALLOCATE(ofield_index_cfg)
DEALLOCATE(ofield_cfg)
DEALLOCATE(field_out)
DEALLOCATE(oor_mask)
RETURN
END IF
END IF

IF ( output_fields(out_num)%static .AND. .NOT.need_compute .AND. debug_diag_manager ) THEN
CALL check_bounds_are_exact_static(out_num, diag_field_id, err_msg=err_msg_local)
IF ( err_msg_local /= '' ) THEN
IF ( fms_error_handler('diag_manager_mod::send_data_3d', err_msg_local, err_msg)) THEN
DEALLOCATE(field_out)
DEALLOCATE(oor_mask)
RETURN
END IF
END IF
END IF

!!TODO: (Discusssion) One of the calls below will not compile depending
!! on the value of REAL. This is to the mixed use of REAL, R4, R8 and CLASS(*)
!! in send_data_3d. A copy of rmask can be made to avoid but it would be wasteful.
!! The option used for now is that the original code to copy missing values is
!! is used at the end of this procedure.
!IF ( PRESENT(rmask) .AND. missvalue_present ) THEN
! SELECT TYPE (rmask)
! TYPE IS (real(kind=r4_kind))
! call fieldbuff_copy_missvals(ofield_cfg, ofield_index_cfg, &
! & output_fields(out_num)%buffer, sample, &
! & l_start, l_end, rmask_ptr_r4, rmask_threshold, missvalue)
! TYPE IS (real(kind=r8_kind))
! call fieldbuff_copy_missvals(ofield_cfg, ofield_index_cfg, &
! & output_fields(out_num)%buffer, sample, &
! & l_start, l_end, rmask_ptr_r8, rmask_threshold, missvalue)
! CLASS DEFAULT
! CALL error_mesg ('diag_manager_mod::send_data_3d',&
! & 'The rmask is not one of the supported types of real(kind=4) or real(kind=8)', FATAL)
! END SELECT
!END IF

IF(ALLOCATED(ofield_index_cfg)) THEN
DEALLOCATE(ofield_index_cfg)
ENDIF
IF(ALLOCATED(ofield_cfg)) THEN
DEALLOCATE(ofield_cfg)
ENDIF

ELSE !! END USE_REFACTORED_SEND; Don''t use CYCLE option.

! Take care of submitted field data
IF ( average ) THEN
IF ( input_fields(diag_field_id)%mask_variant ) THEN
Expand Down Expand Up @@ -3020,6 +3122,8 @@ LOGICAL FUNCTION send_data_3d(diag_field_id, field, time, is_in, js_in, ks_in, &
END IF
END IF

END IF !! END OF IS_USE_REFACTORED SEND

! If rmask and missing value present, then insert missing value
IF ( PRESENT(rmask) .AND. missvalue_present ) THEN
IF ( need_compute ) THEN
Expand Down
Loading