Skip to content

Commit

Permalink
bugfix for #234 (#235)
Browse files Browse the repository at this point in the history
  • Loading branch information
laestrada authored Jul 2, 2024
1 parent 6000578 commit ddca238
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/inversion_scripts/invert.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,10 @@ def do_inversion(
for p in obs_GC[:, 4]
]
)
# Define observational errors (diagonal entries of S_o matrix)
obs_error = np.power(obs_error, 2)
gP = s_superO_p**2 / s_superO_1**2
# scale error variance by gP
obs_error = gP * obs_err

# check to make sure obs_err isn't negative, set 1 as default value
Expand Down Expand Up @@ -179,9 +182,6 @@ def do_inversion(
scaling_matrix = np.tile(scale_factors, (reps, 1))
K *= scaling_matrix

# Define observational errors (diagonal entries of S_o matrix)
obs_error = np.power(obs_error, 2)

# Measurement-model mismatch: TROPOMI columns minus GEOS-Chem virtual TROPOMI columns
# This is (y - F(xA)), i.e., (y - (K*xA + c)) or (y - K*xA) in shorthand
delta_y = obs_GC[:, 0] - obs_GC[:, 1] # [ppb]
Expand Down
2 changes: 1 addition & 1 deletion src/inversion_scripts/lognormal_invert.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def lognormal_invert(config, state_vector_filepath, jacobian_sf):

# get the So matrix
ds = np.load("so_super.npz")
so = ds["so"] ** 2
so = ds["so"]

# Calculate the difference between tropomi and the background
# simulation, which has no emissions
Expand Down
2 changes: 2 additions & 0 deletions src/inversion_scripts/merge_partial_k.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ def merge_partial_k(satdat_dir, lat_bounds, lon_bounds, obs_err, precomp_K):
for p in obs_GC[:, 4]
]
)
# scale error variance by gP value following Chen et al. 2023
gP = s_superO_p**2 / s_superO_1**2
obs_error = obs_error ** 2
obs_error = gP * obs_error

# check to make sure obs_err isn't negative, set 1 as default value
Expand Down

0 comments on commit ddca238

Please sign in to comment.