cloudnetpy 1.78.3__py3-none-any.whl → 1.78.4__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.
@@ -206,10 +206,11 @@ class Thies(Disdrometer):
206
206
  self.serial_number = first_id
207
207
 
208
208
  def _read_line(self, line: str, timestamp: datetime.datetime | None = None):
209
- raw_values = line.split(";")
209
+ raw_values = line.strip().strip(";").split(";")
210
210
  # Support custom truncated format used in Leipzig LIM.
211
- expected_columns = self.site_meta.get("truncate_columns", 521)
212
- if len(raw_values) != expected_columns:
211
+ expected_columns = self.site_meta.get("truncate_columns", 521) - 1
212
+ # Length matches telegram 4 or 5 (has 4 additional columns).
213
+ if len(raw_values) not in (expected_columns, expected_columns + 4):
213
214
  return
214
215
  for i, key in TELEGRAM4:
215
216
  if i >= expected_columns - 1:
@@ -246,7 +247,7 @@ class Thies(Disdrometer):
246
247
  self.raw_data[key].append(value)
247
248
  if expected_columns > 79:
248
249
  self.raw_data["spectrum"].append(
249
- np.array(list(map(int, raw_values[79:-2])), dtype="i2").reshape(
250
+ np.array(list(map(int, raw_values[79:519])), dtype="i2").reshape(
250
251
  self.n_diameter, self.n_velocity
251
252
  )
252
253
  )
cloudnetpy/utils.py CHANGED
@@ -8,9 +8,9 @@ import re
8
8
  import textwrap
9
9
  import uuid
10
10
  import warnings
11
- from collections.abc import Iterator
11
+ from collections.abc import Callable, Iterator
12
12
  from datetime import timezone
13
- from typing import Any, Literal, TypeVar
13
+ from typing import Literal, TypeVar
14
14
 
15
15
  import netCDF4
16
16
  import numpy as np
@@ -139,11 +139,19 @@ def binvec(x: np.ndarray | list) -> np.ndarray:
139
139
  return np.linspace(edge1, edge2, len(x) + 1)
140
140
 
141
141
 
142
+ REBIN_STAT = Literal["mean", "std", "max"]
143
+ REBIN_STAT_FN: dict[REBIN_STAT, Callable] = {
144
+ "mean": ma.mean,
145
+ "std": ma.std,
146
+ "max": ma.max,
147
+ }
148
+
149
+
142
150
  def rebin_2d(
143
151
  x_in: np.ndarray,
144
152
  array: np.ndarray,
145
153
  x_new: np.ndarray,
146
- statistic: Literal["mean", "std", "max"] = "mean",
154
+ statistic: REBIN_STAT = "mean",
147
155
  n_min: int = 1,
148
156
  *,
149
157
  keepdim: bool = False,
@@ -154,11 +162,7 @@ def rebin_2d(
154
162
  n_bins = len(x_new)
155
163
  counts = np.bincount(binn[binn >= 0], minlength=n_bins)
156
164
 
157
- stat_fn: Any = {
158
- "mean": ma.mean,
159
- "std": ma.std,
160
- "max": ma.max,
161
- }[statistic]
165
+ stat_fn = REBIN_STAT_FN[statistic]
162
166
 
163
167
  shape = array.shape if keepdim else (n_bins, array.shape[1])
164
168
  result: ma.MaskedArray = ma.masked_array(np.ones(shape, dtype="float32"), mask=True)
@@ -183,7 +187,7 @@ def rebin_1d(
183
187
  x_in: np.ndarray,
184
188
  array: np.ndarray | ma.MaskedArray,
185
189
  x_new: np.ndarray,
186
- statistic: str = "mean",
190
+ statistic: REBIN_STAT = "mean",
187
191
  ) -> ma.MaskedArray:
188
192
  """Rebins 1D array.
189
193
 
cloudnetpy/version.py CHANGED
@@ -1,4 +1,4 @@
1
1
  MAJOR = 1
2
2
  MINOR = 78
3
- PATCH = 3
3
+ PATCH = 4
4
4
  __version__ = f"{MAJOR}.{MINOR}.{PATCH}"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cloudnetpy
3
- Version: 1.78.3
3
+ Version: 1.78.4
4
4
  Summary: Python package for Cloudnet processing
5
5
  Author: Simo Tukiainen
6
6
  License: MIT License
@@ -8,8 +8,8 @@ cloudnetpy/exceptions.py,sha256=hYbUtBwjCIfxnPe_5mELDEw87AWITBrwuo7WYIEKmJ8,1579
8
8
  cloudnetpy/metadata.py,sha256=lO7BCbVAzFoH3Nq-VuezYX0f7MnbG1Zp11g5GSiuQwM,6189
9
9
  cloudnetpy/output.py,sha256=gupxt4f_-eUrFsWMto8tnknoV-p9QauC9L6CJAqBILU,15988
10
10
  cloudnetpy/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
- cloudnetpy/utils.py,sha256=HdcSNIgdxoZlP_jHl66ItheHLw_cDYZb7u6mZ5dfMNE,31952
12
- cloudnetpy/version.py,sha256=pYMEbxEa9ahzrcn_G9DIIY9enBLmzjF9ZpI-AB73HTw,72
11
+ cloudnetpy/utils.py,sha256=WczDeGN408XSgGeaRLXFmlLjgAS67lK1osV0YEuKmwo,32027
12
+ cloudnetpy/version.py,sha256=PsA9X5V3-O4wqAT55qKQUjxDaJreoMoF1C4k2clvJAs,72
13
13
  cloudnetpy/categorize/__init__.py,sha256=s-SJaysvVpVVo5kidiruWQO6p3gv2TXwY1wEHYO5D6I,44
14
14
  cloudnetpy/categorize/atmos_utils.py,sha256=RcmbKxm2COkE7WEya0mK3yX5rzUbrewRVh3ekm01RtM,10598
15
15
  cloudnetpy/categorize/attenuation.py,sha256=Y_-fzmQTltWTqIZTulJhovC7a6ifpMcaAazDJcnMIOc,990
@@ -60,7 +60,7 @@ cloudnetpy/instruments/weather_station.py,sha256=pZK7I5bk1USDRoTeIhZoWzbka9ciea5
60
60
  cloudnetpy/instruments/disdrometer/__init__.py,sha256=lyjwttWvFvuwYxEkusoAvgRcbBmglmOp5HJOpXUqLWo,93
61
61
  cloudnetpy/instruments/disdrometer/common.py,sha256=g52iK2aNp3Z88kovUmGVpC54NZomPa9D871gzO0AmQ4,9267
62
62
  cloudnetpy/instruments/disdrometer/parsivel.py,sha256=HJZrEysQkx9MiIVPDV25CYHpXi_SjgZlgO-otoaKK34,25640
63
- cloudnetpy/instruments/disdrometer/thies.py,sha256=4T15XW5Hu0SviL_a_PWieIWkZzaVJY92Qm7psSa1kPU,10943
63
+ cloudnetpy/instruments/disdrometer/thies.py,sha256=JwwXExDePJy-57hdWXy0kC84oLqcJbwYopGvmsH605E,11064
64
64
  cloudnetpy/model_evaluation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
65
65
  cloudnetpy/model_evaluation/file_handler.py,sha256=jnpTxwxLSZdt08By0cjFDmq1KWC4fhJaN_MfjgA8ijQ,6440
66
66
  cloudnetpy/model_evaluation/metadata.py,sha256=PAsnOqcUoV3CJwplgWiVCF9Zt4io8tqj7CIgS4fEL-8,8412
@@ -117,10 +117,10 @@ cloudnetpy/products/lwc.py,sha256=sl6Al2tuH3KkCBrPbWTmuz3jlD5UQJ4D6qBsn1tt2CQ,18
117
117
  cloudnetpy/products/mie_lu_tables.nc,sha256=It4fYpqJXlqOgL8jeZ-PxGzP08PMrELIDVe55y9ob58,16637951
118
118
  cloudnetpy/products/mwr_tools.py,sha256=8HPZpQMTojKZP1JS1S83IE0sxmbDE9bxlaWoqmGnUZE,6199
119
119
  cloudnetpy/products/product_tools.py,sha256=uu4l6reuGbPcW3TgttbaSrqIKbyYGhBVTdnC7opKvmg,11101
120
- cloudnetpy-1.78.3.dist-info/licenses/LICENSE,sha256=wcZF72bdaoG9XugpyE95Juo7lBQOwLuTKBOhhtANZMM,1094
120
+ cloudnetpy-1.78.4.dist-info/licenses/LICENSE,sha256=wcZF72bdaoG9XugpyE95Juo7lBQOwLuTKBOhhtANZMM,1094
121
121
  docs/source/conf.py,sha256=IKiFWw6xhUd8NrCg0q7l596Ck1d61XWeVjIFHVSG9Og,1490
122
- cloudnetpy-1.78.3.dist-info/METADATA,sha256=rwmnbibL2ih6Bub0PwnyBbDzEYoSFQLS_IAuERyxDb0,5796
123
- cloudnetpy-1.78.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
124
- cloudnetpy-1.78.3.dist-info/entry_points.txt,sha256=HhY7LwCFk4qFgDlXx_Fy983ZTd831WlhtdPIzV-Y3dY,51
125
- cloudnetpy-1.78.3.dist-info/top_level.txt,sha256=ibSPWRr6ojS1i11rtBFz2_gkIe68mggj7aeswYfaOo0,16
126
- cloudnetpy-1.78.3.dist-info/RECORD,,
122
+ cloudnetpy-1.78.4.dist-info/METADATA,sha256=yNApetkcs7v4tbvKRWH3pVT7hsbpES7Q-1lfCIQnw7E,5796
123
+ cloudnetpy-1.78.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
124
+ cloudnetpy-1.78.4.dist-info/entry_points.txt,sha256=HhY7LwCFk4qFgDlXx_Fy983ZTd831WlhtdPIzV-Y3dY,51
125
+ cloudnetpy-1.78.4.dist-info/top_level.txt,sha256=ibSPWRr6ojS1i11rtBFz2_gkIe68mggj7aeswYfaOo0,16
126
+ cloudnetpy-1.78.4.dist-info/RECORD,,