doppy 0.5.4__tar.gz → 0.5.5__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 (51) hide show
  1. {doppy-0.5.4 → doppy-0.5.5}/Cargo.lock +2 -2
  2. {doppy-0.5.4 → doppy-0.5.5}/Cargo.toml +1 -1
  3. {doppy-0.5.4 → doppy-0.5.5}/PKG-INFO +1 -1
  4. {doppy-0.5.4 → doppy-0.5.5}/crates/doprs/Cargo.toml +1 -0
  5. doppy-0.5.5/crates/doprs/README.md +5 -0
  6. doppy-0.5.5/crates/doprs/src/bin/parse_halo.rs +8 -0
  7. {doppy-0.5.4 → doppy-0.5.5}/crates/doprs/src/raw/halo_hpl.rs +26 -6
  8. {doppy-0.5.4 → doppy-0.5.5}/LICENSE +0 -0
  9. {doppy-0.5.4 → doppy-0.5.5}/README.md +0 -0
  10. {doppy-0.5.4 → doppy-0.5.5}/crates/doppy_rs/Cargo.toml +0 -0
  11. {doppy-0.5.4 → doppy-0.5.5}/crates/doppy_rs/src/lib.rs +0 -0
  12. {doppy-0.5.4 → doppy-0.5.5}/crates/doppy_rs/src/raw/halo_hpl.rs +0 -0
  13. {doppy-0.5.4 → doppy-0.5.5}/crates/doppy_rs/src/raw/wls70.rs +0 -0
  14. {doppy-0.5.4 → doppy-0.5.5}/crates/doppy_rs/src/raw/wls77.rs +0 -0
  15. {doppy-0.5.4 → doppy-0.5.5}/crates/doppy_rs/src/raw.rs +0 -0
  16. {doppy-0.5.4 → doppy-0.5.5}/crates/doprs/.gitignore +0 -0
  17. {doppy-0.5.4 → doppy-0.5.5}/crates/doprs/src/bin/parse_wls70.rs +0 -0
  18. {doppy-0.5.4 → doppy-0.5.5}/crates/doprs/src/bin/parse_wls77.rs +0 -0
  19. {doppy-0.5.4 → doppy-0.5.5}/crates/doprs/src/lib.rs +0 -0
  20. {doppy-0.5.4 → doppy-0.5.5}/crates/doprs/src/raw/error.rs +0 -0
  21. {doppy-0.5.4 → doppy-0.5.5}/crates/doprs/src/raw/wls70.rs +0 -0
  22. {doppy-0.5.4 → doppy-0.5.5}/crates/doprs/src/raw/wls77.rs +0 -0
  23. {doppy-0.5.4 → doppy-0.5.5}/crates/doprs/src/raw.rs +0 -0
  24. {doppy-0.5.4 → doppy-0.5.5}/pyproject.toml +0 -0
  25. {doppy-0.5.4 → doppy-0.5.5}/src/doppy/__init__.py +0 -0
  26. {doppy-0.5.4 → doppy-0.5.5}/src/doppy/__main__.py +0 -0
  27. {doppy-0.5.4 → doppy-0.5.5}/src/doppy/bench.py +0 -0
  28. {doppy-0.5.4 → doppy-0.5.5}/src/doppy/data/__init__.py +0 -0
  29. {doppy-0.5.4 → doppy-0.5.5}/src/doppy/data/api.py +0 -0
  30. {doppy-0.5.4 → doppy-0.5.5}/src/doppy/data/cache.py +0 -0
  31. {doppy-0.5.4 → doppy-0.5.5}/src/doppy/data/exceptions.py +0 -0
  32. {doppy-0.5.4 → doppy-0.5.5}/src/doppy/defaults.py +0 -0
  33. {doppy-0.5.4 → doppy-0.5.5}/src/doppy/exceptions.py +0 -0
  34. {doppy-0.5.4 → doppy-0.5.5}/src/doppy/netcdf.py +0 -0
  35. {doppy-0.5.4 → doppy-0.5.5}/src/doppy/options.py +0 -0
  36. {doppy-0.5.4 → doppy-0.5.5}/src/doppy/product/__init__.py +0 -0
  37. {doppy-0.5.4 → doppy-0.5.5}/src/doppy/product/noise_utils.py +0 -0
  38. {doppy-0.5.4 → doppy-0.5.5}/src/doppy/product/stare.py +0 -0
  39. {doppy-0.5.4 → doppy-0.5.5}/src/doppy/product/stare_depol.py +0 -0
  40. {doppy-0.5.4 → doppy-0.5.5}/src/doppy/product/turbulence.py +0 -0
  41. {doppy-0.5.4 → doppy-0.5.5}/src/doppy/product/wind.py +0 -0
  42. {doppy-0.5.4 → doppy-0.5.5}/src/doppy/py.typed +0 -0
  43. {doppy-0.5.4 → doppy-0.5.5}/src/doppy/raw/__init__.py +0 -0
  44. {doppy-0.5.4 → doppy-0.5.5}/src/doppy/raw/halo_bg.py +0 -0
  45. {doppy-0.5.4 → doppy-0.5.5}/src/doppy/raw/halo_hpl.py +0 -0
  46. {doppy-0.5.4 → doppy-0.5.5}/src/doppy/raw/halo_sys_params.py +0 -0
  47. {doppy-0.5.4 → doppy-0.5.5}/src/doppy/raw/utils.py +0 -0
  48. {doppy-0.5.4 → doppy-0.5.5}/src/doppy/raw/windcube.py +0 -0
  49. {doppy-0.5.4 → doppy-0.5.5}/src/doppy/raw/wls70.py +0 -0
  50. {doppy-0.5.4 → doppy-0.5.5}/src/doppy/raw/wls77.py +0 -0
  51. {doppy-0.5.4 → doppy-0.5.5}/src/doppy/utils.py +0 -0
@@ -106,7 +106,7 @@ checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
106
106
 
107
107
  [[package]]
108
108
  name = "doppy_rs"
109
- version = "0.5.4"
109
+ version = "0.5.5"
110
110
  dependencies = [
111
111
  "doprs",
112
112
  "ndarray 0.16.1",
@@ -116,7 +116,7 @@ dependencies = [
116
116
 
117
117
  [[package]]
118
118
  name = "doprs"
119
- version = "0.5.4"
119
+ version = "0.5.5"
120
120
  dependencies = [
121
121
  "chrono",
122
122
  "ndarray 0.16.1",
@@ -4,7 +4,7 @@ resolver = "2"
4
4
 
5
5
  [workspace.package]
6
6
  edition = "2021"
7
- version = "0.5.4"
7
+ version = "0.5.5"
8
8
  authors = ["Niko Leskinen <niko.leskinen@fmi.fi>"]
9
9
  license-file = "LICENSE"
10
10
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: doppy
3
- Version: 0.5.4
3
+ Version: 0.5.5
4
4
  Classifier: Development Status :: 4 - Beta
5
5
  Classifier: Programming Language :: Python :: 3
6
6
  Classifier: Programming Language :: Python :: 3.10
@@ -10,3 +10,4 @@ version = {workspace = true}
10
10
  authors = {workspace = true}
11
11
  edition = {workspace = true}
12
12
  license-file = {workspace = true}
13
+ readme = "README.md"
@@ -0,0 +1,5 @@
1
+ ## Test
2
+
3
+ ```
4
+ cargo run --bin parse_halo PATH_TO_HPL_FILE
5
+ ```
@@ -0,0 +1,8 @@
1
+ use doprs::raw::halo_hpl;
2
+
3
+ fn main() {
4
+ let path = std::env::args().nth(1).unwrap();
5
+ let file = std::fs::File::open(path).unwrap();
6
+ let a = halo_hpl::from_file_src(&file).unwrap();
7
+ dbg!(a.info);
8
+ }
@@ -34,15 +34,21 @@ pub struct Info {
34
34
 
35
35
  #[derive(Debug, Clone)]
36
36
  enum RangeFormula {
37
- Common, //(range gate + 0.5) * Gate length
38
- Overlapping, //Gate length / 2 + (range gate x 3)
37
+ Common, //(range gate + 0.5) * Gate length
38
+ Overlapping {
39
+ gate_length_div: f64,
40
+ gate_index_mul: f64,
41
+ }, //Gate length / gate_length_div + (range gate x gate_index_mul)
39
42
  }
40
43
 
41
44
  impl RangeFormula {
42
45
  fn compute_distance(&self, gate_index: f64, range_gate_length: f64) -> f64 {
43
46
  match self {
44
47
  RangeFormula::Common => (gate_index + 0.5) * range_gate_length,
45
- RangeFormula::Overlapping => range_gate_length / 2.0 + gate_index * 3.0,
48
+ RangeFormula::Overlapping {
49
+ gate_length_div,
50
+ gate_index_mul,
51
+ } => range_gate_length / gate_length_div + gate_index * gate_index_mul,
46
52
  }
47
53
  }
48
54
  }
@@ -231,7 +237,11 @@ fn infer_data_shape(cur: &mut Cursor<&[u8]>) -> Result<(u64, u64), RawParseError
231
237
 
232
238
  fn parse_header(header_bytes: &[u8]) -> Result<Info, RawParseError> {
233
239
  let mut info = Info::default();
234
- let re = regex::Regex::new(r"^**** Instrument spectral width = (\d+(\.\d+)?)$")?;
240
+ let re_spectral = regex::Regex::new(r"^**** Instrument spectral width = (\d+(?:\.\d+)?)$")?;
241
+ let re_overlapping = regex::Regex::new(
242
+ r"^Range of measurement \(center of gate\) = Gate length / (\d+(?:\.\d+)?) \+ \(range gate x (\d+(?:\.\d+)?)\)$",
243
+ )?;
244
+
235
245
  for line in header_bytes
236
246
  .split(|&b| b == b'\n')
237
247
  .filter(|line| !line.is_empty())
@@ -266,8 +276,18 @@ fn parse_header(header_bytes: &[u8]) -> Result<Info, RawParseError> {
266
276
  }
267
277
  } else {
268
278
  let line = std::str::from_utf8(line)?.trim().to_string();
269
- if let Some(captures) = re.captures(&line) {
279
+ if let Some(captures) = re_spectral.captures(&line) {
270
280
  info.instrument_spectral_width = Some(captures[1].parse()?);
281
+ } else if let Some(captures) = re_overlapping.captures(&line) {
282
+ let divisor = captures[1].parse()?;
283
+ let multiplier = captures[2].parse()?;
284
+ if !(divisor > 0.0 && divisor < 10.0 && multiplier > 0.0 && multiplier < 10.0) {
285
+ return Err(format!("Suspicious range formula: {}", line).into());
286
+ }
287
+ info.range_formula = Some(RangeFormula::Overlapping {
288
+ gate_length_div: divisor,
289
+ gate_index_mul: multiplier,
290
+ });
271
291
  } else {
272
292
  match line.as_str() {
273
293
  "Altitude of measurement (center of gate) = (range gate + 0.5) * Gate length" |
@@ -275,7 +295,7 @@ fn parse_header(header_bytes: &[u8]) -> Result<Info, RawParseError> {
275
295
  info.range_formula = Some(RangeFormula::Common)
276
296
  },
277
297
  "Range of measurement (center of gate) = Gate length / 2 + (range gate x 3)" => {
278
- info.range_formula = Some(RangeFormula::Overlapping)
298
+ info.range_formula = Some(RangeFormula::Overlapping{gate_length_div: 2.0, gate_index_mul: 3.0})
279
299
  },
280
300
  "Data line 1: Decimal time (hours) Azimuth (degrees) Elevation (degrees) Pitch (degrees) Roll (degrees)" => (),
281
301
  "Data line 1: Decimal time (hours) Azimuth (degrees) Elevation (degrees)" => (),
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