doppy 0.2.4__tar.gz → 0.3.1__tar.gz

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.

Files changed (41) hide show
  1. {doppy-0.2.4 → doppy-0.3.1}/Cargo.lock +2 -2
  2. {doppy-0.2.4 → doppy-0.3.1}/Cargo.toml +1 -1
  3. {doppy-0.2.4 → doppy-0.3.1}/PKG-INFO +1 -1
  4. {doppy-0.2.4 → doppy-0.3.1}/src/doppy/netcdf.py +13 -1
  5. {doppy-0.2.4 → doppy-0.3.1}/src/doppy/product/__init__.py +2 -1
  6. doppy-0.3.1/src/doppy/product/stare_depol.py +83 -0
  7. {doppy-0.2.4 → doppy-0.3.1}/LICENSE +0 -0
  8. {doppy-0.2.4 → doppy-0.3.1}/README.md +0 -0
  9. {doppy-0.2.4 → doppy-0.3.1}/crates/doppy_rs/Cargo.toml +0 -0
  10. {doppy-0.2.4 → doppy-0.3.1}/crates/doppy_rs/src/lib.rs +0 -0
  11. {doppy-0.2.4 → doppy-0.3.1}/crates/doppy_rs/src/raw/halo_hpl.rs +0 -0
  12. {doppy-0.2.4 → doppy-0.3.1}/crates/doppy_rs/src/raw/wls70.rs +0 -0
  13. {doppy-0.2.4 → doppy-0.3.1}/crates/doppy_rs/src/raw.rs +0 -0
  14. {doppy-0.2.4 → doppy-0.3.1}/crates/doprs/.gitignore +0 -0
  15. {doppy-0.2.4 → doppy-0.3.1}/crates/doprs/Cargo.toml +0 -0
  16. {doppy-0.2.4 → doppy-0.3.1}/crates/doprs/src/lib.rs +0 -0
  17. {doppy-0.2.4 → doppy-0.3.1}/crates/doprs/src/raw/error.rs +0 -0
  18. {doppy-0.2.4 → doppy-0.3.1}/crates/doprs/src/raw/halo_hpl.rs +0 -0
  19. {doppy-0.2.4 → doppy-0.3.1}/crates/doprs/src/raw/wls70.rs +0 -0
  20. {doppy-0.2.4 → doppy-0.3.1}/crates/doprs/src/raw.rs +0 -0
  21. {doppy-0.2.4 → doppy-0.3.1}/pyproject.toml +0 -0
  22. {doppy-0.2.4 → doppy-0.3.1}/src/doppy/__init__.py +0 -0
  23. {doppy-0.2.4 → doppy-0.3.1}/src/doppy/__main__.py +0 -0
  24. {doppy-0.2.4 → doppy-0.3.1}/src/doppy/bench.py +0 -0
  25. {doppy-0.2.4 → doppy-0.3.1}/src/doppy/data/__init__.py +0 -0
  26. {doppy-0.2.4 → doppy-0.3.1}/src/doppy/data/api.py +0 -0
  27. {doppy-0.2.4 → doppy-0.3.1}/src/doppy/data/cache.py +0 -0
  28. {doppy-0.2.4 → doppy-0.3.1}/src/doppy/data/exceptions.py +0 -0
  29. {doppy-0.2.4 → doppy-0.3.1}/src/doppy/defaults.py +0 -0
  30. {doppy-0.2.4 → doppy-0.3.1}/src/doppy/exceptions.py +0 -0
  31. {doppy-0.2.4 → doppy-0.3.1}/src/doppy/options.py +0 -0
  32. {doppy-0.2.4 → doppy-0.3.1}/src/doppy/product/stare.py +0 -0
  33. {doppy-0.2.4 → doppy-0.3.1}/src/doppy/product/wind.py +0 -0
  34. {doppy-0.2.4 → doppy-0.3.1}/src/doppy/py.typed +0 -0
  35. {doppy-0.2.4 → doppy-0.3.1}/src/doppy/raw/__init__.py +0 -0
  36. {doppy-0.2.4 → doppy-0.3.1}/src/doppy/raw/halo_bg.py +0 -0
  37. {doppy-0.2.4 → doppy-0.3.1}/src/doppy/raw/halo_hpl.py +0 -0
  38. {doppy-0.2.4 → doppy-0.3.1}/src/doppy/raw/halo_sys_params.py +0 -0
  39. {doppy-0.2.4 → doppy-0.3.1}/src/doppy/raw/windcube.py +0 -0
  40. {doppy-0.2.4 → doppy-0.3.1}/src/doppy/raw/wls70.py +0 -0
  41. {doppy-0.2.4 → doppy-0.3.1}/src/doppy/utils.py +0 -0
@@ -106,7 +106,7 @@ checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345"
106
106
 
107
107
  [[package]]
108
108
  name = "doppy_rs"
109
- version = "0.2.4"
109
+ version = "0.3.1"
110
110
  dependencies = [
111
111
  "doprs",
112
112
  "numpy",
@@ -115,7 +115,7 @@ dependencies = [
115
115
 
116
116
  [[package]]
117
117
  name = "doprs"
118
- version = "0.2.4"
118
+ version = "0.3.1"
119
119
  dependencies = [
120
120
  "chrono",
121
121
  "rayon",
@@ -4,6 +4,6 @@ resolver = "2"
4
4
 
5
5
  [workspace.package]
6
6
  edition = "2021"
7
- version = "0.2.4"
7
+ version = "0.3.1"
8
8
  authors = ["Niko Leskinen <niko.leskinen@fmi.fi>"]
9
9
  license-file = "LICENSE"
@@ -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,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(
@@ -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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes