sgf-parser 0.0.1b5__tar.gz → 0.0.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.
Files changed (22) hide show
  1. {sgf_parser-0.0.1b5 → sgf_parser-0.0.3}/PKG-INFO +8 -7
  2. {sgf_parser-0.0.1b5 → sgf_parser-0.0.3}/README.md +1 -1
  3. {sgf_parser-0.0.1b5 → sgf_parser-0.0.3}/pyproject.toml +5 -7
  4. {sgf_parser-0.0.1b5 → sgf_parser-0.0.3}/src/sgf_parser/models/__init__.py +3 -0
  5. {sgf_parser-0.0.1b5 → sgf_parser-0.0.3}/src/sgf_parser/models/method.py +22 -1
  6. {sgf_parser-0.0.1b5 → sgf_parser-0.0.3}/src/sgf_parser/models/method_cpt.py +1 -22
  7. {sgf_parser-0.0.1b5 → sgf_parser-0.0.3}/src/sgf_parser/models/method_dp.py +2 -22
  8. {sgf_parser-0.0.1b5 → sgf_parser-0.0.3}/src/sgf_parser/models/method_dt.py +1 -17
  9. {sgf_parser-0.0.1b5 → sgf_parser-0.0.3}/src/sgf_parser/models/method_rp.py +1 -22
  10. sgf_parser-0.0.3/src/sgf_parser/models/method_slb.py +33 -0
  11. {sgf_parser-0.0.1b5 → sgf_parser-0.0.3}/src/sgf_parser/models/method_srs.py +4 -2
  12. sgf_parser-0.0.3/src/sgf_parser/models/method_sti.py +32 -0
  13. {sgf_parser-0.0.1b5 → sgf_parser-0.0.3}/src/sgf_parser/models/method_svt.py +1 -15
  14. {sgf_parser-0.0.1b5 → sgf_parser-0.0.3}/src/sgf_parser/models/method_tot.py +0 -21
  15. sgf_parser-0.0.3/src/sgf_parser/models/method_tr.py +37 -0
  16. {sgf_parser-0.0.1b5 → sgf_parser-0.0.3}/src/sgf_parser/models/method_type.py +3 -0
  17. {sgf_parser-0.0.1b5 → sgf_parser-0.0.3}/src/sgf_parser/models/method_wst.py +1 -15
  18. {sgf_parser-0.0.1b5 → sgf_parser-0.0.3}/src/sgf_parser/parser.py +11 -5
  19. {sgf_parser-0.0.1b5 → sgf_parser-0.0.3}/LICENSE +0 -0
  20. {sgf_parser-0.0.1b5 → sgf_parser-0.0.3}/src/sgf_parser/__init__.py +0 -0
  21. {sgf_parser-0.0.1b5 → sgf_parser-0.0.3}/src/sgf_parser/datetime_parser.py +0 -0
  22. {sgf_parser-0.0.1b5 → sgf_parser-0.0.3}/src/sgf_parser/models/types.py +0 -0
@@ -1,24 +1,25 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: sgf-parser
3
- Version: 0.0.1b5
3
+ Version: 0.0.3
4
4
  Summary: Parser for the Swedish Geotechnical Society / Svenska Geotekniska Föreningen (SGF) data format
5
- Home-page: https://github.com/norwegian-geotechnical-institute/sgf-parser
6
5
  License: MIT
7
6
  Author: Jostein Leira
8
7
  Author-email: jostein@leira.net
9
8
  Maintainer: Jostein Leira
10
9
  Maintainer-email: jostein@leira.net
11
10
  Requires-Python: >=3.11,<4
12
- Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Development Status :: 5 - Production/Stable
13
12
  Classifier: License :: OSI Approved :: MIT License
14
13
  Classifier: Operating System :: OS Independent
15
14
  Classifier: Programming Language :: Python :: 3
16
15
  Classifier: Programming Language :: Python :: 3.11
17
16
  Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
18
  Classifier: Topic :: Scientific/Engineering :: GIS
19
- Requires-Dist: pydantic (>=2.7.1,<3.0.0)
19
+ Requires-Dist: pydantic (>=2.10,<3.0)
20
20
  Requires-Dist: python-dateutil (>=2.9.0.post0,<3.0.0)
21
- Requires-Dist: types-python-dateutil (>=2.8.19.20240311,<3.0.0.0)
21
+ Requires-Dist: types-python-dateutil (>=2.9,<3.0)
22
+ Project-URL: Homepage, https://github.com/norwegian-geotechnical-institute/sgf-parser
22
23
  Project-URL: Repository, https://github.com/norwegian-geotechnical-institute/sgf-parser
23
24
  Description-Content-Type: text/markdown
24
25
 
@@ -75,7 +76,7 @@ len(method.method_data)
75
76
  1. Software dependencies
76
77
 
77
78
  - Python 3.11 or higher
78
- - Poetry
79
+ - Poetry 2
79
80
  - ruff code formatter
80
81
 
81
82
  2. Clone this repository
@@ -51,7 +51,7 @@ len(method.method_data)
51
51
  1. Software dependencies
52
52
 
53
53
  - Python 3.11 or higher
54
- - Poetry
54
+ - Poetry 2
55
55
  - ruff code formatter
56
56
 
57
57
  2. Clone this repository
@@ -15,7 +15,7 @@ exclude = '''
15
15
 
16
16
  [tool.poetry]
17
17
  name = "sgf-parser"
18
- version = "0.0.1b5"
18
+ version = "0.0.3"
19
19
  description = "Parser for the Swedish Geotechnical Society / Svenska Geotekniska Föreningen (SGF) data format"
20
20
  license = "MIT"
21
21
  authors = ["Jostein Leira <jostein@leira.net>"]
@@ -24,9 +24,9 @@ readme = "README.md"
24
24
  homepage = "https://github.com/norwegian-geotechnical-institute/sgf-parser"
25
25
  repository = "https://github.com/norwegian-geotechnical-institute/sgf-parser"
26
26
  classifiers = [
27
- # "Development Status :: 5 - Production/Stable",
27
+ "Development Status :: 5 - Production/Stable",
28
28
  # "Development Status :: 4 - Beta",
29
- "Development Status :: 3 - Alpha",
29
+ # "Development Status :: 3 - Alpha",
30
30
  "Operating System :: OS Independent",
31
31
  "Programming Language :: Python :: 3",
32
32
  "Topic :: Scientific/Engineering :: GIS",
@@ -58,9 +58,9 @@ no_implicit_reexport = false
58
58
 
59
59
  [tool.poetry.dependencies]
60
60
  python = ">=3.11,<4"
61
- pydantic = "^2.7.1"
61
+ pydantic = "^2.10"
62
62
  python-dateutil = "^2.9.0.post0"
63
- types-python-dateutil = "^2.8.19.20240311"
63
+ types-python-dateutil = "^2.9"
64
64
 
65
65
 
66
66
  [tool.poetry.group.dev.dependencies]
@@ -71,8 +71,6 @@ bandit = "*"
71
71
  safety = "*"
72
72
  pip-licenses = "*"
73
73
  ruff = "*"
74
- # Pinned due to problem with unpinned ruamel-yaml subdependency ruamel-yaml-clib not able to install on windows
75
- ruamel-yaml-clib={platform = "win32", version = "<0.2.6"}
76
74
 
77
75
  [build-system]
78
76
  requires = ["poetry-core>=1.0.0"]
@@ -9,4 +9,7 @@ from sgf_parser.models.method_rp import MethodRP, MethodRPData
9
9
  from sgf_parser.models.method_srs import MethodSRS, MethodSRSData
10
10
  from sgf_parser.models.method_svt import MethodSVT, MethodSVTData
11
11
  from sgf_parser.models.method_tot import MethodTOT, MethodTOTData
12
+ from sgf_parser.models.method_tr import MethodTR, MethodTRData
13
+ from sgf_parser.models.method_slb import MethodSLB, MethodSLBData
14
+ from sgf_parser.models.method_sti import MethodSTI, MethodSTIData
12
15
  from sgf_parser.models.method_wst import MethodWST, MethodWSTData
@@ -4,7 +4,7 @@ from datetime import datetime, time
4
4
  from decimal import Decimal
5
5
  from typing import Any
6
6
 
7
- from pydantic import BaseModel, Field, AliasChoices, model_validator
7
+ from pydantic import BaseModel, Field, AliasChoices, model_validator, computed_field
8
8
 
9
9
  from sgf_parser.datetime_parser import convert_str_to_datetime, convert_str_to_time
10
10
  from sgf_parser.models import MethodType
@@ -394,6 +394,27 @@ class Method(BaseModel):
394
394
 
395
395
  return data
396
396
 
397
+ @computed_field
398
+ def depth_top(self) -> Decimal | None:
399
+ if not self.method_data:
400
+ return None
401
+
402
+ return min(method_data.depth for method_data in self.method_data)
403
+
404
+ @computed_field
405
+ def depth_base(self) -> Decimal | None:
406
+ if not self.method_data:
407
+ return None
408
+
409
+ return max(method_data.depth for method_data in self.method_data)
410
+
411
+ @computed_field
412
+ def stopcode(self) -> int | None:
413
+ if not self.method_data:
414
+ return None
415
+
416
+ return self.method_data[-1].comment_code
417
+
397
418
  method_type: MethodType
398
419
  method_data_type: type[MethodData]
399
420
 
@@ -1,7 +1,7 @@
1
1
  from decimal import Decimal
2
2
  from typing import Literal
3
3
 
4
- from pydantic import Field, AliasChoices, computed_field
4
+ from pydantic import Field, AliasChoices
5
5
 
6
6
  from sgf_parser.models import MethodType, MethodData, Method
7
7
  from sgf_parser.models.types import ApplicationClass
@@ -251,27 +251,6 @@ class MethodCPT(Method):
251
251
  else:
252
252
  return ApplicationClass.UNKNOWN
253
253
 
254
- @computed_field
255
- def depth_top(self) -> Decimal | None:
256
- if not self.method_data:
257
- return None
258
-
259
- return min(method_data.depth for method_data in self.method_data)
260
-
261
- @computed_field
262
- def depth_base(self) -> Decimal | None:
263
- if not self.method_data:
264
- return None
265
-
266
- return max(method_data.depth for method_data in self.method_data)
267
-
268
- @computed_field
269
- def stopcode(self) -> int | None:
270
- if not self.method_data:
271
- return None
272
-
273
- return self.method_data[-1].comment_code
274
-
275
254
  # "MA": "cone_area_ratio", # same as header code IE
276
255
  # "IE": "cone_area_ratio", # same as header code MA
277
256
  # "MB": "sleeve_area_ratio", # same as header code IF
@@ -1,7 +1,7 @@
1
1
  from decimal import Decimal
2
2
  from typing import Literal, Any
3
3
 
4
- from pydantic import Field, model_validator, computed_field, AliasChoices
4
+ from pydantic import Field, model_validator, AliasChoices
5
5
 
6
6
  from sgf_parser.models import MethodData, Method, MethodType
7
7
  from sgf_parser.models.types import DPType
@@ -63,20 +63,6 @@ class MethodDP(Method):
63
63
 
64
64
  method_data: list[MethodDPData] = []
65
65
 
66
- @computed_field
67
- def depth_top(self) -> Decimal | None:
68
- if not self.method_data:
69
- return None
70
-
71
- return min(method_data.depth for method_data in self.method_data)
72
-
73
- @computed_field
74
- def depth_base(self) -> Decimal | None:
75
- if not self.method_data:
76
- return None
77
-
78
- return max(method_data.depth for method_data in self.method_data)
79
-
80
66
  @model_validator(mode="before")
81
67
  @classmethod
82
68
  def set_operation(cls, data: Any) -> Any:
@@ -88,14 +74,8 @@ class MethodDP(Method):
88
74
  "108B": DPType.DPL,
89
75
  "108C": DPType.DPM,
90
76
  "108D": DPType.DPH,
77
+ "9": DPType.DPSH_B,
91
78
  "108E": DPType.DPSH_B,
92
79
  }[data["HM"]]
93
80
 
94
81
  return data
95
-
96
- @computed_field
97
- def stopcode(self) -> int | None:
98
- if not self.method_data:
99
- return None
100
-
101
- return self.method_data[-1].comment_code
@@ -1,7 +1,7 @@
1
1
  from decimal import Decimal
2
2
  from typing import Literal
3
3
 
4
- from pydantic import Field, computed_field
4
+ from pydantic import Field
5
5
 
6
6
  from sgf_parser.models import MethodType, MethodData, Method
7
7
 
@@ -32,19 +32,3 @@ class MethodDT(Method):
32
32
  method_data_type: type[MethodDTData] = MethodDTData
33
33
 
34
34
  method_data: list[MethodDTData] = []
35
-
36
- @computed_field
37
- def stopcode(self) -> int | None:
38
- if not self.method_data:
39
- return None
40
-
41
- return self.method_data[-1].comment_code
42
-
43
- def post_processing(self):
44
- """
45
- Post-processing
46
-
47
- """
48
-
49
- if not self.method_data:
50
- return
@@ -1,7 +1,7 @@
1
1
  from decimal import Decimal
2
2
  from typing import Literal
3
3
 
4
- from pydantic import Field, computed_field
4
+ from pydantic import Field
5
5
 
6
6
  from sgf_parser.models import MethodType, MethodData, Method
7
7
 
@@ -40,27 +40,6 @@ class MethodRP(Method):
40
40
 
41
41
  method_data: list[MethodRPData] = []
42
42
 
43
- @computed_field
44
- def depth_top(self) -> Decimal | None:
45
- if not self.method_data:
46
- return None
47
-
48
- return min(method_data.depth for method_data in self.method_data)
49
-
50
- @computed_field
51
- def depth_base(self) -> Decimal | None:
52
- if not self.method_data:
53
- return None
54
-
55
- return max(method_data.depth for method_data in self.method_data)
56
-
57
- @computed_field
58
- def stopcode(self) -> int | None:
59
- if not self.method_data:
60
- return None
61
-
62
- return self.method_data[-1].comment_code
63
-
64
43
  def post_processing(self):
65
44
  """
66
45
  Post-processing
@@ -0,0 +1,33 @@
1
+ from decimal import Decimal
2
+ from typing import Literal
3
+
4
+ from pydantic import Field
5
+
6
+ from sgf_parser.models import MethodType, MethodData, Method
7
+
8
+
9
+ class MethodSLBData(MethodData):
10
+ """
11
+ Method Impact sounding Data (Swedish "Slagsondering")
12
+ """
13
+
14
+ def __init__(self, **kwargs):
15
+ super().__init__(**kwargs)
16
+
17
+ depth: Decimal | None = Field(None, alias="D", description="Depth (m)")
18
+ penetration_rate: Decimal | None = Field(None, alias="B", description="Penetration rate (mm/s)")
19
+
20
+
21
+ class MethodSLB(Method):
22
+ """
23
+ Method Impact sounding (Swedish "Slagsondering")
24
+ """
25
+
26
+ def __init__(self, **kwargs):
27
+ super().__init__(**kwargs)
28
+
29
+ name: str = "Slb"
30
+ method_type: Literal[MethodType.SLB] = MethodType.SLB
31
+ method_data_type: type[MethodSLBData] = MethodSLBData
32
+
33
+ method_data: list[MethodSLBData] = []
@@ -14,8 +14,8 @@ class MethodSRSData(MethodData):
14
14
  Sounding classes:
15
15
 
16
16
  12 (Jb-1)
17
- 41 (Jb-2)
18
- 42 (Jb-3)
17
+ 41 71 (Jb-2)
18
+ 42 72 (Jb-3)
19
19
  73 (Jb-tot)
20
20
 
21
21
  """
@@ -83,7 +83,9 @@ class MethodSRS(Method):
83
83
  data["sounding_class"] = {
84
84
  "12": SoundingClass.JB1,
85
85
  "41": SoundingClass.JB2,
86
+ "71": SoundingClass.JB2,
86
87
  "42": SoundingClass.JB3,
88
+ "72": SoundingClass.JB3,
87
89
  "73": SoundingClass.JBTOT,
88
90
  }[data["HM"]]
89
91
 
@@ -0,0 +1,32 @@
1
+ from decimal import Decimal
2
+ from typing import Literal
3
+
4
+ from pydantic import Field
5
+
6
+ from sgf_parser.models import MethodType, MethodData, Method
7
+
8
+
9
+ class MethodSTIData(MethodData):
10
+ """
11
+ Method Light sounding Data (Swedish "Sticksondering")
12
+ """
13
+
14
+ def __init__(self, **kwargs):
15
+ super().__init__(**kwargs)
16
+
17
+ depth: Decimal | None = Field(None, alias="D", description="Depth (m)")
18
+
19
+
20
+ class MethodSTI(Method):
21
+ """
22
+ Method Light sounding (Swedish "Sticksondering")
23
+ """
24
+
25
+ def __init__(self, **kwargs):
26
+ super().__init__(**kwargs)
27
+
28
+ name: str = "Sti"
29
+ method_type: Literal[MethodType.STI] = MethodType.STI
30
+ method_data_type: type[MethodSTIData] = MethodSTIData
31
+
32
+ method_data: list[MethodSTIData] = []
@@ -4,7 +4,7 @@ from datetime import datetime
4
4
  from decimal import Decimal
5
5
  from typing import Literal
6
6
 
7
- from pydantic import computed_field, Field
7
+ from pydantic import Field
8
8
 
9
9
  from sgf_parser.models import MethodData, MethodType, Method
10
10
 
@@ -38,20 +38,6 @@ class MethodSVT(Method):
38
38
 
39
39
  method_data: list[MethodSVTData] = []
40
40
 
41
- @computed_field
42
- def depth_top(self) -> Decimal | None:
43
- if not self.method_data:
44
- return None
45
-
46
- return min(method_data.depth for method_data in self.method_data)
47
-
48
- @computed_field
49
- def depth_base(self) -> Decimal | None:
50
- if not self.method_data:
51
- return None
52
-
53
- return max(method_data.depth for method_data in self.method_data)
54
-
55
41
  vane_height: Decimal | None = Field(None, description="Height of the vane used (mm).")
56
42
  serial_number: str | None = Field(None, alias="HN", description="Serial number of the vane used.")
57
43
  calibration_date: datetime | None = Field(None, description="Date of calibration of the vane used.")
@@ -87,27 +87,6 @@ class MethodTOT(Method):
87
87
  method_data_type: type[MethodTOTData] = MethodTOTData
88
88
  method_data: list[MethodTOTData] = []
89
89
 
90
- @computed_field
91
- def depth_top(self) -> Decimal | None:
92
- if not self.method_data:
93
- return None
94
-
95
- return min(method_data.depth for method_data in self.method_data)
96
-
97
- @computed_field
98
- def depth_base(self) -> Decimal | None:
99
- if not self.method_data:
100
- return None
101
-
102
- return max(method_data.depth for method_data in self.method_data)
103
-
104
- @computed_field
105
- def stopcode(self) -> int | None:
106
- if not self.method_data:
107
- return None
108
-
109
- return self.method_data[-1].comment_code
110
-
111
90
  @computed_field
112
91
  def depth_in_rock(self) -> Decimal | None:
113
92
  _rock_top_depth = None
@@ -0,0 +1,37 @@
1
+ from decimal import Decimal
2
+ from typing import Literal
3
+
4
+ from pydantic import Field
5
+
6
+ from sgf_parser.models import MethodType, MethodData, Method
7
+
8
+
9
+ class MethodTRData(MethodData):
10
+ """
11
+ Method Pressure Sounding Data (Swedish "Trycksondering")
12
+ """
13
+
14
+ def __init__(self, **kwargs):
15
+ super().__init__(**kwargs)
16
+
17
+ depth: Decimal | None = Field(None, alias="D", description="Depth (m)")
18
+ penetration_force: Decimal | None = Field(None, alias="A", description="Penetration force (kN)")
19
+ penetration_rate: Decimal | None = Field(None, alias="B", description="Penetration rate (mm/s)")
20
+ rotation_rate: Decimal | None = Field(None, alias="R", description="Rotation rate (rpm)")
21
+ rod_friction: Decimal | None = Field(None, alias="N", description="Rod friction (kN)")
22
+ increased_rotation_rate: bool | None = Field(None, alias="AQ")
23
+
24
+
25
+ class MethodTR(Method):
26
+ """
27
+ Method Pressure Sounding (Swedish "Trycksondering")
28
+ """
29
+
30
+ def __init__(self, **kwargs):
31
+ super().__init__(**kwargs)
32
+
33
+ name: str = "Tr"
34
+ method_type: Literal[MethodType.TR] = MethodType.TR
35
+ method_data_type: type[MethodTRData] = MethodTRData
36
+
37
+ method_data: list[MethodTRData] = []
@@ -10,7 +10,10 @@ class MethodType(enum.StrEnum):
10
10
  DP = "DP"
11
11
  DT = "DT"
12
12
  RP = "RP"
13
+ SLB = "SLB"
13
14
  SRS = "SRS"
15
+ STI = "STI"
14
16
  SVT = "SVT"
15
17
  TOT = "TOT"
18
+ TR = "TR"
16
19
  WST = "WST"
@@ -1,7 +1,7 @@
1
1
  from decimal import Decimal
2
2
  from typing import Literal, Any
3
3
 
4
- from pydantic import Field, model_validator, computed_field
4
+ from pydantic import Field, model_validator
5
5
 
6
6
  from sgf_parser.models import MethodData, Method, MethodType
7
7
  from sgf_parser.models.types import Operation
@@ -40,20 +40,6 @@ class MethodWST(Method):
40
40
 
41
41
  method_data: list[MethodWSTData] = []
42
42
 
43
- @computed_field
44
- def depth_top(self) -> Decimal | None:
45
- if not self.method_data:
46
- return None
47
-
48
- return min(method_data.depth for method_data in self.method_data)
49
-
50
- @computed_field
51
- def depth_base(self) -> Decimal | None:
52
- if not self.method_data:
53
- return None
54
-
55
- return max(method_data.depth for method_data in self.method_data)
56
-
57
43
  @model_validator(mode="before")
58
44
  @classmethod
59
45
  def set_operation(cls, data: Any) -> Any:
@@ -20,26 +20,32 @@ class Parser:
20
20
  """
21
21
 
22
22
  method_code_class_mapping = {
23
- "7": models.MethodCPT,
24
23
  "07": models.MethodCPT,
24
+ "10": models.MethodSLB,
25
25
  "101": models.MethodWST,
26
26
  "102": models.MethodWST,
27
27
  "107A": models.MethodCPT,
28
28
  "107B": models.MethodCPT,
29
- "8": models.MethodDP,
30
29
  "108A": models.MethodDP,
31
30
  "108B": models.MethodDP,
32
31
  "108C": models.MethodDP,
33
32
  "108D": models.MethodDP,
34
33
  "108E": models.MethodDP,
34
+ "11": models.MethodSTI,
35
+ "12": models.MethodSRS,
36
+ "13": models.MethodSVT,
35
37
  "23": models.MethodRP,
36
38
  "24": models.MethodTOT,
37
- "12": models.MethodSRS,
39
+ "3": models.MethodTR,
40
+ "35": models.MethodDT,
38
41
  "41": models.MethodSRS,
39
42
  "42": models.MethodSRS,
43
+ "7": models.MethodCPT,
44
+ "71": models.MethodSRS,
45
+ "72": models.MethodSRS,
40
46
  "73": models.MethodSRS,
41
- "13": models.MethodSVT,
42
- "35": models.MethodDT,
47
+ "8": models.MethodDP,
48
+ "9": models.MethodDP,
43
49
  }
44
50
 
45
51
  def parse(self, file: TextIO) -> list[Method]:
File without changes