doppy 0.2.4__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,6 +1,7 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import warnings
4
+ from types import TracebackType
4
5
  from typing import Literal, TypeAlias
5
6
 
6
7
  import netCDF4
@@ -14,6 +15,17 @@ class Dataset:
14
15
  def __init__(self, filename: str) -> None:
15
16
  self.nc = netCDF4.Dataset(filename, mode="w")
16
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
+
17
29
  def add_dimension(self, dim: str) -> Dataset:
18
30
  self.nc.createDimension(dim, None)
19
31
  return self
@@ -23,7 +35,7 @@ class Dataset:
23
35
  return self
24
36
 
25
37
  def add_atribute(self, key: str, val: str) -> Dataset:
26
- warnings.warn("Use add_attribute", DeprecationWarning)
38
+ warnings.warn("Use add_attribute", DeprecationWarning, stacklevel=2)
27
39
  return self.add_attribute(key, val)
28
40
 
29
41
  def add_time(
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"]
@@ -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/rs.pyd CHANGED
Binary file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: doppy
3
- Version: 0.2.4
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
@@ -1,7 +1,7 @@
1
- doppy-0.2.4.dist-info/METADATA,sha256=ZkylqwgahVuTks7ZPyEqmkuvmoFPHIlzHGZIw3uBkNU,4243
2
- doppy-0.2.4.dist-info/WHEEL,sha256=ooo3OLxJB34JFfOmPzfiM9QlB2wmB_Cl3_kcSm8NkLg,95
3
- doppy-0.2.4.dist-info/entry_points.txt,sha256=9b_Ca7vJoh6AwL3W8qAPh_UmJ_1Pa6hi-TDfCTDjvSk,43
4
- doppy-0.2.4.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
5
5
  doppy/bench.py,sha256=fLN2iS5mmoYH4qZjD80Vl1h9lp3C-KDfhj9fteWRPtM,260
6
6
  doppy/data/api.py,sha256=c3zbZI3IV7HnzhyFzJpUPOFT20eYFuQlJ5K_1ZEe1Pg,1921
7
7
  doppy/data/cache.py,sha256=VNPB3XsWGwY2bNXBs1r_sEWF4qBq_U7sJSlSmt1Rxm8,1033
@@ -9,11 +9,12 @@ doppy/data/exceptions.py,sha256=JOyekvUO-Ew4ZVezf3_IxZOrPN0IksfUILd8R2YcSts,95
9
9
  doppy/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  doppy/defaults.py,sha256=nhxcZcFd2jyDVbq0azwtekEJEjiz8k21MZmXFlSXAjo,40
11
11
  doppy/exceptions.py,sha256=YNEyz4r0ObzZHZ9re83K3wZlR2CRI1GyhH0vvFGasgQ,148
12
- doppy/netcdf.py,sha256=NnTkZEb5gBInvrvn7uD91V2t4e_WlCOrLzhPm00azOE,3716
12
+ doppy/netcdf.py,sha256=VkWGleFKef3bkWf2_LfCdJnR1LORIFc51cXDRoRdHFo,4023
13
13
  doppy/options.py,sha256=uyIKM_G2GtbmV6Gve8o13eIShQqUwsnYZ41mhX2ypGE,218
14
14
  doppy/product/stare.py,sha256=sh2HuKEWa-gaWZCbjbozYFA0oRUZa4U3nG9FpgqtoKM,20522
15
+ doppy/product/stare_depol.py,sha256=rSi1nxC9VqiTse4xu4E733iJJUq9IC2EXKa_n3dIUWA,2980
15
16
  doppy/product/wind.py,sha256=f52owv_pzfUDiMzLXv6IqHFWHWdLXmGUIgBCXjOhPnk,13455
16
- doppy/product/__init__.py,sha256=kHVF77la8tzWKKpiM9eNWT-eAkAUd4uwb0wJFp62QLk,177
17
+ doppy/product/__init__.py,sha256=xoBEXuhid-bvoof5Ogzpt1dKIhJgNMRyrAinCqUOUUI,241
17
18
  doppy/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
19
  doppy/raw/halo_bg.py,sha256=9K7E9smahGOqDIYnA-9m-Di3QsDY0PR2FH4Yd_oYiEY,4951
19
20
  doppy/raw/halo_hpl.py,sha256=VF8JQ_5N8adLsGNJOlhvKwz0LtNd4oCU76hETe5Vuhk,19007
@@ -24,5 +25,5 @@ doppy/raw/__init__.py,sha256=J06q7iykSAWIif4XAxI1jOszkARvLFBR1eU-B9yUXMw,235
24
25
  doppy/utils.py,sha256=lENDTzMVjCOA15Va9WZ6cou-foL5bGbNt4-NbDcnXpc,223
25
26
  doppy/__init__.py,sha256=Af7_8p3oN1nTqS9fo0mVKVuiKf5CAEK69uQa32CSFBA,197
26
27
  doppy/__main__.py,sha256=38hIWWfanILuBBGorQiAaleSC4qYJoIxuzVBkxf7Dng,371
27
- doppy/rs.pyd,sha256=dYpxLPIMM6YD1kr2MDlb2gypV4QhJ2LsQgxBRUCT3dE,2103808
28
- doppy-0.2.4.dist-info/RECORD,,
28
+ doppy/rs.pyd,sha256=-gldLueqXNJls_220C85maa0oidYpfxu2Gs-ovk1-tU,2100736
29
+ doppy-0.3.0.dist-info/RECORD,,
File without changes