Skip to content

Commit

Permalink
Check if all data are masked in mwr-single and mwr-multi
Browse files Browse the repository at this point in the history
  • Loading branch information
tukiains committed Aug 21, 2024
1 parent b45f08e commit 6b882bf
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cloudnetpy/products/mwr_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from typing import Literal

import netCDF4
import numpy as np
from mwrpy.level2.lev2_collocated import generate_lev2_multi as gen_multi
from mwrpy.level2.lev2_collocated import generate_lev2_single as gen_single
from mwrpy.level2.write_lev2_nc import MissingInputData
Expand Down Expand Up @@ -67,6 +68,12 @@ def _generate_product(
netCDF4.Dataset(mwr_l1c_file, "r") as nc_input,
netCDF4.Dataset(output_file, "r+") as nc_output,
):
flag_variable = "lwp" if product == "single" else "temperature"
flag_name = f"{flag_variable}_quality_flag"
flags = nc_output.variables[flag_name][:]
if not np.any(flags == 0):
msg = f"All {flag_variable} data are flagged."
raise ValidTimeStampError(msg)
mwr = Mwr(nc_input, nc_output, uuid)
return mwr.harmonize(product)

Expand Down

0 comments on commit 6b882bf

Please sign in to comment.