doppy 0.3.2__cp310-abi3-win_amd64.whl → 0.3.4__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/exceptions.py +4 -0
- doppy/netcdf.py +2 -1
- doppy/product/stare.py +61 -0
- doppy/product/stare_depol.py +115 -10
- doppy/product/wind.py +84 -1
- doppy/raw/halo_bg.py +38 -7
- doppy/raw/windcube.py +3 -3
- doppy/rs.pyd +0 -0
- {doppy-0.3.2.dist-info → doppy-0.3.4.dist-info}/METADATA +66 -64
- {doppy-0.3.2.dist-info → doppy-0.3.4.dist-info}/RECORD +13 -13
- {doppy-0.3.2.dist-info → doppy-0.3.4.dist-info}/WHEEL +0 -0
- {doppy-0.3.2.dist-info → doppy-0.3.4.dist-info}/entry_points.txt +0 -0
- {doppy-0.3.2.dist-info → doppy-0.3.4.dist-info}/licenses/LICENSE +0 -0
doppy/exceptions.py
CHANGED
doppy/netcdf.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
import pathlib
|
|
3
4
|
import warnings
|
|
4
5
|
from types import TracebackType
|
|
5
6
|
from typing import Literal, TypeAlias
|
|
@@ -12,7 +13,7 @@ NetCDFDataType: TypeAlias = Literal["f4", "f8", "i4", "i8", "u4", "u8"]
|
|
|
12
13
|
|
|
13
14
|
|
|
14
15
|
class Dataset:
|
|
15
|
-
def __init__(self, filename: str) -> None:
|
|
16
|
+
def __init__(self, filename: str | pathlib.Path) -> None:
|
|
16
17
|
self.nc = netCDF4.Dataset(filename, mode="w")
|
|
17
18
|
|
|
18
19
|
def __enter__(self) -> Dataset:
|
doppy/product/stare.py
CHANGED
|
@@ -115,6 +115,67 @@ class Stare:
|
|
|
115
115
|
system_id=raw.header.system_id,
|
|
116
116
|
)
|
|
117
117
|
|
|
118
|
+
def write_to_netcdf(self, filename: str | Path) -> None:
|
|
119
|
+
with doppy.netcdf.Dataset(filename) as nc:
|
|
120
|
+
nc.add_dimension("time")
|
|
121
|
+
nc.add_dimension("range")
|
|
122
|
+
nc.add_time(
|
|
123
|
+
name="time",
|
|
124
|
+
dimensions=("time",),
|
|
125
|
+
standard_name="time",
|
|
126
|
+
long_name="Time UTC",
|
|
127
|
+
data=self.time,
|
|
128
|
+
dtype="f8",
|
|
129
|
+
)
|
|
130
|
+
nc.add_variable(
|
|
131
|
+
name="range",
|
|
132
|
+
dimensions=("range",),
|
|
133
|
+
units="m",
|
|
134
|
+
data=self.radial_distance,
|
|
135
|
+
dtype="f4",
|
|
136
|
+
)
|
|
137
|
+
nc.add_variable(
|
|
138
|
+
name="elevation",
|
|
139
|
+
dimensions=("time",),
|
|
140
|
+
units="degrees",
|
|
141
|
+
data=self.elevation,
|
|
142
|
+
dtype="f4",
|
|
143
|
+
long_name="elevation from horizontal",
|
|
144
|
+
)
|
|
145
|
+
nc.add_variable(
|
|
146
|
+
name="beta_raw",
|
|
147
|
+
dimensions=("time", "range"),
|
|
148
|
+
units="sr-1 m-1",
|
|
149
|
+
data=self.beta,
|
|
150
|
+
dtype="f4",
|
|
151
|
+
)
|
|
152
|
+
nc.add_variable(
|
|
153
|
+
name="beta",
|
|
154
|
+
dimensions=("time", "range"),
|
|
155
|
+
units="sr-1 m-1",
|
|
156
|
+
data=self.beta,
|
|
157
|
+
dtype="f4",
|
|
158
|
+
mask=self.mask,
|
|
159
|
+
)
|
|
160
|
+
nc.add_variable(
|
|
161
|
+
name="v",
|
|
162
|
+
dimensions=("time", "range"),
|
|
163
|
+
units="m s-1",
|
|
164
|
+
long_name="Doppler velocity",
|
|
165
|
+
data=self.radial_velocity,
|
|
166
|
+
dtype="f4",
|
|
167
|
+
mask=self.mask,
|
|
168
|
+
)
|
|
169
|
+
nc.add_scalar_variable(
|
|
170
|
+
name="wavelength",
|
|
171
|
+
units="m",
|
|
172
|
+
standard_name="radiation_wavelength",
|
|
173
|
+
data=self.wavelength,
|
|
174
|
+
dtype="f4",
|
|
175
|
+
)
|
|
176
|
+
nc.add_attribute("serial_number", self.system_id)
|
|
177
|
+
nc.add_attribute("doppy_version", doppy.__version__)
|
|
178
|
+
|
|
118
179
|
|
|
119
180
|
def _compute_noise_mask(
|
|
120
181
|
intensity: npt.NDArray[np.float64],
|
doppy/product/stare_depol.py
CHANGED
|
@@ -8,6 +8,7 @@ from typing import Sequence
|
|
|
8
8
|
import numpy as np
|
|
9
9
|
import numpy.typing as npt
|
|
10
10
|
|
|
11
|
+
import doppy
|
|
11
12
|
from doppy import options
|
|
12
13
|
from doppy.product.stare import Stare
|
|
13
14
|
|
|
@@ -70,8 +71,6 @@ class StareDepol:
|
|
|
70
71
|
radial_velocity: npt.NDArray[np.float64]
|
|
71
72
|
mask: npt.NDArray[np.bool_]
|
|
72
73
|
depolarisation: npt.NDArray[np.float64]
|
|
73
|
-
mask_depolarisation: npt.NDArray[np.bool_]
|
|
74
|
-
mask_beta_cross: npt.NDArray[np.bool_]
|
|
75
74
|
polariser_bleed_through: float
|
|
76
75
|
wavelength: float
|
|
77
76
|
system_id: str
|
|
@@ -93,6 +92,12 @@ class StareDepol:
|
|
|
93
92
|
The amount of bleed-through from the polariser.
|
|
94
93
|
"""
|
|
95
94
|
|
|
95
|
+
if co.beta.shape[1] != cross.beta.shape[1]:
|
|
96
|
+
raise doppy.exceptions.ShapeError(
|
|
97
|
+
"Range dimension mismatch in co and cross: "
|
|
98
|
+
f"{co.beta.shape[1]} vs {cross.beta.shape[1]}"
|
|
99
|
+
)
|
|
100
|
+
|
|
96
101
|
if not np.isclose(co.wavelength, cross.wavelength):
|
|
97
102
|
raise ValueError(
|
|
98
103
|
"Different wavelength in co and cross: "
|
|
@@ -106,12 +111,6 @@ class StareDepol:
|
|
|
106
111
|
if not np.allclose(co.radial_distance, cross.radial_distance, atol=1):
|
|
107
112
|
raise ValueError("Different radial distance in co and cross")
|
|
108
113
|
|
|
109
|
-
if co.beta.shape[1] != cross.beta.shape[1]:
|
|
110
|
-
raise ValueError(
|
|
111
|
-
"Range dimension mismatch in co and cross: "
|
|
112
|
-
f"{co.beta.shape[1]} vs {cross.beta.shape[1]}"
|
|
113
|
-
)
|
|
114
|
-
|
|
115
114
|
ind = np.searchsorted(cross.time, co.time, side="left")
|
|
116
115
|
pick_ind = ind < len(cross.time)
|
|
117
116
|
time_diff_threshold = 2 * np.median(np.diff(co.time))
|
|
@@ -141,12 +140,18 @@ class StareDepol:
|
|
|
141
140
|
self.radial_velocity = co.radial_velocity
|
|
142
141
|
self.mask = co.mask
|
|
143
142
|
self.depolarisation = depolarisation
|
|
144
|
-
self.mask_depolarisation = np.isnan(depolarisation)
|
|
145
|
-
self.mask_beta_cross = np.isnan(self.beta_cross)
|
|
146
143
|
self.polariser_bleed_through = polariser_bleed_through
|
|
147
144
|
self.wavelength = co.wavelength
|
|
148
145
|
self.system_id = co.system_id
|
|
149
146
|
|
|
147
|
+
@property
|
|
148
|
+
def mask_depolarisation(self) -> npt.NDArray[np.bool_]:
|
|
149
|
+
return np.isnan(self.depolarisation)
|
|
150
|
+
|
|
151
|
+
@property
|
|
152
|
+
def mask_beta_cross(self) -> npt.NDArray[np.bool_]:
|
|
153
|
+
return np.isnan(self.beta_cross)
|
|
154
|
+
|
|
150
155
|
@classmethod
|
|
151
156
|
def from_halo_data(
|
|
152
157
|
cls,
|
|
@@ -178,3 +183,103 @@ class StareDepol:
|
|
|
178
183
|
bg_correction_method=bg_correction_method,
|
|
179
184
|
)
|
|
180
185
|
return cls(co, cross, polariser_bleed_through)
|
|
186
|
+
|
|
187
|
+
def write_to_netcdf(self, filename: str | Path) -> None:
|
|
188
|
+
with doppy.netcdf.Dataset(filename) as nc:
|
|
189
|
+
nc.add_dimension("time")
|
|
190
|
+
nc.add_dimension("range")
|
|
191
|
+
nc.add_time(
|
|
192
|
+
name="time",
|
|
193
|
+
dimensions=("time",),
|
|
194
|
+
standard_name="time",
|
|
195
|
+
long_name="Time UTC",
|
|
196
|
+
data=self.time,
|
|
197
|
+
dtype="f8",
|
|
198
|
+
)
|
|
199
|
+
nc.add_variable(
|
|
200
|
+
name="range",
|
|
201
|
+
dimensions=("range",),
|
|
202
|
+
units="m",
|
|
203
|
+
data=self.radial_distance,
|
|
204
|
+
dtype="f4",
|
|
205
|
+
)
|
|
206
|
+
nc.add_variable(
|
|
207
|
+
name="elevation",
|
|
208
|
+
dimensions=("time",),
|
|
209
|
+
units="degrees",
|
|
210
|
+
data=self.elevation,
|
|
211
|
+
dtype="f4",
|
|
212
|
+
long_name="elevation from horizontal",
|
|
213
|
+
)
|
|
214
|
+
nc.add_variable(
|
|
215
|
+
name="beta_raw",
|
|
216
|
+
dimensions=("time", "range"),
|
|
217
|
+
units="sr-1 m-1",
|
|
218
|
+
data=self.beta,
|
|
219
|
+
dtype="f4",
|
|
220
|
+
)
|
|
221
|
+
nc.add_variable(
|
|
222
|
+
name="beta",
|
|
223
|
+
dimensions=("time", "range"),
|
|
224
|
+
units="sr-1 m-1",
|
|
225
|
+
data=self.beta,
|
|
226
|
+
dtype="f4",
|
|
227
|
+
mask=self.mask,
|
|
228
|
+
)
|
|
229
|
+
nc.add_variable(
|
|
230
|
+
name="v",
|
|
231
|
+
dimensions=("time", "range"),
|
|
232
|
+
units="m s-1",
|
|
233
|
+
long_name="Doppler velocity",
|
|
234
|
+
data=self.radial_velocity,
|
|
235
|
+
dtype="f4",
|
|
236
|
+
mask=self.mask,
|
|
237
|
+
)
|
|
238
|
+
nc.add_scalar_variable(
|
|
239
|
+
name="wavelength",
|
|
240
|
+
units="m",
|
|
241
|
+
standard_name="radiation_wavelength",
|
|
242
|
+
data=self.wavelength,
|
|
243
|
+
dtype="f4",
|
|
244
|
+
)
|
|
245
|
+
nc.add_variable(
|
|
246
|
+
name="depolarisation_raw",
|
|
247
|
+
dimensions=("time", "range"),
|
|
248
|
+
units="1",
|
|
249
|
+
data=self.depolarisation,
|
|
250
|
+
dtype="f4",
|
|
251
|
+
mask=self.mask_depolarisation,
|
|
252
|
+
)
|
|
253
|
+
nc.add_variable(
|
|
254
|
+
name="depolarisation",
|
|
255
|
+
dimensions=("time", "range"),
|
|
256
|
+
units="1",
|
|
257
|
+
data=self.depolarisation,
|
|
258
|
+
dtype="f4",
|
|
259
|
+
mask=self.mask | self.mask_depolarisation,
|
|
260
|
+
)
|
|
261
|
+
nc.add_variable(
|
|
262
|
+
name="beta_cross_raw",
|
|
263
|
+
dimensions=("time", "range"),
|
|
264
|
+
units="sr-1 m-1",
|
|
265
|
+
data=self.beta_cross,
|
|
266
|
+
mask=self.mask_beta_cross,
|
|
267
|
+
dtype="f4",
|
|
268
|
+
)
|
|
269
|
+
nc.add_variable(
|
|
270
|
+
name="beta_cross",
|
|
271
|
+
dimensions=("time", "range"),
|
|
272
|
+
units="sr-1 m-1",
|
|
273
|
+
data=self.beta_cross,
|
|
274
|
+
mask=self.mask | self.mask_beta_cross,
|
|
275
|
+
dtype="f4",
|
|
276
|
+
)
|
|
277
|
+
nc.add_scalar_variable(
|
|
278
|
+
name="polariser_bleed_through",
|
|
279
|
+
units="1",
|
|
280
|
+
long_name="Polariser bleed-through",
|
|
281
|
+
data=self.polariser_bleed_through,
|
|
282
|
+
dtype="f4",
|
|
283
|
+
)
|
|
284
|
+
nc.add_attribute("serial_number", self.system_id)
|
|
285
|
+
nc.add_attribute("doppy_version", doppy.__version__)
|
doppy/product/wind.py
CHANGED
|
@@ -32,6 +32,19 @@ class Wind:
|
|
|
32
32
|
vertical_wind: npt.NDArray[np.float64]
|
|
33
33
|
mask: npt.NDArray[np.bool_]
|
|
34
34
|
system_id: str
|
|
35
|
+
options: Options | None
|
|
36
|
+
|
|
37
|
+
@property
|
|
38
|
+
def mask_zonal_wind(self) -> npt.NDArray[np.bool_]:
|
|
39
|
+
return np.isnan(self.zonal_wind)
|
|
40
|
+
|
|
41
|
+
@property
|
|
42
|
+
def mask_meridional_wind(self) -> npt.NDArray[np.bool_]:
|
|
43
|
+
return np.isnan(self.meridional_wind)
|
|
44
|
+
|
|
45
|
+
@property
|
|
46
|
+
def mask_vertical_wind(self) -> npt.NDArray[np.bool_]:
|
|
47
|
+
return np.isnan(self.vertical_wind)
|
|
35
48
|
|
|
36
49
|
@functools.cached_property
|
|
37
50
|
def horizontal_wind_speed(self) -> npt.NDArray[np.float64]:
|
|
@@ -104,6 +117,7 @@ class Wind:
|
|
|
104
117
|
vertical_wind=wind[:, :, 2],
|
|
105
118
|
mask=mask,
|
|
106
119
|
system_id=raw.header.system_id,
|
|
120
|
+
options=options,
|
|
107
121
|
)
|
|
108
122
|
|
|
109
123
|
@classmethod
|
|
@@ -151,7 +165,7 @@ class Wind:
|
|
|
151
165
|
elevation = np.array(elevation_list)
|
|
152
166
|
wind = np.concatenate(wind_list)
|
|
153
167
|
rmse = np.concatenate(rmse_list)
|
|
154
|
-
mask = _compute_mask(wind, rmse)
|
|
168
|
+
mask = _compute_mask(wind, rmse) | np.any(np.isnan(wind), axis=2)
|
|
155
169
|
if not np.allclose(elevation, elevation[0]):
|
|
156
170
|
raise ValueError("Elevation is expected to stay same")
|
|
157
171
|
height = np.array(raw.height, dtype=np.float64)
|
|
@@ -163,6 +177,7 @@ class Wind:
|
|
|
163
177
|
vertical_wind=wind[:, :, 2],
|
|
164
178
|
mask=mask,
|
|
165
179
|
system_id=raw.system_id,
|
|
180
|
+
options=options,
|
|
166
181
|
)
|
|
167
182
|
|
|
168
183
|
@classmethod
|
|
@@ -211,8 +226,76 @@ class Wind:
|
|
|
211
226
|
vertical_wind=raw.vertical_wind,
|
|
212
227
|
mask=mask,
|
|
213
228
|
system_id=raw.system_id,
|
|
229
|
+
options=options,
|
|
214
230
|
)
|
|
215
231
|
|
|
232
|
+
def write_to_netcdf(self, filename: str | Path) -> None:
|
|
233
|
+
with doppy.netcdf.Dataset(filename) as nc:
|
|
234
|
+
nc.add_dimension("time")
|
|
235
|
+
nc.add_dimension("height")
|
|
236
|
+
nc.add_time(
|
|
237
|
+
name="time",
|
|
238
|
+
dimensions=("time",),
|
|
239
|
+
standard_name="time",
|
|
240
|
+
long_name="Time UTC",
|
|
241
|
+
data=self.time,
|
|
242
|
+
dtype="f8",
|
|
243
|
+
)
|
|
244
|
+
nc.add_variable(
|
|
245
|
+
name="height",
|
|
246
|
+
dimensions=("height",),
|
|
247
|
+
units="m",
|
|
248
|
+
data=self.height,
|
|
249
|
+
dtype="f4",
|
|
250
|
+
)
|
|
251
|
+
nc.add_variable(
|
|
252
|
+
name="uwind_raw",
|
|
253
|
+
dimensions=("time", "height"),
|
|
254
|
+
units="m s-1",
|
|
255
|
+
data=self.zonal_wind,
|
|
256
|
+
mask=self.mask_zonal_wind,
|
|
257
|
+
dtype="f4",
|
|
258
|
+
long_name="Non-screened zonal wind",
|
|
259
|
+
)
|
|
260
|
+
nc.add_variable(
|
|
261
|
+
name="uwind",
|
|
262
|
+
dimensions=("time", "height"),
|
|
263
|
+
units="m s-1",
|
|
264
|
+
data=self.zonal_wind,
|
|
265
|
+
mask=self.mask | self.mask_zonal_wind,
|
|
266
|
+
dtype="f4",
|
|
267
|
+
long_name="Zonal wind",
|
|
268
|
+
)
|
|
269
|
+
nc.add_variable(
|
|
270
|
+
name="vwind_raw",
|
|
271
|
+
dimensions=("time", "height"),
|
|
272
|
+
units="m s-1",
|
|
273
|
+
data=self.meridional_wind,
|
|
274
|
+
mask=self.mask_meridional_wind,
|
|
275
|
+
dtype="f4",
|
|
276
|
+
long_name="Non-screened meridional wind",
|
|
277
|
+
)
|
|
278
|
+
nc.add_variable(
|
|
279
|
+
name="vwind",
|
|
280
|
+
dimensions=("time", "height"),
|
|
281
|
+
units="m s-1",
|
|
282
|
+
data=self.meridional_wind,
|
|
283
|
+
mask=self.mask | self.mask_meridional_wind,
|
|
284
|
+
dtype="f4",
|
|
285
|
+
long_name="Meridional wind",
|
|
286
|
+
)
|
|
287
|
+
nc.add_attribute("serial_number", self.system_id)
|
|
288
|
+
nc.add_attribute("doppy_version", doppy.__version__)
|
|
289
|
+
if self.options is not None and self.options.azimuth_offset_deg is not None:
|
|
290
|
+
nc.add_scalar_variable(
|
|
291
|
+
name="azimuth_offset",
|
|
292
|
+
units="degrees",
|
|
293
|
+
data=self.options.azimuth_offset_deg,
|
|
294
|
+
dtype="f4",
|
|
295
|
+
long_name="Azimuth offset of the instrument "
|
|
296
|
+
"(positive clockwise from north)",
|
|
297
|
+
)
|
|
298
|
+
|
|
216
299
|
|
|
217
300
|
def _compute_wind(
|
|
218
301
|
raw: doppy.raw.HaloHpl | doppy.raw.WindCube,
|
doppy/raw/halo_bg.py
CHANGED
|
@@ -12,6 +12,8 @@ import numpy as np
|
|
|
12
12
|
import numpy.typing as npt
|
|
13
13
|
from numpy import datetime64
|
|
14
14
|
|
|
15
|
+
from doppy.exceptions import RawParsingError
|
|
16
|
+
|
|
15
17
|
|
|
16
18
|
@dataclass
|
|
17
19
|
class HaloBg:
|
|
@@ -30,6 +32,28 @@ class HaloBg:
|
|
|
30
32
|
| Sequence[tuple[bytes, str]]
|
|
31
33
|
| Sequence[tuple[BufferedIOBase, str]],
|
|
32
34
|
) -> list[HaloBg]:
|
|
35
|
+
"""
|
|
36
|
+
Creates a list of `HaloBg` instances from various data sources.
|
|
37
|
+
|
|
38
|
+
Parameters
|
|
39
|
+
----------
|
|
40
|
+
data
|
|
41
|
+
A sequence of data source identifiers which can be file paths (as strings
|
|
42
|
+
or `Path` objects), tuples of raw byte data with filenames, or tuples of
|
|
43
|
+
buffered reader streams with filenames.
|
|
44
|
+
|
|
45
|
+
Returns
|
|
46
|
+
-------
|
|
47
|
+
list[HaloBg]
|
|
48
|
+
A list of `HaloBg` instances created from the provided data sources. Data
|
|
49
|
+
sources that cause a raw parsing error are ignored and not included in
|
|
50
|
+
the resulting list.
|
|
51
|
+
|
|
52
|
+
Raises
|
|
53
|
+
------
|
|
54
|
+
TypeError
|
|
55
|
+
If `data` is not a list or tuple of supported types.
|
|
56
|
+
"""
|
|
33
57
|
if not isinstance(data, (list, tuple)):
|
|
34
58
|
raise TypeError("data should be list or tuple")
|
|
35
59
|
# TODO: rust reader and proper type checking
|
|
@@ -46,10 +70,13 @@ class HaloBg:
|
|
|
46
70
|
data_normalised.append(item)
|
|
47
71
|
elif isinstance(item, tuple) and isinstance(item[0], BufferedIOBase):
|
|
48
72
|
data_normalised.append((item[0].read(), item[1]))
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
73
|
+
bgs = []
|
|
74
|
+
for data_bytes, filename in data_normalised:
|
|
75
|
+
try:
|
|
76
|
+
bgs.append(HaloBg.from_src(data_bytes, filename))
|
|
77
|
+
except RawParsingError:
|
|
78
|
+
continue
|
|
79
|
+
return bgs
|
|
53
80
|
|
|
54
81
|
@classmethod
|
|
55
82
|
def from_src(
|
|
@@ -124,9 +151,13 @@ def _from_src(data: BufferedIOBase, filename: str) -> HaloBg:
|
|
|
124
151
|
try:
|
|
125
152
|
signal = np.array(list(map(float, data_bytes.split(b"\r\n"))))[np.newaxis]
|
|
126
153
|
except ValueError:
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
154
|
+
try:
|
|
155
|
+
signal = np.array(
|
|
156
|
+
list(map(float, data_bytes.replace(b",", b".").split(b"\r\n")))
|
|
157
|
+
)[np.newaxis]
|
|
158
|
+
except ValueError as err:
|
|
159
|
+
raise RawParsingError(err) from err
|
|
160
|
+
|
|
130
161
|
return HaloBg(time, signal)
|
|
131
162
|
|
|
132
163
|
|
doppy/raw/windcube.py
CHANGED
|
@@ -216,7 +216,7 @@ def _extract_float64_or_raise(nc: Dataset) -> npt.NDArray[np.float64]:
|
|
|
216
216
|
if nc.units != "dB":
|
|
217
217
|
raise ValueError(f"Unexpected units for {nc.name}")
|
|
218
218
|
if nc[:].mask is not np.bool_(False):
|
|
219
|
-
|
|
219
|
+
pass # ignore that array contains masked values
|
|
220
220
|
return np.array(nc[:].data, dtype=np.float64)
|
|
221
221
|
case "radial_wind_speed":
|
|
222
222
|
if nc.dimensions != ("time", "gate_index"):
|
|
@@ -224,7 +224,7 @@ def _extract_float64_or_raise(nc: Dataset) -> npt.NDArray[np.float64]:
|
|
|
224
224
|
if nc.units != "m s-1":
|
|
225
225
|
raise ValueError(f"Unexpected units for {nc.name}")
|
|
226
226
|
if nc[:].mask is not np.bool_(False):
|
|
227
|
-
|
|
227
|
+
pass # ignore that array contains masked values
|
|
228
228
|
return np.array(nc[:].data, dtype=np.float64)
|
|
229
229
|
case "radial_wind_speed_ci":
|
|
230
230
|
if nc.dimensions != ("time", "gate_index"):
|
|
@@ -232,7 +232,7 @@ def _extract_float64_or_raise(nc: Dataset) -> npt.NDArray[np.float64]:
|
|
|
232
232
|
if nc.units != "percent":
|
|
233
233
|
raise ValueError(f"Unexpected units for {nc.name}")
|
|
234
234
|
if nc[:].mask is not np.bool_(False):
|
|
235
|
-
|
|
235
|
+
pass # ignore that array contains masked values
|
|
236
236
|
return np.array(nc[:].data, dtype=np.float64)
|
|
237
237
|
case "azimuth" | "elevation":
|
|
238
238
|
if nc.dimensions != ("time",):
|
doppy/rs.pyd
CHANGED
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: doppy
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.4
|
|
4
4
|
Classifier: Development Status :: 4 - Beta
|
|
5
5
|
Classifier: Programming Language :: Python :: 3
|
|
6
6
|
Classifier: Programming Language :: Python :: 3.10
|
|
@@ -44,8 +44,8 @@ Project-URL: Bug Tracker, https://github.com/actris-cloudnet/doppy/issues
|
|
|
44
44
|
|
|
45
45
|
## Products
|
|
46
46
|
|
|
47
|
-
- [
|
|
48
|
-
- [
|
|
47
|
+
- Stare: [src](https://github.com/actris-cloudnet/doppy/blob/main/src/doppy/product/stare.py), [Cloudnet examples](https://cloudnet.fmi.fi/search/visualizations?experimental=true&product=doppler-lidar&dateFrom=2024-06-05&dateTo=2024-06-05)
|
|
48
|
+
- Wind: [src](https://github.com/actris-cloudnet/doppy/blob/main/src/doppy/product/wind.py), [Cloudnet examples](https://cloudnet.fmi.fi/search/visualizations?experimental=true&product=doppler-lidar-wind&dateFrom=2024-06-05&dateTo=2024-06-05)
|
|
49
49
|
|
|
50
50
|
## Instruments
|
|
51
51
|
|
|
@@ -61,6 +61,8 @@ pip install doppy
|
|
|
61
61
|
|
|
62
62
|
## Usage
|
|
63
63
|
|
|
64
|
+
### Stare
|
|
65
|
+
|
|
64
66
|
```python
|
|
65
67
|
import doppy
|
|
66
68
|
|
|
@@ -70,68 +72,68 @@ stare = doppy.product.Stare.from_halo_data(
|
|
|
70
72
|
bg_correction_method=doppy.options.BgCorrectionMethod.FIT,
|
|
71
73
|
)
|
|
72
74
|
|
|
75
|
+
stare.write_to_netcdf(FILENAME)
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Stare with depolarisation
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
import doppy
|
|
82
|
+
|
|
83
|
+
stare_depol = doppy.product.StareDepol.from_halo_data(
|
|
84
|
+
co_data=LIST_OF_STARE_CO_FILE_PATHS,
|
|
85
|
+
co_data_bg=LIST_OF_BACKGROUND_CO_FILE_PATHS,
|
|
86
|
+
cross_data=LIST_OF_STARE_CROSS_FILE_PATHS,
|
|
87
|
+
cross_data_bg=LIST_OF_BACKGROUND_CROSS_FILE_PATHS,
|
|
88
|
+
bg_correction_method=doppy.options.BgCorrectionMethod.FIT,
|
|
89
|
+
polariser_bleed_through=0,
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
stare_depol.write_to_netcdf(FILENAME)
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Wind
|
|
96
|
+
|
|
97
|
+
```python
|
|
98
|
+
import doppy
|
|
99
|
+
|
|
100
|
+
wind = doppy.product.Wind.from_halo_data(
|
|
101
|
+
data=LIST_OF_WIND_SCAN_HPL_FILES,
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
# You can also pass instrument azimuth offset in degrees as an option
|
|
105
|
+
wind = doppy.product.Wind.from_halo_data(
|
|
106
|
+
data=LIST_OF_WIND_SCAN_HPL_FILES,
|
|
107
|
+
options=doppy.product.wind.Options(azimuth_offset_deg=30),
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
# For windcube wls200s use
|
|
111
|
+
wind = doppy.product.Wind.from_windcube_data(
|
|
112
|
+
data=LIST_OF_VAD_NETCDF_FILES,
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
# For windcube wls70 use
|
|
116
|
+
wind = doppy.product.Wind.from_wls70_data(
|
|
117
|
+
data=LIST_OF_RTD_FILES,
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
wind.write_to_netcdf(FILENAME)
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Raw files
|
|
124
|
+
|
|
125
|
+
```python
|
|
126
|
+
import doppy
|
|
127
|
+
|
|
128
|
+
# Halo
|
|
129
|
+
raws_hpl = doppy.raw.HaloHpl.from_srcs(LIST_OF_HPL_FILES)
|
|
130
|
+
raws_bg = doppy.raw.HaloBg.from_srcs(LIST_OF_BACKGROUND_FILES)
|
|
131
|
+
raw_system_params = doppy.raw.HaloSysParams.from_src(SYSTEM_PARAMS_FILENAME)
|
|
73
132
|
|
|
74
|
-
|
|
75
|
-
|
|
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_attribute("serial_number", stare.system_id)
|
|
133
|
-
.add_attribute("doppy_version", doppy.__version__)
|
|
134
|
-
).close()
|
|
133
|
+
# Windcube WLS200S
|
|
134
|
+
raws_wls200s = doppy.raw.WindCube.from_vad_srcs(LIST_OF_VAD_NETCDF_FILES)
|
|
135
135
|
|
|
136
|
+
# Windcube WLS70
|
|
137
|
+
raws_wls70 = doppy.raw.Wls70.from_srcs(LIST_OF_RTD_FILES)
|
|
136
138
|
```
|
|
137
139
|
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
doppy-0.3.
|
|
2
|
-
doppy-0.3.
|
|
3
|
-
doppy-0.3.
|
|
4
|
-
doppy-0.3.
|
|
1
|
+
doppy-0.3.4.dist-info/METADATA,sha256=WXh04XFnBQcfDpb0B9J0lUyLE5j5R0QymYWrsKb0794,4274
|
|
2
|
+
doppy-0.3.4.dist-info/WHEEL,sha256=kQSgRz4wLs1NoHeP8cPfiUAbi-20athsJLkIuWHUegk,95
|
|
3
|
+
doppy-0.3.4.dist-info/entry_points.txt,sha256=9b_Ca7vJoh6AwL3W8qAPh_UmJ_1Pa6hi-TDfCTDjvSk,43
|
|
4
|
+
doppy-0.3.4.dist-info/licenses/LICENSE,sha256=RIAxFjJLTw0wQ3_SM73JoTeppoD99DJJ72cjvVuRrW4,1110
|
|
5
5
|
doppy/bench.py,sha256=fLN2iS5mmoYH4qZjD80Vl1h9lp3C-KDfhj9fteWRPtM,260
|
|
6
6
|
doppy/data/api.py,sha256=c3zbZI3IV7HnzhyFzJpUPOFT20eYFuQlJ5K_1ZEe1Pg,1921
|
|
7
7
|
doppy/data/cache.py,sha256=VNPB3XsWGwY2bNXBs1r_sEWF4qBq_U7sJSlSmt1Rxm8,1033
|
|
8
8
|
doppy/data/exceptions.py,sha256=JOyekvUO-Ew4ZVezf3_IxZOrPN0IksfUILd8R2YcSts,95
|
|
9
9
|
doppy/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
10
|
doppy/defaults.py,sha256=nhxcZcFd2jyDVbq0azwtekEJEjiz8k21MZmXFlSXAjo,40
|
|
11
|
-
doppy/exceptions.py,sha256=
|
|
12
|
-
doppy/netcdf.py,sha256=
|
|
11
|
+
doppy/exceptions.py,sha256=IUF8D_d-QOvtemUSEMg1raXDWA3dSXQ2MUBvlwgm1rU,197
|
|
12
|
+
doppy/netcdf.py,sha256=W5YPbsv6CQ2Ycy4sFaIyjfn9YjvDgygczm8j9E1_uAg,4054
|
|
13
13
|
doppy/options.py,sha256=uyIKM_G2GtbmV6Gve8o13eIShQqUwsnYZ41mhX2ypGE,218
|
|
14
|
-
doppy/product/stare.py,sha256=
|
|
15
|
-
doppy/product/stare_depol.py,sha256=
|
|
16
|
-
doppy/product/wind.py,sha256=
|
|
14
|
+
doppy/product/stare.py,sha256=ipZuRO8Bc5jWDlPYAxDZQ91gR8OMmnK-D7mNiKo2E7I,23322
|
|
15
|
+
doppy/product/stare_depol.py,sha256=D0bVRZT4EP-pYHE84lioUxiuB3a2Cl6LvOgCE-YPJZY,9938
|
|
16
|
+
doppy/product/wind.py,sha256=da2ZHksxH1A-pN0qbbKx3NkwlooaGfyKlXeTuS92VQQ,16525
|
|
17
17
|
doppy/product/__init__.py,sha256=xoBEXuhid-bvoof5Ogzpt1dKIhJgNMRyrAinCqUOUUI,241
|
|
18
18
|
doppy/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
|
-
doppy/raw/halo_bg.py,sha256=
|
|
19
|
+
doppy/raw/halo_bg.py,sha256=TrqJDUXa1atW2w4UDN9PPx2Mzrc7D9Q2Ndph0yB65p0,5988
|
|
20
20
|
doppy/raw/halo_hpl.py,sha256=VF8JQ_5N8adLsGNJOlhvKwz0LtNd4oCU76hETe5Vuhk,19007
|
|
21
21
|
doppy/raw/halo_sys_params.py,sha256=nT9r4F-H0Rf5njee5rYzzLTCm7vm3N_pdJqrW6RtyK4,4041
|
|
22
|
-
doppy/raw/windcube.py,sha256=
|
|
22
|
+
doppy/raw/windcube.py,sha256=XZEocaAM836ODcx5ZAvJWMWu-hOLDiy68oEGHv39rww,10262
|
|
23
23
|
doppy/raw/wls70.py,sha256=2OhjmQ1SoAmjN4npOKFH0eFLyo9RssO7sr-gOtxjAho,7622
|
|
24
24
|
doppy/raw/__init__.py,sha256=J06q7iykSAWIif4XAxI1jOszkARvLFBR1eU-B9yUXMw,235
|
|
25
25
|
doppy/utils.py,sha256=lENDTzMVjCOA15Va9WZ6cou-foL5bGbNt4-NbDcnXpc,223
|
|
26
26
|
doppy/__init__.py,sha256=Af7_8p3oN1nTqS9fo0mVKVuiKf5CAEK69uQa32CSFBA,197
|
|
27
27
|
doppy/__main__.py,sha256=38hIWWfanILuBBGorQiAaleSC4qYJoIxuzVBkxf7Dng,371
|
|
28
|
-
doppy/rs.pyd,sha256=
|
|
29
|
-
doppy-0.3.
|
|
28
|
+
doppy/rs.pyd,sha256=xjawDfh3xMkWLqbcN9pDVB9LBM_iUK5IqMLY6WnwSI0,2100736
|
|
29
|
+
doppy-0.3.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|