doppy 0.1.3__cp310-abi3-macosx_11_0_arm64.whl → 0.2.0__cp310-abi3-macosx_11_0_arm64.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/data/api.py +7 -1
- doppy/product/stare.py +3 -0
- doppy/product/wind.py +33 -0
- doppy/raw/__init__.py +2 -1
- doppy/raw/halo_hpl.py +4 -0
- doppy/raw/wls70.py +188 -0
- doppy/rs.abi3.so +0 -0
- {doppy-0.1.3.dist-info → doppy-0.2.0.dist-info}/METADATA +2 -2
- {doppy-0.1.3.dist-info → doppy-0.2.0.dist-info}/RECORD +13 -12
- {doppy-0.1.3.dist-info → doppy-0.2.0.dist-info}/WHEEL +1 -1
- {doppy-0.1.3.dist-info → doppy-0.2.0.dist-info}/entry_points.txt +0 -0
- {doppy-0.1.3.dist-info → doppy-0.2.0.dist-info}/license_files/LICENSE +0 -0
doppy/data/api.py
CHANGED
|
@@ -37,7 +37,13 @@ class Api:
|
|
|
37
37
|
return self.get(
|
|
38
38
|
"raw-files",
|
|
39
39
|
params={
|
|
40
|
-
"instrument": [
|
|
40
|
+
"instrument": [
|
|
41
|
+
"halo-doppler-lidar",
|
|
42
|
+
"wls100s",
|
|
43
|
+
"wls200s",
|
|
44
|
+
"wls400s",
|
|
45
|
+
"wls70",
|
|
46
|
+
],
|
|
41
47
|
"site": site,
|
|
42
48
|
"date": date,
|
|
43
49
|
},
|
doppy/product/stare.py
CHANGED
|
@@ -50,6 +50,7 @@ class Stare:
|
|
|
50
50
|
doppy.raw.HaloHpl.merge(_select_raws_for_stare(raws))
|
|
51
51
|
.sorted_by_time()
|
|
52
52
|
.non_strictly_increasing_timesteps_removed()
|
|
53
|
+
.nans_removed()
|
|
53
54
|
)
|
|
54
55
|
|
|
55
56
|
bgs = doppy.raw.HaloBg.from_srcs(data_bg)
|
|
@@ -65,6 +66,8 @@ class Stare:
|
|
|
65
66
|
.non_strictly_increasing_timesteps_removed()
|
|
66
67
|
)
|
|
67
68
|
raw, intensity_bg_corrected = _correct_background(raw, bg, bg_correction_method)
|
|
69
|
+
if len(raw.time) == 0:
|
|
70
|
+
raise doppy.exceptions.NoDataError("No matching data and bg files")
|
|
68
71
|
intensity_noise_bias_corrected = _correct_intensity_noise_bias(
|
|
69
72
|
raw, intensity_bg_corrected
|
|
70
73
|
)
|
doppy/product/wind.py
CHANGED
|
@@ -54,6 +54,7 @@ class Wind:
|
|
|
54
54
|
doppy.raw.HaloHpl.merge(_select_raws_for_wind(raws))
|
|
55
55
|
.sorted_by_time()
|
|
56
56
|
.non_strictly_increasing_timesteps_removed()
|
|
57
|
+
.nans_removed()
|
|
57
58
|
)
|
|
58
59
|
if len(raw.time) == 0:
|
|
59
60
|
raise doppy.exceptions.NoDataError("No suitable data for the wind product")
|
|
@@ -148,6 +149,38 @@ class Wind:
|
|
|
148
149
|
mask=mask,
|
|
149
150
|
)
|
|
150
151
|
|
|
152
|
+
@classmethod
|
|
153
|
+
def from_wls70_data(
|
|
154
|
+
cls,
|
|
155
|
+
data: Sequence[str]
|
|
156
|
+
| Sequence[Path]
|
|
157
|
+
| Sequence[bytes]
|
|
158
|
+
| Sequence[BufferedIOBase],
|
|
159
|
+
) -> Wind:
|
|
160
|
+
raws = doppy.raw.Wls70.from_srcs(data)
|
|
161
|
+
|
|
162
|
+
if len(raws) == 0:
|
|
163
|
+
raise doppy.exceptions.NoDataError("Wls70 data missing")
|
|
164
|
+
|
|
165
|
+
raw = (
|
|
166
|
+
doppy.raw.Wls70.merge(raws)
|
|
167
|
+
.sorted_by_time()
|
|
168
|
+
.non_strictly_increasing_timesteps_removed()
|
|
169
|
+
)
|
|
170
|
+
mask = (
|
|
171
|
+
np.isnan(raw.meridional_wind)
|
|
172
|
+
| np.isnan(raw.zonal_wind)
|
|
173
|
+
| np.isnan(raw.vertical_wind)
|
|
174
|
+
)
|
|
175
|
+
return Wind(
|
|
176
|
+
time=raw.time,
|
|
177
|
+
height=raw.altitude,
|
|
178
|
+
zonal_wind=raw.zonal_wind,
|
|
179
|
+
meridional_wind=raw.meridional_wind,
|
|
180
|
+
vertical_wind=raw.vertical_wind,
|
|
181
|
+
mask=mask,
|
|
182
|
+
)
|
|
183
|
+
|
|
151
184
|
|
|
152
185
|
def _compute_wind(
|
|
153
186
|
raw: doppy.raw.HaloHpl | doppy.raw.WindCube,
|
doppy/raw/__init__.py
CHANGED
|
@@ -2,5 +2,6 @@ from .halo_bg import HaloBg
|
|
|
2
2
|
from .halo_hpl import HaloHpl
|
|
3
3
|
from .halo_sys_params import HaloSysParams
|
|
4
4
|
from .windcube import WindCube
|
|
5
|
+
from .wls70 import Wls70
|
|
5
6
|
|
|
6
|
-
__all__ = ["HaloHpl", "HaloBg", "HaloSysParams", "WindCube"]
|
|
7
|
+
__all__ = ["HaloHpl", "HaloBg", "HaloSysParams", "WindCube", "Wls70"]
|
doppy/raw/halo_hpl.py
CHANGED
doppy/raw/wls70.py
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from datetime import datetime
|
|
5
|
+
from io import BufferedIOBase
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from typing import Sequence
|
|
8
|
+
|
|
9
|
+
import numpy as np
|
|
10
|
+
import numpy.typing as npt
|
|
11
|
+
from numpy import datetime64
|
|
12
|
+
|
|
13
|
+
import doppy
|
|
14
|
+
from doppy import exceptions
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@dataclass
|
|
18
|
+
class Wls70:
|
|
19
|
+
time: npt.NDArray[datetime64] # dim: (time, )
|
|
20
|
+
altitude: npt.NDArray[np.float64] # dim: (altitude, )
|
|
21
|
+
position: npt.NDArray[np.float64] # dim: (time, )
|
|
22
|
+
temperature: npt.NDArray[np.float64] # dim: (time, )
|
|
23
|
+
wiper: npt.NDArray[np.bool_] # dim: (time, )
|
|
24
|
+
cnr: npt.NDArray[np.float64] # dim: (time, altitude)
|
|
25
|
+
radial_velocity: npt.NDArray[np.float64] # dim: (time, altitude)
|
|
26
|
+
radial_velocity_deviation: npt.NDArray[np.float64] # dim: (time, altitude)
|
|
27
|
+
vh: npt.NDArray[np.float64] # dim: (time, altitude)
|
|
28
|
+
wind_direction: npt.NDArray[np.float64] # dim: (time, altitude)
|
|
29
|
+
zonal_wind: npt.NDArray[np.float64] # u := zonal wind?, dim: (time, altitude)
|
|
30
|
+
meridional_wind: npt.NDArray[
|
|
31
|
+
np.float64
|
|
32
|
+
] # v := meridional wind?, dim: (time, altitude)
|
|
33
|
+
vertical_wind: npt.NDArray[np.float64] # w := vertical wind?, dim: (time, altitude)
|
|
34
|
+
|
|
35
|
+
@classmethod
|
|
36
|
+
def from_srcs(
|
|
37
|
+
cls,
|
|
38
|
+
data: Sequence[str]
|
|
39
|
+
| Sequence[Path]
|
|
40
|
+
| Sequence[bytes]
|
|
41
|
+
| Sequence[BufferedIOBase],
|
|
42
|
+
) -> list[Wls70]:
|
|
43
|
+
if not isinstance(data, (list, tuple)):
|
|
44
|
+
raise TypeError("data should be list or tuple")
|
|
45
|
+
if all(isinstance(src, bytes) for src in data):
|
|
46
|
+
data_bytes = data
|
|
47
|
+
elif all(isinstance(src, str) for src in data):
|
|
48
|
+
data_bytes = []
|
|
49
|
+
for src in data:
|
|
50
|
+
with Path(src).open("rb") as f:
|
|
51
|
+
data_bytes.append(f.read())
|
|
52
|
+
elif all(isinstance(src, Path) for src in data):
|
|
53
|
+
data_bytes = []
|
|
54
|
+
for src in data:
|
|
55
|
+
with src.open("rb") as f:
|
|
56
|
+
data_bytes.append(f.read())
|
|
57
|
+
elif all(isinstance(src, BufferedIOBase) for src in data):
|
|
58
|
+
data_bytes = [src.read() for src in data]
|
|
59
|
+
else:
|
|
60
|
+
raise TypeError("Unexpected types in data")
|
|
61
|
+
raws = doppy.rs.raw.wls70.from_bytes_srcs(data_bytes)
|
|
62
|
+
try:
|
|
63
|
+
return [_raw_rs_to_wls70(r) for r in raws]
|
|
64
|
+
except RuntimeError as err:
|
|
65
|
+
raise exceptions.RawParsingError(err) from err
|
|
66
|
+
|
|
67
|
+
@classmethod
|
|
68
|
+
def from_src(cls, data: str | Path | bytes | BufferedIOBase) -> Wls70:
|
|
69
|
+
if isinstance(data, str):
|
|
70
|
+
path = Path(data)
|
|
71
|
+
with path.open("rb") as f:
|
|
72
|
+
data_bytes = f.read()
|
|
73
|
+
elif isinstance(data, Path):
|
|
74
|
+
with data.open("rb") as f:
|
|
75
|
+
data_bytes = f.read()
|
|
76
|
+
elif isinstance(data, bytes):
|
|
77
|
+
data_bytes = data
|
|
78
|
+
elif isinstance(data, BufferedIOBase):
|
|
79
|
+
data_bytes = data.read()
|
|
80
|
+
else:
|
|
81
|
+
raise TypeError("Unsupported data type")
|
|
82
|
+
try:
|
|
83
|
+
return _raw_rs_to_wls70(doppy.rs.raw.wls70.from_bytes_src(data_bytes))
|
|
84
|
+
except RuntimeError as err:
|
|
85
|
+
raise exceptions.RawParsingError(err) from err
|
|
86
|
+
|
|
87
|
+
def __getitem__(
|
|
88
|
+
self,
|
|
89
|
+
index: int
|
|
90
|
+
| slice
|
|
91
|
+
| list[int]
|
|
92
|
+
| npt.NDArray[np.int64]
|
|
93
|
+
| npt.NDArray[np.bool_]
|
|
94
|
+
| tuple[slice, slice],
|
|
95
|
+
) -> Wls70:
|
|
96
|
+
if isinstance(index, (int, slice, list, np.ndarray)):
|
|
97
|
+
return Wls70(
|
|
98
|
+
time=self.time[index],
|
|
99
|
+
altitude=self.altitude,
|
|
100
|
+
position=self.position[index],
|
|
101
|
+
temperature=self.temperature[index],
|
|
102
|
+
wiper=self.wiper[index],
|
|
103
|
+
cnr=self.cnr[index],
|
|
104
|
+
radial_velocity=self.radial_velocity[index],
|
|
105
|
+
radial_velocity_deviation=self.radial_velocity_deviation[index],
|
|
106
|
+
vh=self.vh[index],
|
|
107
|
+
wind_direction=self.wind_direction[index],
|
|
108
|
+
zonal_wind=self.zonal_wind[index],
|
|
109
|
+
meridional_wind=self.meridional_wind[index],
|
|
110
|
+
vertical_wind=self.vertical_wind[index],
|
|
111
|
+
)
|
|
112
|
+
raise TypeError
|
|
113
|
+
|
|
114
|
+
def sorted_by_time(self) -> Wls70:
|
|
115
|
+
sort_indices = np.argsort(self.time)
|
|
116
|
+
return self[sort_indices]
|
|
117
|
+
|
|
118
|
+
@classmethod
|
|
119
|
+
def merge(cls, raws: Sequence[Wls70]) -> Wls70:
|
|
120
|
+
return cls(
|
|
121
|
+
time=np.concatenate(tuple(r.time for r in raws)),
|
|
122
|
+
altitude=raws[0].altitude,
|
|
123
|
+
position=np.concatenate(tuple(r.position for r in raws)),
|
|
124
|
+
temperature=np.concatenate(tuple(r.temperature for r in raws)),
|
|
125
|
+
wiper=np.concatenate(tuple(r.wiper for r in raws)),
|
|
126
|
+
cnr=np.concatenate(tuple(r.cnr for r in raws)),
|
|
127
|
+
radial_velocity=np.concatenate(tuple(r.radial_velocity for r in raws)),
|
|
128
|
+
radial_velocity_deviation=np.concatenate(
|
|
129
|
+
tuple(r.radial_velocity_deviation for r in raws)
|
|
130
|
+
),
|
|
131
|
+
vh=np.concatenate(tuple(r.vh for r in raws)),
|
|
132
|
+
wind_direction=np.concatenate(tuple(r.wind_direction for r in raws)),
|
|
133
|
+
zonal_wind=np.concatenate(tuple(r.zonal_wind for r in raws)),
|
|
134
|
+
meridional_wind=np.concatenate(tuple(r.meridional_wind for r in raws)),
|
|
135
|
+
vertical_wind=np.concatenate(tuple(r.vertical_wind for r in raws)),
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
def non_strictly_increasing_timesteps_removed(self) -> Wls70:
|
|
139
|
+
if len(self.time) == 0:
|
|
140
|
+
return self
|
|
141
|
+
mask = np.ones_like(self.time, dtype=np.bool_)
|
|
142
|
+
latest_time = self.time[0]
|
|
143
|
+
for i, t in enumerate(self.time[1:], start=1):
|
|
144
|
+
if t <= latest_time:
|
|
145
|
+
mask[i] = False
|
|
146
|
+
else:
|
|
147
|
+
latest_time = t
|
|
148
|
+
return self[mask]
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
def _raw_rs_to_wls70(
|
|
152
|
+
raw_rs: tuple[
|
|
153
|
+
dict[str, npt.NDArray[np.float64]], list[str], npt.NDArray[np.float64]
|
|
154
|
+
],
|
|
155
|
+
) -> Wls70:
|
|
156
|
+
info, cols, data = raw_rs
|
|
157
|
+
altitude = info["altitude"]
|
|
158
|
+
data = data.reshape(-1, len(cols))
|
|
159
|
+
time_ts = data[:, 0]
|
|
160
|
+
time = np.array([datetime64(datetime.utcfromtimestamp(ts)) for ts in time_ts])
|
|
161
|
+
|
|
162
|
+
position = data[:, 1]
|
|
163
|
+
temperature = data[:, 2]
|
|
164
|
+
wiper = np.array(np.isclose(data[:, 3], 1), dtype=np.bool_)
|
|
165
|
+
cnr = data[:, 4::8]
|
|
166
|
+
rws = data[:, 5::8]
|
|
167
|
+
rwsd = data[:, 6::8]
|
|
168
|
+
vh = data[:, 7::8]
|
|
169
|
+
direction = data[:, 8::8]
|
|
170
|
+
u = data[:, 9::8]
|
|
171
|
+
v = data[:, 10::8]
|
|
172
|
+
w = data[:, 11::8]
|
|
173
|
+
|
|
174
|
+
return Wls70(
|
|
175
|
+
time=time,
|
|
176
|
+
altitude=altitude,
|
|
177
|
+
position=position,
|
|
178
|
+
temperature=temperature,
|
|
179
|
+
wiper=wiper,
|
|
180
|
+
cnr=cnr,
|
|
181
|
+
radial_velocity=rws,
|
|
182
|
+
radial_velocity_deviation=rwsd,
|
|
183
|
+
vh=vh,
|
|
184
|
+
wind_direction=direction,
|
|
185
|
+
zonal_wind=u,
|
|
186
|
+
meridional_wind=v,
|
|
187
|
+
vertical_wind=w,
|
|
188
|
+
)
|
doppy/rs.abi3.so
CHANGED
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: doppy
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Classifier: Development Status :: 4 - Beta
|
|
5
5
|
Classifier: Programming Language :: Python :: 3
|
|
6
6
|
Classifier: Programming Language :: Python :: 3.10
|
|
@@ -13,7 +13,7 @@ Requires-Dist: requests
|
|
|
13
13
|
Requires-Dist: urllib3
|
|
14
14
|
Requires-Dist: numpy
|
|
15
15
|
Requires-Dist: netcdf4
|
|
16
|
-
Requires-Dist: typer
|
|
16
|
+
Requires-Dist: typer
|
|
17
17
|
Requires-Dist: matplotlib
|
|
18
18
|
Requires-Dist: scikit-learn
|
|
19
19
|
Requires-Dist: scipy
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
doppy-0.
|
|
2
|
-
doppy-0.
|
|
3
|
-
doppy-0.
|
|
4
|
-
doppy-0.
|
|
5
|
-
doppy-0.
|
|
1
|
+
doppy-0.2.0.dist-info/METADATA,sha256=gCEKLklhaVBhxondzo0x-pLTJ48yuiV3O9krrKSBGZw,1789
|
|
2
|
+
doppy-0.2.0.dist-info/WHEEL,sha256=Eyff-rEDSOF0Q7IZpSwsYe3r6zR3sNi9c9VlO0C9EVo,103
|
|
3
|
+
doppy-0.2.0.dist-info/entry_points.txt,sha256=9b_Ca7vJoh6AwL3W8qAPh_UmJ_1Pa6hi-TDfCTDjvSk,43
|
|
4
|
+
doppy-0.2.0.dist-info/license_files/LICENSE,sha256=V-0iroMNMI8ctnLgUau1kdFvwhkYhr9vi-5kWKxw2wc,1089
|
|
5
|
+
doppy-0.2.0.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=
|
|
8
|
+
doppy/product/wind.py,sha256=t7P6lTp_Nu9HSwFAhCeVFQ0KGxULbT_0J4BuYACp_tE,12014
|
|
9
9
|
doppy/product/__init__.py,sha256=lyp88zs7GBk8uUzkj8lxaXPuYwPa52xXeTwf5qwFddU,103
|
|
10
|
-
doppy/product/stare.py,sha256=
|
|
10
|
+
doppy/product/stare.py,sha256=_z1qdw756AkGHnzAj401ncq0n_azppzVcR8drb9parw,19844
|
|
11
11
|
doppy/bench.py,sha256=iVNYveMVGGRES2oe3Orsn31jQFCKTXOmxRFuFiJ8_OA,248
|
|
12
12
|
doppy/netcdf.py,sha256=uEiJfqxXxHwe5ghT6OpIu8xeY1HgWDW1ENTBlFLOGtE,3416
|
|
13
13
|
doppy/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -15,13 +15,14 @@ doppy/exceptions.py,sha256=1tljrtzp0McQhB6INFXj4yfLjxj6mXor5jLF9HZjp1A,138
|
|
|
15
15
|
doppy/defaults.py,sha256=-il4DWU1HPttlGFoVQTPC7R4pDZERoPvt3kw6xwMKrw,38
|
|
16
16
|
doppy/data/cache.py,sha256=2rxmkWFn-FPy2LNGuCW2Vu4KKLBwIV9sb2gPBA-Jfck,996
|
|
17
17
|
doppy/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
|
-
doppy/data/api.py,sha256=
|
|
18
|
+
doppy/data/api.py,sha256=QaVKj304OPcu8OF5xgtduQzDis8Srn-I6UgR9qb2u9E,1863
|
|
19
19
|
doppy/data/exceptions.py,sha256=6CS6OHIWq8CqlxiceEvC1j0EfWUYoIfM7dW88apQVn4,89
|
|
20
20
|
doppy/raw/halo_sys_params.py,sha256=IXH40xBHyXCGX0ZE79KnSeXRj1wbqoqL0RYUQyBJqdE,3937
|
|
21
|
-
doppy/raw/__init__.py,sha256=
|
|
21
|
+
doppy/raw/__init__.py,sha256=AMHyONuH0aUJUQz20EhlANaq9UjWJtSZf7kWUVx3ZjA,228
|
|
22
|
+
doppy/raw/wls70.py,sha256=APuo6dSd7NFo7WORw7Uo1kI0JROCNAkDUwmHU653U1g,6792
|
|
22
23
|
doppy/raw/halo_bg.py,sha256=kO03yGlKS-DpMMGHYuy_BuidyeUL38TxT5vMn8H_8lE,4809
|
|
23
|
-
doppy/raw/halo_hpl.py,sha256=
|
|
24
|
+
doppy/raw/halo_hpl.py,sha256=_hq0JCNPuZrt3yt4U2KphKvJVNx_Uh4bnGfKbVPRGoA,18625
|
|
24
25
|
doppy/raw/windcube.py,sha256=TVqR3SwfUJYHtPJXnA_b6uUGo_ylVkGGEPob63Zcee0,9685
|
|
25
26
|
doppy/__main__.py,sha256=zrKQJVj0k0ypBQCGK65Czt9G9FZ_qx3ussw6Q9VJ14g,346
|
|
26
|
-
doppy/rs.abi3.so,sha256=
|
|
27
|
-
doppy-0.
|
|
27
|
+
doppy/rs.abi3.so,sha256=UqqfWJzmHNtbh_exG6ueOuKE2Mg7Fez5hn3pEJWj5Rg,2752352
|
|
28
|
+
doppy-0.2.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|