Skip to content

Commit 1a592d4

Browse files
committed
Separate multipliers for T/S corrections
1 parent fe680b3 commit 1a592d4

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

src/ocean_data_assim/MOM_oda_driver.F90

+22-13
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,13 @@ module MOM_oda_driver_mod
136136
logical :: do_T_bias_adjustment !< If true, use spatio-temporally varying climatological tendency
137137
!! adjustment for Temperature and Salinity
138138
logical :: do_S_bias_adjustment !< If true, use spatio-temporally varying climatological tendency
139-
real, dimension(2) :: bias_adjustment_multiplier !< A scaling for the bias adjustment
139+
real :: T_bias_adjustment_multiplier !< A scaling for the bias adjustment
140+
real :: S_bias_adjustment_multiplier !< A scaling for the bias adjustment
140141
logical :: do_T_ml_bias_adjustment !< If true, use machine learning-trained tendency
141142
!! adjustment for Temperature and Salinity
142143
logical :: do_S_ml_bias_adjustment !< If true, use machine learning-trained tendency
143-
real, dimension(2) :: ml_bias_adjustment_multiplier !< A scaling for the bias adjustment
144+
real :: T_ml_bias_adjustment_multiplier !< A scaling for the bias adjustment
145+
real :: S_ml_bias_adjustment_multiplier !< A scaling for the bias adjustment
144146
integer :: assim_method !< Method: NO_ASSIM,EAKF_ASSIM or OI_ASSIM
145147
integer :: ensemble_size !< Size of the ensemble
146148
integer :: ensemble_id = 0 !< id of the current ensemble member
@@ -262,8 +264,13 @@ subroutine init_oda(Time, G, GV, US, diag_CS, CS)
262264
"If true, add a spatio-temporally varying climatological adjustment "//&
263265
"to salinity.", &
264266
default=.false.)
265-
if (CS%do_T_bias_adjustment .or. CS%do_S_bias_adjustment) then
266-
call get_param(PF, mdl, "TRACER_ADJUSTMENT_FACTOR", CS%bias_adjustment_multiplier, &
267+
if (CS%do_T_bias_adjustment) then
268+
call get_param(PF, mdl, "TEMP_ADJUSTMENT_FACTOR", CS%T_bias_adjustment_multiplier, &
269+
"A multiplicative scaling factor for the climatological tracer tendency adjustment ", &
270+
units="nondim", default=1.0)
271+
endif
272+
if (CS%do_S_bias_adjustment) then
273+
call get_param(PF, mdl, "SALT_ADJUSTMENT_FACTOR", CS%S_bias_adjustment_multiplier, &
267274
"A multiplicative scaling factor for the climatological tracer tendency adjustment ", &
268275
units="nondim", default=1.0)
269276
endif
@@ -275,8 +282,13 @@ subroutine init_oda(Time, G, GV, US, diag_CS, CS)
275282
"If true, add a machine learning-trained adjustment "//&
276283
"to salinity.", &
277284
default=.false.)
278-
if (CS%do_T_ml_bias_adjustment .or. CS%do_S_ml_bias_adjustment) then
279-
call get_param(PF, mdl, "ML_TRACER_ADJUSTMENT_FACTOR", CS%ml_bias_adjustment_multiplier, &
285+
if (CS%do_T_ml_bias_adjustment) then
286+
call get_param(PF, mdl, "ML_TEMP_ADJUSTMENT_FACTOR", CS%T_ml_bias_adjustment_multiplier, &
287+
"A multiplicative scaling factor for the machine learning tracer tendency adjustment ", &
288+
units="nondim", default=1.0)
289+
endif
290+
if (CS%do_S_ml_bias_adjustment) then
291+
call get_param(PF, mdl, "ML_SALT_ADJUSTMENT_FACTOR", CS%S_ml_bias_adjustment_multiplier, &
280292
"A multiplicative scaling factor for the machine learning tracer tendency adjustment ", &
281293
units="nondim", default=1.0)
282294
endif
@@ -774,8 +786,8 @@ subroutine get_bias_correction_tracer(Time, US, CS)
774786
enddo
775787
enddo
776788

777-
CS%T_bc_tend = T_bias * CS%bias_adjustment_multiplier(1)
778-
CS%S_bc_tend = S_bias * CS%bias_adjustment_multiplier(2)
789+
CS%T_bc_tend = T_bias * CS%T_bias_adjustment_multiplier
790+
CS%S_bc_tend = S_bias * CS%S_bias_adjustment_multiplier
779791

780792
call pass_var(CS%T_bc_tend, CS%domains(CS%ensemble_id))
781793
call pass_var(CS%S_bc_tend, CS%domains(CS%ensemble_id))
@@ -829,14 +841,11 @@ subroutine get_ML_bias_correction(Time, US, CS)
829841
!! Call inference subroutine with the concatenated vector
830842
call oda_ml_inference(CS%ml_config, CS%ml_data)
831843

832-
CS%T_ml_tend(i,j,:) = CS%ml_data%T_inc
833-
CS%S_ml_tend(i,j,:) = CS%ml_data%S_inc
844+
CS%T_ml_tend(i,j,:) = CS%ml_data%T_inc * CS%T_ml_bias_adjustment_multiplier
845+
CS%S_ml_tend(i,j,:) = CS%ml_data%S_inc * CS%S_ml_bias_adjustment_multiplier
834846
endif
835847
enddo; enddo
836848

837-
CS%T_ml_tend = CS%T_ml_tend * CS%ml_bias_adjustment_multiplier(1)
838-
CS%S_ml_tend = CS%S_ml_tend * CS%ml_bias_adjustment_multiplier(2)
839-
840849
call pass_var(CS%T_ml_tend, CS%domains(CS%ensemble_id))
841850
call pass_var(CS%S_ml_tend, CS%domains(CS%ensemble_id))
842851

0 commit comments

Comments
 (0)