cloudnetpy 1.73.2__py3-none-any.whl → 1.74.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.
@@ -166,6 +166,7 @@ def generate_categorize(
166
166
  except DisdrometerDataError as err:
167
167
  logging.warning("Unable to use disdrometer: %s", err)
168
168
  time, height = _define_dense_grid()
169
+ data.radar.add_location(time)
169
170
  valid_ind = _interpolate_to_cloudnet_grid()
170
171
  if len(valid_ind) < 2:
171
172
  msg = "Less than 2 overlapping radar, lidar and model timestamps found"
@@ -316,11 +316,25 @@ class Radar(DataSource):
316
316
 
317
317
  def add_meta(self) -> None:
318
318
  """Copies misc. metadata from the input file."""
319
- for key in ("latitude", "longitude", "altitude"):
320
- self.append_data(np.array(self.getvar(key)), key)
321
319
  for key in ("time", "height", "radar_frequency"):
322
320
  self.append_data(np.array(getattr(self, key)), key)
323
321
 
322
+ def add_location(self, time_new: np.ndarray):
323
+ """Add latitude, longitude and altitude from nearest timestamp."""
324
+ idx = np.searchsorted(self.time, time_new)
325
+ idx_left = np.clip(idx - 1, 0, len(self.time) - 1)
326
+ idx_right = np.clip(idx, 0, len(self.time) - 1)
327
+ diff_left = np.abs(time_new - self.time[idx_left])
328
+ diff_right = np.abs(time_new - self.time[idx_right])
329
+ idx_closest = np.where(diff_left < diff_right, idx_left, idx_right)
330
+ for key in ("latitude", "longitude", "altitude"):
331
+ data = self.getvar(key)
332
+ if not utils.isscalar(data):
333
+ data = data[idx_closest]
334
+ if not np.any(ma.getmaskarray(data)):
335
+ data = np.array(data)
336
+ self.append_data(data, key)
337
+
324
338
  def _init_data(self) -> None:
325
339
  self.append_data(self.getvar("Zh"), "Z", units="dBZ")
326
340
  for key in ("v", "ldr", "width", "sldr", "rainfall_rate"):
cloudnetpy/version.py CHANGED
@@ -1,4 +1,4 @@
1
1
  MAJOR = 1
2
- MINOR = 73
3
- PATCH = 2
2
+ MINOR = 74
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.73.2
3
+ Version: 1.74.0
4
4
  Summary: Python package for Cloudnet processing
5
5
  Author: Simo Tukiainen
6
6
  License: MIT License
@@ -9,11 +9,11 @@ cloudnetpy/metadata.py,sha256=lO7BCbVAzFoH3Nq-VuezYX0f7MnbG1Zp11g5GSiuQwM,6189
9
9
  cloudnetpy/output.py,sha256=l0LoOhcGCBrg2EJ4NT1xZ7-UKWdV7X7yQ0fJmhkwJVc,15829
10
10
  cloudnetpy/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  cloudnetpy/utils.py,sha256=ui6sq8g1HlgfOQO644iNHsRGqpDwS3q-5uGR2y2tOAk,33325
12
- cloudnetpy/version.py,sha256=O-ZDKRFC3Nc0B4ktZmifX0cT6SR1S3t5k0zOx1eDVn0,72
12
+ cloudnetpy/version.py,sha256=NyE8VYDVST3jInl97hnM5B9JXFGdkILThRQ42YmU1wA,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
16
- cloudnetpy/categorize/categorize.py,sha256=HtttmUlnLE4Cw3QLdz-DRfRpd8sVr_Tp4A62XI67x24,20739
16
+ cloudnetpy/categorize/categorize.py,sha256=PzkgQ63MtEHlz_0govFkoM6F41OKgQLsxDh7GLQHyrs,20777
17
17
  cloudnetpy/categorize/classify.py,sha256=qovHgHsMku5kpl3cJxKteNBsG8GAkfI3Zo8QhJwZSFQ,8512
18
18
  cloudnetpy/categorize/containers.py,sha256=evqVQOoUycBtaFeKpms7_NuM9z8jKWq37nLIhoDxa8k,5278
19
19
  cloudnetpy/categorize/disdrometer.py,sha256=sRSt2B932lrrkvycKoSaKEIaDVfq9Z7uU-4iHRr-fC0,1893
@@ -26,7 +26,7 @@ cloudnetpy/categorize/lidar.py,sha256=YQrM_LOz8NQrrD9l9HyujV1GSGwkQ8LMqXN13bEJRW
26
26
  cloudnetpy/categorize/melting.py,sha256=ZnLeL_qWmiCdjXVOm9iBYHdo29Brqxu_DEErZPqUloQ,6217
27
27
  cloudnetpy/categorize/model.py,sha256=QFRCY0TvM2fzGRyP8BNkqbvu13XcQjt7TsN5fhjI_Uc,6654
28
28
  cloudnetpy/categorize/mwr.py,sha256=F7cquERWL6mBkgboqeaCIPf9gOlKI-NWUQIBdQXGT_I,1635
29
- cloudnetpy/categorize/radar.py,sha256=0Wg5u2aLXRVhHiFiXb4fSqY_iGgSwcCMMVshM3wBoo0,14149
29
+ cloudnetpy/categorize/radar.py,sha256=PmriTnrHbgZrau1RTNKpPI_-h5Uu0kGIMrMOaoMuROY,14821
30
30
  cloudnetpy/categorize/attenuations/__init__.py,sha256=CWFHVWeTIe2hrZtgkJaX2HGftbuffsFc39Mzv5B0Lw0,1037
31
31
  cloudnetpy/categorize/attenuations/gas_attenuation.py,sha256=emr-RCxQT0i2N8k6eBNhRsmsCBPHJzQsWJfjC4fVSTo,975
32
32
  cloudnetpy/categorize/attenuations/liquid_attenuation.py,sha256=0p0G79BPkw1itCXHMwbvkNHtJGBocJzow3gNHAirChI,3036
@@ -116,10 +116,10 @@ cloudnetpy/products/lwc.py,sha256=sl6Al2tuH3KkCBrPbWTmuz3jlD5UQJ4D6qBsn1tt2CQ,18
116
116
  cloudnetpy/products/mie_lu_tables.nc,sha256=It4fYpqJXlqOgL8jeZ-PxGzP08PMrELIDVe55y9ob58,16637951
117
117
  cloudnetpy/products/mwr_tools.py,sha256=1SRaQRW6-1svfnUk25sMyWXSwRJ1fg7v48TsMENZQpg,5103
118
118
  cloudnetpy/products/product_tools.py,sha256=uu4l6reuGbPcW3TgttbaSrqIKbyYGhBVTdnC7opKvmg,11101
119
- cloudnetpy-1.73.2.dist-info/licenses/LICENSE,sha256=wcZF72bdaoG9XugpyE95Juo7lBQOwLuTKBOhhtANZMM,1094
119
+ cloudnetpy-1.74.0.dist-info/licenses/LICENSE,sha256=wcZF72bdaoG9XugpyE95Juo7lBQOwLuTKBOhhtANZMM,1094
120
120
  docs/source/conf.py,sha256=IKiFWw6xhUd8NrCg0q7l596Ck1d61XWeVjIFHVSG9Og,1490
121
- cloudnetpy-1.73.2.dist-info/METADATA,sha256=ItQhmTus3k9nHgZhlkFBsWf3hD2qE6MI2esFpjYAS9o,5796
122
- cloudnetpy-1.73.2.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
123
- cloudnetpy-1.73.2.dist-info/entry_points.txt,sha256=HhY7LwCFk4qFgDlXx_Fy983ZTd831WlhtdPIzV-Y3dY,51
124
- cloudnetpy-1.73.2.dist-info/top_level.txt,sha256=ibSPWRr6ojS1i11rtBFz2_gkIe68mggj7aeswYfaOo0,16
125
- cloudnetpy-1.73.2.dist-info/RECORD,,
121
+ cloudnetpy-1.74.0.dist-info/METADATA,sha256=YopNoTclJY-YXuOMqKereaBmfE4KyID0PAwfmzs_wMU,5796
122
+ cloudnetpy-1.74.0.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
123
+ cloudnetpy-1.74.0.dist-info/entry_points.txt,sha256=HhY7LwCFk4qFgDlXx_Fy983ZTd831WlhtdPIzV-Y3dY,51
124
+ cloudnetpy-1.74.0.dist-info/top_level.txt,sha256=ibSPWRr6ojS1i11rtBFz2_gkIe68mggj7aeswYfaOo0,16
125
+ cloudnetpy-1.74.0.dist-info/RECORD,,