@@ -195,8 +195,8 @@ subroutine apply_topography_edits_from_file(D, G, param_file, US)
195
195
character (len= 200 ) :: topo_edits_file, inputdir ! Strings for file/path
196
196
character (len= 40 ) :: mdl = " apply_topography_edits_from_file" ! This subroutine's name.
197
197
integer :: i, j, n, ncid, n_edits, i_file, j_file, ndims, sizes(8 )
198
- logical :: found
199
198
logical :: topo_edits_change_mask
199
+ real :: min_depth, mask_depth
200
200
201
201
call callTree_enter(trim (mdl)// " (), MOM_shared_initialization.F90" )
202
202
@@ -210,6 +210,17 @@ subroutine apply_topography_edits_from_file(D, G, param_file, US)
210
210
call get_param(param_file, mdl, " ALLOW_LANDMASK_CHANGES" , topo_edits_change_mask, &
211
211
" If true, allow topography overrides to change land mask." , &
212
212
default= .false. )
213
+ call get_param(param_file, mdl, " MINIMUM_DEPTH" , min_depth, &
214
+ " If MASKING_DEPTH is unspecified, then anything shallower than " // &
215
+ " MINIMUM_DEPTH is assumed to be land and all fluxes are masked out. " // &
216
+ " If MASKING_DEPTH is specified, then all depths shallower than " // &
217
+ " MINIMUM_DEPTH but deeper than MASKING_DEPTH are rounded to MINIMUM_DEPTH." , &
218
+ units= " m" , default= 0.0 , scale= m_to_Z)
219
+ call get_param(param_file, mdl, " MASKING_DEPTH" , mask_depth, &
220
+ " The depth below which to mask points as land points, for which all " // &
221
+ " fluxes are zeroed out. MASKING_DEPTH needs to be smaller than MINIMUM_DEPTH" , &
222
+ units= " m" , default=- 9999.0 , scale= m_to_Z)
223
+ if (mask_depth == - 9999 .* m_to_Z) mask_depth = min_depth
213
224
214
225
if (len_trim (topo_edits_file)==0 ) return
215
226
@@ -249,7 +260,7 @@ subroutine apply_topography_edits_from_file(D, G, param_file, US)
249
260
i = ig(n) - G% isd_global + 2 ! +1 for python indexing and +1 for ig-isd_global+1
250
261
j = jg(n) - G% jsd_global + 2
251
262
if (i>= G% isc .and. i<= G% iec .and. j>= G% jsc .and. j<= G% jec) then
252
- if (new_depth(n)/= 0 . ) then
263
+ if (new_depth(n)* m_to_Z /= mask_depth ) then
253
264
write (stdout,' (a,3i5,f8.2,a,f8.2,2i4)' ) &
254
265
' Ocean topography edit: ' , n, ig(n), jg(n), D(i,j)/ m_to_Z, ' ->' , abs (new_depth(n)), i, j
255
266
D(i,j) = abs (m_to_Z* new_depth(n)) ! Allows for height-file edits (i.e. converts negatives)
@@ -434,6 +445,10 @@ subroutine limit_topography(D, G, param_file, max_depth, US)
434
445
do j= G% jsd,G% jed ; do i= G% isd,G% ied
435
446
if (D(i,j) > mask_depth) then
436
447
D(i,j) = min ( max ( D(i,j), min_depth ), max_depth )
448
+ else
449
+ ! This statement is required for cases with masked-out PEs over the land,
450
+ ! to remove the large initialized values (-9e30) from the halos.
451
+ D(i,j) = mask_depth
437
452
endif
438
453
enddo ; enddo
439
454
endif
0 commit comments