doppy 0.2.4__cp310-abi3-macosx_10_12_x86_64.whl → 0.3.1__cp310-abi3-macosx_10_12_x86_64.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, atol=1):
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, atol=1):
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.abi3.so 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.1
4
4
  Classifier: Development Status :: 4 - Beta
5
5
  Classifier: Programming Language :: Python :: 3
6
6
  Classifier: Programming Language :: Python :: 3.10
@@ -1,14 +1,15 @@
1
- doppy-0.2.4.dist-info/METADATA,sha256=v9HI3W9NwDiBFoi7WimE35gNO4zd4wddz1sg0JM_0Qo,4146
2
- doppy-0.2.4.dist-info/WHEEL,sha256=WrMW63pUH_1YC4fVPzaPa4OCS_WjDVtthurSO7B3-1Y,105
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=V-0iroMNMI8ctnLgUau1kdFvwhkYhr9vi-5kWKxw2wc,1089
1
+ doppy-0.3.1.dist-info/METADATA,sha256=Nf2a2FVs4bvMqXqdOC_ujt_9NbjU8TaTWppMiWpzyPA,4146
2
+ doppy-0.3.1.dist-info/WHEEL,sha256=WrMW63pUH_1YC4fVPzaPa4OCS_WjDVtthurSO7B3-1Y,105
3
+ doppy-0.3.1.dist-info/entry_points.txt,sha256=9b_Ca7vJoh6AwL3W8qAPh_UmJ_1Pa6hi-TDfCTDjvSk,43
4
+ doppy-0.3.1.dist-info/license_files/LICENSE,sha256=V-0iroMNMI8ctnLgUau1kdFvwhkYhr9vi-5kWKxw2wc,1089
5
5
  doppy/options.py,sha256=73BDODO4OYHn2qOshhwz6u6G3J1kNd3uj6P0a3V4HBE,205
6
6
  doppy/__init__.py,sha256=Z9aEUlbPRWRUAoB8_-djkgrJuS4-6pjem4-mVSB6Z9I,191
7
7
  doppy/product/wind.py,sha256=MXm5HDoO3X6AzvpPHYPlpUXB_MYp_TBPP81aZ151wj8,13043
8
- doppy/product/__init__.py,sha256=DwTrvhMY_Eq-RG3H6Qyg_R_E9ie1wv0ofKr_1rSJ4Sk,172
8
+ doppy/product/__init__.py,sha256=C6s9cX20m9UwRsKo1lZH6TnYFfM5KmsX5MPUyShbgl4,235
9
+ doppy/product/stare_depol.py,sha256=5YVdyQof5eE8ous9duZS4nDt9VG0aQlgEPZ5t7KshM8,2913
9
10
  doppy/product/stare.py,sha256=jt1vHptufBFwUH5Un_0pk44eHKbAWnkhrU7HUI7gYJ4,19908
10
11
  doppy/bench.py,sha256=iVNYveMVGGRES2oe3Orsn31jQFCKTXOmxRFuFiJ8_OA,248
11
- doppy/netcdf.py,sha256=bGl3oeXtL04Qz0RR2mIdNYp-nWq-OI7_aR3oFfeezOc,3600
12
+ doppy/netcdf.py,sha256=FX151GC8fuRhm-veg94BGeOWqszGn6nnWT9BxbzoSO8,3895
12
13
  doppy/utils.py,sha256=qPtIYBJPaKKTmRWwJI93TFUuhJg7CAoecpyHCm5ZyxI,214
13
14
  doppy/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
15
  doppy/exceptions.py,sha256=1tljrtzp0McQhB6INFXj4yfLjxj6mXor5jLF9HZjp1A,138
@@ -24,5 +25,5 @@ doppy/raw/halo_bg.py,sha256=kO03yGlKS-DpMMGHYuy_BuidyeUL38TxT5vMn8H_8lE,4809
24
25
  doppy/raw/halo_hpl.py,sha256=YFTepAWXvIfAVGgLZCadsc1d-VaOh7j2RB3cpb6Sv6k,18486
25
26
  doppy/raw/windcube.py,sha256=ZaOswQJbVDPBYj5oU1pTYmsX8F-mKIbjJRZmLYEMXP0,9906
26
27
  doppy/__main__.py,sha256=zrKQJVj0k0ypBQCGK65Czt9G9FZ_qx3ussw6Q9VJ14g,346
27
- doppy/rs.abi3.so,sha256=A4SR1Jcxog3RWyLdupKzTlIeoEU4YBSVVt4ubUAtSrI,2787456
28
- doppy-0.2.4.dist-info/RECORD,,
28
+ doppy/rs.abi3.so,sha256=QL14vzujOQmSAm7m3ekkrpl5qZm5ke6l4ZL4Emhy3A0,2655056
29
+ doppy-0.3.1.dist-info/RECORD,,
File without changes