cloudnetpy 1.61.9__py3-none-any.whl → 1.61.11__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.
@@ -8,6 +8,7 @@ from numpy import ma
8
8
  from cloudnetpy import output
9
9
  from cloudnetpy.categorize import atmos_utils
10
10
  from cloudnetpy.cloudnetarray import CloudnetArray
11
+ from cloudnetpy.constants import SEC_IN_HOUR
11
12
  from cloudnetpy.exceptions import ValidTimeStampError, WeatherStationDataError
12
13
  from cloudnetpy.instruments import instruments
13
14
  from cloudnetpy.instruments.cloudnet_instrument import CloudnetInstrument
@@ -60,6 +61,7 @@ def ws2nc(
60
61
  ws.add_site_geolocation()
61
62
  ws.add_data()
62
63
  ws.convert_units()
64
+ ws.calculate_rainfall_amount()
63
65
  attributes = output.add_time_attribute(ATTRIBUTES, ws.date)
64
66
  output.update_attributes(ws.data, attributes)
65
67
  except ValueError as err:
@@ -85,6 +87,13 @@ class WS(CloudnetInstrument):
85
87
  def convert_units(self) -> None:
86
88
  pass
87
89
 
90
+ def calculate_rainfall_amount(self) -> None:
91
+ if "rainfall_amount" in self.data:
92
+ return
93
+ resolution = np.median(np.diff(self.data["time"].data)) * SEC_IN_HOUR
94
+ rainfall_amount = ma.cumsum(self.data["rainfall_rate"].data * resolution)
95
+ self.data["rainfall_amount"] = CloudnetArray(rainfall_amount, "rainfall_amount")
96
+
88
97
 
89
98
  class PalaiseauWS(WS):
90
99
  def __init__(self, filenames: list[str], site_meta: dict):
@@ -256,9 +265,6 @@ class GranadaWS(WS):
256
265
  for key, value in self._data.items():
257
266
  parsed = datetime2decimal_hours(value) if key == "time" else np.array(value)
258
267
  self.data[key] = CloudnetArray(parsed, key)
259
- self.data["rainfall_amount"] = CloudnetArray(
260
- np.cumsum(self._data["rainfall_rate"]), "rainfall_amount"
261
- )
262
268
 
263
269
  def convert_units(self) -> None:
264
270
  temperature_kelvins = atmos_utils.c2k(self.data["air_temperature"][:])
@@ -267,9 +273,6 @@ class GranadaWS(WS):
267
273
  self.data["air_pressure"].data = self.data["air_pressure"][:] * 100 # hPa -> Pa
268
274
  rainfall_rate = self.data["rainfall_rate"][:]
269
275
  self.data["rainfall_rate"].data = rainfall_rate / 60 / 1000 # mm/min -> m/s
270
- self.data["rainfall_amount"].data = (
271
- self.data["rainfall_amount"][:] / 1000
272
- ) # mm -> m
273
276
 
274
277
 
275
278
  class KenttarovaWS(WS):
@@ -344,9 +347,6 @@ class KenttarovaWS(WS):
344
347
  for key, value in self._data.items():
345
348
  parsed = datetime2decimal_hours(value) if key == "time" else ma.array(value)
346
349
  self.data[key] = CloudnetArray(parsed, key)
347
- self.data["rainfall_amount"] = CloudnetArray(
348
- ma.cumsum(self._data["rainfall_rate"]), "rainfall_amount"
349
- )
350
350
 
351
351
  def convert_units(self) -> None:
352
352
  temperature_kelvins = atmos_utils.c2k(self.data["air_temperature"][:])
@@ -354,10 +354,9 @@ class KenttarovaWS(WS):
354
354
  self.data["relative_humidity"].data = self.data["relative_humidity"][:] / 100
355
355
  self.data["air_pressure"].data = self.data["air_pressure"][:] * 100 # hPa -> Pa
356
356
  rainfall_rate = self.data["rainfall_rate"][:]
357
- self.data["rainfall_rate"].data = rainfall_rate / 60 / 1000 # mm/min -> m/s
358
- self.data["rainfall_amount"].data = (
359
- self.data["rainfall_amount"][:] / 1000
360
- ) # mm -> m
357
+ self.data["rainfall_rate"].data = (
358
+ rainfall_rate / 3600 / 10 / 1000
359
+ ) # not sure about units
361
360
 
362
361
 
363
362
  ATTRIBUTES = {
cloudnetpy/output.py CHANGED
@@ -117,9 +117,10 @@ def save_product_file(
117
117
 
118
118
  def get_l1b_source(instrument: Instrument) -> str:
119
119
  """Returns level 1b file source."""
120
- return " ".join(
120
+ parts = [
121
121
  item for item in [instrument.manufacturer, instrument.model] if item is not None
122
- )
122
+ ]
123
+ return " ".join(parts) if parts else instrument.category.capitalize()
123
124
 
124
125
 
125
126
  def get_l1b_history(instrument: Instrument) -> str:
cloudnetpy/version.py CHANGED
@@ -1,4 +1,4 @@
1
1
  MAJOR = 1
2
2
  MINOR = 61
3
- PATCH = 9
3
+ PATCH = 11
4
4
  __version__ = f"{MAJOR}.{MINOR}.{PATCH}"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cloudnetpy
3
- Version: 1.61.9
3
+ Version: 1.61.11
4
4
  Summary: Python package for Cloudnet processing
5
5
  Author: Simo Tukiainen
6
6
  License: MIT License
@@ -5,10 +5,10 @@ cloudnetpy/constants.py,sha256=l7_ohQgLEQ6XEG9AMBarTPKp9OM8B1ElJ6fSN0ScdmM,733
5
5
  cloudnetpy/datasource.py,sha256=CSiKQGVEX459tagRjLrww6hZMZcc3r1sR2WcaTKTTWo,7864
6
6
  cloudnetpy/exceptions.py,sha256=wrI0bZTwmS5C_cqOmvlJ8XJSEFyzuD1eD4voGJc_Gjg,1584
7
7
  cloudnetpy/metadata.py,sha256=v_VDo2vbdTxB0zIsfP69IcrwSKiRlLpsGdq6JPI4CoA,5306
8
- cloudnetpy/output.py,sha256=WoVTNuxni0DUr163vZ-_mDr1brXhY15XSlGMrq9Aoqw,14700
8
+ cloudnetpy/output.py,sha256=UzF0w51c6-QEBj-NfCJg5zTIKVzcmq1HyQb-3_qWTgk,14767
9
9
  cloudnetpy/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  cloudnetpy/utils.py,sha256=-8x7LQ6WDHxf2lDZfhG50WYe2iSVLQObnVXZG46JzKI,28468
11
- cloudnetpy/version.py,sha256=jCiBK4tcMrQYXPVaBsEM_6y-SUJGsVWPfbgo81jYpFg,72
11
+ cloudnetpy/version.py,sha256=B3laILu3O0Nl0QccRB9qv-lhpfU5LAfqtgMUzrcUIHg,73
12
12
  cloudnetpy/categorize/__init__.py,sha256=gP5q3Vis1y9u9OWgA_idlbjfWXYN_S0IBSWdwBhL_uU,69
13
13
  cloudnetpy/categorize/atmos.py,sha256=fWW8ye_8HZASRAiYwURFKWzcGOYIA2RKeVxCq0lVOuM,12389
14
14
  cloudnetpy/categorize/atmos_utils.py,sha256=wndpwJxc2-QnNTkV8tc8I11Vs_WkNz9sVMX1fuGgUC4,3777
@@ -47,7 +47,7 @@ cloudnetpy/instruments/rpg.py,sha256=yQpcKcgzRvVvkl6NhKvo4PUkv9nZ69_hzzPpS2Ei-Is
47
47
  cloudnetpy/instruments/rpg_reader.py,sha256=LAdXL3TmD5QzQbqtPOcemZji_qkXwmw6a6F8NmF6Zg8,11355
48
48
  cloudnetpy/instruments/toa5.py,sha256=1JnuYViD8c_tHJZ9lf4OU44iepEkXHsXOzDfVf_b0qc,1759
49
49
  cloudnetpy/instruments/vaisala.py,sha256=ektdXoID2X_V9H5Zp1fgHTUBapFMSyPVEWW_aoR6DEY,14655
50
- cloudnetpy/instruments/weather_station.py,sha256=76O3z1932Bidi_1tXHeVJmtoISOJFKB9vFVJnWJj4M0,13822
50
+ cloudnetpy/instruments/weather_station.py,sha256=R2b-VfCRkVluEbGd9NGuzf46k18X1BfZwJHhwWn_sVM,13801
51
51
  cloudnetpy/instruments/disdrometer/__init__.py,sha256=lyjwttWvFvuwYxEkusoAvgRcbBmglmOp5HJOpXUqLWo,93
52
52
  cloudnetpy/instruments/disdrometer/common.py,sha256=g52iK2aNp3Z88kovUmGVpC54NZomPa9D871gzO0AmQ4,9267
53
53
  cloudnetpy/instruments/disdrometer/parsivel.py,sha256=WiL-vCjw9Gmb5irvW3AXddsyprp8MGOfqcVAlfy0zpc,25521
@@ -108,8 +108,8 @@ cloudnetpy/products/mie_lu_tables.nc,sha256=It4fYpqJXlqOgL8jeZ-PxGzP08PMrELIDVe5
108
108
  cloudnetpy/products/mwr_tools.py,sha256=RuzokxxqXlTGk7XAOrif_FDPUJdf0j_wJgNq-7a_nK8,4684
109
109
  cloudnetpy/products/product_tools.py,sha256=rhx_Ru9FLlQqCNM-awoiHx18-Aq1eBwL9LiUaQoJs6k,10412
110
110
  docs/source/conf.py,sha256=IKiFWw6xhUd8NrCg0q7l596Ck1d61XWeVjIFHVSG9Og,1490
111
- cloudnetpy-1.61.9.dist-info/LICENSE,sha256=wcZF72bdaoG9XugpyE95Juo7lBQOwLuTKBOhhtANZMM,1094
112
- cloudnetpy-1.61.9.dist-info/METADATA,sha256=-rbU3tJCXKfgY_2BcIqFh0Ryw9R7rHXhURpuPabJXLQ,5784
113
- cloudnetpy-1.61.9.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
114
- cloudnetpy-1.61.9.dist-info/top_level.txt,sha256=ibSPWRr6ojS1i11rtBFz2_gkIe68mggj7aeswYfaOo0,16
115
- cloudnetpy-1.61.9.dist-info/RECORD,,
111
+ cloudnetpy-1.61.11.dist-info/LICENSE,sha256=wcZF72bdaoG9XugpyE95Juo7lBQOwLuTKBOhhtANZMM,1094
112
+ cloudnetpy-1.61.11.dist-info/METADATA,sha256=MjuSUe-bVQa8CzRqFWeJBhqcbkcv5OkXSkM0srtkDpo,5785
113
+ cloudnetpy-1.61.11.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
114
+ cloudnetpy-1.61.11.dist-info/top_level.txt,sha256=ibSPWRr6ojS1i11rtBFz2_gkIe68mggj7aeswYfaOo0,16
115
+ cloudnetpy-1.61.11.dist-info/RECORD,,