Commit fc8b3dad authored by ronesy's avatar ronesy
Browse files

Correction to calc_cost in mod_analytic for optimization of offsets

parent 86cd3928
......@@ -552,16 +552,17 @@ module mod_analytic
! Jo = (y - Hx)^TR^(-1)(y - Hx)
cost_o = 0.
do i = 1, nobs
! only calculate delta if state variables contribute to mixing ratio
if ( obs%model(i).ne.0. ) then
if ( config%spec.eq.'co2' ) then
obs%delta(i) = obs%model(i) + obs%nee(i) + obs%fff(i) + obs%ocn(i) + obs%bbg(i) - &
obs%conc(i) + obs%bkg(i) + obs%cini(i)
if ( config%spec.eq.'co2' ) then
obs%delta(i) = obs%model(i) + obs%nee(i) + obs%fff(i) + obs%ocn(i) + obs%bbg(i) - &
obs%conc(i) + obs%bkg(i) + obs%cini(i)
else
if ( .not.config%offsets ) then
! optimize fluxes themselves
obs%delta(i) = obs%model(i) + obs%ocn(i) - obs%conc(i) + obs%bkg(i) + obs%cini(i)
else
obs%delta(i) = obs%model(i) - obs%conc(i) + obs%bkg(i) + obs%cini(i)
! optimize offsets so account for contribution from best guess fluxes (ghg)
obs%delta(i) = obs%model(i) + obs%ghg(i) - obs%conc(i) + obs%bkg(i) + obs%cini(i)
endif
else
obs%delta(i) = 0.
endif
cost_o = cost_o + obs%delta(i)**2/obs%err(i)**2
end do
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment