MOM6
mom_diag_mediator::downsample_mask Interface Reference

Detailed Description

Down sample the mask of a field.

Definition at line 80 of file MOM_diag_mediator.F90.

Private functions

subroutine downsample_mask_2d (field_in, field_out, dl, isc_o, jsc_o, isc_d, iec_d, jsc_d, jec_d, isd_d, ied_d, jsd_d, jed_d)
 Allocate and compute the 2d down sampled mask The masks are down sampled based on a minority rule, i.e., a coarse cell is open (1) if at least one of the sub-cells are open, otherwise it's closed (0) More...
 
subroutine downsample_mask_3d (field_in, field_out, dl, isc_o, jsc_o, isc_d, iec_d, jsc_d, jec_d, isd_d, ied_d, jsd_d, jed_d)
 Allocate and compute the 3d down sampled mask The masks are down sampled based on a minority rule, i.e., a coarse cell is open (1) if at least one of the sub-cells are open, otherwise it's closed (0) More...
 

Detailed Description

Down sample the mask of a field.

Definition at line 80 of file MOM_diag_mediator.F90.

Functions and subroutines

◆ downsample_mask_2d()

subroutine mom_diag_mediator::downsample_mask::downsample_mask_2d ( real, dimension(:,:), intent(in)  field_in,
real, dimension(:,:), pointer  field_out,
integer, intent(in)  dl,
integer, intent(in)  isc_o,
integer, intent(in)  jsc_o,
integer, intent(in)  isc_d,
integer, intent(in)  iec_d,
integer, intent(in)  jsc_d,
integer, intent(in)  jec_d,
integer, intent(in)  isd_d,
integer, intent(in)  ied_d,
integer, intent(in)  jsd_d,
integer, intent(in)  jed_d 
)
private

Allocate and compute the 2d down sampled mask The masks are down sampled based on a minority rule, i.e., a coarse cell is open (1) if at least one of the sub-cells are open, otherwise it's closed (0)

Parameters
[in]field_inOriginal field to be down sampled
field_outDown sampled field
[in]dlLevel of down sampling
[in]isc_oOriginal i-start index
[in]jsc_oOriginal j-start index
[in]isc_dComputational i-start index of down sampled data
[in]iec_dComputational i-end index of down sampled data
[in]jsc_dComputational j-start index of down sampled data
[in]jec_dComputational j-end index of down sampled data
[in]isd_dComputational i-start index of down sampled data
[in]ied_dComputational i-end index of down sampled data
[in]jsd_dComputational j-start index of down sampled data
[in]jed_dComputational j-end index of down sampled data

Definition at line 4253 of file MOM_diag_mediator.F90.

4253  real, dimension(:,:), intent(in) :: field_in !< Original field to be down sampled
4254  real, dimension(:,:), pointer :: field_out !< Down sampled field
4255  integer, intent(in) :: dl !< Level of down sampling
4256  integer, intent(in) :: isc_o !< Original i-start index
4257  integer, intent(in) :: jsc_o !< Original j-start index
4258  integer, intent(in) :: isc_d !< Computational i-start index of down sampled data
4259  integer, intent(in) :: iec_d !< Computational i-end index of down sampled data
4260  integer, intent(in) :: jsc_d !< Computational j-start index of down sampled data
4261  integer, intent(in) :: jec_d !< Computational j-end index of down sampled data
4262  integer, intent(in) :: isd_d !< Computational i-start index of down sampled data
4263  integer, intent(in) :: ied_d !< Computational i-end index of down sampled data
4264  integer, intent(in) :: jsd_d !< Computational j-start index of down sampled data
4265  integer, intent(in) :: jed_d !< Computational j-end index of down sampled data
4266  ! Locals
4267  integer :: i,j,ii,jj,i0,j0
4268  real :: tot_non_zero
4269  ! down sampled mask = 0 unless the mask value of one of the down sampling cells is 1
4270  allocate(field_out(isd_d:ied_d,jsd_d:jed_d))
4271  field_out(:,:) = 0.0
4272  do j=jsc_d,jec_d ; do i=isc_d,iec_d
4273  i0 = isc_o+dl*(i-isc_d)
4274  j0 = jsc_o+dl*(j-jsc_d)
4275  tot_non_zero = 0.0
4276  do jj=j0,j0+dl-1 ; do ii=i0,i0+dl-1
4277  tot_non_zero = tot_non_zero + field_in(ii,jj)
4278  enddo;enddo
4279  if(tot_non_zero > 0.0) field_out(i,j)=1.0
4280  enddo; enddo

◆ downsample_mask_3d()

subroutine mom_diag_mediator::downsample_mask::downsample_mask_3d ( real, dimension(:,:,:), intent(in)  field_in,
real, dimension(:,:,:), pointer  field_out,
integer, intent(in)  dl,
integer, intent(in)  isc_o,
integer, intent(in)  jsc_o,
integer, intent(in)  isc_d,
integer, intent(in)  iec_d,
integer, intent(in)  jsc_d,
integer, intent(in)  jec_d,
integer, intent(in)  isd_d,
integer, intent(in)  ied_d,
integer, intent(in)  jsd_d,
integer, intent(in)  jed_d 
)
private

Allocate and compute the 3d down sampled mask The masks are down sampled based on a minority rule, i.e., a coarse cell is open (1) if at least one of the sub-cells are open, otherwise it's closed (0)

Parameters
[in]field_inOriginal field to be down sampled
field_outdown sampled field
[in]dlLevel of down sampling
[in]isc_oOriginal i-start index
[in]jsc_oOriginal j-start index
[in]isc_dComputational i-start index of down sampled data
[in]iec_dComputational i-end index of down sampled data
[in]jsc_dComputational j-start index of down sampled data
[in]jec_dComputational j-end index of down sampled data
[in]isd_dComputational i-start index of down sampled data
[in]ied_dComputational i-end index of down sampled data
[in]jsd_dComputational j-start index of down sampled data
[in]jed_dComputational j-end index of down sampled data

Definition at line 4288 of file MOM_diag_mediator.F90.

4288  real, dimension(:,:,:), intent(in) :: field_in !< Original field to be down sampled
4289  real, dimension(:,:,:), pointer :: field_out !< down sampled field
4290  integer, intent(in) :: dl !< Level of down sampling
4291  integer, intent(in) :: isc_o !< Original i-start index
4292  integer, intent(in) :: jsc_o !< Original j-start index
4293  integer, intent(in) :: isc_d !< Computational i-start index of down sampled data
4294  integer, intent(in) :: iec_d !< Computational i-end index of down sampled data
4295  integer, intent(in) :: jsc_d !< Computational j-start index of down sampled data
4296  integer, intent(in) :: jec_d !< Computational j-end index of down sampled data
4297  integer, intent(in) :: isd_d !< Computational i-start index of down sampled data
4298  integer, intent(in) :: ied_d !< Computational i-end index of down sampled data
4299  integer, intent(in) :: jsd_d !< Computational j-start index of down sampled data
4300  integer, intent(in) :: jed_d !< Computational j-end index of down sampled data
4301  ! Locals
4302  integer :: i,j,ii,jj,i0,j0,k,ks,ke
4303  real :: tot_non_zero
4304  ! down sampled mask = 0 unless the mask value of one of the down sampling cells is 1
4305  ks = lbound(field_in,3) ; ke = ubound(field_in,3)
4306  allocate(field_out(isd_d:ied_d,jsd_d:jed_d,ks:ke))
4307  field_out(:,:,:) = 0.0
4308  do k= ks,ke ; do j=jsc_d,jec_d ; do i=isc_d,iec_d
4309  i0 = isc_o+dl*(i-isc_d)
4310  j0 = jsc_o+dl*(j-jsc_d)
4311  tot_non_zero = 0.0
4312  do jj=j0,j0+dl-1 ; do ii=i0,i0+dl-1
4313  tot_non_zero = tot_non_zero + field_in(ii,jj,k)
4314  enddo;enddo
4315  if(tot_non_zero > 0.0) field_out(i,j,k)=1.0
4316  enddo; enddo; enddo

The documentation for this interface was generated from the following file: