sgf-parser 0.0.1a2__tar.gz → 0.0.1b2__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 (21) hide show
  1. {sgf_parser-0.0.1a2 → sgf_parser-0.0.1b2}/PKG-INFO +2 -3
  2. {sgf_parser-0.0.1a2 → sgf_parser-0.0.1b2}/pyproject.toml +4 -3
  3. sgf_parser-0.0.1b2/src/sgf_parser/__init__.py +1 -0
  4. {sgf_parser-0.0.1a2 → sgf_parser-0.0.1b2}/src/sgf_parser/models/__init__.py +1 -0
  5. {sgf_parser-0.0.1a2 → sgf_parser-0.0.1b2}/src/sgf_parser/models/method.py +1 -1
  6. {sgf_parser-0.0.1a2 → sgf_parser-0.0.1b2}/src/sgf_parser/models/method_cpt.py +4 -3
  7. {sgf_parser-0.0.1a2 → sgf_parser-0.0.1b2}/src/sgf_parser/models/method_dt.py +19 -2
  8. sgf_parser-0.0.1b2/src/sgf_parser/models/method_wst.py +67 -0
  9. {sgf_parser-0.0.1a2 → sgf_parser-0.0.1b2}/src/sgf_parser/models/types.py +9 -0
  10. {sgf_parser-0.0.1a2 → sgf_parser-0.0.1b2}/src/sgf_parser/parser.py +2 -0
  11. sgf_parser-0.0.1a2/src/sgf_parser/__init__.py +0 -1
  12. sgf_parser-0.0.1a2/src/sgf_parser/models/method_wst.py +0 -0
  13. sgf_parser-0.0.1a2/src/sgf_parser/units.py +0 -5
  14. {sgf_parser-0.0.1a2 → sgf_parser-0.0.1b2}/LICENSE +0 -0
  15. {sgf_parser-0.0.1a2 → sgf_parser-0.0.1b2}/README.md +0 -0
  16. {sgf_parser-0.0.1a2 → sgf_parser-0.0.1b2}/src/sgf_parser/datetime_parser.py +0 -0
  17. {sgf_parser-0.0.1a2 → sgf_parser-0.0.1b2}/src/sgf_parser/models/method_rp.py +0 -0
  18. {sgf_parser-0.0.1a2 → sgf_parser-0.0.1b2}/src/sgf_parser/models/method_srs.py +0 -0
  19. {sgf_parser-0.0.1a2 → sgf_parser-0.0.1b2}/src/sgf_parser/models/method_svt.py +0 -0
  20. {sgf_parser-0.0.1a2 → sgf_parser-0.0.1b2}/src/sgf_parser/models/method_tot.py +0 -0
  21. {sgf_parser-0.0.1a2 → sgf_parser-0.0.1b2}/src/sgf_parser/models/method_type.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sgf-parser
3
- Version: 0.0.1a2
3
+ Version: 0.0.1b2
4
4
  Summary: Parser for the Swedish Geotechnical Society / Svenska Geotekniska Föreningen (SGF) data format
5
5
  Home-page: https://github.com/norwegian-geotechnical-institute/sgf-parser
6
6
  License: MIT
@@ -16,8 +16,7 @@ Classifier: Programming Language :: Python :: 3
16
16
  Classifier: Programming Language :: Python :: 3.11
17
17
  Classifier: Programming Language :: Python :: 3.12
18
18
  Classifier: Topic :: Scientific/Engineering :: GIS
19
- Requires-Dist: pint (>=0.23,<0.24)
20
- Requires-Dist: pydantic (>=2.6.3,<3.0.0)
19
+ Requires-Dist: pydantic (>=2.7.1,<3.0.0)
21
20
  Requires-Dist: python-dateutil (>=2.9.0.post0,<3.0.0)
22
21
  Requires-Dist: types-python-dateutil (>=2.8.19.20240311,<3.0.0.0)
23
22
  Project-URL: Repository, https://github.com/norwegian-geotechnical-institute/sgf-parser
@@ -15,7 +15,7 @@ exclude = '''
15
15
 
16
16
  [tool.poetry]
17
17
  name = "sgf-parser"
18
- version = "0.0.1a2"
18
+ version = "0.0.1b2"
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>"]
@@ -58,10 +58,9 @@ no_implicit_reexport = false
58
58
 
59
59
  [tool.poetry.dependencies]
60
60
  python = ">=3.11,<4"
61
- pydantic = "^2.6.3"
61
+ pydantic = "^2.7.1"
62
62
  python-dateutil = "^2.9.0.post0"
63
63
  types-python-dateutil = "^2.8.19.20240311"
64
- pint = "^0.23"
65
64
 
66
65
 
67
66
  [tool.poetry.group.dev.dependencies]
@@ -72,6 +71,8 @@ bandit = "*"
72
71
  safety = "*"
73
72
  pip-licenses = "*"
74
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"}
75
76
 
76
77
  [build-system]
77
78
  requires = ["poetry-core>=1.0.0"]
@@ -0,0 +1 @@
1
+ from sgf_parser.parser import Parser
@@ -8,3 +8,4 @@ from sgf_parser.models.method_rp import MethodRP, MethodRPData
8
8
  from sgf_parser.models.method_srs import MethodSRS, MethodSRSData
9
9
  from sgf_parser.models.method_svt import MethodSVT, MethodSVTData
10
10
  from sgf_parser.models.method_tot import MethodTOT, MethodTOTData
11
+ from sgf_parser.models.method_wst import MethodWST, MethodWSTData
@@ -355,7 +355,7 @@ class Method(BaseModel):
355
355
  serial_number: str | None = Field(None, alias="HC")
356
356
 
357
357
  # "HO": "predrilling_depth",
358
- predrilling_depth: Decimal = Field(0, alias="HO")
358
+ predrilling_depth: Decimal = Field(Decimal("0"), alias="HO")
359
359
 
360
360
  # "HQ": "conducted_by",
361
361
  conducted_by: str | None = Field(None, alias="HQ")
@@ -5,7 +5,6 @@ from pydantic import Field, AliasChoices, computed_field
5
5
 
6
6
  from sgf_parser.models import MethodType, MethodData, Method
7
7
  from sgf_parser.models.types import ApplicationClass
8
- from sgf_parser.units import unit
9
8
 
10
9
 
11
10
  class MethodCPTData(MethodData):
@@ -95,7 +94,8 @@ class MethodCPT(Method):
95
94
  if self.method_data[0].zero_value_pressure:
96
95
  return
97
96
 
98
- self.method_data[0].zero_value_resistance = (NA * unit.kPa).to(unit.MPa).magnitude
97
+ # self.method_data[0].zero_value_resistance = (NA * unit.kPa).to(unit.MPa).magnitude
98
+ self.method_data[0].zero_value_resistance = NA * Decimal("0.001")
99
99
  self.method_data[0].zero_value_friction = NB
100
100
  self.method_data[0].zero_value_pressure = NC
101
101
 
@@ -177,7 +177,8 @@ class MethodCPT(Method):
177
177
 
178
178
  qc_max_data_value = self._get_data_field_max_value(field="qc") # MPa
179
179
  # convert to kPa
180
- qc_max_data_value = (qc_max_data_value * unit.MPa).to(unit.kPa).magnitude
180
+ # qc_max_data_value = (qc_max_data_value * unit.MPa).to(unit.kPa).magnitude
181
+ qc_max_data_value = qc_max_data_value * Decimal("1000")
181
182
 
182
183
  NA_class = self._get_zero_value_class(
183
184
  field="zero_value_resistance",
@@ -1,7 +1,7 @@
1
1
  from decimal import Decimal
2
2
  from typing import Literal
3
3
 
4
- from pydantic import Field
4
+ from pydantic import Field, computed_field
5
5
 
6
6
  from sgf_parser.models import MethodType, MethodData, Method
7
7
 
@@ -18,6 +18,7 @@ class MethodDTData(MethodData):
18
18
  u2: Decimal | None = Field(None, alias="AG", description="Shoulder pressure (kPa)")
19
19
  depth: Decimal | None = Field(None, alias="D", description="Depth (m)")
20
20
 
21
+
21
22
  class MethodDT(Method):
22
23
  """
23
24
  Method Pore Pressure Dissipation Test (placeholder)
@@ -30,4 +31,20 @@ class MethodDT(Method):
30
31
  method_type: Literal[MethodType.DT] = MethodType.DT
31
32
  method_data_type: type[MethodDTData] = MethodDTData
32
33
 
33
- method_data: list[MethodDTData] = []
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
@@ -0,0 +1,67 @@
1
+ from decimal import Decimal
2
+ from typing import Literal, Any
3
+
4
+ from pydantic import Field, model_validator, computed_field
5
+
6
+ from sgf_parser.models import MethodData, Method, MethodType
7
+ from sgf_parser.models.types import Operation
8
+
9
+
10
+ class MethodWSTData(MethodData):
11
+ """
12
+ Weight Sounding Test (Swedish Viktsondering) Data
13
+ """
14
+
15
+ def __init__(self, **kwargs):
16
+ super().__init__(**kwargs)
17
+
18
+ depth: Decimal = Field(..., alias="D", description="Depth (m)")
19
+ turning: Decimal = Field(..., alias="H", description="Turning (half revolution/0.2 m)")
20
+ load: Decimal = Field(..., alias="W", description="Load (kN)")
21
+ penetration_rate: Decimal | None = Field(None, alias="B", description="Penetration rate (mm/s)")
22
+
23
+ hammering: bool | None = Field(None, alias="AP")
24
+ rotation_rate: Decimal | None = Field(None, alias="R", description="Rotation rate (rpm)")
25
+
26
+
27
+ class MethodWST(Method):
28
+ """
29
+ Weight Sounding Test (Swedish Viktsondering)
30
+ """
31
+
32
+ def __init__(self, **kwargs):
33
+ super().__init__(**kwargs)
34
+
35
+ name: str = "WST"
36
+ method_type: Literal[MethodType.WST] = MethodType.WST
37
+ method_data_type: type[MethodWSTData] = MethodWSTData
38
+
39
+ operation: Operation = Operation.MECHANICAL
40
+
41
+ method_data: list[MethodWSTData] = []
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
+ @model_validator(mode="before")
58
+ @classmethod
59
+ def set_operation(cls, data: Any) -> Any:
60
+ if isinstance(data, dict):
61
+ if "HM" in data and data["HM"] is not None:
62
+ data["operation"] = {
63
+ "101": Operation.MANUAL,
64
+ "102": Operation.MECHANICAL,
65
+ }[data["HM"]]
66
+
67
+ return data
@@ -125,3 +125,12 @@ class SoundingClass(enum.StrEnum):
125
125
  JB2 = "Jb-2"
126
126
  JB3 = "Jb-3"
127
127
  JBTOT = "Jb-tot"
128
+
129
+
130
+ class Operation(enum.StrEnum):
131
+ """
132
+ Operation
133
+ """
134
+
135
+ MANUAL = "MANUAL"
136
+ MECHANICAL = "MECHANICAL"
@@ -22,6 +22,8 @@ class Parser:
22
22
  method_code_class_mapping = {
23
23
  "7": models.MethodCPT,
24
24
  "07": models.MethodCPT,
25
+ "101": models.MethodWST,
26
+ "102": models.MethodWST,
25
27
  "107A": models.MethodCPT,
26
28
  "107B": models.MethodCPT,
27
29
  "23": models.MethodRP,
@@ -1 +0,0 @@
1
- from sgf_parser.parser import Parser
File without changes
@@ -1,5 +0,0 @@
1
- from decimal import Decimal
2
-
3
- from pint import UnitRegistry
4
-
5
- unit = UnitRegistry(non_int_type=Decimal)
File without changes
File without changes