cloudnetpy 1.65.0__py3-none-any.whl → 1.65.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -20,47 +20,50 @@ def generate_categorize(
20
20
  uuid: str | None = None,
21
21
  options: dict | None = None,
22
22
  ) -> str:
23
- """Generates Cloudnet Level 1c categorize file.
23
+ """Generates a Cloudnet Level 1c categorize file.
24
24
 
25
- The measurements are rebinned into a common height / time grid,
26
- and classified as different types of scatterers such as ice, liquid,
27
- insects, etc. Next, the radar signal is corrected for atmospheric
28
- attenuation, and error estimates are computed. Results are saved
29
- in *output_file* which is a compressed netCDF4 file.
25
+ This function rebins measurements into a common height/time grid
26
+ and classifies them into different scatterer types, such as ice,
27
+ liquid, insects, etc. The radar signal is corrected for atmospheric
28
+ attenuation, and error estimates are computed. The results are saved in
29
+ *output_file*, a compressed netCDF4 file.
30
30
 
31
31
  Args:
32
- input_files: dict containing file names for calibrated `radar`, `lidar`,
33
- `model` and `mwr` files. Optionally also `lv0_files`, a list of
34
- RPG level 0 files.
35
- output_file: Full path of the output file.
36
- uuid: Set specific UUID for the file.
37
- options: Dictionary containing optional parameters.
32
+ input_files (dict): Contains filenames for calibrated `radar`, `lidar`,
33
+ and `model` files. Optionally, it can also include `disdrometer`,
34
+ `mwr` (containing the LWP variable), and `lv0_files` (a list of RPG
35
+ Level 0 files).
36
+ output_file (str): The full path of the output file.
37
+ uuid (str): Specific UUID to assign to the generated file.
38
+ options (dict): Dictionary containing optional parameters.
38
39
 
39
40
  Returns:
40
- UUID of the generated file.
41
+ str: UUID of the generated file.
41
42
 
42
43
  Raises:
43
- RuntimeError: Failed to create the categorize file.
44
+ RuntimeError: Raised if the categorize file creation fails.
44
45
 
45
46
  Notes:
46
- Separate mwr-file is not needed when using RPG cloud radar which
47
- measures liquid water path. Then, the radar file can be used as
48
- a mwr-file as well, i.e. {'mwr': 'radar.nc'}.
47
+ A separate MWR file is not required when using an RPG cloud radar that
48
+ measures liquid water path (LWP). In this case, the radar file can also
49
+ serve as the MWR file (e.g., {'mwr': 'radar.nc'}). If no MWR file
50
+ is provided, liquid attenuation correction cannot be performed.
49
51
 
50
- If RPG L0 files are provided as an additional input, Voodoo method is used
51
- to detect liquid droplets.
52
+ If RPG L0 files are included as additional input, the Voodoo method
53
+ is used to detect liquid droplets.
52
54
 
53
55
  Examples:
54
56
  >>> from cloudnetpy.categorize import generate_categorize
55
- >>> input_files = {'radar': 'radar.nc',
56
- 'lidar': 'lidar.nc',
57
- 'model': 'model.nc',
58
- 'mwr': 'mwr.nc'}
57
+ >>> input_files = {
58
+ ... 'radar': 'radar.nc',
59
+ ... 'lidar': 'lidar.nc',
60
+ ... 'model': 'model.nc',
61
+ ... 'mwr': 'mwr.nc'
62
+ ... }
59
63
  >>> generate_categorize(input_files, 'output.nc')
60
64
 
61
- >>> input_files["lv0_files"] = ["file1.LV0", "file2.LV0"] # Add RGP LV0 files
62
- >>> generate_categorize(input_files, 'output.nc') # Use Voodoo method
63
-
65
+ >>> input_files['lv0_files'] = ['file1.LV0', 'file2.LV0'] # Add RPG LV0 files
66
+ >>> generate_categorize(input_files, 'output.nc') # Use the Voodoo method
64
67
  """
65
68
 
66
69
  def _interpolate_to_cloudnet_grid() -> list:
@@ -60,6 +60,12 @@ def hatpro2l1c(
60
60
 
61
61
  hatpro = HatproL1c(hatpro_raw, site_meta)
62
62
 
63
+ flags = hatpro.data["quality_flag"][:]
64
+ bad_percentage = ma.sum(flags != 0) / flags.size * 100
65
+ if bad_percentage > 90:
66
+ msg = "More than 90% of brightness temperatures are flagged"
67
+ raise HatproDataError(msg)
68
+
63
69
  timestamps = hatpro.data["time"][:]
64
70
  if date is not None:
65
71
  # Screen timestamps if these assertions start to fail
@@ -2,6 +2,7 @@ import tempfile
2
2
  from typing import Literal
3
3
 
4
4
  import netCDF4
5
+ import numpy as np
5
6
  from mwrpy.level2.lev2_collocated import generate_lev2_multi as gen_multi
6
7
  from mwrpy.level2.lev2_collocated import generate_lev2_single as gen_single
7
8
  from mwrpy.level2.write_lev2_nc import MissingInputData
@@ -67,6 +68,12 @@ def _generate_product(
67
68
  netCDF4.Dataset(mwr_l1c_file, "r") as nc_input,
68
69
  netCDF4.Dataset(output_file, "r+") as nc_output,
69
70
  ):
71
+ flag_variable = "lwp" if product == "single" else "temperature"
72
+ flag_name = f"{flag_variable}_quality_flag"
73
+ flags = nc_output.variables[flag_name][:]
74
+ if not np.any(flags == 0):
75
+ msg = f"All {flag_variable} data are flagged."
76
+ raise ValidTimeStampError(msg)
70
77
  mwr = Mwr(nc_input, nc_output, uuid)
71
78
  return mwr.harmonize(product)
72
79
 
cloudnetpy/version.py CHANGED
@@ -1,4 +1,4 @@
1
1
  MAJOR = 1
2
2
  MINOR = 65
3
- PATCH = 0
3
+ PATCH = 2
4
4
  __version__ = f"{MAJOR}.{MINOR}.{PATCH}"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cloudnetpy
3
- Version: 1.65.0
3
+ Version: 1.65.2
4
4
  Summary: Python package for Cloudnet processing
5
5
  Author: Simo Tukiainen
6
6
  License: MIT License
@@ -8,11 +8,11 @@ cloudnetpy/metadata.py,sha256=v_VDo2vbdTxB0zIsfP69IcrwSKiRlLpsGdq6JPI4CoA,5306
8
8
  cloudnetpy/output.py,sha256=YkCaxVkG_Mt2hng_IVnhygHteV4UMKzKALkeFZwFJL8,14822
9
9
  cloudnetpy/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  cloudnetpy/utils.py,sha256=JV0Fawnme1HoZgoiidV3eIzsn6vx0AEjBNmI1CcrBsA,28517
11
- cloudnetpy/version.py,sha256=GyQ5dtQt1vQ9KfpnsA6Fw5Z-nvlfzCZj7jSg1WwwuhY,72
11
+ cloudnetpy/version.py,sha256=u6lVmR8dh9GGZ-f5jZEFKWsE9A_b-CpQB_QHzX-r1b0,72
12
12
  cloudnetpy/categorize/__init__.py,sha256=gP5q3Vis1y9u9OWgA_idlbjfWXYN_S0IBSWdwBhL_uU,69
13
13
  cloudnetpy/categorize/atmos.py,sha256=vavMC_WQQyGH14eL4vAzKLKDDZt8tBrMYimztYHOjH8,12639
14
14
  cloudnetpy/categorize/atmos_utils.py,sha256=64uenj2uxj3P3Blaq_pBN1pBjcF-X4LYNt-uTOjvevg,3778
15
- cloudnetpy/categorize/categorize.py,sha256=WQobVBcCk0HbbSIVm9yNX5apwj-5S6IIX4dvleaji0Y,18070
15
+ cloudnetpy/categorize/categorize.py,sha256=VcxSs22icYDG3R5x9jTX7uuSjPU8tyc5bIz0Zj5F9z0,18303
16
16
  cloudnetpy/categorize/classify.py,sha256=a-0bVCtynGfORnDGTsPuzqkuDeOOR_OMz5ai9NsMuic,9870
17
17
  cloudnetpy/categorize/containers.py,sha256=g3SQHoqlY1uJ8b-MG-BbW3oWz5IyacA8kJBeIPy_4EA,4859
18
18
  cloudnetpy/categorize/disdrometer.py,sha256=keU3pFvKtk840A0oLwAyNDuqOCswBPJEKf2bV0YWyA8,2004
@@ -34,7 +34,7 @@ cloudnetpy/instruments/cl61d.py,sha256=g6DNBFju3wYhLFl32DKmC8pUup7y-EupXoUU0fuoG
34
34
  cloudnetpy/instruments/cloudnet_instrument.py,sha256=RG5HJxGM6p0F-IGyr85fvOizcMmgx48OeD_XeIsrgSU,3367
35
35
  cloudnetpy/instruments/copernicus.py,sha256=nmgqGOjVQFngj7BNbpcuCwA-W3yksvBbqn__iq7MyDk,6469
36
36
  cloudnetpy/instruments/galileo.py,sha256=yQBedd7dmDnwuWi1MtXOsg4-RyRx0uRAXumCY4YuH9k,4686
37
- cloudnetpy/instruments/hatpro.py,sha256=PD2wLmzzbeOticvg44cT3aJzQYsRnLekW9pBPOzjFLc,8514
37
+ cloudnetpy/instruments/hatpro.py,sha256=2lEblvJ9m7QniWH1OH7ycWtywYqY6X3ulE4dNuQp-Z8,8749
38
38
  cloudnetpy/instruments/instruments.py,sha256=jG5TYnZ8bdCZXnI303ZsaJBEdSKaIjKMbkGtnq6kQX0,3261
39
39
  cloudnetpy/instruments/lufft.py,sha256=ugXF6pssHAAz1Y_hqPdpKuluAjxxHSR88xBmQuS6RlI,3705
40
40
  cloudnetpy/instruments/mira.py,sha256=EyzEBTpWfDlgaspZVuIfaP4l73GYSVnSzEzBZc0lZNg,9333
@@ -105,11 +105,11 @@ cloudnetpy/products/ier.py,sha256=ge1f_aYick20Nlznq8zbBl5umWlTP-UwMivy4Y05Sck,78
105
105
  cloudnetpy/products/iwc.py,sha256=Q8dXV3JF3JUQgwkmQFOKakm21Tnf8oCWsH0CSqIEKl4,10209
106
106
  cloudnetpy/products/lwc.py,sha256=wSd3GDqELz4yyWBMiKDR-QhRK8scPheqsBcS1qzxYOI,18997
107
107
  cloudnetpy/products/mie_lu_tables.nc,sha256=It4fYpqJXlqOgL8jeZ-PxGzP08PMrELIDVe55y9ob58,16637951
108
- cloudnetpy/products/mwr_tools.py,sha256=3esU5cG5GI2WVmOENqrJ0FbMuxLegADv7q8TB0RorGg,4674
108
+ cloudnetpy/products/mwr_tools.py,sha256=tN_sPDS3BdpFJfa5a2mnc3eCMoi7syjVJMaTt962hmo,5004
109
109
  cloudnetpy/products/product_tools.py,sha256=VNw2diJj30POz68-3qNVkJP7r9AUspT_d1Fp0BbeIx8,10414
110
110
  docs/source/conf.py,sha256=IKiFWw6xhUd8NrCg0q7l596Ck1d61XWeVjIFHVSG9Og,1490
111
- cloudnetpy-1.65.0.dist-info/LICENSE,sha256=wcZF72bdaoG9XugpyE95Juo7lBQOwLuTKBOhhtANZMM,1094
112
- cloudnetpy-1.65.0.dist-info/METADATA,sha256=MRy1c5jmGmBs67KS3mr2jWmkiuvmhMWh1zfdr8YZj58,5784
113
- cloudnetpy-1.65.0.dist-info/WHEEL,sha256=nCVcAvsfA9TDtwGwhYaRrlPhTLV9m-Ga6mdyDtuwK18,91
114
- cloudnetpy-1.65.0.dist-info/top_level.txt,sha256=ibSPWRr6ojS1i11rtBFz2_gkIe68mggj7aeswYfaOo0,16
115
- cloudnetpy-1.65.0.dist-info/RECORD,,
111
+ cloudnetpy-1.65.2.dist-info/LICENSE,sha256=wcZF72bdaoG9XugpyE95Juo7lBQOwLuTKBOhhtANZMM,1094
112
+ cloudnetpy-1.65.2.dist-info/METADATA,sha256=4xKvPJLnx0MWstdTF5rFXHynPcmaWO5qff4b-JlMLJ0,5784
113
+ cloudnetpy-1.65.2.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91
114
+ cloudnetpy-1.65.2.dist-info/top_level.txt,sha256=ibSPWRr6ojS1i11rtBFz2_gkIe68mggj7aeswYfaOo0,16
115
+ cloudnetpy-1.65.2.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (73.0.0)
2
+ Generator: setuptools (73.0.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5