Skip to content

Commit

Permalink
Extract quality flag bits for lev2 products
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasmarke committed Dec 1, 2023
1 parent 2a42b51 commit 52145ad
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions mwrpy/level2/write_lev2_nc.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
interpol_2d,
interpolate_2d,
read_config,
setbit,
isbit,
)

Fill_Value_Float = -999.0
Expand Down Expand Up @@ -497,9 +499,13 @@ def _get_qf(
assume_unique=False,
return_indices=True,
)
rpg_dat[product + "_quality_flag"] = np.max(
lev1["quality_flag"][index, freq_ind], axis=1
)
rpg_dat[product + "_quality_flag"] = np.zeros(len(index), np.int32)
for bit in range(8):
bit_set = np.any(isbit(lev1["quality_flag"][index, freq_ind], bit), axis=1)
if np.any(bit_set):
rpg_dat[product + "_quality_flag"][bit_set] = setbit(
rpg_dat[product + "_quality_flag"][bit_set], bit
)
rpg_dat[product + "_quality_flag_status"] = lev1["quality_flag_status"][
index, freq_ind[0]
]
Expand Down

0 comments on commit 52145ad

Please sign in to comment.