doppy 0.0.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.

@@ -0,0 +1,104 @@
1
+ from __future__ import annotations
2
+
3
+ import io
4
+ from dataclasses import dataclass
5
+ from datetime import datetime
6
+ from io import BufferedIOBase
7
+ from pathlib import Path
8
+ from typing import Iterable
9
+
10
+ import numpy as np
11
+ import numpy.typing as npt
12
+ from numpy import datetime64
13
+
14
+
15
+ @dataclass
16
+ class HaloSysParams:
17
+ time: npt.NDArray[datetime64] # dim: (time, )
18
+ internal_temperature: npt.NDArray[np.float64] # dim: (time, ), unit: degree Celsius
19
+ internal_relative_humidity: npt.NDArray[np.float64] # dim: (time, )
20
+ supply_voltage: npt.NDArray[np.float64] # dim: (time, )
21
+ acquisition_card_temperature: npt.NDArray[np.float64] # dim: (time, )
22
+ pitch: npt.NDArray[np.float64] # dim: (time, )
23
+ roll: npt.NDArray[np.float64] # dim: (time, )
24
+
25
+ @classmethod
26
+ def from_src(cls, data: str | Path | bytes | BufferedIOBase) -> HaloSysParams:
27
+ if isinstance(data, str):
28
+ path = Path(data)
29
+ with path.open("rb") as f:
30
+ return _from_src(f)
31
+ elif isinstance(data, Path):
32
+ with data.open("rb") as f:
33
+ return _from_src(f)
34
+ elif isinstance(data, bytes):
35
+ return _from_src(io.BytesIO(data))
36
+ elif isinstance(data, BufferedIOBase):
37
+ return _from_src(data)
38
+ else:
39
+ raise TypeError("Unsupported data type")
40
+
41
+ @classmethod
42
+ def merge(cls, raws: Iterable[HaloSysParams]) -> HaloSysParams:
43
+ return cls(
44
+ np.concatenate(tuple(r.time for r in raws)),
45
+ np.concatenate(tuple(r.internal_temperature for r in raws)),
46
+ np.concatenate(tuple(r.internal_relative_humidity for r in raws)),
47
+ np.concatenate(tuple(r.supply_voltage for r in raws)),
48
+ np.concatenate(tuple(r.acquisition_card_temperature for r in raws)),
49
+ np.concatenate(tuple(r.pitch for r in raws)),
50
+ np.concatenate(tuple(r.roll for r in raws)),
51
+ )
52
+
53
+ def __getitem__(
54
+ self,
55
+ index: int | slice | list[int] | npt.NDArray[np.int64] | npt.NDArray[np.bool_],
56
+ ) -> HaloSysParams:
57
+ if isinstance(index, (int, slice, list, np.ndarray)):
58
+ return HaloSysParams(
59
+ self.time[index],
60
+ self.internal_temperature[index],
61
+ self.internal_relative_humidity[index],
62
+ self.supply_voltage[index],
63
+ self.acquisition_card_temperature[index],
64
+ self.pitch[index],
65
+ self.roll[index],
66
+ )
67
+ raise TypeError
68
+
69
+ def sorted_by_time(self) -> HaloSysParams:
70
+ sort_indices = np.argsort(self.time)
71
+ return self[sort_indices]
72
+
73
+ def non_strictly_increasing_timesteps_removed(self) -> HaloSysParams:
74
+ is_increasing = np.insert(np.diff(self.time).astype(int) > 0, 0, True)
75
+ return self[is_increasing]
76
+
77
+
78
+ def _from_src(data: BufferedIOBase) -> HaloSysParams:
79
+ data_bytes = data.read().strip().replace(b",", b".").replace(b"\x00", b"")
80
+ a = data_bytes.strip().split(b"\r\n")
81
+ b = [r.split(b"\t") for r in a]
82
+ arr = np.array(b)
83
+ if arr.shape[1] != 7:
84
+ raise ValueError("Unexpected data fromat")
85
+
86
+ def timestr2datetime64_12H(datetime_bytes: bytes) -> np.datetime64:
87
+ return datetime64(
88
+ datetime.strptime(datetime_bytes.decode("utf-8"), "%m/%d/%Y %I:%M:%S %p"),
89
+ "s",
90
+ )
91
+
92
+ def timestr2datetime64_24H(datetime_bytes: bytes) -> np.datetime64:
93
+ return datetime64(
94
+ datetime.strptime(datetime_bytes.decode("utf-8"), "%d/%m/%Y %H:%M:%S"), "s"
95
+ )
96
+
97
+ arr_time = np.full_like(arr[:, 0], np.datetime64("NaT"), dtype="datetime64[s]")
98
+ for i, time in enumerate(arr[:, 0]):
99
+ try:
100
+ arr_time[i] = timestr2datetime64_12H(time)
101
+ except ValueError:
102
+ arr_time[i] = timestr2datetime64_24H(time)
103
+ arr_others = np.vectorize(float)(arr[:, 1:])
104
+ return HaloSysParams(arr_time, *arr_others.T)
doppy/rs.abi3.so ADDED
Binary file
@@ -0,0 +1,42 @@
1
+ Metadata-Version: 2.1
2
+ Name: doppy
3
+ Version: 0.0.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[all]
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 ; extra == 'dev'
26
+ Provides-Extra: dev
27
+ License-File: LICENSE
28
+ License-File: LICENSE
29
+ Summary: Doppler lidar processing
30
+ Author: Niko Leskinen <niko.leskinen@fmi.fi>
31
+ Author-email: Niko Leskinen <niko.leskinen@fmi.fi>
32
+ Requires-Python: >=3.10
33
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
34
+ Project-URL: Homepage, https://github.com/actris-cloudnet/doppy
35
+ Project-URL: Repository, https://github.com/actris-cloudnet/doppy
36
+ Project-URL: Changelog, https://github.com/actris-cloudnet/doppy/blob/main/CHANGELOG.md
37
+ Project-URL: Bug Tracker, https://github.com/actris-cloudnet/doppy/issues
38
+
39
+ # Doppy - Wind doppler lidar processing
40
+
41
+
42
+
@@ -0,0 +1,24 @@
1
+ doppy-0.0.1.dist-info/METADATA,sha256=surNgB0FEY2TWKuPQ1h4_vwWz-8mLNLCOYe_A9fL7n8,1494
2
+ doppy-0.0.1.dist-info/WHEEL,sha256=6lWwZR4XDMZCOGKxNbitp3oy9XC3VeW-i3RwU9wYcOc,105
3
+ doppy-0.0.1.dist-info/entry_points.txt,sha256=9b_Ca7vJoh6AwL3W8qAPh_UmJ_1Pa6hi-TDfCTDjvSk,43
4
+ doppy-0.0.1.dist-info/license_files/LICENSE,sha256=V-0iroMNMI8ctnLgUau1kdFvwhkYhr9vi-5kWKxw2wc,1089
5
+ doppy-0.0.1.dist-info/license_files/LICENSE,sha256=V-0iroMNMI8ctnLgUau1kdFvwhkYhr9vi-5kWKxw2wc,1089
6
+ doppy/options.py,sha256=73BDODO4OYHn2qOshhwz6u6G3J1kNd3uj6P0a3V4HBE,205
7
+ doppy/__init__.py,sha256=Z9aEUlbPRWRUAoB8_-djkgrJuS4-6pjem4-mVSB6Z9I,191
8
+ doppy/product/__init__.py,sha256=QtS5Eq0KGUYkaylDGAW8Oz6OIlab4WQYd5fTTUshTbc,59
9
+ doppy/product/stare.py,sha256=04rAnG6bSsdyFSe43jONtthvtQn9S1RBsQ3DY8iqzjA,18581
10
+ doppy/bench.py,sha256=iVNYveMVGGRES2oe3Orsn31jQFCKTXOmxRFuFiJ8_OA,248
11
+ doppy/netcdf.py,sha256=NW5zTW2OY-M4ApMzgxwN7ysmL0LRRWOfyKFPinCw6gg,3403
12
+ doppy/exceptions.py,sha256=1tljrtzp0McQhB6INFXj4yfLjxj6mXor5jLF9HZjp1A,138
13
+ doppy/defaults.py,sha256=eIBH60MdnAjzDCU5Ai6BzkwPH_4aPuL_JYZqftS020U,39
14
+ doppy/data/cache.py,sha256=lfSSoxGsbRE11j8fhjCiPehq6wG0CNuOoe2EaIRl6us,890
15
+ doppy/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
+ doppy/data/api.py,sha256=njr-yLbx1mTSiko2Lg4AZi8GgQ3Um614kqqv-WdLmB4,1508
17
+ doppy/data/exceptions.py,sha256=6CS6OHIWq8CqlxiceEvC1j0EfWUYoIfM7dW88apQVn4,89
18
+ doppy/raw/halo_sys_params.py,sha256=IXH40xBHyXCGX0ZE79KnSeXRj1wbqoqL0RYUQyBJqdE,3937
19
+ doppy/raw/__init__.py,sha256=GrBbsTkoD2DH_Xwt6apZGwpT1cCIbfOWHzdQVjAPVh0,151
20
+ doppy/raw/halo_bg.py,sha256=kO03yGlKS-DpMMGHYuy_BuidyeUL38TxT5vMn8H_8lE,4809
21
+ doppy/raw/halo_hpl.py,sha256=18LvnqdMbYaqnA-7lIMpzCvWkusahWmT4eP43cIlGCk,17894
22
+ doppy/__main__.py,sha256=zrKQJVj0k0ypBQCGK65Czt9G9FZ_qx3ussw6Q9VJ14g,346
23
+ doppy/rs.abi3.so,sha256=yZe0xKXOQq45e9FDA1C5UPASKmpcSCqsFxSGIpzTjCA,2715824
24
+ doppy-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: maturin (1.4.0)
3
+ Root-Is-Purelib: false
4
+ Tag: cp310-abi3-macosx_10_12_x86_64
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ doppy=doppy.__main__:app
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Finnish Meteorological Institute
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.