doppy 0.2.0__cp310-abi3-macosx_10_12_x86_64.whl → 0.2.1__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/stare.py CHANGED
@@ -27,6 +27,7 @@ class Stare:
27
27
  radial_velocity: npt.NDArray[np.float64]
28
28
  mask: npt.NDArray[np.bool_]
29
29
  wavelength: float
30
+ system_id: str
30
31
 
31
32
  @classmethod
32
33
  def from_halo_data(
@@ -89,6 +90,7 @@ class Stare:
89
90
  radial_velocity=raw.radial_velocity,
90
91
  mask=mask,
91
92
  wavelength=wavelength,
93
+ system_id=raw.header.system_id,
92
94
  )
93
95
 
94
96
 
doppy/product/wind.py CHANGED
@@ -26,6 +26,7 @@ class Wind:
26
26
  meridional_wind: npt.NDArray[np.float64]
27
27
  vertical_wind: npt.NDArray[np.float64]
28
28
  mask: npt.NDArray[np.bool_]
29
+ system_id: str
29
30
 
30
31
  @functools.cached_property
31
32
  def horizontal_wind_speed(self) -> npt.NDArray[np.float64]:
@@ -93,6 +94,7 @@ class Wind:
93
94
  meridional_wind=wind[:, :, 1],
94
95
  vertical_wind=wind[:, :, 2],
95
96
  mask=mask,
97
+ system_id=raw.header.system_id,
96
98
  )
97
99
 
98
100
  @classmethod
@@ -147,6 +149,7 @@ class Wind:
147
149
  meridional_wind=wind[:, :, 1],
148
150
  vertical_wind=wind[:, :, 2],
149
151
  mask=mask,
152
+ system_id=raw.system_id,
150
153
  )
151
154
 
152
155
  @classmethod
@@ -179,6 +182,7 @@ class Wind:
179
182
  meridional_wind=raw.meridional_wind,
180
183
  vertical_wind=raw.vertical_wind,
181
184
  mask=mask,
185
+ system_id=raw.system_id,
182
186
  )
183
187
 
184
188
 
doppy/raw/halo_hpl.py CHANGED
@@ -8,7 +8,7 @@ from datetime import datetime, timedelta
8
8
  from io import BufferedIOBase
9
9
  from os.path import commonprefix
10
10
  from pathlib import Path
11
- from typing import Any, Sequence, TypeVar, cast
11
+ from typing import Any, Sequence, cast
12
12
 
13
13
  import numpy as np
14
14
  import numpy.typing as npt
@@ -16,8 +16,7 @@ from numpy import datetime64, timedelta64
16
16
 
17
17
  import doppy
18
18
  from doppy import exceptions
19
-
20
- T = TypeVar("T")
19
+ from doppy.utils import merge_all_equal
21
20
 
22
21
 
23
22
  @dataclass
@@ -258,18 +257,12 @@ class HaloHplHeader:
258
257
  )
259
258
 
260
259
 
261
- def _merger(key: str, lst: list[T]) -> T:
262
- if len(set(lst)) != 1:
263
- raise ValueError(f"Cannot merge header key {key} values {lst}")
264
- return lst[0]
265
-
266
-
267
260
  def _merge_headers(headers: list[HaloHplHeader]) -> HaloHplHeader:
268
261
  return HaloHplHeader(
269
262
  filename=commonprefix([h.filename for h in headers]),
270
263
  start_time=np.min([h.start_time for h in headers]),
271
264
  **{
272
- key: _merger(key, [getattr(h, key) for h in headers])
265
+ key: merge_all_equal(key, [getattr(h, key) for h in headers])
273
266
  for key in (
274
267
  "gate_points",
275
268
  "nrays",
doppy/raw/windcube.py CHANGED
@@ -10,6 +10,8 @@ import numpy.typing as npt
10
10
  from netCDF4 import Dataset, num2date
11
11
  from numpy import datetime64
12
12
 
13
+ from doppy.utils import merge_all_equal
14
+
13
15
 
14
16
  @dataclass
15
17
  class WindCube:
@@ -22,6 +24,7 @@ class WindCube:
22
24
  radial_velocity: npt.NDArray[np.float64] # dim: (time, radial_distance)
23
25
  radial_velocity_confidence: npt.NDArray[np.float64] # dim: (time, radial_distance)
24
26
  scan_index: npt.NDArray[np.int64]
27
+ system_id: str
25
28
 
26
29
  @classmethod
27
30
  def from_vad_srcs(
@@ -53,6 +56,7 @@ class WindCube:
53
56
  [r.radial_velocity_confidence for r in raws]
54
57
  ),
55
58
  cnr=np.concatenate([r.cnr for r in raws]),
59
+ system_id=merge_all_equal("system_id", [r.system_id for r in raws]),
56
60
  )
57
61
 
58
62
  def __getitem__(
@@ -75,6 +79,7 @@ class WindCube:
75
79
  radial_velocity_confidence=self.radial_velocity_confidence[index],
76
80
  cnr=self.cnr[index],
77
81
  scan_index=self.scan_index[index],
82
+ system_id=self.system_id,
78
83
  )
79
84
  raise TypeError
80
85
 
@@ -189,6 +194,7 @@ def _from_vad_src(nc: Dataset) -> WindCube:
189
194
  radial_velocity=np.concatenate(radial_wind_speed_list),
190
195
  radial_velocity_confidence=np.concatenate(radial_wind_speed_confidence_list),
191
196
  cnr=np.concatenate(cnr_list),
197
+ system_id=nc.instrument_name,
192
198
  )
193
199
 
194
200
 
doppy/raw/wls70.py CHANGED
@@ -4,7 +4,7 @@ from dataclasses import dataclass
4
4
  from datetime import datetime
5
5
  from io import BufferedIOBase
6
6
  from pathlib import Path
7
- from typing import Sequence
7
+ from typing import Any, Sequence
8
8
 
9
9
  import numpy as np
10
10
  import numpy.typing as npt
@@ -12,6 +12,7 @@ from numpy import datetime64
12
12
 
13
13
  import doppy
14
14
  from doppy import exceptions
15
+ from doppy.utils import merge_all_equal
15
16
 
16
17
 
17
18
  @dataclass
@@ -31,6 +32,7 @@ class Wls70:
31
32
  np.float64
32
33
  ] # v := meridional wind?, dim: (time, altitude)
33
34
  vertical_wind: npt.NDArray[np.float64] # w := vertical wind?, dim: (time, altitude)
35
+ system_id: str
34
36
 
35
37
  @classmethod
36
38
  def from_srcs(
@@ -108,6 +110,7 @@ class Wls70:
108
110
  zonal_wind=self.zonal_wind[index],
109
111
  meridional_wind=self.meridional_wind[index],
110
112
  vertical_wind=self.vertical_wind[index],
113
+ system_id=self.system_id,
111
114
  )
112
115
  raise TypeError
113
116
 
@@ -133,6 +136,7 @@ class Wls70:
133
136
  zonal_wind=np.concatenate(tuple(r.zonal_wind for r in raws)),
134
137
  meridional_wind=np.concatenate(tuple(r.meridional_wind for r in raws)),
135
138
  vertical_wind=np.concatenate(tuple(r.vertical_wind for r in raws)),
139
+ system_id=merge_all_equal("system_id", [r.system_id for r in raws]),
136
140
  )
137
141
 
138
142
  def non_strictly_increasing_timesteps_removed(self) -> Wls70:
@@ -149,12 +153,11 @@ class Wls70:
149
153
 
150
154
 
151
155
  def _raw_rs_to_wls70(
152
- raw_rs: tuple[
153
- dict[str, npt.NDArray[np.float64]], list[str], npt.NDArray[np.float64]
154
- ],
156
+ raw_rs: tuple[dict[str, Any], list[str], npt.NDArray[np.float64]],
155
157
  ) -> Wls70:
156
158
  info, cols, data = raw_rs
157
159
  altitude = info["altitude"]
160
+ system_id = info["system_id"]
158
161
  data = data.reshape(-1, len(cols))
159
162
  time_ts = data[:, 0]
160
163
  time = np.array([datetime64(datetime.utcfromtimestamp(ts)) for ts in time_ts])
@@ -185,4 +188,5 @@ def _raw_rs_to_wls70(
185
188
  zonal_wind=u,
186
189
  meridional_wind=v,
187
190
  vertical_wind=w,
191
+ system_id=system_id,
188
192
  )
doppy/rs.abi3.so CHANGED
Binary file
doppy/utils.py ADDED
@@ -0,0 +1,9 @@
1
+ from typing import TypeVar
2
+
3
+ T = TypeVar("T")
4
+
5
+
6
+ def merge_all_equal(key: str, lst: list[T]) -> T:
7
+ if len(set(lst)) != 1:
8
+ raise ValueError(f"Cannot merge header key {key} values {lst}")
9
+ return lst[0]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: doppy
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Classifier: Development Status :: 4 - Beta
5
5
  Classifier: Programming Language :: Python :: 3
6
6
  Classifier: Programming Language :: Python :: 3.10
@@ -1,15 +1,16 @@
1
- doppy-0.2.0.dist-info/METADATA,sha256=gCEKLklhaVBhxondzo0x-pLTJ48yuiV3O9krrKSBGZw,1789
2
- doppy-0.2.0.dist-info/WHEEL,sha256=HYZ_jUi0IGqtX7pjBFQby7ex6mkgDnUsBYfR-onY1Fw,105
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
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
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=t7P6lTp_Nu9HSwFAhCeVFQ0KGxULbT_0J4BuYACp_tE,12014
8
+ doppy/product/wind.py,sha256=MAK-ZTx37gL7y-x3RbqN_QrZR9kjAiLxdIMn_c6M5UA,12151
9
9
  doppy/product/__init__.py,sha256=lyp88zs7GBk8uUzkj8lxaXPuYwPa52xXeTwf5qwFddU,103
10
- doppy/product/stare.py,sha256=_z1qdw756AkGHnzAj401ncq0n_azppzVcR8drb9parw,19844
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
13
+ doppy/utils.py,sha256=qPtIYBJPaKKTmRWwJI93TFUuhJg7CAoecpyHCm5ZyxI,214
13
14
  doppy/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
15
  doppy/exceptions.py,sha256=1tljrtzp0McQhB6INFXj4yfLjxj6mXor5jLF9HZjp1A,138
15
16
  doppy/defaults.py,sha256=-il4DWU1HPttlGFoVQTPC7R4pDZERoPvt3kw6xwMKrw,38
@@ -19,10 +20,10 @@ doppy/data/api.py,sha256=QaVKj304OPcu8OF5xgtduQzDis8Srn-I6UgR9qb2u9E,1863
19
20
  doppy/data/exceptions.py,sha256=6CS6OHIWq8CqlxiceEvC1j0EfWUYoIfM7dW88apQVn4,89
20
21
  doppy/raw/halo_sys_params.py,sha256=IXH40xBHyXCGX0ZE79KnSeXRj1wbqoqL0RYUQyBJqdE,3937
21
22
  doppy/raw/__init__.py,sha256=AMHyONuH0aUJUQz20EhlANaq9UjWJtSZf7kWUVx3ZjA,228
22
- doppy/raw/wls70.py,sha256=APuo6dSd7NFo7WORw7Uo1kI0JROCNAkDUwmHU653U1g,6792
23
+ doppy/raw/wls70.py,sha256=paFT8PddRemtiDAXxkZVcMljCq_CFw1DHmxLHXY0ZhE,7008
23
24
  doppy/raw/halo_bg.py,sha256=kO03yGlKS-DpMMGHYuy_BuidyeUL38TxT5vMn8H_8lE,4809
24
- doppy/raw/halo_hpl.py,sha256=_hq0JCNPuZrt3yt4U2KphKvJVNx_Uh4bnGfKbVPRGoA,18625
25
- doppy/raw/windcube.py,sha256=TVqR3SwfUJYHtPJXnA_b6uUGo_ylVkGGEPob63Zcee0,9685
25
+ doppy/raw/halo_hpl.py,sha256=VkWemJfGFu-tF-fkhjYwF6dCZPrNQanqL0NBFJVS-TQ,18485
26
+ doppy/raw/windcube.py,sha256=ZaOswQJbVDPBYj5oU1pTYmsX8F-mKIbjJRZmLYEMXP0,9906
26
27
  doppy/__main__.py,sha256=zrKQJVj0k0ypBQCGK65Czt9G9FZ_qx3ussw6Q9VJ14g,346
27
- doppy/rs.abi3.so,sha256=1_5Q7_kGJYsXWOWeyk1jkPDysEzGllJhaOpG5zKrx7E,2876456
28
- doppy-0.2.0.dist-info/RECORD,,
28
+ doppy/rs.abi3.so,sha256=xJ24N0vZB2LmuWNoCt2wUI4f1gFnUVOh5NxgvYPjlSE,2876040
29
+ doppy-0.2.1.dist-info/RECORD,,
File without changes