sgf-parser 0.0.11__tar.gz → 0.0.13__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.
Files changed (88) hide show
  1. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/.github/workflows/branch.yaml +7 -4
  2. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/.github/workflows/release.yaml +4 -1
  3. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/CHANGES.md +54 -42
  4. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/PKG-INFO +1 -1
  5. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/pyproject.toml +14 -13
  6. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/src/sgf_parser/models/method.py +44 -3
  7. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/src/sgf_parser/models/method_dt.py +1 -0
  8. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/src/sgf_parser/models/method_slb.py +1 -1
  9. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/src/sgf_parser/models/method_wst.py +1 -1
  10. sgf_parser-0.0.13/tests/data/cpt-dt-unicode-minus-1.std +84 -0
  11. sgf_parser-0.0.13/tests/data/cpt-dt-unicode-minus-2.std +91 -0
  12. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/integration/test_parse.py +19 -14
  13. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/unit/test_cpt_application_class.py +1 -3
  14. sgf_parser-0.0.13/uv.lock +1248 -0
  15. sgf_parser-0.0.11/uv.lock +0 -1442
  16. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/.gitattributes +0 -0
  17. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/.gitignore +0 -0
  18. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/LICENSE +0 -0
  19. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/README.md +0 -0
  20. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/src/sgf_parser/__init__.py +0 -0
  21. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/src/sgf_parser/datetime_parser.py +0 -0
  22. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/src/sgf_parser/models/__init__.py +0 -0
  23. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/src/sgf_parser/models/method_cpt.py +0 -0
  24. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/src/sgf_parser/models/method_dp.py +0 -0
  25. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/src/sgf_parser/models/method_rp.py +0 -0
  26. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/src/sgf_parser/models/method_srs.py +0 -0
  27. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/src/sgf_parser/models/method_sti.py +0 -0
  28. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/src/sgf_parser/models/method_svt.py +0 -0
  29. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/src/sgf_parser/models/method_tot.py +0 -0
  30. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/src/sgf_parser/models/method_tr.py +0 -0
  31. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/src/sgf_parser/models/method_type.py +0 -0
  32. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/src/sgf_parser/models/types.py +0 -0
  33. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/src/sgf_parser/parser.py +0 -0
  34. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/cpt-dt-test-1.std +0 -0
  35. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/cpt-test-1.cpt +0 -0
  36. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/cpt-test-2.cpt +0 -0
  37. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/cpt-test-3.cpt +0 -0
  38. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/cpt-test-4.cpt +0 -0
  39. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/cpt-test-malformed-data-1.cpt +0 -0
  40. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/cpt-test-malformed-date-header.cpt +0 -0
  41. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/cpt-test-multi-line-header.cpt +0 -0
  42. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/cpt-test-two-lines-header.cpt +0 -0
  43. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/cpt-test-with-method-block.cpt +0 -0
  44. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/cpt-test-wrong-type.cpt +0 -0
  45. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/dp-test-1.hfa +0 -0
  46. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/dp-test-2.hfa +0 -0
  47. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/dp-test-3.hfa +0 -0
  48. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/dp-test-4.hfa +0 -0
  49. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/dp-test-modified-2.hfa +0 -0
  50. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/dt-test-1.std +0 -0
  51. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/dt-test-2.dpt +0 -0
  52. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/dt-test-3.dpt +0 -0
  53. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/dt-test-4.dpt +0 -0
  54. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/rp-test-1.std +0 -0
  55. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/rp-test-2.std +0 -0
  56. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/slb-test-1.slb +0 -0
  57. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/slb-test-2.slb +0 -0
  58. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/slb-test-3.slb +0 -0
  59. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/srs-test-1.jb3 +0 -0
  60. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/srs-test-2.jbt +0 -0
  61. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/srs-test-3.jbt +0 -0
  62. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/srs-test-4.jb2 +0 -0
  63. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/srs-test-5.jb3 +0 -0
  64. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/srs-test-problem-comment.jbt +0 -0
  65. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/svt-test-1.std +0 -0
  66. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/tot-malformed-code.tot +0 -0
  67. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/tot-test-1.tot +0 -0
  68. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/tot-test-2.tot +0 -0
  69. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/tot-test-3.tot +0 -0
  70. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/tot-test-4.tot +0 -0
  71. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/tot-test-5.tot +0 -0
  72. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/tot-test-6.tot +0 -0
  73. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/tot-test-7.tot +0 -0
  74. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/tot-test-8.tot +0 -0
  75. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/tot-test-9.TOT +0 -0
  76. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/tot-test-data-ending-with-comma.tot +0 -0
  77. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/tot-test-multiple-codes.tot +0 -0
  78. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/tr-test-1.trt +0 -0
  79. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/tr-test-2.trt +0 -0
  80. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/tr-test-3.trt +0 -0
  81. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/wst-test-1.vim +0 -0
  82. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/data/wst-test-2.vim +0 -0
  83. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/integration/test_file_errors.py +0 -0
  84. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/integration/test_parse_slb.py +0 -0
  85. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/integration/test_parse_tr.py +0 -0
  86. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/unit/test_dates.py +0 -0
  87. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/unit/test_tot_depth.py +0 -0
  88. {sgf_parser-0.0.11 → sgf_parser-0.0.13}/tests/unit/test_tot_k_codes.py +0 -0
@@ -1,5 +1,7 @@
1
1
  name: Push
2
2
  on: [push]
3
+ permissions:
4
+ contents: read
3
5
 
4
6
  jobs:
5
7
  test:
@@ -47,16 +49,17 @@ jobs:
47
49
  - name: Run ruff
48
50
  run: uv run ruff check .
49
51
 
50
- - name: Run mypy
51
- run: uv run mypy .
52
-
53
52
  - name: Run bandit
54
53
  run: uv run bandit .
55
54
 
55
+ - name: Run uv audit
56
+ run: uv audit --locked --color never
57
+
56
58
  - name: Run safety
57
59
  run: uv run safety --disable-optional-telemetry --stage cicd scan
58
60
  env:
59
61
  SAFETY_API_KEY: ${{ secrets.SAFETY_API_KEY }}
60
62
 
61
63
  - name: Check for acceptable licenses
62
- run: uv run pip-licenses --allow-only="Apache-2.0 AND CNRI-Python;MIT;MIT License;BSD License;BSD-3-Clause;Python Software Foundation License;Apache Software License;Mozilla Public License 2.0 (MPL 2.0);ISC License (ISCL);The Unlicense (Unlicense);UNKNOWN;Apache-2.0;Apache-2.0 or BSD-3-Clause;PSF-2.0;Unlicense"
64
+ run: uv run pip-licenses --allow-only="Apache-2.0 AND CNRI-Python;MIT;MIT License;BSD License;BSD-2-Clause;BSD-3-Clause;Python Software Foundation License;Apache Software License;Mozilla Public License 2.0 (MPL 2.0);ISC License (ISCL);Apache-2.0;Apache-2.0 or BSD-3-Clause;PSF-2.0;MIT-0;Apache-2.0 OR BSD-2-Clause;MPL-2.0 AND MIT"
65
+
@@ -4,6 +4,9 @@ on:
4
4
  types:
5
5
  - created
6
6
 
7
+ permissions:
8
+ contents: read
9
+
7
10
  jobs:
8
11
  publish:
9
12
  runs-on: ubuntu-latest
@@ -23,5 +26,5 @@ jobs:
23
26
  env:
24
27
  PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
25
28
  run: |
26
- uv build
29
+ uv build --no-config
27
30
  uv publish --token $PYPI_TOKEN
@@ -1,117 +1,129 @@
1
1
  # NGI Python SGF Parser Package
2
2
 
3
- _2025-12-02_
3
+ Version 0.0.13
4
4
 
5
- Version 0.0.11
5
+ _2026-07-14_
6
6
 
7
- - Change the attribute name `load` to `penetration_force` for the Weight Sounding Test (WST)
8
- and the Swedish Impact sounding / Slagsondering (Slb) method data.
7
+ - Now read the `IC=` header and populate a new `depth` attribute on the Dissipation Test (DT) class `MethodDT`.
8
+ - Set 7 days delay on installing new packages.
9
9
 
10
- _2025-11-27_
10
+ Version 0.0.12
11
+
12
+ _2026-07-08_
13
+
14
+ - Now accept Unicode minus characters in the data.
15
+
16
+ Version 0.0.11 Yanked
17
+
18
+ _2025-12-02_
19
+
20
+ - ~~Change the attribute name `load` to `penetration_force` for the Weight Sounding Test (WST)
21
+ and the Swedish Impact sounding / Slagsondering (Slb) method data.~~
11
22
 
12
23
  Version 0.0.10
13
24
 
14
- - Add data model for the Impact sounding / Slagsondering (Slb) method
25
+ _2025-11-27_
15
26
 
16
- _2025-08-12_
27
+ - Add data model for the Impact sounding / Slagsondering (Slb) method
17
28
 
18
29
  Version 0.0.9
19
30
 
31
+ _2025-08-12_
32
+
20
33
  - Better support for importing Dissipation Tests (DT). Still need the code `HM=35`, and we do not handle dissipation
21
34
  tests with `HM=7`.
22
35
 
23
- _2025-05-13_
24
-
25
36
  Version 0.0.8
26
37
 
27
- - Reverted the parsing strategy to go line by line, such that K-codes do not overrule the other data.
38
+ _2025-05-13_
28
39
 
29
- _2025-04-11_
40
+ - Reverted the parsing strategy to go line by line, such that K-codes do not overrule the other data.
30
41
 
31
42
  Version 0.0.7
32
43
 
33
- - Add `SP` as an alias for hammering pressure.
34
- Affects method Total sounding (TOT) and Soil Rock Sounding (SRS).
44
+ _2025-04-11_
35
45
 
36
- _2025-03-13_
46
+ - Add `SP` as an alias for hammering pressure.
47
+ Affects method Total sounding (TOT) and Soil Rock Sounding (SRS).
37
48
 
38
49
  Version 0.0.6
39
50
 
40
- - Converting from Poetry to uv. No functional changes.
51
+ _2025-03-13_
41
52
 
42
- _2025-03-10_
53
+ - Converting from Poetry to uv. No functional changes.
43
54
 
44
55
  Version 0.0.5
45
56
 
57
+ _2025-03-10_
58
+
46
59
  - Add support for old WST code (2).
47
60
  - Rename Dynamic Probing (DP) type from `type` to `dynamic_probing_type`.
48
61
 
49
- _2025-02-27_
50
-
51
62
  Version 0.0.4
52
63
 
64
+ _2025-02-27_
65
+
53
66
  - Add `borehole_name` to methods.
54
67
  - Change the values of the SoundingClass and DPType.
55
68
 
56
- _2025-02-17_
57
-
58
69
  Version 0.0.3
59
70
 
60
- Add support for the methods Pressure Sounding (Tr), Impact sounding (Slb) and Light sounding (Sti).
71
+ _2025-02-17_
61
72
 
62
- _2024-10-15_
73
+ - Add support for the methods Pressure Sounding (Tr), Impact sounding (Slb) and Light sounding (Sti).
63
74
 
64
75
  Version 0.0.2
65
76
 
66
- Fix missing handling of non-standard method codes 9, 71 and 72.
77
+ _2024-10-15_
67
78
 
68
- _2024-10-03_
79
+ - Fix missing handling of non-standard method codes 9, 71 and 72.
69
80
 
70
81
  Version 0.0.1
71
82
 
72
- Add support for non-standard SGF codes for SRS/Jb2 71, SRS/Jb3 72 and DP SH B 9.
83
+ _2024-10-03_
73
84
 
74
- _2024-08-22_
85
+ - Add support for non-standard SGF codes for SRS/Jb2 71, SRS/Jb3 72 and DP SH B 9.
75
86
 
76
87
  Version 0.0.1b5
77
88
 
78
- Add support for Dynamic Probing (DP).
89
+ _2024-08-22_
79
90
 
80
- _2024-08-08_
91
+ - Add support for Dynamic Probing (DP).
81
92
 
82
93
  Version 0.0.1b4
83
94
 
84
- Fix an edge case where strings are given in the "K" code, e.g. "K=SAND".
85
- These are not moved to the "T"/remarks column, as "K" is reserved for (integer) comment codes.
95
+ _2024-08-08_
86
96
 
87
- _2024-08-06_
97
+ - Fix an edge case where strings are given in the "K" code, e.g. "K=SAND".
98
+ These are not moved to the "T"/remarks column, as "K" is reserved for (integer) comment codes.
88
99
 
89
100
  Version 0.0.1b3
90
101
 
91
- Fix bug in SGFParser that causes the parser to fail if it contains several comment codes (in "K" column) but no remarks (in "T" column).
102
+ _2024-08-06_
92
103
 
93
- _2024-07-29_
104
+ - Fix bug in SGFParser that causes the parser to fail if it contains several comment codes (in "K" column) but no
105
+ remarks (in "T" column).
94
106
 
95
107
  Version 0.0.1b2
96
108
 
97
- Support Weight Sounding Test (WST) (Swedish Viktsondering)
109
+ _2024-07-29_
98
110
 
99
- _2024-06-21_
111
+ - Support Weight Sounding Test (WST) (Swedish Viktsondering)
100
112
 
101
113
  Version 0.0.1b1
102
114
 
103
- Update packages.
104
-
115
+ _2024-06-21_
105
116
 
106
- _2024-05-22_
117
+ - Update packages.
107
118
 
108
119
  Version 0.0.1a2
109
120
 
110
- Addition of dissipation test method with limited support.
121
+ _2024-05-22_
111
122
 
112
-
113
- _2024-04-03_
123
+ - Addition of dissipation test method with limited support.
114
124
 
115
125
  Version 0.0.1a1 (Alpha Release)
116
126
 
117
- Initial pre-release version of the package.
127
+ _2024-04-03_
128
+
129
+ - Initial pre-release version of the package.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sgf-parser
3
- Version: 0.0.11
3
+ Version: 0.0.13
4
4
  Summary: Parser for the Swedish Geotechnical Society / Svenska Geotekniska Föreningen (SGF) data format
5
5
  Project-URL: homepage, https://github.com/norwegian-geotechnical-institute/sgf-parser
6
6
  Project-URL: repository, https://github.com/norwegian-geotechnical-institute/sgf-parser
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "sgf-parser"
3
- version = "0.0.11"
3
+ version = "0.0.13"
4
4
  description = "Parser for the Swedish Geotechnical Society / Svenska Geotekniska Föreningen (SGF) data format"
5
5
  authors = [{ name = "Jostein Leira", email = "jostein@leira.net" }]
6
6
  requires-python = ">=3.11,<4"
@@ -32,13 +32,25 @@ build-backend = "hatchling.build"
32
32
  dev = [
33
33
  "pytest",
34
34
  "pytest-cov",
35
- "mypy",
36
35
  "bandit",
37
36
  "safety",
38
37
  "pip-licenses",
39
38
  "ruff",
40
39
  ]
41
40
 
41
+ [tool.uv]
42
+ exclude-newer = "P7D"
43
+ no-build = true
44
+ no-binary-package = ["sgf-parser"]
45
+
46
+ [tool.uv.audit]
47
+ ignore = [
48
+ "GHSA-p4gq-832x-fm9v", # Safety uses nltk:
49
+ # Natural Language Toolkit (NLTK):
50
+ # URL-Encoded Path Traversal in nltk.data.load() Allows Arbitrary Local File Read
51
+ "PYSEC-2026-597", # Yet another security volnerability in nltk 3.9.4
52
+ ]
53
+
42
54
  [tool.ruff]
43
55
  line-length = 120
44
56
  src = ["src", "tests"]
@@ -46,14 +58,3 @@ src = ["src", "tests"]
46
58
  [tool.ruff.lint.per-file-ignores]
47
59
  "__init__.py" = ["F401"]
48
60
 
49
- [tool.mypy]
50
- plugins = [
51
- "pydantic.mypy"
52
- ]
53
-
54
- follow_imports = "skip"
55
- warn_redundant_casts = true
56
- warn_unused_ignores = true
57
- disallow_any_generics = true
58
- check_untyped_defs = true
59
- no_implicit_reexport = false
@@ -10,6 +10,35 @@ from sgf_parser.datetime_parser import convert_str_to_datetime, convert_str_to_t
10
10
  from sgf_parser.models import MethodType
11
11
 
12
12
 
13
+ _MINUS_SIGN_TRANSLATION = str.maketrans(
14
+ {
15
+ "\u2212": "-",
16
+ "\u2010": "-",
17
+ "\u2011": "-",
18
+ "\u2012": "-",
19
+ "\u2013": "-",
20
+ "\ufe63": "-",
21
+ "\uff0d": "-",
22
+ }
23
+ )
24
+
25
+
26
+ def _normalize_minus_signs(value: Any) -> Any:
27
+ if isinstance(value, str):
28
+ return value.translate(_MINUS_SIGN_TRANSLATION)
29
+
30
+ if isinstance(value, dict):
31
+ return {key: _normalize_minus_signs(item) for key, item in value.items()}
32
+
33
+ if isinstance(value, list):
34
+ return [_normalize_minus_signs(item) for item in value]
35
+
36
+ if isinstance(value, tuple):
37
+ return tuple(_normalize_minus_signs(item) for item in value)
38
+
39
+ return value
40
+
41
+
13
42
  class MethodData(BaseModel, abc.ABC):
14
43
  @classmethod
15
44
  def _fix_malformed_data(cls, code: str) -> str | None:
@@ -27,9 +56,11 @@ class MethodData(BaseModel, abc.ABC):
27
56
  codes = data["K"].split(", ")
28
57
  sorted_codes = sorted(
29
58
  codes,
30
- key=lambda code: "0"
31
- if code in ("40", "41", "42", "43")
32
- else (" " if code in ("90", "91", "92", "93", "94", "95", "96", "97", "98", "99") else code),
59
+ key=lambda code: (
60
+ "0"
61
+ if code in ("40", "41", "42", "43")
62
+ else (" " if code in ("90", "91", "92", "93", "94", "95", "96", "97", "98", "99") else code)
63
+ ),
33
64
  reverse=False,
34
65
  )
35
66
  code = sorted_codes[0]
@@ -128,6 +159,11 @@ class MethodData(BaseModel, abc.ABC):
128
159
 
129
160
  return data
130
161
 
162
+ @model_validator(mode="before")
163
+ @classmethod
164
+ def normalize_unicode_minus_signs(cls, data: Any) -> Any:
165
+ return _normalize_minus_signs(data)
166
+
131
167
  def __repr__(self):
132
168
  return f"<{self.__class__.__name__} {self.depth}>"
133
169
 
@@ -287,6 +323,11 @@ class Method(BaseModel):
287
323
 
288
324
  return data
289
325
 
326
+ @model_validator(mode="before")
327
+ @classmethod
328
+ def normalize_unicode_minus_signs(cls, data: Any) -> Any:
329
+ return _normalize_minus_signs(data)
330
+
290
331
  @computed_field
291
332
  def depth_top(self) -> Decimal | None:
292
333
  if not self.method_data:
@@ -35,5 +35,6 @@ class MethodDT(Method):
35
35
  name: str = "DT"
36
36
  method_type: Literal[MethodType.DT] = MethodType.DT
37
37
  method_data_type: type[MethodDTData] = MethodDTData
38
+ depth: Decimal | None = Field(None, alias="IC", description="Depth (m)")
38
39
 
39
40
  method_data: list[MethodDTData] = []
@@ -16,7 +16,7 @@ class MethodSLBData(MethodData):
16
16
 
17
17
  depth: Decimal | None = Field(None, alias="D", description="Depth (m)")
18
18
  penetration_rate: Decimal | None = Field(None, alias="B", description="Penetration rate (mm/s)")
19
- penetration_force: Decimal | None = Field(None, description="Load (kN)", validation_alias=AliasChoices("W", "A"))
19
+ load: Decimal | None = Field(None, description="Load (kN)", validation_alias=AliasChoices("W", "A"))
20
20
 
21
21
 
22
22
  class MethodSLB(Method):
@@ -17,7 +17,7 @@ class MethodWSTData(MethodData):
17
17
 
18
18
  depth: Decimal = Field(..., alias="D", description="Depth (m)")
19
19
  turning: Decimal = Field(..., alias="H", description="Turning (half revolution/0.2 m)")
20
- penetration_force: Decimal | None = Field(None, description="Load (kN)", validation_alias=AliasChoices("W", "A"))
20
+ load: Decimal | None = Field(None, description="Load (kN)", validation_alias=AliasChoices("W", "A"))
21
21
  penetration_rate: Decimal | None = Field(None, alias="B", description="Penetration rate (mm/s)")
22
22
 
23
23
  hammering: bool | None = Field(None, alias="AP")
@@ -0,0 +1,84 @@
1
+ $
2
+ HA=1,HB=808,HC=TEST,HD=20260113,HI=1234,HJ=1234,HK=7,HM=7,HO=2.0,HN=52504,HT=2162.9 31186.0 1906.5 2166.6 31118.0 1905.9,HQ=JOST
3
+ #
4
+ D=2.006,B=0.24,A=0.43,U=143.100,Q=0.849,F=64.5542,TA=0.6,O=7.3,NA=0.000,NB=0.000,NC=0.000
5
+ D=2.020,B=3.73,A=2.91,U=53.267,Q=2.498,F=86.7444,TA=0.6,O=7.3
6
+ D=2.030,B=6.15,A=2.40,U=64.300,Q=2.140,F=75.8750,TA=0.7,O=7.3
7
+ D=2.040,B=9.13,A=2.03,U=72.000,Q=1.888,F=70.0000,TA=0.7,O=7.3
8
+ D=2.049,B=13.22,A=1.72,U=59.067,Q=1.681,F=64.3333,TA=0.7,O=7.3
9
+ D=2.061,B=16.82,A=1.53,U=66.700,Q=1.521,F=59.5000,TA=0.7,O=7.3
10
+ D=2.070,B=17.95,A=1.41,U=97.700,Q=1.467,F=55.7000,TA=0.3,O=7.3
11
+ D=2.079,B=19.22,A=1.31,U=153.450,Q=1.425,F=49.8000,TA=0.0,O=7.3
12
+ D=2.091,B=19.79,A=1.23,U=222.750,Q=1.387,F=42.5500,TA=0.3,O=7.3
13
+ D=2.099,B=20.66,A=1.28,U=287.300,Q=1.345,F=37.1500,TA=0.7,O=7.3
14
+ D=2.111,B=21.21,A=1.29,U=307.550,Q=1.323,F=32.4500,TA=0.3,O=7.3
15
+ D=2.119,B=21.50,A=1.28,U=244.650,Q=1.358,F=26.3500,TA=0.0,O=7.3
16
+ D=2.130,B=21.65,A=1.33,U=155.450,Q=1.435,F=21.3500,TA=0.4,O=7.3
17
+ D=2.140,B=22.04,A=1.33,U=98.250,Q=1.527,F=18.6500,TA=0.8,O=7.3
18
+ D=2.151,B=21.65,A=1.19,U=85.350,Q=1.576,F=17.1000,TA=0.8,O=7.3
19
+ D=2.160,B=21.51,A=1.04,U=105.200,Q=1.535,F=16.4000,TA=0.7,O=7.3
20
+ D=2.169,B=21.52,A=0.88,U=141.800,Q=1.385,F=17.9500,TA=0.3,O=7.3
21
+ D=2.181,B=21.10,A=0.79,U=156.850,Q=1.200,F=20.1000,TA=0.0,O=7.3
22
+ D=2.190,B=21.07,A=0.63,U=170.900,Q=1.091,F=21.2000,TA=0.0,O=7.3
23
+ D=2.199,B=21.14,A=0.56,U=236.850,Q=1.007,F=23.3000,TA=0.0,O=7.3
24
+ D=2.210,B=20.99,A=0.47,U=330.050,Q=0.927,F=24.0000,TA=0.0,O=7.3
25
+ D=2.221,B=21.28,A=0.35,U=373.150,Q=0.882,F=22.4500,TA=0.0,O=7.3
26
+ D=2.230,B=21.09,A=0.07,U=359.900,Q=0.866,F=21.6000,TA=0.0,O=7.3
27
+ D=2.239,B=21.25,A=-0.01,U=364.250,Q=0.852,F=21.1000,TA=0.4,O=7.3
28
+ D=2.250,B=21.10,A=-0.02,U=370.400,Q=0.830,F=18.9500,TA=0.8,O=7.3
29
+ D=2.260,B=21.12,A=-0.03,U=382.700,Q=0.807,F=16.5000,TA=0.8,O=7.3
30
+ D=2.270,B=21.16,A=-0.02,U=395.000,Q=0.776,F=15.4500,TA=0.8,O=7.3
31
+ D=2.280,B=20.91,A=-0.02,U=395.600,Q=0.756,F=15.1000,TA=0.8,O=7.3
32
+ D=2.290,B=21.04,A=-0.00,U=397.550,Q=0.764,F=14.5000,TA=0.8,O=7.3
33
+ D=2.300,B=20.79,A=0.00,U=409.600,Q=0.784,F=13.7000,TA=0.8,O=7.3
34
+ D=2.310,B=20.91,A=0.01,U=424.800,Q=0.819,F=13.1500,TA=0.8,O=7.3
35
+ D=2.320,B=20.91,A=0.02,U=429.750,Q=0.874,F=12.6500,TA=0.8,O=7.3
36
+ D=3.250,B=10.14,A=20.98,U=620.167,Q=6.951,F=13.4333,TA=1.2,O=6.7
37
+ D=3.260,B=12.61,A=28.16,U=317.450,Q=17.087,F=24.7500,TA=0.7,O=6.7
38
+ D=3.270,B=13.95,A=33.27,U=163.133,Q=22.529,F=32.1667,TA=0.5,O=6.7
39
+ D=3.280,B=15.39,A=36.99,U=53.550,Q=28.121,F=39.3000,TA=1.0,O=6.7
40
+ D=3.290,B=0.28,A=39.46,U=-10.627,Q=36.094,F=30.4487,TA=0.5,O=6.1
41
+ D=3.300,B=24.67,A=40.24,U=-9.500,Q=35.008,F=30.8000,TA=0.7,O=6.1,NA=-0.068,NB=-0.599,NC=3.699,K=92
42
+ $
43
+ HA=1,HB=808,HC=test,HD=20260113,HI=1234,HM=35,HJ=4444,HK=7,IC=3.301
44
+ #
45
+ AD=0.3,AG=−9.600
46
+ AD=0.8,AG=−15.500
47
+ AD=1.3,AG=−23.600
48
+ AD=1.8,AG=−19.600
49
+ AD=2.3,AG=−19.900
50
+ AD=2.8,AG=−19.900
51
+ AD=3.3,AG=−21.000
52
+ AD=3.8,AG=−19.700
53
+ AD=4.3,AG=−19.800
54
+ AD=4.8,AG=−19.900
55
+ AD=5.3,AG=−19.800
56
+ AD=5.8,AG=−19.800
57
+ AD=6.3,AG=−19.800
58
+ AD=6.8,AG=−19.900
59
+ AD=7.3,AG=−19.800
60
+ AD=7.8,AG=−19.800
61
+ AD=8.3,AG=−19.700
62
+ AD=8.8,AG=−19.800
63
+ AD=9.3,AG=−19.700
64
+ AD=9.8,AG=−19.800
65
+ AD=10.3,AG=−19.700
66
+ AD=10.8,AG=−19.600
67
+ AD=11.3,AG=−19.800
68
+ AD=11.8,AG=−19.700
69
+ AD=12.3,AG=−19.800
70
+ AD=12.8,AG=−19.700
71
+ AD=13.3,AG=−19.700
72
+ AD=13.8,AG=−20.200
73
+ AD=14.3,AG=−19.900
74
+ AD=14.8,AG=−20.200
75
+ AD=15.3,AG=−20.100
76
+ AD=15.8,AG=−20.100
77
+ AD=16.3,AG=−20.100
78
+ AD=16.8,AG=−20.100
79
+ AD=17.3,AG=−20.100
80
+ AD=17.8,AG=−20.100
81
+ AD=18.3,AG=−20.100
82
+ AD=18.8,AG=−20.100
83
+ AD=19.3,AG=−20.000
84
+ AD=19.8,AG=−20.100
@@ -0,0 +1,91 @@
1
+ $
2
+ HA=1,HB=661,HC=TEST,HD=20260111,HI=12342,HJ=614,HK=T12,HM=7,HO=2.0,HN=52013,HT=2707.2 21572.0 1779.0 2709.0 21548.0 1778.5,HQ=JOST,KP=Nysen
3
+ #
4
+ D=2.01,B=0.27,U=42.488,Q=0.696,F=19.8160,TA=2.0,NA=0.000,NB=0.000,NC=0.000
5
+ D=2.02,B=42.73,U=29.300,Q=1.004,F=35.7000,TA=1.6
6
+ D=2.03,B=35.76,U=25.850,Q=0.986,F=35.3500,TA=1.6
7
+ D=2.04,B=0.33,U=6.628,Q=0.292,F=9.3547,TA=1.1
8
+ D=2.05,B=18.58,U=11.500,Q=0.000,F=0.0000,TA=1.6
9
+ D=2.06,B=15.92,U=11.500,Q=0.000,F=0.0000,TA=1.6
10
+ D=2.07,B=17.16,U=11.500,Q=0.000,F=0.0000,TA=1.6
11
+ D=2.08,B=17.78,U=11.500,Q=0.000,F=0.0000,TA=1.6
12
+ D=2.09,B=18.07,U=11.500,Q=0.000,F=0.0000,TA=1.6
13
+ D=2.10,B=0.94,U=48.523,Q=1.264,F=11.6545,TA=1.1
14
+ D=2.11,B=18.58,U=60.750,Q=1.575,F=14.7500,TA=1.6
15
+ D=12.86,B=17.68,U=81.800,Q=4.641,F=67.5500,TA=2.2
16
+ D=12.87,B=18.68,U=107.333,Q=4.897,F=77.0000,TA=2.2
17
+ D=12.88,B=16.63,U=125.850,Q=5.127,F=85.3000,TA=2.2
18
+ D=12.89,B=17.79,U=123.350,Q=5.057,F=88.5000,TA=2.2
19
+ D=12.90,B=18.28,U=114.750,Q=4.821,F=90.3500,TA=2.1
20
+ D=12.91,B=19.35,U=104.150,Q=4.533,F=91.9500,TA=2.0
21
+ D=12.92,B=19.46,U=95.400,Q=4.177,F=95.1000,TA=2.1
22
+ D=12.93,B=19.56,U=98.500,Q=3.612,F=96.2500,TA=2.2
23
+ D=12.94,B=19.56,U=142.050,Q=3.025,F=93.7500,TA=2.2
24
+ D=12.95,B=16.09,U=223.400,Q=2.786,F=90.6000,TA=2.2
25
+ D=12.96,B=17.22,U=305.050,Q=2.814,F=86.0500,TA=2.2
26
+ D=12.97,B=17.97,U=363.133,Q=3.265,F=83.0333,TA=2.2
27
+ D=12.98,B=18.77,U=376.050,Q=3.781,F=84.4000,TA=2.2
28
+ D=12.99,B=19.35,U=355.400,Q=3.834,F=83.1000,TA=2.1
29
+ D=13.00,B=19.46,U=310.450,Q=3.586,F=80.4500,TA=2.0,K=90,NA=-0.024,NB=-0.5,NC=1.8
30
+ $
31
+ HA=1,HB=661,HC=TEST,HD=20260111,HI=1234,HM=35,HJ=614,HK=T12,KP=Nysen,IC=9.28
32
+ #
33
+ AD=0.2,AG=222.100
34
+ AD=0.7,AG=219.600
35
+ AD=1.2,AG=249.500
36
+ AD=1.7,AG=275.400
37
+ AD=2.2,AG=290.800
38
+ AD=2.7,AG=299.900
39
+ AD=3.2,AG=304.000
40
+ AD=3.7,AG=307.300
41
+ AD=4.2,AG=311.500
42
+ AD=4.7,AG=314.600
43
+ AD=5.2,AG=316.300
44
+ AD=5.7,AG=317.900
45
+ AD=6.2,AG=319.300
46
+ AD=6.7,AG=321.100
47
+ AD=7.2,AG=322.600
48
+ AD=7.7,AG=323.500
49
+ AD=8.2,AG=324.300
50
+ AD=8.7,AG=325.000
51
+ AD=9.2,AG=325.700
52
+ AD=9.7,AG=326.000
53
+ AD=10.2,AG=326.200
54
+ AD=10.7,AG=296.800
55
+ AD=11.2,AG=297.800
56
+ AD=11.7,AG=299.500
57
+ AD=12.2,AG=301.100
58
+ AD=12.7,AG=302.600
59
+ AD=13.2,AG=304.400
60
+ AD=13.7,AG=306.000
61
+ AD=14.2,AG=306.700
62
+ AD=14.7,AG=307.500
63
+ AD=15.2,AG=308.200
64
+ AD=15.7,AG=308.900
65
+ AD=16.2,AG=309.100
66
+ AD=16.7,AG=309.300
67
+ AD=17.2,AG=309.400
68
+ AD=17.7,AG=309.500
69
+ AD=602.2,AG=101.800
70
+ AD=602.7,AG=94.300
71
+ AD=603.2,AG=84.700
72
+ AD=603.7,AG=90.400
73
+ AD=604.2,AG=93.400
74
+ AD=604.7,AG=94.200
75
+ AD=605.2,AG=93.200
76
+ AD=605.7,AG=92.000
77
+ AD=606.2,AG=90.700
78
+ AD=606.7,AG=88.500
79
+ AD=607.2,AG=86.100
80
+ AD=607.7,AG=84.700
81
+ AD=608.2,AG=83.600
82
+ AD=608.7,AG=82.000
83
+ AD=609.2,AG=80.500
84
+ AD=609.7,AG=79.500
85
+ AD=610.2,AG=78.500
86
+ AD=610.7,AG=77.500
87
+ AD=611.2,AG=76.200
88
+ AD=611.7,AG=74.900
89
+ AD=612.2,AG=74.000
90
+ AD=612.7,AG=73.200
91
+ AD=613.2,AG=72.100
@@ -461,21 +461,26 @@ class TestParse:
461
461
  assert getattr(row, key) == pytest.approx(
462
462
  data_rows[row.depth][key]), f"{key} {getattr(row, key)} != {data_rows[row.depth][key]}"
463
463
 
464
- # fmt: off
464
+
465
465
  @pytest.mark.parametrize(
466
- "file_name",
467
- ("tests/data/dt-test-1.std",
468
- )
466
+ "file_name, depth",
467
+ (("tests/data/dt-test-1.std",Decimal("2.57")),
468
+ ("tests/data/cpt-dt-unicode-minus-1.std",Decimal("3.301")),
469
+ ("tests/data/cpt-dt-unicode-minus-2.std",Decimal("9.28")),
470
+ )
469
471
  )
470
- # fmt: on
471
472
  def test_placeholder_dissipation_test(
472
- self, file_name
473
+ self, file_name, depth
473
474
  ):
474
- with open(file_name, "r", encoding="windows-1252") as file:
475
+ with open(file_name, "r", encoding="utf-8") as file:
475
476
  methods = Parser().parse(file)
476
477
 
477
478
  assert methods
478
479
 
480
+ for method in methods:
481
+ if isinstance(method, models.MethodDT):
482
+ assert method.depth == depth
483
+
479
484
  # fmt: off
480
485
  @pytest.mark.parametrize(
481
486
  "file_name, number_of_methods, number_of_rows",
@@ -509,20 +514,20 @@ class TestParse:
509
514
  "tests/data/wst-test-1.vim", 65, Decimal("0.025"), Decimal("1.625"),
510
515
  datetime(2022, 11, 1, 11, 7,5),
511
516
  {
512
- # penetration rate=B, hammering=AP, penetration_force=W, turning=H, rotation_rate=R
517
+ # penetration rate=B, hammering=AP, load=W, turning=H, rotation_rate=R
513
518
  Decimal("0.025"): {"comment_code": None, "remarks": None, "penetration_rate": Decimal("0.3"), "hammering": False, "rotation_rate":Decimal("0")},
514
- Decimal("0.350"): {"penetration_rate": Decimal("2.2"), "hammering": False, "rotation_rate": Decimal("0"), "penetration_force": Decimal("-0.796"), "turning": Decimal("0")},
515
- Decimal("0.375"): {"penetration_rate": Decimal("0.2"), "hammering": False, "rotation_rate": Decimal("0"), "penetration_force": Decimal("1.02"), "turning": Decimal("1112")},
519
+ Decimal("0.350"): {"penetration_rate": Decimal("2.2"), "hammering": False, "rotation_rate": Decimal("0"), "load": Decimal("-0.796"), "turning": Decimal("0")},
520
+ Decimal("0.375"): {"penetration_rate": Decimal("0.2"), "hammering": False, "rotation_rate": Decimal("0"), "load": Decimal("1.02"), "turning": Decimal("1112")},
516
521
  },
517
522
  ),
518
523
  (
519
524
  "tests/data/wst-test-2.vim", 7, Decimal("3.625"), Decimal("3.775"),
520
525
  datetime(2018, 11, 20, 10, 50,21),
521
526
  {
522
- # penetration_force=A, hammering=AP, penetration_force=W, turning=H, rotation_rate=R
523
- Decimal("3.625"): {"penetration_force":Decimal("1.020"), "turning":Decimal("152"), "penetration_rate": Decimal("154.208"), "comment_code": None, "remarks": None, "hammering": False},
524
- Decimal("3.700"): {"penetration_force": Decimal("1.020"), "turning": Decimal("24"), "penetration_rate": Decimal("10.287"), "hammering": False,},
525
- Decimal("3.775"): {"penetration_force": Decimal("5.681"), "turning": Decimal("24"), "penetration_rate": Decimal("1.506"), "hammering": False, "comment_code": 91, "remarks": "Sond kan ej drivas normalt"},
527
+ # load=A, hammering=AP, load=W, turning=H, rotation_rate=R
528
+ Decimal("3.625"): {"load":Decimal("1.020"), "turning":Decimal("152"), "penetration_rate": Decimal("154.208"), "comment_code": None, "remarks": None, "hammering": False},
529
+ Decimal("3.700"): {"load": Decimal("1.020"), "turning": Decimal("24"), "penetration_rate": Decimal("10.287"), "hammering": False,},
530
+ Decimal("3.775"): {"load": Decimal("5.681"), "turning": Decimal("24"), "penetration_rate": Decimal("1.506"), "hammering": False, "comment_code": 91, "remarks": "Sond kan ej drivas normalt"},
526
531
  },
527
532
  ),
528
533
  ),
@@ -27,9 +27,7 @@ def build_test_string(
27
27
  q = NA * 100.0 / NA_percent + 0.001 # MPa
28
28
  f = NB * 100.0 / NB_percent + 0.001 # kPa
29
29
  u = NC * 100.0 / NC_percent + 0.001 # kPa
30
- test_string += (
31
- f"D={delta_depth:0.2f},B=0.9,A=0.0,U={u},Q={q},F={f},O=6.2,NA={NA*2:0.3f},NB={NB*2:0.3f},NC={NC*2:0.3f}\r\n"
32
- )
30
+ test_string += f"D={delta_depth:0.2f},B=0.9,A=0.0,U={u},Q={q},F={f},O=6.2,NA={NA * 2:0.3f},NB={NB * 2:0.3f},NC={NC * 2:0.3f}\r\n"
33
31
  test_string += f"D={2 * delta_depth:0.2f},B=0.9,A=0.0,U={u},Q={q},F={f},O=6.2\r\n"
34
32
  test_string += f"D={3 * delta_depth:0.2f},B=0.9,A=0.0,U={u},Q={q},F={f},O=6.2\r\n"
35
33
  test_string += (