Normalise a freshly loaded draft field onto Roundabout’s
convention (DEPTH, positive down, >= 0).
CAVITY_SIGN_DEPTH — identity (bit-for-bit).CAVITY_SIGN_ELEVATION — z_draft = -z_d.Open water in the ISOMIP+ file is z_d = 0, which negates to
-0.0. Left as the literal negation would make a downstream
z_draft /= 0 test (cavity_apply_land_exclusion) fire on a
cell with no ice, so the zero is re-normalised explicitly.
No clipping otherwise: a POSITIVE elevation (ice base above sea
level, i.e. grounded ice or a file in the wrong convention)
negates to a negative depth and is caught fail-loud by
cavity_draft_is_finite_nonneg — which is the point of having
an explicit knob instead of a guess.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(inout) | :: | z_draft(nx,ny) | |||
| integer, | intent(in) | :: | nx | |||
| integer, | intent(in) | :: | ny | |||
| integer, | intent(in) | :: | sign_code |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | private | :: | i | ||||
| integer, | private | :: | j |
pure subroutine cavity_draft_apply_sign(z_draft, nx, ny, sign_code) !! Normalise a freshly loaded draft field onto Roundabout's !! convention (DEPTH, positive down, `>= 0`). !! !! * `CAVITY_SIGN_DEPTH` — identity (bit-for-bit). !! * `CAVITY_SIGN_ELEVATION` — `z_draft = -z_d`. !! !! Open water in the ISOMIP+ file is `z_d = 0`, which negates to !! `-0.0`. Left as the literal negation would make a downstream !! `z_draft /= 0` test (`cavity_apply_land_exclusion`) fire on a !! cell with no ice, so the zero is re-normalised explicitly. !! No clipping otherwise: a POSITIVE elevation (ice base above sea !! level, i.e. grounded ice or a file in the wrong convention) !! negates to a negative depth and is caught fail-loud by !! `cavity_draft_is_finite_nonneg` — which is the point of having !! an explicit knob instead of a guess. integer, intent(in) :: nx, ny, sign_code real(wp), intent(inout) :: z_draft(nx, ny) integer :: i, j if (sign_code /= CAVITY_SIGN_ELEVATION) return do j = 1, ny do i = 1, nx if (z_draft(i, j) == 0.0_wp) then z_draft(i, j) = 0.0_wp else z_draft(i, j) = -z_draft(i, j) end if end do end do end subroutine cavity_draft_apply_sign