doppy 0.5.4__cp310-abi3-win_amd64.whl → 0.5.6__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/product/stare.py +1 -1
- doppy/product/utils.py +12 -0
- doppy/product/wind.py +40 -97
- doppy/raw/windcube.py +1 -1
- doppy/rs.pyd +0 -0
- {doppy-0.5.4.dist-info → doppy-0.5.6.dist-info}/METADATA +2 -2
- {doppy-0.5.4.dist-info → doppy-0.5.6.dist-info}/RECORD +15 -14
- {doppy-0.5.4.dist-info → doppy-0.5.6.dist-info}/WHEEL +1 -1
- {doppy-0.5.4.dist-info → doppy-0.5.6.dist-info}/entry_points.txt +0 -0
- {doppy-0.5.4.dist-info → doppy-0.5.6.dist-info}/licenses/LICENSE +0 -0
doppy/product/stare.py
CHANGED
|
@@ -113,7 +113,7 @@ class Stare:
|
|
|
113
113
|
mask_radial_velocity=mask_radial_velocity,
|
|
114
114
|
wavelength=wavelength,
|
|
115
115
|
system_id=raw.system_id,
|
|
116
|
-
ray_info=RayAccumulationTime(raw.ray_accumulation_time),
|
|
116
|
+
ray_info=RayAccumulationTime(raw.ray_accumulation_time.astype(float)),
|
|
117
117
|
)
|
|
118
118
|
|
|
119
119
|
@classmethod
|
doppy/product/utils.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from collections import Counter
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
import numpy.typing as npt
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def arr_to_rounded_set(arr: npt.NDArray[np.float64]) -> set[int]:
|
|
8
|
+
return set(int(x) for x in np.round(arr))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def count_rounded(arr: npt.NDArray[np.float64]) -> Counter[int]:
|
|
12
|
+
return Counter(int(x) for x in np.round(arr))
|
doppy/product/wind.py
CHANGED
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import functools
|
|
4
|
-
from collections import
|
|
4
|
+
from collections import Counter
|
|
5
5
|
from dataclasses import dataclass
|
|
6
6
|
from io import BufferedIOBase
|
|
7
7
|
from pathlib import Path
|
|
8
|
-
from typing import Sequence
|
|
8
|
+
from typing import Sequence
|
|
9
9
|
|
|
10
10
|
import numpy as np
|
|
11
11
|
import numpy.typing as npt
|
|
12
12
|
from scipy.ndimage import generic_filter
|
|
13
|
-
from sklearn.cluster import KMeans
|
|
14
13
|
|
|
15
14
|
import doppy
|
|
16
|
-
|
|
17
|
-
# ngates, gate points, elevation angle, tuple of sorted azimuth angles
|
|
18
|
-
SelectionGroupKeyType: TypeAlias = tuple[int, int, tuple[int, ...]]
|
|
15
|
+
from doppy.product.utils import arr_to_rounded_set
|
|
19
16
|
|
|
20
17
|
|
|
21
18
|
@dataclass
|
|
@@ -413,99 +410,45 @@ def _wrap_and_round_angle(a: np.float64) -> int:
|
|
|
413
410
|
return int(np.round(a)) % 360
|
|
414
411
|
|
|
415
412
|
|
|
416
|
-
def _group_scans(raw: doppy.raw.HaloHpl) -> npt.NDArray[np.int64]:
|
|
417
|
-
if len(raw.time) < 4:
|
|
418
|
-
raise ValueError("Expected at least 4 profiles to compute wind profile")
|
|
419
|
-
if raw.time.dtype != "<M8[us]":
|
|
420
|
-
raise TypeError("time expected to be in numpy datetime[us]")
|
|
421
|
-
time = raw.time.astype(np.float64) * 1e-6
|
|
422
|
-
timediff_in_seconds = np.diff(time)
|
|
423
|
-
kmeans = KMeans(n_clusters=2, n_init="auto").fit(timediff_in_seconds.reshape(-1, 1))
|
|
424
|
-
centers = kmeans.cluster_centers_.flatten()
|
|
425
|
-
scanstep_timediff = centers[np.argmin(centers)]
|
|
426
|
-
|
|
427
|
-
if scanstep_timediff < 0.1 or scanstep_timediff > 30:
|
|
428
|
-
raise ValueError(
|
|
429
|
-
"Time difference between profiles in one scan "
|
|
430
|
-
"expected to be between 0.1 and 30 seconds"
|
|
431
|
-
)
|
|
432
|
-
scanstep_timediff_upperbound = 2 * scanstep_timediff
|
|
433
|
-
groups_by_time = -1 * np.ones_like(time, dtype=np.int64)
|
|
434
|
-
groups_by_time[0] = 0
|
|
435
|
-
scan_index = 0
|
|
436
|
-
for i, (t_prev, t) in enumerate(zip(time[:-1], time[1:]), start=1):
|
|
437
|
-
if t - t_prev > scanstep_timediff_upperbound:
|
|
438
|
-
scan_index += 1
|
|
439
|
-
groups_by_time[i] = scan_index
|
|
440
|
-
|
|
441
|
-
return _subgroup_scans(raw, groups_by_time)
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
def _subgroup_scans(
|
|
445
|
-
raw: doppy.raw.HaloHpl, time_groups: npt.NDArray[np.int64]
|
|
446
|
-
) -> npt.NDArray[np.int64]:
|
|
447
|
-
"""
|
|
448
|
-
Groups scans further based on the azimuth angles
|
|
449
|
-
"""
|
|
450
|
-
group = -1 * np.ones_like(raw.time, dtype=np.int64)
|
|
451
|
-
i = -1
|
|
452
|
-
for time_group in set(time_groups):
|
|
453
|
-
i += 1
|
|
454
|
-
(pick,) = np.where(time_group == time_groups)
|
|
455
|
-
raw_group = raw[pick]
|
|
456
|
-
first_azimuth_angle = int(np.round(raw_group.azimuth[0])) % 360
|
|
457
|
-
group[pick[0]] = i
|
|
458
|
-
for j, azi in enumerate(
|
|
459
|
-
(int(np.round(azi)) % 360 for azi in raw_group.azimuth[1:]), start=1
|
|
460
|
-
):
|
|
461
|
-
if azi == first_azimuth_angle:
|
|
462
|
-
i += 1
|
|
463
|
-
group[pick[j]] = i
|
|
464
|
-
return group
|
|
465
|
-
|
|
466
|
-
|
|
467
413
|
def _select_raws_for_wind(
|
|
468
414
|
raws: Sequence[doppy.raw.HaloHpl],
|
|
469
415
|
) -> Sequence[doppy.raw.HaloHpl]:
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
)
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
416
|
+
counter: Counter[tuple[int, int]] = Counter()
|
|
417
|
+
filtered_raws = []
|
|
418
|
+
for raw in raws:
|
|
419
|
+
select = (1 < raw.elevation) & (raw.elevation < 85)
|
|
420
|
+
for el in arr_to_rounded_set(raw.elevation[select]):
|
|
421
|
+
select_el = raw.elevation.round().astype(int) == el
|
|
422
|
+
select_and = select & select_el
|
|
423
|
+
|
|
424
|
+
if _get_nrounded_angles(raw.azimuth[select_and]) > 3:
|
|
425
|
+
filtered_raws.append(raw[select_and])
|
|
426
|
+
counter.update(
|
|
427
|
+
Counter(
|
|
428
|
+
(raw.header.mergeable_hash(), el)
|
|
429
|
+
for el in raw.elevation[select_and].round().astype(int)
|
|
430
|
+
)
|
|
431
|
+
)
|
|
432
|
+
if len(counter) == 0:
|
|
483
433
|
raise doppy.exceptions.NoDataError(
|
|
484
|
-
"No
|
|
485
|
-
"Multiple elevation angles or "
|
|
486
|
-
"elevation angle >= 80 or "
|
|
487
|
-
"elevation angle <= 25 or "
|
|
488
|
-
"no more than 3 azimuth angles"
|
|
434
|
+
"No scans with 1 < elevation angle < 85 and more than 3 azimuth angles"
|
|
489
435
|
)
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
next(iter(raw.elevation_angles)),
|
|
510
|
-
tuple(sorted(raw.azimuth_angles)),
|
|
511
|
-
)
|
|
436
|
+
if len(counter) == 1:
|
|
437
|
+
return filtered_raws
|
|
438
|
+
# Else select angle closes to 75 from angles
|
|
439
|
+
# that have count larger than mean_count/2
|
|
440
|
+
mean_count = counter.total() / len(counter)
|
|
441
|
+
_, _, hash = sorted(
|
|
442
|
+
[
|
|
443
|
+
(el, abs(el - 75), hash)
|
|
444
|
+
for (hash, el), count in counter.items()
|
|
445
|
+
if count > mean_count / 2
|
|
446
|
+
],
|
|
447
|
+
key=lambda x: x[1],
|
|
448
|
+
)[0]
|
|
449
|
+
raws = [raw for raw in filtered_raws if raw.header.mergeable_hash() == hash]
|
|
450
|
+
return raws
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
def _get_nrounded_angles(arr: npt.NDArray[np.float64]) -> int:
|
|
454
|
+
return len(set((x + 360) % 360 for x in arr_to_rounded_set(arr)))
|
doppy/raw/windcube.py
CHANGED
|
@@ -97,7 +97,7 @@ class WindCubeFixed:
|
|
|
97
97
|
return self[sort_indices]
|
|
98
98
|
|
|
99
99
|
def nan_profiles_removed(self) -> WindCubeFixed:
|
|
100
|
-
return self[np.array(~np.all(np.isnan(self.cnr), axis=1), dtype=np.
|
|
100
|
+
return self[np.array(~np.all(np.isnan(self.cnr), axis=1), dtype=np.bool_)]
|
|
101
101
|
|
|
102
102
|
|
|
103
103
|
@dataclass
|
doppy/rs.pyd
CHANGED
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: doppy
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.6
|
|
4
4
|
Classifier: Development Status :: 4 - Beta
|
|
5
5
|
Classifier: Programming Language :: Python :: 3
|
|
6
6
|
Classifier: Programming Language :: Python :: 3.10
|
|
@@ -29,10 +29,10 @@ Requires-Dist: release-version ; extra == 'dev'
|
|
|
29
29
|
Requires-Dist: pre-commit ; extra == 'dev'
|
|
30
30
|
Requires-Dist: xarray[io] ; extra == 'dev'
|
|
31
31
|
Requires-Dist: seaborn ; extra == 'dev'
|
|
32
|
+
Requires-Dist: tomli ; extra == 'dev'
|
|
32
33
|
Provides-Extra: dev
|
|
33
34
|
License-File: LICENSE
|
|
34
35
|
License-File: LICENSE
|
|
35
|
-
Author: Niko Leskinen <niko.leskinen@fmi.fi>
|
|
36
36
|
Author-email: Niko Leskinen <niko.leskinen@fmi.fi>
|
|
37
37
|
Requires-Python: >=3.10
|
|
38
38
|
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
@@ -1,33 +1,34 @@
|
|
|
1
|
-
doppy-0.5.
|
|
2
|
-
doppy-0.5.
|
|
3
|
-
doppy-0.5.
|
|
4
|
-
doppy-0.5.
|
|
1
|
+
doppy-0.5.6.dist-info/METADATA,sha256=qk92LK22aqb7ezTG0IxCYv6yTEnmhb_EQdsEtoyfzKI,4447
|
|
2
|
+
doppy-0.5.6.dist-info/WHEEL,sha256=MF1HCxdpioEZC6lqltB_WBzy4tzMPetoB2hZW2ZWEzg,95
|
|
3
|
+
doppy-0.5.6.dist-info/entry_points.txt,sha256=9b_Ca7vJoh6AwL3W8qAPh_UmJ_1Pa6hi-TDfCTDjvSk,43
|
|
4
|
+
doppy-0.5.6.dist-info/licenses/LICENSE,sha256=RIAxFjJLTw0wQ3_SM73JoTeppoD99DJJ72cjvVuRrW4,1110
|
|
5
|
+
doppy/__init__.py,sha256=Af7_8p3oN1nTqS9fo0mVKVuiKf5CAEK69uQa32CSFBA,197
|
|
6
|
+
doppy/__main__.py,sha256=38hIWWfanILuBBGorQiAaleSC4qYJoIxuzVBkxf7Dng,371
|
|
5
7
|
doppy/bench.py,sha256=X4yPXFPAM708ptzXKDYxVBOC0E3cMj_KxXzmD_Q9_RM,321
|
|
8
|
+
doppy/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
9
|
doppy/data/api.py,sha256=IoLRodfITNHs4Pb2IvVvOjSirSeK-xNoSO4tsQYjsKc,1933
|
|
7
10
|
doppy/data/cache.py,sha256=ERFzH-KjLLXV8fCePsewTepKZXmLwtXxeazmHiFdA80,1203
|
|
8
11
|
doppy/data/exceptions.py,sha256=JOyekvUO-Ew4ZVezf3_IxZOrPN0IksfUILd8R2YcSts,95
|
|
9
|
-
doppy/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
12
|
doppy/defaults.py,sha256=jZvGmHJkvOzFpwy97L6Sj9-bnF0-nvq0-zNNWxM_WpE,490
|
|
11
13
|
doppy/exceptions.py,sha256=IUF8D_d-QOvtemUSEMg1raXDWA3dSXQ2MUBvlwgm1rU,197
|
|
12
14
|
doppy/netcdf.py,sha256=R41GVQQrjo3z4Pqi-Rh9QeF7nU8HsYT2jY9Bd8xDmDQ,4212
|
|
13
15
|
doppy/options.py,sha256=uyIKM_G2GtbmV6Gve8o13eIShQqUwsnYZ41mhX2ypGE,218
|
|
16
|
+
doppy/product/__init__.py,sha256=xoBEXuhid-bvoof5Ogzpt1dKIhJgNMRyrAinCqUOUUI,241
|
|
14
17
|
doppy/product/noise_utils.py,sha256=Bro3T8uMY9MmJcrXbOl_QKIU7OXVRUs_R6Norl5Tv3Q,2735
|
|
15
|
-
doppy/product/stare.py,sha256=
|
|
18
|
+
doppy/product/stare.py,sha256=zcy-BAvY3R0PtBxVILNDH6FRvd9OwfHMfsNOowEoNtQ,28023
|
|
16
19
|
doppy/product/stare_depol.py,sha256=GkS-60Izk-rF9PnHPtOgAssr--K4ddzQHUlyLZ7JNkU,11026
|
|
17
20
|
doppy/product/turbulence.py,sha256=RHvQlNobnXiF2Vx8OuvTYe7BIibmTNNXpHa7X4BfGbQ,8870
|
|
18
|
-
doppy/product/
|
|
19
|
-
doppy/product/
|
|
21
|
+
doppy/product/utils.py,sha256=-hsyKwZmV3UEIqv9MND5ng-YzW4bBN5QdkMwR4ZDLHw,322
|
|
22
|
+
doppy/product/wind.py,sha256=54Fl2rcaCiMo8Qc_5xhsYJMEU4spIpe0g_OMraNmLt8,15381
|
|
20
23
|
doppy/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
24
|
+
doppy/raw/__init__.py,sha256=QqAPpV53Xbz3tHo4zCYv9_pgLYw_F2YIRH2-Mg9l2gI,341
|
|
21
25
|
doppy/raw/halo_bg.py,sha256=TrqJDUXa1atW2w4UDN9PPx2Mzrc7D9Q2Ndph0yB65p0,5988
|
|
22
26
|
doppy/raw/halo_hpl.py,sha256=ap9WGBSHCYtLDZ89TaTXbHJHIwT6y3y-U0wO1kCR0o8,17304
|
|
23
27
|
doppy/raw/halo_sys_params.py,sha256=9aZpAgaLFniADjYv7EO8wKtmBD6McJP2v7YUz94hrTM,5385
|
|
24
28
|
doppy/raw/utils.py,sha256=pBeBk87_LMxop14_RK5Xj64iYBMu8AhH-IqBRoGgUzE,436
|
|
25
|
-
doppy/raw/windcube.py,sha256
|
|
29
|
+
doppy/raw/windcube.py,sha256=-AC7tECxOfht6CxxSeFYmRM1bU3DRZSlRvR_nHK4tqg,19627
|
|
26
30
|
doppy/raw/wls70.py,sha256=lWSnuZlmdCGqrlYt6SUDFvPRBOOdtt6LiDiu_nhnPiU,6494
|
|
27
31
|
doppy/raw/wls77.py,sha256=SOIFGC1GhoAPGePH6B-fAuyWqfW5jevi1zbku9JOBng,6623
|
|
28
|
-
doppy/
|
|
32
|
+
doppy/rs.pyd,sha256=_dB5h2KcvVttwWrVMMRZK47emPsjzhmrlb3IJfe6fKg,2192896
|
|
29
33
|
doppy/utils.py,sha256=2PwDiO8GyMjsHC-EYcTGyN2mEfPaCi3hhEn2twETOl0,814
|
|
30
|
-
doppy/
|
|
31
|
-
doppy/__main__.py,sha256=38hIWWfanILuBBGorQiAaleSC4qYJoIxuzVBkxf7Dng,371
|
|
32
|
-
doppy/rs.pyd,sha256=8H1KXP5TZTafe-bXfbVS55yAJE6mmYRvE4OFJOYMAKA,2198528
|
|
33
|
-
doppy-0.5.4.dist-info/RECORD,,
|
|
34
|
+
doppy-0.5.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|