doppy 0.5.1__tar.gz → 0.5.3__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 (44) hide show
  1. {doppy-0.5.1 → doppy-0.5.3}/Cargo.lock +28 -28
  2. {doppy-0.5.1 → doppy-0.5.3}/Cargo.toml +1 -1
  3. {doppy-0.5.1 → doppy-0.5.3}/PKG-INFO +1 -1
  4. {doppy-0.5.1 → doppy-0.5.3}/crates/doprs/src/raw/halo_hpl.rs +30 -4
  5. {doppy-0.5.1 → doppy-0.5.3}/src/doppy/product/turbulence.py +13 -14
  6. {doppy-0.5.1 → doppy-0.5.3}/LICENSE +0 -0
  7. {doppy-0.5.1 → doppy-0.5.3}/README.md +0 -0
  8. {doppy-0.5.1 → doppy-0.5.3}/crates/doppy_rs/Cargo.toml +0 -0
  9. {doppy-0.5.1 → doppy-0.5.3}/crates/doppy_rs/src/lib.rs +0 -0
  10. {doppy-0.5.1 → doppy-0.5.3}/crates/doppy_rs/src/raw/halo_hpl.rs +0 -0
  11. {doppy-0.5.1 → doppy-0.5.3}/crates/doppy_rs/src/raw/wls70.rs +0 -0
  12. {doppy-0.5.1 → doppy-0.5.3}/crates/doppy_rs/src/raw.rs +0 -0
  13. {doppy-0.5.1 → doppy-0.5.3}/crates/doprs/.gitignore +0 -0
  14. {doppy-0.5.1 → doppy-0.5.3}/crates/doprs/Cargo.toml +0 -0
  15. {doppy-0.5.1 → doppy-0.5.3}/crates/doprs/src/lib.rs +0 -0
  16. {doppy-0.5.1 → doppy-0.5.3}/crates/doprs/src/raw/error.rs +0 -0
  17. {doppy-0.5.1 → doppy-0.5.3}/crates/doprs/src/raw/wls70.rs +0 -0
  18. {doppy-0.5.1 → doppy-0.5.3}/crates/doprs/src/raw.rs +0 -0
  19. {doppy-0.5.1 → doppy-0.5.3}/pyproject.toml +0 -0
  20. {doppy-0.5.1 → doppy-0.5.3}/src/doppy/__init__.py +0 -0
  21. {doppy-0.5.1 → doppy-0.5.3}/src/doppy/__main__.py +0 -0
  22. {doppy-0.5.1 → doppy-0.5.3}/src/doppy/bench.py +0 -0
  23. {doppy-0.5.1 → doppy-0.5.3}/src/doppy/data/__init__.py +0 -0
  24. {doppy-0.5.1 → doppy-0.5.3}/src/doppy/data/api.py +0 -0
  25. {doppy-0.5.1 → doppy-0.5.3}/src/doppy/data/cache.py +0 -0
  26. {doppy-0.5.1 → doppy-0.5.3}/src/doppy/data/exceptions.py +0 -0
  27. {doppy-0.5.1 → doppy-0.5.3}/src/doppy/defaults.py +0 -0
  28. {doppy-0.5.1 → doppy-0.5.3}/src/doppy/exceptions.py +0 -0
  29. {doppy-0.5.1 → doppy-0.5.3}/src/doppy/netcdf.py +0 -0
  30. {doppy-0.5.1 → doppy-0.5.3}/src/doppy/options.py +0 -0
  31. {doppy-0.5.1 → doppy-0.5.3}/src/doppy/product/__init__.py +0 -0
  32. {doppy-0.5.1 → doppy-0.5.3}/src/doppy/product/noise_utils.py +0 -0
  33. {doppy-0.5.1 → doppy-0.5.3}/src/doppy/product/stare.py +0 -0
  34. {doppy-0.5.1 → doppy-0.5.3}/src/doppy/product/stare_depol.py +0 -0
  35. {doppy-0.5.1 → doppy-0.5.3}/src/doppy/product/wind.py +0 -0
  36. {doppy-0.5.1 → doppy-0.5.3}/src/doppy/py.typed +0 -0
  37. {doppy-0.5.1 → doppy-0.5.3}/src/doppy/raw/__init__.py +0 -0
  38. {doppy-0.5.1 → doppy-0.5.3}/src/doppy/raw/halo_bg.py +0 -0
  39. {doppy-0.5.1 → doppy-0.5.3}/src/doppy/raw/halo_hpl.py +0 -0
  40. {doppy-0.5.1 → doppy-0.5.3}/src/doppy/raw/halo_sys_params.py +0 -0
  41. {doppy-0.5.1 → doppy-0.5.3}/src/doppy/raw/utils.py +0 -0
  42. {doppy-0.5.1 → doppy-0.5.3}/src/doppy/raw/windcube.py +0 -0
  43. {doppy-0.5.1 → doppy-0.5.3}/src/doppy/raw/wls70.py +0 -0
  44. {doppy-0.5.1 → doppy-0.5.3}/src/doppy/utils.py +0 -0
@@ -34,9 +34,9 @@ checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
34
34
 
35
35
  [[package]]
36
36
  name = "bitflags"
37
- version = "2.8.0"
37
+ version = "2.9.0"
38
38
  source = "registry+https://github.com/rust-lang/crates.io-index"
39
- checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36"
39
+ checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd"
40
40
 
41
41
  [[package]]
42
42
  name = "bumpalo"
@@ -46,9 +46,9 @@ checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf"
46
46
 
47
47
  [[package]]
48
48
  name = "cc"
49
- version = "1.2.15"
49
+ version = "1.2.16"
50
50
  source = "registry+https://github.com/rust-lang/crates.io-index"
51
- checksum = "c736e259eea577f443d5c86c304f9f4ae0295c43f3ba05c21f1d66b5f06001af"
51
+ checksum = "be714c154be609ec7f5dad223a33bf1482fff90472de28f7362806e6d4832b8c"
52
52
  dependencies = [
53
53
  "shlex",
54
54
  ]
@@ -106,7 +106,7 @@ checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
106
106
 
107
107
  [[package]]
108
108
  name = "doppy_rs"
109
- version = "0.5.1"
109
+ version = "0.5.3"
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.5.1"
118
+ version = "0.5.3"
119
119
  dependencies = [
120
120
  "chrono",
121
121
  "rayon",
@@ -124,9 +124,9 @@ dependencies = [
124
124
 
125
125
  [[package]]
126
126
  name = "either"
127
- version = "1.14.0"
127
+ version = "1.15.0"
128
128
  source = "registry+https://github.com/rust-lang/crates.io-index"
129
- checksum = "b7914353092ddf589ad78f25c5c1c21b7f80b0ff8621e7c814c3485b5306da9d"
129
+ checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
130
130
 
131
131
  [[package]]
132
132
  name = "heck"
@@ -159,9 +159,9 @@ dependencies = [
159
159
 
160
160
  [[package]]
161
161
  name = "indoc"
162
- version = "2.0.5"
162
+ version = "2.0.6"
163
163
  source = "registry+https://github.com/rust-lang/crates.io-index"
164
- checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5"
164
+ checksum = "f4c7245a08504955605670dbf141fceab975f15ca21570696aebe9d2e71576bd"
165
165
 
166
166
  [[package]]
167
167
  name = "js-sys"
@@ -175,9 +175,9 @@ dependencies = [
175
175
 
176
176
  [[package]]
177
177
  name = "libc"
178
- version = "0.2.170"
178
+ version = "0.2.171"
179
179
  source = "registry+https://github.com/rust-lang/crates.io-index"
180
- checksum = "875b3680cb2f8f71bdcf9a30f38d48282f5d3c95cbf9b3fa57269bb5d5c06828"
180
+ checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6"
181
181
 
182
182
  [[package]]
183
183
  name = "lock_api"
@@ -277,9 +277,9 @@ dependencies = [
277
277
 
278
278
  [[package]]
279
279
  name = "once_cell"
280
- version = "1.20.3"
280
+ version = "1.21.0"
281
281
  source = "registry+https://github.com/rust-lang/crates.io-index"
282
- checksum = "945462a4b81e43c4e3ba96bd7b49d834c6f61198356aa858733bc4acf3cbe62e"
282
+ checksum = "cde51589ab56b20a6f686b2c68f7a0bd6add753d697abf720d63f8db3ab7b1ad"
283
283
 
284
284
  [[package]]
285
285
  name = "parking_lot"
@@ -312,9 +312,9 @@ checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e"
312
312
 
313
313
  [[package]]
314
314
  name = "proc-macro2"
315
- version = "1.0.93"
315
+ version = "1.0.94"
316
316
  source = "registry+https://github.com/rust-lang/crates.io-index"
317
- checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99"
317
+ checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84"
318
318
  dependencies = [
319
319
  "unicode-ident",
320
320
  ]
@@ -384,9 +384,9 @@ dependencies = [
384
384
 
385
385
  [[package]]
386
386
  name = "quote"
387
- version = "1.0.38"
387
+ version = "1.0.40"
388
388
  source = "registry+https://github.com/rust-lang/crates.io-index"
389
- checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc"
389
+ checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
390
390
  dependencies = [
391
391
  "proc-macro2",
392
392
  ]
@@ -419,9 +419,9 @@ dependencies = [
419
419
 
420
420
  [[package]]
421
421
  name = "redox_syscall"
422
- version = "0.5.9"
422
+ version = "0.5.10"
423
423
  source = "registry+https://github.com/rust-lang/crates.io-index"
424
- checksum = "82b568323e98e49e2a0899dcee453dd679fae22d69adf9b11dd508d1549b7e2f"
424
+ checksum = "0b8c0c260b63a8219631167be35e6a988e9554dbd323f8bd08439c8ed1302bd1"
425
425
  dependencies = [
426
426
  "bitflags",
427
427
  ]
@@ -463,9 +463,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
463
463
 
464
464
  [[package]]
465
465
  name = "rustversion"
466
- version = "1.0.19"
466
+ version = "1.0.20"
467
467
  source = "registry+https://github.com/rust-lang/crates.io-index"
468
- checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4"
468
+ checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2"
469
469
 
470
470
  [[package]]
471
471
  name = "scopeguard"
@@ -487,9 +487,9 @@ checksum = "7fcf8323ef1faaee30a44a340193b1ac6814fd9b7b4e88e9d4519a3e4abe1cfd"
487
487
 
488
488
  [[package]]
489
489
  name = "syn"
490
- version = "2.0.98"
490
+ version = "2.0.100"
491
491
  source = "registry+https://github.com/rust-lang/crates.io-index"
492
- checksum = "36147f1a48ae0ec2b5b3bc5b537d267457555a10dc06f3dbc8cb11ba3006d3b1"
492
+ checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0"
493
493
  dependencies = [
494
494
  "proc-macro2",
495
495
  "quote",
@@ -504,15 +504,15 @@ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
504
504
 
505
505
  [[package]]
506
506
  name = "unicode-ident"
507
- version = "1.0.17"
507
+ version = "1.0.18"
508
508
  source = "registry+https://github.com/rust-lang/crates.io-index"
509
- checksum = "00e2473a93778eb0bad35909dff6a10d28e63f792f16ed15e404fca9d5eeedbe"
509
+ checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
510
510
 
511
511
  [[package]]
512
512
  name = "unindent"
513
- version = "0.2.3"
513
+ version = "0.2.4"
514
514
  source = "registry+https://github.com/rust-lang/crates.io-index"
515
- checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce"
515
+ checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
516
516
 
517
517
  [[package]]
518
518
  name = "wasm-bindgen"
@@ -4,6 +4,6 @@ resolver = "2"
4
4
 
5
5
  [workspace.package]
6
6
  edition = "2021"
7
- version = "0.5.1"
7
+ version = "0.5.3"
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.5.1
3
+ Version: 0.5.3
4
4
  Classifier: Development Status :: 4 - Beta
5
5
  Classifier: Programming Language :: Python :: 3
6
6
  Classifier: Programming Language :: Python :: 3.10
@@ -29,6 +29,22 @@ pub struct Info {
29
29
  pub start_time: i64, // Unix-timestamp
30
30
  pub system_id: String,
31
31
  pub instrument_spectral_width: Option<f64>,
32
+ range_formula: Option<RangeFormula>,
33
+ }
34
+
35
+ #[derive(Debug, Clone)]
36
+ enum RangeFormula {
37
+ Common, //(range gate + 0.5) * Gate length
38
+ Overlapping, //Gate length / 2 + (range gate x 3)
39
+ }
40
+
41
+ impl RangeFormula {
42
+ fn compute_distance(&self, gate_index: f64, range_gate_length: f64) -> f64 {
43
+ match self {
44
+ RangeFormula::Common => (gate_index + 0.5) * range_gate_length,
45
+ RangeFormula::Overlapping => range_gate_length / 2.0 + gate_index * 3.0,
46
+ }
47
+ }
32
48
  }
33
49
 
34
50
  #[derive(Debug, Default, Clone)]
@@ -97,7 +113,11 @@ pub fn from_bytes_src(content: &[u8]) -> Result<HaloHpl, RawParseError> {
97
113
  }
98
114
  }
99
115
  let info = parse_header(&buf_header)?;
100
- let data = parse_data(&mut cur, info.ngates, info.range_gate_length)?;
116
+ let range_formula = info
117
+ .range_formula
118
+ .as_ref()
119
+ .ok_or("Cannot find range formula")?;
120
+ let data = parse_data(&mut cur, info.ngates, info.range_gate_length, range_formula)?;
101
121
  Ok(HaloHpl { info, data })
102
122
  }
103
123
 
@@ -105,6 +125,7 @@ fn parse_data(
105
125
  cur: &mut Cursor<&[u8]>,
106
126
  ngates: u64,
107
127
  range_gate_length: f64,
128
+ range_formula: &RangeFormula,
108
129
  ) -> Result<Data, RawParseError> {
109
130
  let (n1d, n2d) = infer_data_shape(cur)?;
110
131
  if ngates < 1 || n1d < 3 || n2d < 4 {
@@ -161,7 +182,7 @@ fn parse_data(
161
182
  time: data_1d[0].clone(),
162
183
  radial_distance: gate
163
184
  .iter()
164
- .map(|&x| (x + 0.5) * range_gate_length)
185
+ .map(|&x| range_formula.compute_distance(x, range_gate_length))
165
186
  .collect(),
166
187
  azimuth: data_1d[1].clone(),
167
188
  elevation: data_1d[2].clone(),
@@ -249,8 +270,13 @@ fn parse_header(header_bytes: &[u8]) -> Result<Info, RawParseError> {
249
270
  info.instrument_spectral_width = Some(captures[1].parse()?);
250
271
  } else {
251
272
  match line.as_str() {
252
- "Altitude of measurement (center of gate) = (range gate + 0.5) * Gate length" => (),
253
- "Range of measurement (center of gate) = (range gate + 0.5) * Gate length" => (),
273
+ "Altitude of measurement (center of gate) = (range gate + 0.5) * Gate length" |
274
+ "Range of measurement (center of gate) = (range gate + 0.5) * Gate length" => {
275
+ info.range_formula = Some(RangeFormula::Common)
276
+ },
277
+ "Range of measurement (center of gate) = Gate length / 2 + (range gate x 3)" => {
278
+ info.range_formula = Some(RangeFormula::Overlapping)
279
+ },
254
280
  "Data line 1: Decimal time (hours) Azimuth (degrees) Elevation (degrees) Pitch (degrees) Roll (degrees)" => (),
255
281
  "Data line 1: Decimal time (hours) Azimuth (degrees) Elevation (degrees)" => (),
256
282
  "f9.6,1x,f6.2,1x,f6.2" => (),
@@ -1,4 +1,3 @@
1
- # type: ignore
2
1
  from __future__ import annotations
3
2
 
4
3
  from dataclasses import dataclass
@@ -94,18 +93,18 @@ def _compute_variance(vert: VerticalWind, period: float) -> VarResult:
94
93
  N_cumsum = N_i.cumsum(axis=0)
95
94
 
96
95
  def N_func(i: int, j: int) -> npt.NDArray[np.float64]:
97
- return N_cumsum[j] - N_cumsum[i] + N_i[i]
96
+ return np.array(N_cumsum[j] - N_cumsum[i] + N_i[i], dtype=np.float64)
98
97
 
99
98
  def S(i: int, j: int) -> npt.NDArray[np.float64]:
100
- return X_cumsum[j] - X_cumsum[i] + X[i]
99
+ return np.array(X_cumsum[j] - X_cumsum[i] + X[i], dtype=np.float64)
101
100
 
102
101
  def S2(i: int, j: int) -> npt.NDArray[np.float64]:
103
- return X2_cumsum[j] - X2_cumsum[i] + X2[i]
102
+ return np.array(X2_cumsum[j] - X2_cumsum[i] + X2[i], dtype=np.float64)
104
103
 
105
104
  def var_ij(i: int, j: int) -> npt.NDArray[np.float64]:
106
105
  N = N_func(i, j)
107
106
  with np.errstate(invalid="ignore"):
108
- return (S2(i, j) - S(i, j) ** 2 / N) / N
107
+ return np.array((S2(i, j) - S(i, j) ** 2 / N) / N, dtype=np.float64)
109
108
 
110
109
  half_period = np.timedelta64(int(1e6 * period / 2), "us")
111
110
  period_start = np.full(vert.w.shape, np.datetime64("NaT", "us"))
@@ -147,7 +146,7 @@ def _length_scale_low(
147
146
 
148
147
  def _preprocess_horiontal_wind(
149
148
  vert: VerticalWind, hori: HorizontalWind, options: Options
150
- ):
149
+ ) -> npt.NDArray[np.float64]:
151
150
  if np.isnan(hori.V).any():
152
151
  raise ValueError("horizontal wind speed cannot contains NaNs")
153
152
  trg_points = np.meshgrid(vert.time, vert.height, indexing="ij")
@@ -186,8 +185,8 @@ def _rolling_mean_over_time(
186
185
 
187
186
  S = arr.cumsum(axis=0)
188
187
 
189
- def rolling_mean(i: int, j: int) -> npt.NDArray[np.flaat64]:
190
- return (S[j] - S[i] + arr[i]) / (j - i + 1)
188
+ def rolling_mean(i: int, j: int) -> npt.NDArray[np.float64]:
189
+ return np.array((S[j] - S[i] + arr[i]) / (j - i + 1), dtype=np.float64)
191
190
 
192
191
  half_period = np.timedelta64(int(period * 0.5e6), "us")
193
192
  rol_mean = np.full(arr.shape, np.nan, dtype=np.float64)
@@ -208,7 +207,7 @@ def _compute_dissipation_rate(
208
207
  variance: npt.NDArray[np.float64],
209
208
  length_scale_lower: npt.NDArray[np.float64],
210
209
  length_scale_upper: npt.NDArray[np.float64],
211
- ):
210
+ ) -> npt.NDArray[np.float64]:
212
211
  """
213
212
  Parameters
214
213
  ----------
@@ -225,10 +224,10 @@ def _compute_dissipation_rate(
225
224
  * (length_scale_upper ** (2 / 3) - length_scale_lower ** (2 / 3))
226
225
  ** (-3 / 2)
227
226
  )
228
- return dr
227
+ return np.array(dr, dtype=np.float64)
229
228
 
230
229
 
231
- def _next_valid_from_mask(mask):
230
+ def _next_valid_from_mask(mask: npt.NDArray[np.bool_]) -> npt.NDArray[np.int64]:
232
231
  """
233
232
  mask[t,v] (time,value)
234
233
 
@@ -244,10 +243,10 @@ def _next_valid_from_mask(mask):
244
243
  for t in reversed(range(n - 1)):
245
244
  N[t][~mask[t]] = t
246
245
  N[t][mask[t]] = N[t + 1][mask[t]]
247
- return N
246
+ return np.array(N, dtype=np.int64)
248
247
 
249
248
 
250
- def _prev_valid_from_mask(mask):
249
+ def _prev_valid_from_mask(mask: npt.NDArray[np.bool_]) -> npt.NDArray[np.int64]:
251
250
  """
252
251
  mask[t,v] (time,value)
253
252
 
@@ -262,4 +261,4 @@ def _prev_valid_from_mask(mask):
262
261
  for t in range(1, n):
263
262
  N[t][~mask[t]] = t
264
263
  N[t][mask[t]] = N[t - 1][mask[t]]
265
- return N
264
+ return np.array(N, dtype=np.int64)
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
File without changes