cloudnetpy 1.69.7__py3-none-any.whl → 1.69.9__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
 
@@ -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,46 +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
- else:
63
- msg = "Unsupported site"
64
- raise ValueError(msg) # noqa: TRY301
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)
79
- except ValueError as err:
80
- 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)
81
79
  return output.save_level1b(ws, output_file, uuid)
82
80
 
83
81
 
@@ -486,3 +484,58 @@ class JuelichWS(WS):
486
484
  data[keymap[key]].append(parsed)
487
485
 
488
486
  return self.format_data(data)
487
+
488
+
489
+ class LampedusaWS(WS):
490
+ """Read Lampedusa weather station data in ICOS format."""
491
+
492
+ def __init__(self, filenames: list[str], site_meta: dict):
493
+ super().__init__(site_meta)
494
+ self.filename = filenames[0]
495
+ self._data = self._read_data()
496
+
497
+ def _read_data(self) -> dict:
498
+ with open(self.filename, newline="") as f:
499
+ fields = [
500
+ "time",
501
+ "str1",
502
+ "str2",
503
+ "T",
504
+ "RH",
505
+ "Td",
506
+ "P",
507
+ "WSi",
508
+ "WDi",
509
+ "WS10m",
510
+ "WD10m",
511
+ "rain1m",
512
+ "rain2h",
513
+ "empty",
514
+ ]
515
+ reader = csv.DictReader(f, fieldnames=fields)
516
+ raw_data: dict = {key: [] for key in fields}
517
+ for row in reader:
518
+ for key, value in row.items():
519
+ fixed_value = value.strip("\0")
520
+ parsed_value: float | datetime.datetime
521
+ if key == "time":
522
+ parsed_value = datetime.datetime.strptime(
523
+ fixed_value, "%y%m%d %H%M%S"
524
+ )
525
+ else:
526
+ try:
527
+ parsed_value = float(fixed_value)
528
+ except ValueError:
529
+ parsed_value = math.nan
530
+ raw_data[key].append(parsed_value)
531
+
532
+ data = {
533
+ "time": raw_data["time"],
534
+ "air_temperature": raw_data["T"],
535
+ "relative_humidity": raw_data["RH"],
536
+ "air_pressure": raw_data["P"],
537
+ "wind_speed": raw_data["WSi"],
538
+ "wind_direction": raw_data["WDi"],
539
+ "rainfall_rate": raw_data["rain1m"],
540
+ }
541
+ return self.format_data(data)
cloudnetpy/version.py CHANGED
@@ -1,4 +1,4 @@
1
1
  MAJOR = 1
2
2
  MINOR = 69
3
- PATCH = 7
3
+ PATCH = 9
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.7
3
+ Version: 1.69.9
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=-IUZQr92Bl3iPgWnQnSY2olTzqzFU3_hYW-0u9a634A,72
12
+ cloudnetpy/version.py,sha256=4otwtr1gsJbl5oNuU68pG4SHC-_8LxrwJTRyk4U7cXo,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
@@ -50,12 +50,12 @@ 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=jSu9sY2LYV1ssWcuLr6kiF8EEqGW29mywE9UUZccac0,18720
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
@@ -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.7.dist-info/LICENSE,sha256=wcZF72bdaoG9XugpyE95Juo7lBQOwLuTKBOhhtANZMM,1094
120
- cloudnetpy-1.69.7.dist-info/METADATA,sha256=lvWiTkHIS1gOzawCKFtGwU-jUuyWyEN59T-s_TuRaNg,5844
121
- cloudnetpy-1.69.7.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
122
- cloudnetpy-1.69.7.dist-info/entry_points.txt,sha256=HhY7LwCFk4qFgDlXx_Fy983ZTd831WlhtdPIzV-Y3dY,51
123
- cloudnetpy-1.69.7.dist-info/top_level.txt,sha256=ibSPWRr6ojS1i11rtBFz2_gkIe68mggj7aeswYfaOo0,16
124
- cloudnetpy-1.69.7.dist-info/RECORD,,
119
+ cloudnetpy-1.69.9.dist-info/LICENSE,sha256=wcZF72bdaoG9XugpyE95Juo7lBQOwLuTKBOhhtANZMM,1094
120
+ cloudnetpy-1.69.9.dist-info/METADATA,sha256=P_X-ceqpTa3ccAtDAH26gUoA-cZt21HcSCKG3UZ3mCo,5844
121
+ cloudnetpy-1.69.9.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
122
+ cloudnetpy-1.69.9.dist-info/entry_points.txt,sha256=HhY7LwCFk4qFgDlXx_Fy983ZTd831WlhtdPIzV-Y3dY,51
123
+ cloudnetpy-1.69.9.dist-info/top_level.txt,sha256=ibSPWRr6ojS1i11rtBFz2_gkIe68mggj7aeswYfaOo0,16
124
+ cloudnetpy-1.69.9.dist-info/RECORD,,