doppy 0.2.1__cp310-abi3-macosx_10_12_x86_64.whl → 0.2.3__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/product/__init__.py CHANGED
@@ -1,4 +1,5 @@
1
1
  from doppy.product.stare import Stare
2
+ from doppy.product.wind import Options as WindOptions
2
3
  from doppy.product.wind import Wind
3
4
 
4
- __all__ = ["Stare", "Wind"]
5
+ __all__ = ["Stare", "Wind", "WindOptions"]
doppy/product/wind.py CHANGED
@@ -18,6 +18,11 @@ import doppy
18
18
  SelectionGroupKeyType: TypeAlias = tuple[int, int, tuple[int, ...]]
19
19
 
20
20
 
21
+ @dataclass
22
+ class Options:
23
+ azimuth_offset_deg: float | None
24
+
25
+
21
26
  @dataclass
22
27
  class Wind:
23
28
  time: npt.NDArray[np.datetime64]
@@ -45,6 +50,7 @@ class Wind:
45
50
  | Sequence[Path]
46
51
  | Sequence[bytes]
47
52
  | Sequence[BufferedIOBase],
53
+ options: Options | None = None,
48
54
  ) -> Wind:
49
55
  raws = doppy.raw.HaloHpl.from_srcs(data)
50
56
 
@@ -60,6 +66,9 @@ class Wind:
60
66
  if len(raw.time) == 0:
61
67
  raise doppy.exceptions.NoDataError("No suitable data for the wind product")
62
68
 
69
+ if options and options.azimuth_offset_deg:
70
+ raw.azimuth += options.azimuth_offset_deg
71
+
63
72
  groups = _group_scans_by_azimuth_rotation(raw)
64
73
  time_list = []
65
74
  elevation_list = []
@@ -104,6 +113,7 @@ class Wind:
104
113
  | Sequence[Path]
105
114
  | Sequence[bytes]
106
115
  | Sequence[BufferedIOBase],
116
+ options: Options | None = None,
107
117
  ) -> Wind:
108
118
  raws = doppy.raw.WindCube.from_vad_srcs(data)
109
119
 
@@ -119,6 +129,9 @@ class Wind:
119
129
  if len(raw.time) == 0:
120
130
  raise doppy.exceptions.NoDataError("No suitable data for the wind product")
121
131
 
132
+ if options and options.azimuth_offset_deg:
133
+ raw.azimuth += options.azimuth_offset_deg
134
+
122
135
  time_list = []
123
136
  elevation_list = []
124
137
  wind_list = []
@@ -159,6 +172,7 @@ class Wind:
159
172
  | Sequence[Path]
160
173
  | Sequence[bytes]
161
174
  | Sequence[BufferedIOBase],
175
+ options: Options | None = None,
162
176
  ) -> Wind:
163
177
  raws = doppy.raw.Wls70.from_srcs(data)
164
178
 
@@ -170,6 +184,20 @@ class Wind:
170
184
  .sorted_by_time()
171
185
  .non_strictly_increasing_timesteps_removed()
172
186
  )
187
+
188
+ if options and options.azimuth_offset_deg:
189
+ theta = np.deg2rad(options.azimuth_offset_deg)
190
+ cos_theta = np.cos(theta)
191
+ sin_theta = np.sin(theta)
192
+
193
+ meridional_wind = (
194
+ sin_theta * raw.zonal_wind + cos_theta * raw.meridional_wind
195
+ )
196
+ zonal_wind = cos_theta * raw.zonal_wind - sin_theta * raw.meridional_wind
197
+ else:
198
+ meridional_wind = raw.meridional_wind
199
+ zonal_wind = raw.zonal_wind
200
+
173
201
  mask = (
174
202
  np.isnan(raw.meridional_wind)
175
203
  | np.isnan(raw.zonal_wind)
@@ -178,8 +206,8 @@ class Wind:
178
206
  return Wind(
179
207
  time=raw.time,
180
208
  height=raw.altitude,
181
- zonal_wind=raw.zonal_wind,
182
- meridional_wind=raw.meridional_wind,
209
+ zonal_wind=zonal_wind,
210
+ meridional_wind=meridional_wind,
183
211
  vertical_wind=raw.vertical_wind,
184
212
  mask=mask,
185
213
  system_id=raw.system_id,
doppy/raw/wls70.py CHANGED
@@ -33,6 +33,7 @@ class Wls70:
33
33
  ] # v := meridional wind?, dim: (time, altitude)
34
34
  vertical_wind: npt.NDArray[np.float64] # w := vertical wind?, dim: (time, altitude)
35
35
  system_id: str
36
+ cnr_threshold: float
36
37
 
37
38
  @classmethod
38
39
  def from_srcs(
@@ -111,6 +112,7 @@ class Wls70:
111
112
  meridional_wind=self.meridional_wind[index],
112
113
  vertical_wind=self.vertical_wind[index],
113
114
  system_id=self.system_id,
115
+ cnr_threshold=self.cnr_threshold,
114
116
  )
115
117
  raise TypeError
116
118
 
@@ -137,6 +139,9 @@ class Wls70:
137
139
  meridional_wind=np.concatenate(tuple(r.meridional_wind for r in raws)),
138
140
  vertical_wind=np.concatenate(tuple(r.vertical_wind for r in raws)),
139
141
  system_id=merge_all_equal("system_id", [r.system_id for r in raws]),
142
+ cnr_threshold=merge_all_equal(
143
+ "cnr_threshold", [r.cnr_threshold for r in raws]
144
+ ),
140
145
  )
141
146
 
142
147
  def non_strictly_increasing_timesteps_removed(self) -> Wls70:
@@ -158,6 +163,7 @@ def _raw_rs_to_wls70(
158
163
  info, cols, data = raw_rs
159
164
  altitude = info["altitude"]
160
165
  system_id = info["system_id"]
166
+ cnr_threshold = float(info["cnr_threshold"])
161
167
  data = data.reshape(-1, len(cols))
162
168
  time_ts = data[:, 0]
163
169
  time = np.array([datetime64(datetime.utcfromtimestamp(ts)) for ts in time_ts])
@@ -173,7 +179,10 @@ def _raw_rs_to_wls70(
173
179
  u = data[:, 9::8]
174
180
  v = data[:, 10::8]
175
181
  w = data[:, 11::8]
176
-
182
+ mask = (np.abs(u) > 90) | (np.abs(v) > 90) | (np.abs(w) > 90)
183
+ u[mask] = np.nan
184
+ v[mask] = np.nan
185
+ w[mask] = np.nan
177
186
  return Wls70(
178
187
  time=time,
179
188
  altitude=altitude,
@@ -189,4 +198,5 @@ def _raw_rs_to_wls70(
189
198
  meridional_wind=v,
190
199
  vertical_wind=w,
191
200
  system_id=system_id,
201
+ cnr_threshold=cnr_threshold,
192
202
  )
doppy/rs.abi3.so CHANGED
Binary file
@@ -0,0 +1,137 @@
1
+ Metadata-Version: 2.3
2
+ Name: doppy
3
+ Version: 0.2.3
4
+ Classifier: Development Status :: 4 - Beta
5
+ Classifier: Programming Language :: Python :: 3
6
+ Classifier: Programming Language :: Python :: 3.10
7
+ Classifier: Programming Language :: Python :: 3.11
8
+ Classifier: Programming Language :: Python :: 3.12
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Intended Audience :: Science/Research
11
+ Classifier: Operating System :: OS Independent
12
+ Requires-Dist: requests
13
+ Requires-Dist: urllib3
14
+ Requires-Dist: numpy
15
+ Requires-Dist: netcdf4
16
+ Requires-Dist: typer
17
+ Requires-Dist: matplotlib
18
+ Requires-Dist: scikit-learn
19
+ Requires-Dist: scipy
20
+ Requires-Dist: mypy ; extra == 'dev'
21
+ Requires-Dist: ruff ; extra == 'dev'
22
+ Requires-Dist: pytest ; extra == 'dev'
23
+ Requires-Dist: types-requests ; extra == 'dev'
24
+ Requires-Dist: py-spy ; extra == 'dev'
25
+ Requires-Dist: maturin ==1.4 ; extra == 'dev'
26
+ Requires-Dist: release-version ; extra == 'dev'
27
+ Requires-Dist: pre-commit ; extra == 'dev'
28
+ Provides-Extra: dev
29
+ License-File: LICENSE
30
+ License-File: LICENSE
31
+ Author: Niko Leskinen <niko.leskinen@fmi.fi>
32
+ Author-email: Niko Leskinen <niko.leskinen@fmi.fi>
33
+ Requires-Python: >=3.10
34
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
35
+ Project-URL: Homepage, https://github.com/actris-cloudnet/doppy
36
+ Project-URL: Repository, https://github.com/actris-cloudnet/doppy
37
+ Project-URL: Changelog, https://github.com/actris-cloudnet/doppy/blob/main/CHANGELOG.md
38
+ Project-URL: Bug Tracker, https://github.com/actris-cloudnet/doppy/issues
39
+
40
+ # Doppy - Wind doppler lidar processing
41
+
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
+ [![PyPI version](https://badge.fury.io/py/doppy.svg)](https://badge.fury.io/py/doppy)
44
+
45
+ ## Products
46
+
47
+ - [Stare](https://github.com/actris-cloudnet/doppy/blob/main/src/doppy/product/stare.py): [Examples](https://cloudnet.fmi.fi/search/visualizations?experimental=true&product=doppler-lidar&dateFrom=2024-06-05&dateTo=2024-06-05)
48
+ - [Wind](https://github.com/actris-cloudnet/doppy/blob/main/src/doppy/product/wind.py): [Examples](https://cloudnet.fmi.fi/search/visualizations?experimental=true&product=doppler-lidar-wind&dateFrom=2024-06-05&dateTo=2024-06-05)
49
+
50
+ ## Instruments
51
+
52
+ - HALO Photonics Streamline lidars (stare, wind)
53
+ - Leosphere WindCube WLS200S (wind)
54
+ - Leosphere WindCube WLS70 (wind)
55
+
56
+ ## Install
57
+
58
+ ```sh
59
+ pip install doppy
60
+ ```
61
+
62
+ ## Usage
63
+
64
+ ```python
65
+ import doppy
66
+
67
+ stare = doppy.product.Stare.from_halo_data(
68
+ data=LIST_OF_STARE_FILE_PATHS,
69
+ data_bg=LIST_OF_BACKGROUND_FILE_PATHS,
70
+ bg_correction_method=doppy.options.BgCorrectionMethod.FIT,
71
+ )
72
+
73
+
74
+ (
75
+ doppy.netcdf.Dataset(FILENAME)
76
+ .add_dimension("time")
77
+ .add_dimension("range")
78
+ .add_time(
79
+ name="time",
80
+ dimensions=("time",),
81
+ standard_name="time",
82
+ long_name="Time UTC",
83
+ data=stare.time,
84
+ dtype="f8",
85
+ )
86
+ .add_variable(
87
+ name="range",
88
+ dimensions=("range",),
89
+ units="m",
90
+ data=stare.radial_distance,
91
+ dtype="f4",
92
+ )
93
+ .add_variable(
94
+ name="elevation",
95
+ dimensions=("time",),
96
+ units="degrees",
97
+ data=stare.elevation,
98
+ dtype="f4",
99
+ long_name="elevation from horizontal",
100
+ )
101
+ .add_variable(
102
+ name="beta_raw",
103
+ dimensions=("time", "range"),
104
+ units="sr-1 m-1",
105
+ data=stare.beta,
106
+ dtype="f4",
107
+ )
108
+ .add_variable(
109
+ name="beta",
110
+ dimensions=("time", "range"),
111
+ units="sr-1 m-1",
112
+ data=stare.beta,
113
+ dtype="f4",
114
+ mask=stare.mask,
115
+ )
116
+ .add_variable(
117
+ name="v",
118
+ dimensions=("time", "range"),
119
+ units="m s-1",
120
+ long_name="Doppler velocity",
121
+ data=stare.radial_velocity,
122
+ dtype="f4",
123
+ mask=stare.mask,
124
+ )
125
+ .add_scalar_variable(
126
+ name="wavelength",
127
+ units="m",
128
+ standard_name="radiation_wavelength",
129
+ data=stare.wavelength,
130
+ dtype="f4",
131
+ )
132
+ .add_atribute("serial_number", stare.system_id)
133
+ .add_atribute("doppy_version", doppy.__version__)
134
+ ).close()
135
+
136
+ ```
137
+
@@ -1,12 +1,12 @@
1
- doppy-0.2.1.dist-info/METADATA,sha256=0T7yh-b9uQUGEeBymLzElKfO6tw2QAlDqffDPUNda7k,1789
2
- doppy-0.2.1.dist-info/WHEEL,sha256=HYZ_jUi0IGqtX7pjBFQby7ex6mkgDnUsBYfR-onY1Fw,105
3
- doppy-0.2.1.dist-info/entry_points.txt,sha256=9b_Ca7vJoh6AwL3W8qAPh_UmJ_1Pa6hi-TDfCTDjvSk,43
4
- doppy-0.2.1.dist-info/license_files/LICENSE,sha256=V-0iroMNMI8ctnLgUau1kdFvwhkYhr9vi-5kWKxw2wc,1089
5
- doppy-0.2.1.dist-info/license_files/LICENSE,sha256=V-0iroMNMI8ctnLgUau1kdFvwhkYhr9vi-5kWKxw2wc,1089
1
+ doppy-0.2.3.dist-info/METADATA,sha256=oQQ7h-pTzAIlKSN7C0vAqEw70QLwmzVjeuNwmvxMYGY,4142
2
+ doppy-0.2.3.dist-info/WHEEL,sha256=yeRC21W_lRgy51Xt7_Plp8suG9tGryQjlozuN-L_Ook,105
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=V-0iroMNMI8ctnLgUau1kdFvwhkYhr9vi-5kWKxw2wc,1089
5
+ doppy-0.2.3.dist-info/license_files/LICENSE,sha256=V-0iroMNMI8ctnLgUau1kdFvwhkYhr9vi-5kWKxw2wc,1089
6
6
  doppy/options.py,sha256=73BDODO4OYHn2qOshhwz6u6G3J1kNd3uj6P0a3V4HBE,205
7
7
  doppy/__init__.py,sha256=Z9aEUlbPRWRUAoB8_-djkgrJuS4-6pjem4-mVSB6Z9I,191
8
- doppy/product/wind.py,sha256=MAK-ZTx37gL7y-x3RbqN_QrZR9kjAiLxdIMn_c6M5UA,12151
9
- doppy/product/__init__.py,sha256=lyp88zs7GBk8uUzkj8lxaXPuYwPa52xXeTwf5qwFddU,103
8
+ doppy/product/wind.py,sha256=mL8Ru7Hefq8YBYFIklBkySO3OEoRQ32ZPgB3deIhO7c,13042
9
+ doppy/product/__init__.py,sha256=DwTrvhMY_Eq-RG3H6Qyg_R_E9ie1wv0ofKr_1rSJ4Sk,172
10
10
  doppy/product/stare.py,sha256=aMhOA5yXjcnwgzAp4GvLF1HT1cD-Zuqg9sEQIPlxWa0,19907
11
11
  doppy/bench.py,sha256=iVNYveMVGGRES2oe3Orsn31jQFCKTXOmxRFuFiJ8_OA,248
12
12
  doppy/netcdf.py,sha256=uEiJfqxXxHwe5ghT6OpIu8xeY1HgWDW1ENTBlFLOGtE,3416
@@ -20,10 +20,10 @@ doppy/data/api.py,sha256=QaVKj304OPcu8OF5xgtduQzDis8Srn-I6UgR9qb2u9E,1863
20
20
  doppy/data/exceptions.py,sha256=6CS6OHIWq8CqlxiceEvC1j0EfWUYoIfM7dW88apQVn4,89
21
21
  doppy/raw/halo_sys_params.py,sha256=IXH40xBHyXCGX0ZE79KnSeXRj1wbqoqL0RYUQyBJqdE,3937
22
22
  doppy/raw/__init__.py,sha256=AMHyONuH0aUJUQz20EhlANaq9UjWJtSZf7kWUVx3ZjA,228
23
- doppy/raw/wls70.py,sha256=paFT8PddRemtiDAXxkZVcMljCq_CFw1DHmxLHXY0ZhE,7008
23
+ doppy/raw/wls70.py,sha256=PMyr_JYTiKuYv1JpWHgVX6OA5zU83DOnr8vBCxFyFAw,7420
24
24
  doppy/raw/halo_bg.py,sha256=kO03yGlKS-DpMMGHYuy_BuidyeUL38TxT5vMn8H_8lE,4809
25
25
  doppy/raw/halo_hpl.py,sha256=VkWemJfGFu-tF-fkhjYwF6dCZPrNQanqL0NBFJVS-TQ,18485
26
26
  doppy/raw/windcube.py,sha256=ZaOswQJbVDPBYj5oU1pTYmsX8F-mKIbjJRZmLYEMXP0,9906
27
27
  doppy/__main__.py,sha256=zrKQJVj0k0ypBQCGK65Czt9G9FZ_qx3ussw6Q9VJ14g,346
28
- doppy/rs.abi3.so,sha256=xJ24N0vZB2LmuWNoCt2wUI4f1gFnUVOh5NxgvYPjlSE,2876040
29
- doppy-0.2.1.dist-info/RECORD,,
28
+ doppy/rs.abi3.so,sha256=uS-gr5NekphI-rQ6plXqpuEDCiEJXGUZfyvl5atqSKE,2844096
29
+ doppy-0.2.3.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: maturin (1.5.1)
2
+ Generator: maturin (1.6.0)
3
3
  Root-Is-Purelib: false
4
4
  Tag: cp310-abi3-macosx_10_12_x86_64
@@ -1,44 +0,0 @@
1
- Metadata-Version: 2.3
2
- Name: doppy
3
- Version: 0.2.1
4
- Classifier: Development Status :: 4 - Beta
5
- Classifier: Programming Language :: Python :: 3
6
- Classifier: Programming Language :: Python :: 3.10
7
- Classifier: Programming Language :: Python :: 3.11
8
- Classifier: Programming Language :: Python :: 3.12
9
- Classifier: License :: OSI Approved :: MIT License
10
- Classifier: Intended Audience :: Science/Research
11
- Classifier: Operating System :: OS Independent
12
- Requires-Dist: requests
13
- Requires-Dist: urllib3
14
- Requires-Dist: numpy
15
- Requires-Dist: netcdf4
16
- Requires-Dist: typer
17
- Requires-Dist: matplotlib
18
- Requires-Dist: scikit-learn
19
- Requires-Dist: scipy
20
- Requires-Dist: mypy ; extra == 'dev'
21
- Requires-Dist: ruff ; extra == 'dev'
22
- Requires-Dist: pytest ; extra == 'dev'
23
- Requires-Dist: types-requests ; extra == 'dev'
24
- Requires-Dist: py-spy ; extra == 'dev'
25
- Requires-Dist: maturin ==1.4 ; extra == 'dev'
26
- Requires-Dist: release-version ; extra == 'dev'
27
- Requires-Dist: pre-commit ; extra == 'dev'
28
- Provides-Extra: dev
29
- License-File: LICENSE
30
- License-File: LICENSE
31
- Author: Niko Leskinen <niko.leskinen@fmi.fi>
32
- Author-email: Niko Leskinen <niko.leskinen@fmi.fi>
33
- Requires-Python: >=3.10
34
- Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
35
- Project-URL: Homepage, https://github.com/actris-cloudnet/doppy
36
- Project-URL: Repository, https://github.com/actris-cloudnet/doppy
37
- Project-URL: Changelog, https://github.com/actris-cloudnet/doppy/blob/main/CHANGELOG.md
38
- Project-URL: Bug Tracker, https://github.com/actris-cloudnet/doppy/issues
39
-
40
- # Doppy - Wind doppler lidar processing
41
-
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
- [![PyPI version](https://badge.fury.io/py/doppy.svg)](https://badge.fury.io/py/doppy)
44
-