Skip to content

Commit 55e4c6e

Browse files
committed
Removed sort_obs_inc from the QCF table; removed code related to the sort_obs_inc logical from filter_assim and obs_increment in assim_tools_mod.f90 and obs_inc_info in algorithm_info_mod.f90
1 parent 42bec45 commit 55e4c6e

File tree

2 files changed

+11
-45
lines changed

2 files changed

+11
-45
lines changed

assimilation_code/modules/assimilation/algorithm_info_mod.f90

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ module algorithm_info_mod
6767

6868
type obs_inc_info_type
6969
integer :: filter_kind
70-
logical :: sort_obs_inc, spread_restoration
70+
logical :: spread_restoration
7171
logical :: bounded_below, bounded_above
7272
real(r8) :: lower_bound, upper_bound
7373
end type
@@ -82,7 +82,7 @@ module algorithm_info_mod
8282

8383
integer, parameter :: HEADER_LINES = 2
8484
character(len=129), dimension(4) :: header1
85-
character(len=129), dimension(27) :: header2
85+
character(len=129), dimension(26) :: header2
8686

8787
character(len=129), allocatable :: specified_qtys(:)
8888
type(algorithm_info_type), allocatable :: qcf_table_data(:)
@@ -177,7 +177,7 @@ subroutine read_qcf_table(qcf_table_filename)
177177
qcf_table_data(row)%probit_state%lower_bound, qcf_table_data(row)%probit_state%upper_bound, dist_type_string_probit_extended_state, &
178178
qcf_table_data(row)%probit_extended_state%bounded_below, qcf_table_data(row)%probit_extended_state%bounded_above, &
179179
qcf_table_data(row)%probit_extended_state%lower_bound, qcf_table_data(row)%probit_extended_state%upper_bound, &
180-
filter_kind_string, qcf_table_data(row)%obs_inc_info%sort_obs_inc, qcf_table_data(row)%obs_inc_info%spread_restoration, &
180+
filter_kind_string, qcf_table_data(row)%obs_inc_info%spread_restoration, &
181181
qcf_table_data(row)%obs_inc_info%bounded_below, qcf_table_data(row)%obs_inc_info%bounded_above, &
182182
qcf_table_data(row)%obs_inc_info%lower_bound, qcf_table_data(row)%obs_inc_info%upper_bound
183183

@@ -415,12 +415,11 @@ end subroutine probit_dist_info
415415
!------------------------------------------------------------------------
416416

417417

418-
subroutine obs_inc_info(obs_qty, filter_kind, sort_obs_inc, spread_restoration, &
418+
subroutine obs_inc_info(obs_qty, filter_kind, spread_restoration, &
419419
bounded_below, bounded_above, lower_bound, upper_bound)
420420

421421
integer, intent(in) :: obs_qty
422422
integer, intent(inout) :: filter_kind
423-
logical, intent(inout) :: sort_obs_inc
424423
logical, intent(inout) :: spread_restoration
425424
logical, intent(inout) :: bounded_below, bounded_above
426425
real(r8), intent(inout) :: lower_bound, upper_bound
@@ -440,7 +439,7 @@ subroutine obs_inc_info(obs_qty, filter_kind, sort_obs_inc, spread_restoration,
440439
filter_kind = BOUNDED_NORMAL_RHF
441440
bounded_below = .false.; bounded_above = .false.
442441
lower_bound = missing_r8; upper_bound = missing_r8
443-
sort_obs_inc = .false.; spread_restoration = .false.
442+
spread_restoration = .false.
444443
return
445444
endif
446445

@@ -455,13 +454,12 @@ subroutine obs_inc_info(obs_qty, filter_kind, sort_obs_inc, spread_restoration,
455454
filter_kind = BOUNDED_NORMAL_RHF
456455
bounded_below = .false.; bounded_above = .false.
457456
lower_bound = missing_r8; upper_bound = missing_r8
458-
sort_obs_inc = .false.; spread_restoration = .false.
459-
! Default settings for now for Icepack and tracer model tests (sort_obs_inc, spread_restoration)
457+
spread_restoration = .false.
458+
! Default settings for now for Icepack and tracer model tests (spread_restoration)
460459

461460
else
462461

463462
filter_kind = qcf_table_data(QTY_loc(1))%obs_inc_info%filter_kind
464-
sort_obs_inc = qcf_table_data(QTY_loc(1))%obs_inc_info%sort_obs_inc
465463
spread_restoration = qcf_table_data(QTY_loc(1))%obs_inc_info%spread_restoration
466464
bounded_below = qcf_table_data(QTY_loc(1))%obs_inc_info%bounded_below
467465
bounded_above = qcf_table_data(QTY_loc(1))%obs_inc_info%bounded_above
@@ -584,9 +582,8 @@ subroutine log_qcf_table_data()
584582
qcf_table_data(row)%probit_state%lower_bound, qcf_table_data(row)%probit_state%upper_bound, qcf_table_data(row)%probit_extended_state%dist_type, &
585583
qcf_table_data(row)%probit_extended_state%bounded_below, qcf_table_data(row)%probit_extended_state%bounded_above, &
586584
qcf_table_data(row)%probit_extended_state%lower_bound, qcf_table_data(row)%probit_extended_state%upper_bound, &
587-
qcf_table_data(row)%obs_inc_info%filter_kind, qcf_table_data(row)%obs_inc_info%sort_obs_inc, &
588-
qcf_table_data(row)%obs_inc_info%spread_restoration, qcf_table_data(row)%obs_inc_info%bounded_below, qcf_table_data(row)%obs_inc_info%bounded_above, &
589-
qcf_table_data(row)%obs_inc_info%lower_bound, qcf_table_data(row)%obs_inc_info%upper_bound
585+
qcf_table_data(row)%obs_inc_info%filter_kind, qcf_table_data(row)%obs_inc_info%spread_restoration, qcf_table_data(row)%obs_inc_info%bounded_below, &
586+
qcf_table_data(row)%obs_inc_info%bounded_above, qcf_table_data(row)%obs_inc_info%lower_bound, qcf_table_data(row)%obs_inc_info%upper_bound
590587
call error_handler(E_MSG, 'log_qcf_table_data:', trim(log_msg), source)
591588
end do
592589

assimilation_code/modules/assimilation/assim_tools_mod.f90

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ module assim_tools_mod
145145
!
146146
integer :: filter_kind = 1
147147
real(r8) :: cutoff = 0.2_r8
148-
logical :: sort_obs_inc = .false.
148+
logical :: sort_obs_inc = .true.
149149
logical :: spread_restoration = .false.
150150
logical :: sampling_error_correction = .false.
151151
integer :: adaptive_localization_threshold = -1
@@ -421,22 +421,6 @@ subroutine filter_assim(ens_handle, obs_ens_handle, obs_seq, keys, &
421421
! Need to give create_mean_window the mean copy
422422
call create_mean_window(ens_handle, ENS_MEAN_COPY, distribute_mean)
423423

424-
! filter kinds 1 and 8 return sorted increments, however non-deterministic
425-
! inflation can scramble these. the sort is expensive, so help users get better
426-
! performance by rejecting namelist combinations that do unneeded work.
427-
if (sort_obs_inc) then
428-
if(deterministic_inflate(inflate) .and. ((filter_kind == 1) .or. (filter_kind == 8))) then
429-
write(msgstring, *) 'With a deterministic filter [assim_tools_nml:filter_kind = ',filter_kind,']'
430-
write(msgstring2, *) 'and deterministic inflation [filter_nml:inf_deterministic = .TRUE.]'
431-
write(msgstring3, *) 'assim_tools_nml:sort_obs_inc = .TRUE. is not needed and is expensive.'
432-
call error_handler(E_MSG,'', '') ! whitespace
433-
call error_handler(E_MSG,'WARNING filter_assim:', msgstring, source, &
434-
text2=msgstring2,text3=msgstring3)
435-
call error_handler(E_MSG,'', '') ! whitespace
436-
sort_obs_inc = .FALSE.
437-
endif
438-
endif
439-
440424
! Open the localization diagnostics file
441425
if(output_localization_diagnostics .and. my_task_id() == 0) &
442426
localization_unit = open_file(localization_diagnostics_file, action = 'append')
@@ -987,7 +971,7 @@ subroutine obs_increment(ens_in, ens_size, obs, obs_var, obs_kind, obs_inc, &
987971
bounded_below = .false.; lower_bound = 0.0_r8
988972
bounded_above = .false.; upper_bound = 0.0_r8
989973

990-
call obs_inc_info(obs_kind, filter_kind, sort_obs_inc, spread_restoration, &
974+
call obs_inc_info(obs_kind, filter_kind, spread_restoration, &
991975
bounded_below, bounded_above, lower_bound, upper_bound)
992976

993977
! Could add logic to check on sort being true when not needed.
@@ -1082,21 +1066,6 @@ subroutine obs_increment(ens_in, ens_size, obs, obs_var, obs_kind, obs_inc, &
10821066
! Add in the extra increments if doing observation space covariance inflation
10831067
if(do_obs_inflate(inflate)) obs_inc = obs_inc + inflate_inc
10841068

1085-
! To minimize regression errors, may want to sort to minimize increments
1086-
! This makes sense for any of the non-deterministic algorithms
1087-
! By doing it here, can take care of both standard non-deterministic updates
1088-
! plus non-deterministic obs space covariance inflation. This is expensive, so
1089-
! don't use it if it's not needed.
1090-
if (sort_obs_inc) then
1091-
new_val = ens_in + obs_inc
1092-
! Sorting to make increments as small as possible
1093-
call index_sort(ens_in, ens_index, ens_size)
1094-
call index_sort(new_val, new_index, ens_size)
1095-
do i = 1, ens_size
1096-
obs_inc(ens_index(i)) = new_val(new_index(i)) - ens_in(ens_index(i))
1097-
end do
1098-
endif
1099-
11001069
! Get the net change in spread if obs space inflation was used
11011070
if(do_obs_inflate(inflate)) net_a = net_a * sqrt(my_cov_inflate)
11021071

0 commit comments

Comments
 (0)