cloudnetpy 1.69.8__py3-none-any.whl → 1.69.10__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.
cloudnetpy/exceptions.py CHANGED
@@ -30,13 +30,6 @@ class PlottingError(CloudnetException):
30
30
  super().__init__(msg)
31
31
 
32
32
 
33
- class WeatherStationDataError(CloudnetException):
34
- """Internal exception class."""
35
-
36
- def __init__(self, msg: str = "Unable to read the file"):
37
- super().__init__(msg)
38
-
39
-
40
33
  class ModelDataError(CloudnetException):
41
34
  """Internal exception class."""
42
35
 
@@ -4,6 +4,7 @@ from os import PathLike
4
4
  from typing import Any
5
5
 
6
6
  import numpy as np
7
+ from numpy import ma
7
8
 
8
9
  from cloudnetpy import output
9
10
  from cloudnetpy.cloudnetarray import CloudnetArray
@@ -107,6 +108,7 @@ def thies2nc(
107
108
  raise DisdrometerDataError(msg) from err
108
109
  disdrometer.sort_timestamps()
109
110
  disdrometer.remove_duplicate_timestamps()
111
+ disdrometer.mask_invalid_values()
110
112
  disdrometer.add_meta()
111
113
  disdrometer.convert_units()
112
114
  attributes = output.add_time_attribute(ATTRIBUTES, disdrometer.date)
@@ -269,6 +271,12 @@ class Thies(Disdrometer):
269
271
  for key in self.raw_data:
270
272
  self.raw_data[key] = self.raw_data[key][valid_mask]
271
273
 
274
+ def mask_invalid_values(self) -> None:
275
+ rainfall_rate = self.data["rainfall_rate"]
276
+ rainfall_rate.data = ma.masked_where(
277
+ rainfall_rate.data > 999, rainfall_rate.data
278
+ )
279
+
272
280
  def _create_velocity_vectors(self) -> None:
273
281
  n_values = [5, 6, 7, 1, 1]
274
282
  spreads = [0.2, 0.4, 0.8, 1, 10]
@@ -31,7 +31,6 @@ def rain_e_h32nc(
31
31
  UUID of the generated file.
32
32
 
33
33
  Raises:
34
- WeatherStationDataError : Unable to read the file.
35
34
  ValidTimeStampError: No valid timestamps found.
36
35
  """
37
36
  rain = RainEH3(site_meta)
@@ -10,7 +10,7 @@ from cloudnetpy import output
10
10
  from cloudnetpy.categorize import atmos_utils
11
11
  from cloudnetpy.cloudnetarray import CloudnetArray
12
12
  from cloudnetpy.constants import HPA_TO_PA, MM_H_TO_M_S, SEC_IN_HOUR
13
- from cloudnetpy.exceptions import ValidTimeStampError, WeatherStationDataError
13
+ from cloudnetpy.exceptions import ValidTimeStampError
14
14
  from cloudnetpy.instruments import instruments
15
15
  from cloudnetpy.instruments.cloudnet_instrument import CSVFile
16
16
  from cloudnetpy.instruments.toa5 import read_toa5
@@ -38,48 +38,44 @@ def ws2nc(
38
38
  UUID of the generated file.
39
39
 
40
40
  Raises:
41
- WeatherStationDataError : Unable to read the file.
42
41
  ValidTimeStampError: No valid timestamps found.
43
42
  """
44
43
  if not isinstance(weather_station_file, list):
45
44
  weather_station_file = [weather_station_file]
46
- try:
47
- ws: WS
48
- if site_meta["name"] == "Palaiseau":
49
- ws = PalaiseauWS(weather_station_file, site_meta)
50
- elif site_meta["name"] == "Bucharest":
51
- ws = BucharestWS(weather_station_file, site_meta)
52
- elif site_meta["name"] == "Granada":
53
- ws = GranadaWS(weather_station_file, site_meta)
54
- elif site_meta["name"] == "Kenttärova":
55
- ws = KenttarovaWS(weather_station_file, site_meta)
56
- elif site_meta["name"] == "Hyytiälä":
57
- ws = HyytialaWS(weather_station_file, site_meta)
58
- elif site_meta["name"] == "Galați":
59
- ws = GalatiWS(weather_station_file, site_meta)
60
- elif site_meta["name"] == "Jülich":
61
- ws = JuelichWS(weather_station_file, site_meta)
62
- elif site_meta["name"] == "Lampedusa":
63
- ws = LampedusaWS(weather_station_file, site_meta)
64
- else:
65
- msg = "Unsupported site"
66
- raise ValueError(msg) # noqa: TRY301
67
- if date is not None:
68
- ws.screen_timestamps(date)
69
- ws.convert_time()
70
- ws.add_date()
71
- ws.add_site_geolocation()
72
- ws.add_data()
73
- ws.convert_temperature_and_humidity()
74
- ws.convert_pressure()
75
- ws.convert_rainfall_rate()
76
- ws.convert_rainfall_amount()
77
- ws.normalize_rainfall_amount()
78
- ws.calculate_rainfall_amount()
79
- attributes = output.add_time_attribute({}, ws.date)
80
- output.update_attributes(ws.data, attributes)
81
- except ValueError as err:
82
- raise WeatherStationDataError from err
45
+ ws: WS
46
+ if site_meta["name"] == "Palaiseau":
47
+ ws = PalaiseauWS(weather_station_file, site_meta)
48
+ elif site_meta["name"] == "Bucharest":
49
+ ws = BucharestWS(weather_station_file, site_meta)
50
+ elif site_meta["name"] == "Granada":
51
+ ws = GranadaWS(weather_station_file, site_meta)
52
+ elif site_meta["name"] == "Kenttärova":
53
+ ws = KenttarovaWS(weather_station_file, site_meta)
54
+ elif site_meta["name"] == "Hyytiälä":
55
+ ws = HyytialaWS(weather_station_file, site_meta)
56
+ elif site_meta["name"] == "Galați":
57
+ ws = GalatiWS(weather_station_file, site_meta)
58
+ elif site_meta["name"] == "Jülich":
59
+ ws = JuelichWS(weather_station_file, site_meta)
60
+ elif site_meta["name"] == "Lampedusa":
61
+ ws = LampedusaWS(weather_station_file, site_meta)
62
+ else:
63
+ msg = "Unsupported site"
64
+ raise ValueError(msg)
65
+ if date is not None:
66
+ ws.screen_timestamps(date)
67
+ ws.convert_time()
68
+ ws.add_date()
69
+ ws.add_site_geolocation()
70
+ ws.add_data()
71
+ ws.convert_temperature_and_humidity()
72
+ ws.convert_pressure()
73
+ ws.convert_rainfall_rate()
74
+ ws.convert_rainfall_amount()
75
+ ws.normalize_rainfall_amount()
76
+ ws.calculate_rainfall_amount()
77
+ attributes = output.add_time_attribute({}, ws.date)
78
+ output.update_attributes(ws.data, attributes)
83
79
  return output.save_level1b(ws, output_file, uuid)
84
80
 
85
81
 
@@ -520,14 +516,15 @@ class LampedusaWS(WS):
520
516
  raw_data: dict = {key: [] for key in fields}
521
517
  for row in reader:
522
518
  for key, value in row.items():
519
+ fixed_value = value.strip("\0")
523
520
  parsed_value: float | datetime.datetime
524
521
  if key == "time":
525
522
  parsed_value = datetime.datetime.strptime(
526
- value, "%y%m%d %H%M%S"
523
+ fixed_value, "%y%m%d %H%M%S"
527
524
  )
528
525
  else:
529
526
  try:
530
- parsed_value = float(value)
527
+ parsed_value = float(fixed_value)
531
528
  except ValueError:
532
529
  parsed_value = math.nan
533
530
  raw_data[key].append(parsed_value)
cloudnetpy/version.py CHANGED
@@ -1,4 +1,4 @@
1
1
  MAJOR = 1
2
2
  MINOR = 69
3
- PATCH = 8
3
+ PATCH = 10
4
4
  __version__ = f"{MAJOR}.{MINOR}.{PATCH}"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: cloudnetpy
3
- Version: 1.69.8
3
+ Version: 1.69.10
4
4
  Summary: Python package for Cloudnet processing
5
5
  Author: Simo Tukiainen
6
6
  License: MIT License
@@ -4,12 +4,12 @@ cloudnetpy/cloudnetarray.py,sha256=Ol1ha4RPAmFZANL__U5CaMKX4oYMXYR6OnjoCZ9w3eo,7
4
4
  cloudnetpy/concat_lib.py,sha256=jcLppqAmVHVkykcXBcpwUr8MS_k8v2Xl2xBLmVRE_DI,12624
5
5
  cloudnetpy/constants.py,sha256=jjW1eO5BwmLjtCKXKGXtKF_BoKpvSNrRfpgW43fWT_0,824
6
6
  cloudnetpy/datasource.py,sha256=FcWS77jz56gIzwnbafDLdj-HjAyu0P_VtY7gkeVZThU,7952
7
- cloudnetpy/exceptions.py,sha256=ns48useL9RN3mPh7CqIiLA19VI9OmVbyRsKTkwbThF8,1760
7
+ cloudnetpy/exceptions.py,sha256=hYbUtBwjCIfxnPe_5mELDEw87AWITBrwuo7WYIEKmJ8,1579
8
8
  cloudnetpy/metadata.py,sha256=BDEpgwZ58PHznc1gi11gtNNV4kFiMAmlHnF4huTy7nw,5982
9
9
  cloudnetpy/output.py,sha256=lq4YSeMT_d-j4rlQkKm9KIZ8boupTBBBKV1eUawpmCI,15672
10
10
  cloudnetpy/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  cloudnetpy/utils.py,sha256=U0iMIKPiKLrLVAfs_u9pPuoWYW1RJHcM8dbLF9a4yIA,29796
12
- cloudnetpy/version.py,sha256=oaJd6xYmjdmgsgXNLrMDy5RnVEklJFG2LJx1HtW5UnE,72
12
+ cloudnetpy/version.py,sha256=ShflVzzkFEWEAw_-lUTsVpopYYHwblHCZzQCIFcUW50,73
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
@@ -50,16 +50,16 @@ cloudnetpy/instruments/nc_lidar.py,sha256=5gQG9PApnNPrHmS9_zanl8HEYIQuGRpbnzC3wf
50
50
  cloudnetpy/instruments/nc_radar.py,sha256=QAkiLo3Z-OY6udOxS9O3xWseR_pkd7B82J0JUvPBO4E,7335
51
51
  cloudnetpy/instruments/pollyxt.py,sha256=ra7sYQ_cmkC0T9TBYrMN6iiQEZimmWGdW9Ilv61JB-Q,10027
52
52
  cloudnetpy/instruments/radiometrics.py,sha256=ySG4a042XkgjMTG8d20oAPNvFvw9bMwwiqS3zv-JF_w,11825
53
- cloudnetpy/instruments/rain_e_h3.py,sha256=IY-ytMjQUV94qMQgIXMJsPXe6oF3yk-d9LIbN19ogv0,5376
53
+ cloudnetpy/instruments/rain_e_h3.py,sha256=9TdpP4UzMBNIt2iE2GL6K9dFldzTHPLOrU8Q3tcosCU,5317
54
54
  cloudnetpy/instruments/rpg.py,sha256=vfs_eGahPOxFjOIBczNywRwtdutOsJpSNeXZm99SIOo,17438
55
55
  cloudnetpy/instruments/rpg_reader.py,sha256=ThztFuVrWxhmWVAfZTfQDeUiKK1XMTbtv08IBe8GK98,11364
56
56
  cloudnetpy/instruments/toa5.py,sha256=CfmmBMv5iMGaWHIGBK01Rw24cuXC1R1RMNTXkmsm340,1760
57
57
  cloudnetpy/instruments/vaisala.py,sha256=MA6hAlanFrxJlF4suDxLt5FyjcSSzJg-SWRnkLQpu3E,14688
58
- cloudnetpy/instruments/weather_station.py,sha256=3xClMqo4SV361flX7YM9psEKgF9gr8RHiAN0DKfJ0Kg,20623
58
+ cloudnetpy/instruments/weather_station.py,sha256=pg5Rf6A0qkbAYV1NvC1-oQLkwe9-gmLxHJ8CYW7xgYI,20365
59
59
  cloudnetpy/instruments/disdrometer/__init__.py,sha256=lyjwttWvFvuwYxEkusoAvgRcbBmglmOp5HJOpXUqLWo,93
60
60
  cloudnetpy/instruments/disdrometer/common.py,sha256=g52iK2aNp3Z88kovUmGVpC54NZomPa9D871gzO0AmQ4,9267
61
61
  cloudnetpy/instruments/disdrometer/parsivel.py,sha256=HJZrEysQkx9MiIVPDV25CYHpXi_SjgZlgO-otoaKK34,25640
62
- cloudnetpy/instruments/disdrometer/thies.py,sha256=xePvkLdQbptPDe8yZHCHoYblVg4FDbhtH7AE32lEkcE,10676
62
+ cloudnetpy/instruments/disdrometer/thies.py,sha256=4T15XW5Hu0SviL_a_PWieIWkZzaVJY92Qm7psSa1kPU,10943
63
63
  cloudnetpy/model_evaluation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
64
64
  cloudnetpy/model_evaluation/file_handler.py,sha256=jnpTxwxLSZdt08By0cjFDmq1KWC4fhJaN_MfjgA8ijQ,6440
65
65
  cloudnetpy/model_evaluation/metadata.py,sha256=PAsnOqcUoV3CJwplgWiVCF9Zt4io8tqj7CIgS4fEL-8,8412
@@ -116,9 +116,9 @@ cloudnetpy/products/mie_lu_tables.nc,sha256=It4fYpqJXlqOgL8jeZ-PxGzP08PMrELIDVe5
116
116
  cloudnetpy/products/mwr_tools.py,sha256=rd7UC67O4fsIE5SaHVZ4qWvUJTj41ZGwgQWPwZzOM14,5377
117
117
  cloudnetpy/products/product_tools.py,sha256=uu4l6reuGbPcW3TgttbaSrqIKbyYGhBVTdnC7opKvmg,11101
118
118
  docs/source/conf.py,sha256=IKiFWw6xhUd8NrCg0q7l596Ck1d61XWeVjIFHVSG9Og,1490
119
- cloudnetpy-1.69.8.dist-info/LICENSE,sha256=wcZF72bdaoG9XugpyE95Juo7lBQOwLuTKBOhhtANZMM,1094
120
- cloudnetpy-1.69.8.dist-info/METADATA,sha256=jNccVHKF97dDMCivFHqVVmoHQ0MQ2yU9ZnR6kz-Tfts,5844
121
- cloudnetpy-1.69.8.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
122
- cloudnetpy-1.69.8.dist-info/entry_points.txt,sha256=HhY7LwCFk4qFgDlXx_Fy983ZTd831WlhtdPIzV-Y3dY,51
123
- cloudnetpy-1.69.8.dist-info/top_level.txt,sha256=ibSPWRr6ojS1i11rtBFz2_gkIe68mggj7aeswYfaOo0,16
124
- cloudnetpy-1.69.8.dist-info/RECORD,,
119
+ cloudnetpy-1.69.10.dist-info/LICENSE,sha256=wcZF72bdaoG9XugpyE95Juo7lBQOwLuTKBOhhtANZMM,1094
120
+ cloudnetpy-1.69.10.dist-info/METADATA,sha256=YyapSHk3ZusG0R2vSX6ReLXM5kE57ivobvAdX9c6Ykc,5845
121
+ cloudnetpy-1.69.10.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
122
+ cloudnetpy-1.69.10.dist-info/entry_points.txt,sha256=HhY7LwCFk4qFgDlXx_Fy983ZTd831WlhtdPIzV-Y3dY,51
123
+ cloudnetpy-1.69.10.dist-info/top_level.txt,sha256=ibSPWRr6ojS1i11rtBFz2_gkIe68mggj7aeswYfaOo0,16
124
+ cloudnetpy-1.69.10.dist-info/RECORD,,