cloudnetpy 1.81.1__py3-none-any.whl → 1.82.0__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.
@@ -102,9 +102,11 @@ class Basta(NcRadar):
102
102
  def validate_date(self, expected_date: datetime.date) -> None:
103
103
  """Validates expected data."""
104
104
  date_units = self.dataset.variables["time"].units
105
- date = date_units.split()[2]
105
+ date_str = date_units.split()[2]
106
+ date = datetime.date.fromisoformat(date_str)
106
107
  if expected_date != date:
107
- raise ValidTimeStampError
108
+ msg = "Time units doesn't match expected date"
109
+ raise ValidTimeStampError(msg)
108
110
 
109
111
  def add_zenith_angle(self) -> None:
110
112
  elevation = self.getvar("elevation")
@@ -42,6 +42,7 @@ def hatpro2l1c(
42
42
  output_file: str | PathLike,
43
43
  site_meta: dict,
44
44
  instrument_type: IType = "hatpro",
45
+ lidar_file: str | PathLike | None = None,
45
46
  uuid: str | UUID | None = None,
46
47
  date: str | datetime.date | None = None,
47
48
  ) -> UUID:
@@ -52,6 +53,7 @@ def hatpro2l1c(
52
53
  output_file: Output file name.
53
54
  site_meta: Dictionary containing information about the site and instrument
54
55
  instrument_type: Specific type of the RPG microwave radiometer.
56
+ lidar_file: Path to a lidar file.
55
57
  uuid: Set specific UUID for the file.
56
58
  date: Expected date in the input files.
57
59
 
@@ -71,6 +73,7 @@ def hatpro2l1c(
71
73
  str(mwr_dir),
72
74
  instrument_type=instrument_type,
73
75
  output_file=str(output_file),
76
+ lidar_path=lidar_file,
74
77
  coeff_files=coeff_files,
75
78
  instrument_config=site_meta,
76
79
  date=date,
@@ -133,7 +136,10 @@ def hatpro2l1c(
133
136
  nc.mwrpy_version = mwrpy_version
134
137
  nc.mwrpy_coefficients = ", ".join(site_meta["coefficientLinks"])
135
138
  nc.history = nc.history.replace("mwr", "mwr-l1c")
136
-
139
+ if lidar_file is not None:
140
+ with netCDF4.Dataset(lidar_file) as lidar_nc:
141
+ nc.source = f"{nc.source}\n{lidar_nc.source}"
142
+ nc.history = f"{nc.history}\n{lidar_nc.history}"
137
143
  return uuid
138
144
 
139
145
 
@@ -1,7 +1,7 @@
1
1
  import os
2
2
  import tempfile
3
3
  from os import PathLike
4
- from typing import TYPE_CHECKING, Literal
4
+ from typing import Literal
5
5
  from uuid import UUID
6
6
 
7
7
  import netCDF4
@@ -16,14 +16,12 @@ from mwrpy.version import __version__ as mwrpy_version
16
16
  from cloudnetpy import output, utils
17
17
  from cloudnetpy.exceptions import ValidTimeStampError
18
18
 
19
- if TYPE_CHECKING:
20
- from collections.abc import Callable
21
-
22
19
 
23
20
  def generate_mwr_single(
24
21
  mwr_l1c_file: str | PathLike,
25
22
  output_file: str | PathLike,
26
23
  uuid: str | UUID | None = None,
24
+ lwp_offset: tuple[float | None, float | None] = (None, None),
27
25
  ) -> UUID:
28
26
  """Generates MWR single-pointing product including liquid water path, integrated
29
27
  water vapor, etc. from zenith measurements.
@@ -32,6 +30,7 @@ def generate_mwr_single(
32
30
  mwr_l1c_file: The Level 1C MWR file to be processed.
33
31
  output_file: The file path where the output file should be saved.
34
32
  uuid: The UUID, if any, associated with the output file. Defaults to None.
33
+ lwp_offset: Optional offset to apply to the liquid water path.
35
34
 
36
35
  Returns:
37
36
  UUID of generated file.
@@ -39,13 +38,14 @@ def generate_mwr_single(
39
38
  Example:
40
39
  >>> generate_mwr_single('input_mwr_l1c_file', 'output_file', 'abcdefg1234567')
41
40
  """
42
- return _generate_product(mwr_l1c_file, output_file, uuid, "single")
41
+ return _generate_product(mwr_l1c_file, output_file, uuid, "single", lwp_offset)
43
42
 
44
43
 
45
44
  def generate_mwr_lhumpro(
46
45
  mwr_l1c_file: str | PathLike,
47
46
  output_file: str | PathLike,
48
47
  uuid: str | UUID | None = None,
48
+ lwp_offset: tuple[float | None, float | None] = (None, None),
49
49
  ) -> UUID:
50
50
  """Generates LHUMPRO single-pointing product including liquid water path, integrated
51
51
  water vapor, etc. from zenith measurements.
@@ -54,6 +54,7 @@ def generate_mwr_lhumpro(
54
54
  mwr_l1c_file: The Level 1C MWR file to be processed.
55
55
  output_file: The file path where the output file should be saved.
56
56
  uuid: The UUID, if any, associated with the output file. Defaults to None.
57
+ lwp_offset: Optional offset to apply to the liquid water path.
57
58
 
58
59
  Returns:
59
60
  UUID of generated file.
@@ -61,7 +62,7 @@ def generate_mwr_lhumpro(
61
62
  Example:
62
63
  >>> generate_mwr_lhumpro('input_mwr_l1c_file', 'output_file', 'abcdefg1234567')
63
64
  """
64
- return _generate_product(mwr_l1c_file, output_file, uuid, "lhumpro")
65
+ return _generate_product(mwr_l1c_file, output_file, uuid, "lhumpro", lwp_offset)
65
66
 
66
67
 
67
68
  def generate_mwr_multi(
@@ -88,24 +89,20 @@ def _generate_product(
88
89
  mwr_l1c_file: str | PathLike,
89
90
  output_file: str | PathLike,
90
91
  uuid: str | UUID | None,
91
- product: Literal["multi", "single", "lhumpro"],
92
+ product: Literal["single", "multi", "lhumpro"],
93
+ lwp_offset: tuple[float | None, float | None] = (None, None),
92
94
  ) -> UUID:
93
95
  uuid = utils.get_uuid(uuid)
94
- fun: Callable
95
- if product == "multi":
96
- fun = gen_multi
97
- elif product == "single":
98
- fun = gen_single
99
- elif product == "lhumpro":
100
- fun = gen_lhumpro
101
- product = "single"
102
- else:
103
- msg = f"Invalid product: {product}"
104
- raise ValueError(msg)
105
96
  with tempfile.TemporaryDirectory() as temp_dir:
106
97
  coeffs = _read_mwrpy_coeffs(mwr_l1c_file, temp_dir)
107
98
  try:
108
- fun(None, mwr_l1c_file, output_file, coeff_files=coeffs)
99
+ if product == "multi":
100
+ gen_multi(None, mwr_l1c_file, output_file, coeffs)
101
+ elif product == "single":
102
+ gen_single(None, mwr_l1c_file, output_file, lwp_offset, coeffs)
103
+ else:
104
+ gen_lhumpro(None, mwr_l1c_file, output_file, lwp_offset, coeffs)
105
+ product = "single"
109
106
  except MissingInputData as err:
110
107
  raise ValidTimeStampError from err
111
108
  with (
cloudnetpy/version.py CHANGED
@@ -1,4 +1,4 @@
1
1
  MAJOR = 1
2
- MINOR = 81
3
- PATCH = 1
2
+ MINOR = 82
3
+ PATCH = 0
4
4
  __version__ = f"{MAJOR}.{MINOR}.{PATCH}"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cloudnetpy
3
- Version: 1.81.1
3
+ Version: 1.82.0
4
4
  Summary: Python package for Cloudnet processing
5
5
  Author: Simo Tukiainen
6
6
  License: MIT License
@@ -9,7 +9,7 @@ cloudnetpy/metadata.py,sha256=CFpXmdEkVPzvLPv2xHIR-aMMQ-TR26KfESYw-98j7sk,7213
9
9
  cloudnetpy/output.py,sha256=bUp13wv5TVtfZ-wBPU_n2qvWZa-PviozrVUhJnonbYE,14830
10
10
  cloudnetpy/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  cloudnetpy/utils.py,sha256=7PHfJo9iLMdePwEApLfYH4XiVC9DhlFQMdQTxesZylA,31797
12
- cloudnetpy/version.py,sha256=chZph3CTTre3rPSQC__At9-AeitrZwYJ91usZPqrzko,72
12
+ cloudnetpy/version.py,sha256=go0Zq4vIkrnCH45JYO1gxm5LNSQAgp0clDMvI3GQL7g,72
13
13
  cloudnetpy/categorize/__init__.py,sha256=gtvzWr0IDRn2oA6yHBvinEhTGTuub-JkrOv93lBsgrE,61
14
14
  cloudnetpy/categorize/atmos_utils.py,sha256=uWc9TABVYPI0sn4H5Az9Jf6NVRaWyEKIi17f0pAJQxE,10679
15
15
  cloudnetpy/categorize/attenuation.py,sha256=Y_-fzmQTltWTqIZTulJhovC7a6ifpMcaAazDJcnMIOc,990
@@ -33,7 +33,7 @@ cloudnetpy/categorize/attenuations/liquid_attenuation.py,sha256=bmqmPk_93J4njE16
33
33
  cloudnetpy/categorize/attenuations/melting_attenuation.py,sha256=AHmMMK7upxtps5fXF7Ca_ZF8fwpzaTGyGSwXDJq6q1k,2387
34
34
  cloudnetpy/categorize/attenuations/rain_attenuation.py,sha256=wJPyCiKWzsQDzMhqbA7mYwj9YRVcJIpXWhBnEYFy3uU,2843
35
35
  cloudnetpy/instruments/__init__.py,sha256=PEgrrQNoiOuN_ctYilmt4LV2QCLg1likPjJdWtuGlLs,528
36
- cloudnetpy/instruments/basta.py,sha256=E_qT5g_lzFVk3v-U0hVwgcNYlc9mhgrAv1NnSg2jwG4,4163
36
+ cloudnetpy/instruments/basta.py,sha256=N-kRgl5Vm52pXzr9umo4YsA0hn4zZCOa-0_zZTzhheY,4284
37
37
  cloudnetpy/instruments/bowtie.py,sha256=WZYB_o90I5QKOupCRjzZU4Mi54oX_3teyAPBDUogwRI,4301
38
38
  cloudnetpy/instruments/ceilo.py,sha256=GJ1ZVX6aEMAZw1cpTXcNy9imfuPAkoqmrLQyUc00UEo,8809
39
39
  cloudnetpy/instruments/ceilometer.py,sha256=c37uteeuGnlE-o-Smu49H2qQJw6qZ0tc3Bzhyr1FoSo,13063
@@ -42,7 +42,7 @@ cloudnetpy/instruments/cloudnet_instrument.py,sha256=B1UkiB0ytnT3MWYalEegql5QIPa
42
42
  cloudnetpy/instruments/copernicus.py,sha256=ygEViERBSJdMeP9OxfLelZRDEbSRzY8n17ruYie2wm4,6970
43
43
  cloudnetpy/instruments/fd12p.py,sha256=5TFyNO26VGpO4ts9UIJiuLo4LUwQPHO6aK2fTnOtaKY,7019
44
44
  cloudnetpy/instruments/galileo.py,sha256=f_-GkRxhNaQPbI8HpOwSmoKfGqyjmD16A0ZFgwLOIig,5137
45
- cloudnetpy/instruments/hatpro.py,sha256=omwZ0M_BqZ7rK1As9DOhTe5X9Bh3coMk2Qjlgr7b8cs,9906
45
+ cloudnetpy/instruments/hatpro.py,sha256=TGOqwW0TfoPEYk13MFvFzwgJGzm6MVE5AsPavcIoj3I,10248
46
46
  cloudnetpy/instruments/instruments.py,sha256=z8Osjww3iQRxKvzXdISl-5vV6gShtji8Db5k-ZzDQ-0,4843
47
47
  cloudnetpy/instruments/lufft.py,sha256=G6KeJOeltLUlGCHHEk8ns2K7WJ9ImAr25rSB2JltawE,4286
48
48
  cloudnetpy/instruments/mira.py,sha256=XqmbytpeCJ2-hNugxdsXSBUDB8SAUc97_6lo5mHFG8E,11840
@@ -115,12 +115,12 @@ cloudnetpy/products/ier.py,sha256=Eb5AK-6l5mN_7vWP1cxcXQzj886zAwDDsHXueUju0N0,62
115
115
  cloudnetpy/products/iwc.py,sha256=pXl0xOFDD6AzGaAp_GzD2yapjOc7hXKTno9Q5G6HCOo,9826
116
116
  cloudnetpy/products/lwc.py,sha256=xsNiiG6dGKIkWaFk0xWTabc1bZ4ULf6SqcqHs7itAUk,19339
117
117
  cloudnetpy/products/mie_lu_tables.nc,sha256=It4fYpqJXlqOgL8jeZ-PxGzP08PMrELIDVe55y9ob58,16637951
118
- cloudnetpy/products/mwr_tools.py,sha256=ZIpeeH3qYPrujmITMtnS8H8PfQIPWJYlz4AdaUSSs28,6452
118
+ cloudnetpy/products/mwr_tools.py,sha256=MMWnp68U7bv157-CPB2VeTQvaR6zl7sexbBT_kJ_pn8,6734
119
119
  cloudnetpy/products/product_tools.py,sha256=eyqIw_0KhlpmmYQE69RpGdRIAOW7JVPlEgkTBp2kdps,11302
120
- cloudnetpy-1.81.1.dist-info/licenses/LICENSE,sha256=wcZF72bdaoG9XugpyE95Juo7lBQOwLuTKBOhhtANZMM,1094
120
+ cloudnetpy-1.82.0.dist-info/licenses/LICENSE,sha256=wcZF72bdaoG9XugpyE95Juo7lBQOwLuTKBOhhtANZMM,1094
121
121
  docs/source/conf.py,sha256=IKiFWw6xhUd8NrCg0q7l596Ck1d61XWeVjIFHVSG9Og,1490
122
- cloudnetpy-1.81.1.dist-info/METADATA,sha256=2SO_QdrF7uw6WKEYy7CmgnEdNWkc9nxY9JLr_L1Dgq4,5836
123
- cloudnetpy-1.81.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
124
- cloudnetpy-1.81.1.dist-info/entry_points.txt,sha256=HhY7LwCFk4qFgDlXx_Fy983ZTd831WlhtdPIzV-Y3dY,51
125
- cloudnetpy-1.81.1.dist-info/top_level.txt,sha256=ibSPWRr6ojS1i11rtBFz2_gkIe68mggj7aeswYfaOo0,16
126
- cloudnetpy-1.81.1.dist-info/RECORD,,
122
+ cloudnetpy-1.82.0.dist-info/METADATA,sha256=psXUo1YNPF33S6X7i1WnEGuaMY5V1XZlYJTguJl9-0I,5836
123
+ cloudnetpy-1.82.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
124
+ cloudnetpy-1.82.0.dist-info/entry_points.txt,sha256=HhY7LwCFk4qFgDlXx_Fy983ZTd831WlhtdPIzV-Y3dY,51
125
+ cloudnetpy-1.82.0.dist-info/top_level.txt,sha256=ibSPWRr6ojS1i11rtBFz2_gkIe68mggj7aeswYfaOo0,16
126
+ cloudnetpy-1.82.0.dist-info/RECORD,,