doppy 0.4.0__tar.gz → 0.4.2__tar.gz

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.

Files changed (41) hide show
  1. {doppy-0.4.0 → doppy-0.4.2}/Cargo.lock +3 -3
  2. {doppy-0.4.0 → doppy-0.4.2}/Cargo.toml +1 -1
  3. {doppy-0.4.0 → doppy-0.4.2}/PKG-INFO +1 -1
  4. {doppy-0.4.0 → doppy-0.4.2}/src/doppy/raw/halo_sys_params.py +38 -7
  5. {doppy-0.4.0 → doppy-0.4.2}/LICENSE +0 -0
  6. {doppy-0.4.0 → doppy-0.4.2}/README.md +0 -0
  7. {doppy-0.4.0 → doppy-0.4.2}/crates/doppy_rs/Cargo.toml +0 -0
  8. {doppy-0.4.0 → doppy-0.4.2}/crates/doppy_rs/src/lib.rs +0 -0
  9. {doppy-0.4.0 → doppy-0.4.2}/crates/doppy_rs/src/raw/halo_hpl.rs +0 -0
  10. {doppy-0.4.0 → doppy-0.4.2}/crates/doppy_rs/src/raw/wls70.rs +0 -0
  11. {doppy-0.4.0 → doppy-0.4.2}/crates/doppy_rs/src/raw.rs +0 -0
  12. {doppy-0.4.0 → doppy-0.4.2}/crates/doprs/.gitignore +0 -0
  13. {doppy-0.4.0 → doppy-0.4.2}/crates/doprs/Cargo.toml +0 -0
  14. {doppy-0.4.0 → doppy-0.4.2}/crates/doprs/src/lib.rs +0 -0
  15. {doppy-0.4.0 → doppy-0.4.2}/crates/doprs/src/raw/error.rs +0 -0
  16. {doppy-0.4.0 → doppy-0.4.2}/crates/doprs/src/raw/halo_hpl.rs +0 -0
  17. {doppy-0.4.0 → doppy-0.4.2}/crates/doprs/src/raw/wls70.rs +0 -0
  18. {doppy-0.4.0 → doppy-0.4.2}/crates/doprs/src/raw.rs +0 -0
  19. {doppy-0.4.0 → doppy-0.4.2}/pyproject.toml +0 -0
  20. {doppy-0.4.0 → doppy-0.4.2}/src/doppy/__init__.py +0 -0
  21. {doppy-0.4.0 → doppy-0.4.2}/src/doppy/__main__.py +0 -0
  22. {doppy-0.4.0 → doppy-0.4.2}/src/doppy/bench.py +0 -0
  23. {doppy-0.4.0 → doppy-0.4.2}/src/doppy/data/__init__.py +0 -0
  24. {doppy-0.4.0 → doppy-0.4.2}/src/doppy/data/api.py +0 -0
  25. {doppy-0.4.0 → doppy-0.4.2}/src/doppy/data/cache.py +0 -0
  26. {doppy-0.4.0 → doppy-0.4.2}/src/doppy/data/exceptions.py +0 -0
  27. {doppy-0.4.0 → doppy-0.4.2}/src/doppy/defaults.py +0 -0
  28. {doppy-0.4.0 → doppy-0.4.2}/src/doppy/exceptions.py +0 -0
  29. {doppy-0.4.0 → doppy-0.4.2}/src/doppy/netcdf.py +0 -0
  30. {doppy-0.4.0 → doppy-0.4.2}/src/doppy/options.py +0 -0
  31. {doppy-0.4.0 → doppy-0.4.2}/src/doppy/product/__init__.py +0 -0
  32. {doppy-0.4.0 → doppy-0.4.2}/src/doppy/product/stare.py +0 -0
  33. {doppy-0.4.0 → doppy-0.4.2}/src/doppy/product/stare_depol.py +0 -0
  34. {doppy-0.4.0 → doppy-0.4.2}/src/doppy/product/wind.py +0 -0
  35. {doppy-0.4.0 → doppy-0.4.2}/src/doppy/py.typed +0 -0
  36. {doppy-0.4.0 → doppy-0.4.2}/src/doppy/raw/__init__.py +0 -0
  37. {doppy-0.4.0 → doppy-0.4.2}/src/doppy/raw/halo_bg.py +0 -0
  38. {doppy-0.4.0 → doppy-0.4.2}/src/doppy/raw/halo_hpl.py +0 -0
  39. {doppy-0.4.0 → doppy-0.4.2}/src/doppy/raw/windcube.py +0 -0
  40. {doppy-0.4.0 → doppy-0.4.2}/src/doppy/raw/wls70.py +0 -0
  41. {doppy-0.4.0 → doppy-0.4.2}/src/doppy/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  # This file is automatically @generated by Cargo.
2
2
  # It is not intended for manual editing.
3
- version = 3
3
+ version = 4
4
4
 
5
5
  [[package]]
6
6
  name = "aho-corasick"
@@ -106,7 +106,7 @@ checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345"
106
106
 
107
107
  [[package]]
108
108
  name = "doppy_rs"
109
- version = "0.4.0"
109
+ version = "0.4.2"
110
110
  dependencies = [
111
111
  "doprs",
112
112
  "numpy",
@@ -115,7 +115,7 @@ dependencies = [
115
115
 
116
116
  [[package]]
117
117
  name = "doprs"
118
- version = "0.4.0"
118
+ version = "0.4.2"
119
119
  dependencies = [
120
120
  "chrono",
121
121
  "rayon",
@@ -4,6 +4,6 @@ resolver = "2"
4
4
 
5
5
  [workspace.package]
6
6
  edition = "2021"
7
- version = "0.4.0"
7
+ version = "0.4.2"
8
8
  authors = ["Niko Leskinen <niko.leskinen@fmi.fi>"]
9
9
  license-file = "LICENSE"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: doppy
3
- Version: 0.4.0
3
+ Version: 0.4.2
4
4
  Classifier: Development Status :: 4 - Beta
5
5
  Classifier: Programming Language :: Python :: 3
6
6
  Classifier: Programming Language :: Python :: 3.10
@@ -1,6 +1,7 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import io
4
+ import re
4
5
  from dataclasses import dataclass
5
6
  from datetime import datetime
6
7
  from io import BufferedIOBase
@@ -19,8 +20,8 @@ class HaloSysParams:
19
20
  internal_relative_humidity: npt.NDArray[np.float64] # dim: (time, )
20
21
  supply_voltage: npt.NDArray[np.float64] # dim: (time, )
21
22
  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, )
23
+ platform_pitch_angle: npt.NDArray[np.float64] # dim: (time, ), unit: degrees
24
+ platform_roll_angle: npt.NDArray[np.float64] # dim: (time, ), unit: degrees
24
25
 
25
26
  @classmethod
26
27
  def from_src(cls, data: str | Path | bytes | BufferedIOBase) -> HaloSysParams:
@@ -46,8 +47,8 @@ class HaloSysParams:
46
47
  np.concatenate(tuple(r.internal_relative_humidity for r in raws)),
47
48
  np.concatenate(tuple(r.supply_voltage for r in raws)),
48
49
  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)),
50
+ np.concatenate(tuple(r.platform_pitch_angle for r in raws)),
51
+ np.concatenate(tuple(r.platform_roll_angle for r in raws)),
51
52
  )
52
53
 
53
54
  def __getitem__(
@@ -61,8 +62,8 @@ class HaloSysParams:
61
62
  self.internal_relative_humidity[index],
62
63
  self.supply_voltage[index],
63
64
  self.acquisition_card_temperature[index],
64
- self.pitch[index],
65
- self.roll[index],
65
+ self.platform_pitch_angle[index],
66
+ self.platform_roll_angle[index],
66
67
  )
67
68
  raise TypeError
68
69
 
@@ -75,10 +76,40 @@ class HaloSysParams:
75
76
  return self[is_increasing]
76
77
 
77
78
 
79
+ def _correct_concatenated_rows(rows: list[bytes]) -> list[bytes]:
80
+ concat_pattern = re.compile(rb".*(\t[-+0-9]*\.[-+0-9]*\.[-+0-9]*\t).*")
81
+
82
+ matches = [concat_pattern.fullmatch(row) for row in rows]
83
+
84
+ if not any(matches):
85
+ return rows
86
+ elif not all(matches):
87
+ raise ValueError("Cannot correct the concatenated rows")
88
+
89
+ zero_column_pattern = re.compile(rb".*\t0\t.*")
90
+ if not all(zero_column_pattern.fullmatch(row) for row in rows):
91
+ raise ValueError(r"Concatenated rows are expected to have \t0\t pattern")
92
+ rows = [row.replace(b"\t0\t", b"\t") for row in rows]
93
+
94
+ new_rows = []
95
+ pattern = re.compile(rb"(.*\t[-+]?[0-9]+\.[0-9]+)([-+][0-9]+\.[0-9]+\t.*)")
96
+ pattern_nan = re.compile(rb"(.*\t)[-+]?[0-9]+\.[0-9]+\.[0-9]+(\t.*)")
97
+ for row in rows:
98
+ m = pattern.fullmatch(row)
99
+ if m:
100
+ new_rows.append(m.group(1) + b"\t" + m.group(2))
101
+ elif m_nan := pattern_nan.fullmatch(row):
102
+ new_rows.append(m_nan.group(1) + b"nan\tnan" + m_nan.group(2))
103
+ else:
104
+ raise ValueError("Cannot separate concatenated floats")
105
+ return new_rows
106
+
107
+
78
108
  def _from_src(data: BufferedIOBase) -> HaloSysParams:
79
109
  data_bytes = data.read().strip().replace(b",", b".").replace(b"\x00", b"")
80
110
  a = data_bytes.strip().split(b"\r\n")
81
- b = [r.split(b"\t") for r in a]
111
+ a = _correct_concatenated_rows(a)
112
+ b = [r.strip().split(b"\t") for r in a]
82
113
  arr = np.array(b)
83
114
  if arr.shape[1] != 7:
84
115
  raise ValueError("Unexpected data format")
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes