doppy 0.2.3__cp310-abi3-win_amd64.whl → 0.3.0__cp310-abi3-win_amd64.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.

Potentially problematic release.


This version of doppy might be problematic. Click here for more details.

doppy/netcdf.py CHANGED
@@ -1,5 +1,7 @@
1
1
  from __future__ import annotations
2
2
 
3
+ import warnings
4
+ from types import TracebackType
3
5
  from typing import Literal, TypeAlias
4
6
 
5
7
  import netCDF4
@@ -13,14 +15,29 @@ class Dataset:
13
15
  def __init__(self, filename: str) -> None:
14
16
  self.nc = netCDF4.Dataset(filename, mode="w")
15
17
 
18
+ def __enter__(self) -> Dataset:
19
+ return self
20
+
21
+ def __exit__(
22
+ self,
23
+ exc_type: type[BaseException] | None,
24
+ exc_val: BaseException | None,
25
+ exc_tb: TracebackType | None,
26
+ ) -> None:
27
+ self.close()
28
+
16
29
  def add_dimension(self, dim: str) -> Dataset:
17
30
  self.nc.createDimension(dim, None)
18
31
  return self
19
32
 
20
- def add_atribute(self, key: str, val: str) -> Dataset:
33
+ def add_attribute(self, key: str, val: str) -> Dataset:
21
34
  setattr(self.nc, key, val)
22
35
  return self
23
36
 
37
+ def add_atribute(self, key: str, val: str) -> Dataset:
38
+ warnings.warn("Use add_attribute", DeprecationWarning, stacklevel=2)
39
+ return self.add_attribute(key, val)
40
+
24
41
  def add_time(
25
42
  self,
26
43
  name: str,
doppy/product/__init__.py CHANGED
@@ -1,5 +1,6 @@
1
1
  from doppy.product.stare import Stare
2
+ from doppy.product.stare_depol import StareDepol
2
3
  from doppy.product.wind import Options as WindOptions
3
4
  from doppy.product.wind import Wind
4
5
 
5
- __all__ = ["Stare", "Wind", "WindOptions"]
6
+ __all__ = ["Stare", "StareDepol", "Wind", "WindOptions"]
doppy/product/stare.py CHANGED
@@ -142,7 +142,7 @@ def _compute_beta(
142
142
  c
143
143
  speed of light
144
144
  B
145
- reveiver bandwidth
145
+ receiver bandwidth
146
146
 
147
147
  References
148
148
  ----------
@@ -560,7 +560,7 @@ def _select_raws_for_stare(
560
560
 
561
561
 
562
562
  def _selection_key(raw: doppy.raw.HaloHpl) -> SelectionGroupKeyType:
563
- return (raw.header.mergable_hash(),)
563
+ return (raw.header.mergeable_hash(),)
564
564
 
565
565
 
566
566
  def _time2bg_time(
@@ -0,0 +1,83 @@
1
+ import numpy as np
2
+ import numpy.typing as npt
3
+
4
+ from doppy.product.stare import Stare
5
+
6
+
7
+ class StareDepol:
8
+ """
9
+ Stare product with depolarisation ratio derived from co-polarised and
10
+ cross-polarised stare data.
11
+
12
+ Attributes:
13
+ -----------
14
+ time
15
+ An array of datetime64 objects representing the observation times.
16
+ radial_distance
17
+ An array of radial distances from the observation point, in meters.
18
+ elevation
19
+ An array of elevation angles corresponding to the observation points, in
20
+ degrees.
21
+ beta
22
+ An array of backscatter coefficients for the co-polarised signal, in
23
+ sr-1 m-1.
24
+ radial_velocity
25
+ An array of radial velocities of the co-polarised signal, in m s-1.
26
+ mask
27
+ A boolean array indicating signal (True) or noise (False) data points.
28
+ depolarisation
29
+ An array of depolarisation ratios calculated as the ratio of
30
+ co-polarised to cross-polarised backscatter coefficients.
31
+ wavelength
32
+ The wavelength of the lidar, in meters.
33
+ system_id
34
+ A string identifier for the lidar.
35
+
36
+ Raises
37
+ ------
38
+ ValueError
39
+ If the input `co` and `cross` products have mismatched wavelengths,
40
+ system IDs, radial distances, or elevation angles, this exception is
41
+ raised.
42
+ """
43
+
44
+ time: npt.NDArray[np.datetime64]
45
+ radial_distance: npt.NDArray[np.float64]
46
+ elevation: npt.NDArray[np.float64]
47
+ beta: npt.NDArray[np.float64]
48
+ radial_velocity: npt.NDArray[np.float64]
49
+ mask: npt.NDArray[np.bool_]
50
+ depolarisation: npt.NDArray[np.float64]
51
+ wavelength: float
52
+ system_id: str
53
+
54
+ def __init__(self, co: Stare, cross: Stare):
55
+ if co.wavelength != cross.wavelength:
56
+ raise ValueError(
57
+ "Different wavelength in co and cross: "
58
+ f"{co.wavelength} vs {cross.wavelength}"
59
+ )
60
+ if co.system_id != cross.system_id:
61
+ raise ValueError(
62
+ "Different system ID in co and cross: "
63
+ f"{co.system_id} vs {cross.system_id}"
64
+ )
65
+ if not np.allclose(co.radial_distance, cross.radial_distance):
66
+ raise ValueError("Different radial distance in co and cross")
67
+
68
+ time_ind = np.argmin(np.abs(co.time - cross.time[:, np.newaxis]), axis=0)
69
+ cross_elevation = cross.elevation[time_ind]
70
+ cross_beta = cross.beta[time_ind, :]
71
+
72
+ if not np.allclose(co.elevation, cross_elevation):
73
+ raise ValueError("Different elevation in co and cross")
74
+
75
+ self.time = co.time
76
+ self.radial_distance = co.radial_distance
77
+ self.elevation = co.elevation
78
+ self.beta = co.beta
79
+ self.radial_velocity = co.radial_velocity
80
+ self.mask = co.mask
81
+ self.depolarisation = cross_beta / co.beta
82
+ self.wavelength = co.wavelength
83
+ self.system_id = co.system_id
doppy/product/wind.py CHANGED
@@ -406,7 +406,7 @@ def _selection_key(raw: doppy.raw.HaloHpl) -> SelectionGroupKeyType:
406
406
  if len(raw.elevation_angles) != 1:
407
407
  raise ValueError("Expected only one elevation angle")
408
408
  return (
409
- raw.header.mergable_hash(),
409
+ raw.header.mergeable_hash(),
410
410
  next(iter(raw.elevation_angles)),
411
411
  tuple(sorted(raw.azimuth_angles)),
412
412
  )
doppy/raw/halo_hpl.py CHANGED
@@ -207,7 +207,7 @@ class HaloHplHeader:
207
207
  system_id: str
208
208
  instrument_spectral_width: float | None
209
209
 
210
- def mergable_hash(self) -> int:
210
+ def mergeable_hash(self) -> int:
211
211
  return hash(
212
212
  (
213
213
  self.gate_points,
@@ -81,7 +81,7 @@ def _from_src(data: BufferedIOBase) -> HaloSysParams:
81
81
  b = [r.split(b"\t") for r in a]
82
82
  arr = np.array(b)
83
83
  if arr.shape[1] != 7:
84
- raise ValueError("Unexpected data fromat")
84
+ raise ValueError("Unexpected data format")
85
85
 
86
86
  def timestr2datetime64_12H(datetime_bytes: bytes) -> np.datetime64:
87
87
  return datetime64(
doppy/rs.pyd CHANGED
Binary file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: doppy
3
- Version: 0.2.3
3
+ Version: 0.3.0
4
4
  Classifier: Development Status :: 4 - Beta
5
5
  Classifier: Programming Language :: Python :: 3
6
6
  Classifier: Programming Language :: Python :: 3.10
@@ -37,7 +37,7 @@ Project-URL: Repository, https://github.com/actris-cloudnet/doppy
37
37
  Project-URL: Changelog, https://github.com/actris-cloudnet/doppy/blob/main/CHANGELOG.md
38
38
  Project-URL: Bug Tracker, https://github.com/actris-cloudnet/doppy/issues
39
39
 
40
- # Doppy - Wind doppler lidar processing
40
+ # Doppy Doppler wind lidar processing
41
41
 
42
42
  [![CI](https://github.com/actris-cloudnet/doppy/actions/workflows/ci.yml/badge.svg)](https://github.com/actris-cloudnet/doppy/actions/workflows/ci.yml)
43
43
  [![PyPI version](https://badge.fury.io/py/doppy.svg)](https://badge.fury.io/py/doppy)
@@ -129,8 +129,8 @@ stare = doppy.product.Stare.from_halo_data(
129
129
  data=stare.wavelength,
130
130
  dtype="f4",
131
131
  )
132
- .add_atribute("serial_number", stare.system_id)
133
- .add_atribute("doppy_version", doppy.__version__)
132
+ .add_attribute("serial_number", stare.system_id)
133
+ .add_attribute("doppy_version", doppy.__version__)
134
134
  ).close()
135
135
 
136
136
  ```
@@ -1,8 +1,7 @@
1
- doppy-0.2.3.dist-info/METADATA,sha256=K2bCG_iuezFNxdkiO3No1sMSCvcrb1RgW-1hviAHHmQ,4239
2
- doppy-0.2.3.dist-info/WHEEL,sha256=q-xSG6XZRjDAnU09cWJDju_6rt60Z02Q6B2xMawZIOA,95
3
- doppy-0.2.3.dist-info/entry_points.txt,sha256=9b_Ca7vJoh6AwL3W8qAPh_UmJ_1Pa6hi-TDfCTDjvSk,43
4
- doppy-0.2.3.dist-info/license_files/LICENSE,sha256=RIAxFjJLTw0wQ3_SM73JoTeppoD99DJJ72cjvVuRrW4,1110
5
- doppy-0.2.3.dist-info/license_files/LICENSE,sha256=RIAxFjJLTw0wQ3_SM73JoTeppoD99DJJ72cjvVuRrW4,1110
1
+ doppy-0.3.0.dist-info/METADATA,sha256=Ev5A4AsPf6a-OyhbGFn5cqIK8XHRDmwYFMGg2mnHWEE,4243
2
+ doppy-0.3.0.dist-info/WHEEL,sha256=ooo3OLxJB34JFfOmPzfiM9QlB2wmB_Cl3_kcSm8NkLg,95
3
+ doppy-0.3.0.dist-info/entry_points.txt,sha256=9b_Ca7vJoh6AwL3W8qAPh_UmJ_1Pa6hi-TDfCTDjvSk,43
4
+ doppy-0.3.0.dist-info/license_files/LICENSE,sha256=RIAxFjJLTw0wQ3_SM73JoTeppoD99DJJ72cjvVuRrW4,1110
6
5
  doppy/bench.py,sha256=fLN2iS5mmoYH4qZjD80Vl1h9lp3C-KDfhj9fteWRPtM,260
7
6
  doppy/data/api.py,sha256=c3zbZI3IV7HnzhyFzJpUPOFT20eYFuQlJ5K_1ZEe1Pg,1921
8
7
  doppy/data/cache.py,sha256=VNPB3XsWGwY2bNXBs1r_sEWF4qBq_U7sJSlSmt1Rxm8,1033
@@ -10,20 +9,21 @@ doppy/data/exceptions.py,sha256=JOyekvUO-Ew4ZVezf3_IxZOrPN0IksfUILd8R2YcSts,95
10
9
  doppy/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
10
  doppy/defaults.py,sha256=nhxcZcFd2jyDVbq0azwtekEJEjiz8k21MZmXFlSXAjo,40
12
11
  doppy/exceptions.py,sha256=YNEyz4r0ObzZHZ9re83K3wZlR2CRI1GyhH0vvFGasgQ,148
13
- doppy/netcdf.py,sha256=UnuecY_yEijEDpsuOBCj3EGeWMXtyRIOlLAC1UVUVHY,3527
12
+ doppy/netcdf.py,sha256=VkWGleFKef3bkWf2_LfCdJnR1LORIFc51cXDRoRdHFo,4023
14
13
  doppy/options.py,sha256=uyIKM_G2GtbmV6Gve8o13eIShQqUwsnYZ41mhX2ypGE,218
15
- doppy/product/stare.py,sha256=hJPGujuMiOM424XtbCWWEdnD21zl9qg4dgZXnT-CDfk,20521
16
- doppy/product/wind.py,sha256=JT4DAwE1hl7NbE53mkZl4a-5RQb30IlydzfpDwkOoZM,13454
17
- doppy/product/__init__.py,sha256=kHVF77la8tzWKKpiM9eNWT-eAkAUd4uwb0wJFp62QLk,177
14
+ doppy/product/stare.py,sha256=sh2HuKEWa-gaWZCbjbozYFA0oRUZa4U3nG9FpgqtoKM,20522
15
+ doppy/product/stare_depol.py,sha256=rSi1nxC9VqiTse4xu4E733iJJUq9IC2EXKa_n3dIUWA,2980
16
+ doppy/product/wind.py,sha256=f52owv_pzfUDiMzLXv6IqHFWHWdLXmGUIgBCXjOhPnk,13455
17
+ doppy/product/__init__.py,sha256=xoBEXuhid-bvoof5Ogzpt1dKIhJgNMRyrAinCqUOUUI,241
18
18
  doppy/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
19
  doppy/raw/halo_bg.py,sha256=9K7E9smahGOqDIYnA-9m-Di3QsDY0PR2FH4Yd_oYiEY,4951
20
- doppy/raw/halo_hpl.py,sha256=OMVa6K8TqUnhwE5w3w_qy5Qi_Vg6S2lHwKEaIq5iGG0,19006
21
- doppy/raw/halo_sys_params.py,sha256=L3cFf1jATLMkVf2ViSbrmom-rZu7dn1Nq1J354xO98A,4041
20
+ doppy/raw/halo_hpl.py,sha256=VF8JQ_5N8adLsGNJOlhvKwz0LtNd4oCU76hETe5Vuhk,19007
21
+ doppy/raw/halo_sys_params.py,sha256=nT9r4F-H0Rf5njee5rYzzLTCm7vm3N_pdJqrW6RtyK4,4041
22
22
  doppy/raw/windcube.py,sha256=h_kqlQf2Pz59xg5EVSROiUlcA2RQp2jkGIxohmN1QOE,10166
23
23
  doppy/raw/wls70.py,sha256=2OhjmQ1SoAmjN4npOKFH0eFLyo9RssO7sr-gOtxjAho,7622
24
24
  doppy/raw/__init__.py,sha256=J06q7iykSAWIif4XAxI1jOszkARvLFBR1eU-B9yUXMw,235
25
25
  doppy/utils.py,sha256=lENDTzMVjCOA15Va9WZ6cou-foL5bGbNt4-NbDcnXpc,223
26
26
  doppy/__init__.py,sha256=Af7_8p3oN1nTqS9fo0mVKVuiKf5CAEK69uQa32CSFBA,197
27
27
  doppy/__main__.py,sha256=38hIWWfanILuBBGorQiAaleSC4qYJoIxuzVBkxf7Dng,371
28
- doppy/rs.pyd,sha256=NmaCgG3Sfesud2Uz3Fp87vaMPm0nwV_y9qtVdrSUB7I,2112512
29
- doppy-0.2.3.dist-info/RECORD,,
28
+ doppy/rs.pyd,sha256=-gldLueqXNJls_220C85maa0oidYpfxu2Gs-ovk1-tU,2100736
29
+ doppy-0.3.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: maturin (1.6.0)
2
+ Generator: maturin (1.7.0)
3
3
  Root-Is-Purelib: false
4
4
  Tag: cp310-abi3-win_amd64