sgf-parser 0.0.1__py3-none-any.whl
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.
- sgf_parser/__init__.py +1 -0
- sgf_parser/datetime_parser.py +44 -0
- sgf_parser/models/__init__.py +12 -0
- sgf_parser/models/method.py +447 -0
- sgf_parser/models/method_cpt.py +278 -0
- sgf_parser/models/method_dp.py +102 -0
- sgf_parser/models/method_dt.py +50 -0
- sgf_parser/models/method_rp.py +75 -0
- sgf_parser/models/method_srs.py +198 -0
- sgf_parser/models/method_svt.py +57 -0
- sgf_parser/models/method_tot.py +195 -0
- sgf_parser/models/method_type.py +16 -0
- sgf_parser/models/method_wst.py +67 -0
- sgf_parser/models/types.py +149 -0
- sgf_parser/parser.py +138 -0
- sgf_parser-0.0.1.dist-info/LICENSE +21 -0
- sgf_parser-0.0.1.dist-info/METADATA +110 -0
- sgf_parser-0.0.1.dist-info/RECORD +19 -0
- sgf_parser-0.0.1.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
from decimal import Decimal
|
|
2
|
+
from typing import Literal, Any
|
|
3
|
+
|
|
4
|
+
from pydantic import computed_field, Field, model_validator
|
|
5
|
+
|
|
6
|
+
from sgf_parser.models import MethodType, Method, MethodData
|
|
7
|
+
from sgf_parser.models.types import SoundingClass, StopCode, CommentCode
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class MethodSRSData(MethodData):
|
|
11
|
+
"""
|
|
12
|
+
Soil-Rock-Sounding (Swedish Jord-bergsondering)
|
|
13
|
+
|
|
14
|
+
Sounding classes:
|
|
15
|
+
|
|
16
|
+
12 (Jb-1)
|
|
17
|
+
41 71 (Jb-2)
|
|
18
|
+
42 72 (Jb-3)
|
|
19
|
+
73 (Jb-tot)
|
|
20
|
+
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
def __init__(self, **kwargs):
|
|
24
|
+
super().__init__(**kwargs)
|
|
25
|
+
|
|
26
|
+
depth: Decimal = Field(..., alias="D", description="Depth (m)")
|
|
27
|
+
|
|
28
|
+
penetration_force: Decimal | None = Field(None, alias="A", description="Penetration force (kN)")
|
|
29
|
+
penetration_rate: Decimal | None = Field(None, alias="B", description="Penetration rate (mm/s)")
|
|
30
|
+
engine_pressure: Decimal | None = Field(None, alias="P", description="Engine pressure (MPa)")
|
|
31
|
+
hammering_pressure: Decimal | None = Field(None, alias="AZ", description="Hammering pressure (MPa)")
|
|
32
|
+
rotation_rate: Decimal | None = Field(None, alias="R", description="Rotation rate (rpm)")
|
|
33
|
+
flushing_pressure: Decimal | None = Field(None, alias="I", description="Flushing pressure (MPa)")
|
|
34
|
+
flushing_flow: Decimal | None = Field(None, alias="J", description="Flushing flow (l/min)")
|
|
35
|
+
flushing: bool | None = Field(None, alias="AR")
|
|
36
|
+
hammering: bool | None = Field(None, alias="AP")
|
|
37
|
+
increased_rotation_rate: bool | None = Field(None, alias="AQ")
|
|
38
|
+
torque: Decimal | None = Field(None, alias="V", description="Torque (kNm)")
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class MethodSRS(Method):
|
|
42
|
+
"""
|
|
43
|
+
Method SRS
|
|
44
|
+
"""
|
|
45
|
+
|
|
46
|
+
def __init__(self, **kwargs):
|
|
47
|
+
super().__init__(**kwargs)
|
|
48
|
+
|
|
49
|
+
name: str = "SRS"
|
|
50
|
+
method_type: Literal[MethodType.SRS] = MethodType.SRS
|
|
51
|
+
method_data_type: type[MethodSRSData] = MethodSRSData
|
|
52
|
+
|
|
53
|
+
method_data: list[MethodSRSData] = []
|
|
54
|
+
|
|
55
|
+
sounding_class: SoundingClass = SoundingClass.JBTOT
|
|
56
|
+
|
|
57
|
+
@computed_field
|
|
58
|
+
def depth_top(self) -> Decimal | None:
|
|
59
|
+
if not self.method_data:
|
|
60
|
+
return None
|
|
61
|
+
|
|
62
|
+
return min(method_data.depth for method_data in self.method_data)
|
|
63
|
+
|
|
64
|
+
@computed_field
|
|
65
|
+
def depth_base(self) -> Decimal | None:
|
|
66
|
+
if not self.method_data:
|
|
67
|
+
return None
|
|
68
|
+
|
|
69
|
+
return max(method_data.depth for method_data in self.method_data)
|
|
70
|
+
|
|
71
|
+
@computed_field
|
|
72
|
+
def stopcode(self) -> int | None:
|
|
73
|
+
if not self.method_data:
|
|
74
|
+
return None
|
|
75
|
+
|
|
76
|
+
return self.method_data[-1].comment_code
|
|
77
|
+
|
|
78
|
+
@model_validator(mode="before")
|
|
79
|
+
@classmethod
|
|
80
|
+
def set_sounding_class(cls, data: Any) -> Any:
|
|
81
|
+
if isinstance(data, dict):
|
|
82
|
+
if "HM" in data and data["HM"] is not None:
|
|
83
|
+
data["sounding_class"] = {
|
|
84
|
+
"12": SoundingClass.JB1,
|
|
85
|
+
"41": SoundingClass.JB2,
|
|
86
|
+
"71": SoundingClass.JB2,
|
|
87
|
+
"42": SoundingClass.JB3,
|
|
88
|
+
"72": SoundingClass.JB3,
|
|
89
|
+
"73": SoundingClass.JBTOT,
|
|
90
|
+
}[data["HM"]]
|
|
91
|
+
|
|
92
|
+
return data
|
|
93
|
+
|
|
94
|
+
def post_processing(self):
|
|
95
|
+
"""
|
|
96
|
+
Post-processing
|
|
97
|
+
|
|
98
|
+
"""
|
|
99
|
+
|
|
100
|
+
if not self.method_data:
|
|
101
|
+
return
|
|
102
|
+
|
|
103
|
+
# Update flushing, hammering and increased rotation
|
|
104
|
+
self.flushing_update()
|
|
105
|
+
self.hammering_update()
|
|
106
|
+
self.rotation_update()
|
|
107
|
+
|
|
108
|
+
@computed_field
|
|
109
|
+
def depth_in_rock(self) -> Decimal | None:
|
|
110
|
+
_rock_top_depth = None
|
|
111
|
+
_rock_base_depth = None
|
|
112
|
+
|
|
113
|
+
if not self.method_data:
|
|
114
|
+
return None
|
|
115
|
+
|
|
116
|
+
if self.stopcode not in (
|
|
117
|
+
StopCode.STOP_AGAINST_STONE_BLOCK_OR_ROCK_93,
|
|
118
|
+
StopCode.STOP_AGAINST_PRESUMED_ROCK_94,
|
|
119
|
+
StopCode.SOUNDING_INTERRUPTED_95,
|
|
120
|
+
):
|
|
121
|
+
return None
|
|
122
|
+
|
|
123
|
+
for sample in self.method_data[::-1]:
|
|
124
|
+
if sample.comment_code == CommentCode.ROCK_END_42:
|
|
125
|
+
# 42 false positive
|
|
126
|
+
break
|
|
127
|
+
elif sample.comment_code in (
|
|
128
|
+
CommentCode.ROCK_OR_BEDROCK_41,
|
|
129
|
+
CommentCode.BEDROCK_43,
|
|
130
|
+
CommentCode.ROCK_LEVEL_80,
|
|
131
|
+
StopCode.STOP_AGAINST_PRESUMED_ROCK_94,
|
|
132
|
+
):
|
|
133
|
+
_rock_top_depth = sample.depth
|
|
134
|
+
if _rock_base_depth is None:
|
|
135
|
+
_rock_base_depth = sample.depth
|
|
136
|
+
break
|
|
137
|
+
elif _rock_base_depth is None:
|
|
138
|
+
_rock_base_depth = sample.depth
|
|
139
|
+
|
|
140
|
+
if _rock_top_depth is None or _rock_base_depth is None:
|
|
141
|
+
depth_in_rock = None
|
|
142
|
+
else:
|
|
143
|
+
depth_in_rock = _rock_base_depth - _rock_top_depth
|
|
144
|
+
|
|
145
|
+
return depth_in_rock
|
|
146
|
+
|
|
147
|
+
@computed_field
|
|
148
|
+
def depth_in_soil(self) -> Decimal | None:
|
|
149
|
+
if not self.method_data:
|
|
150
|
+
return None
|
|
151
|
+
|
|
152
|
+
if self.stopcode in (StopCode.INTERRUPTED_WITHOUT_STOP_90, StopCode.CANNOT_DRIVE_FURTHER_91):
|
|
153
|
+
return self.method_data[-1].depth
|
|
154
|
+
|
|
155
|
+
_depth_in_soil: Decimal | None = None
|
|
156
|
+
|
|
157
|
+
for sample in self.method_data[::-1]:
|
|
158
|
+
if sample.comment_code == CommentCode.ROCK_END_42:
|
|
159
|
+
# 42 false positive
|
|
160
|
+
if _depth_in_soil is None:
|
|
161
|
+
_depth_in_soil = sample.depth
|
|
162
|
+
break
|
|
163
|
+
elif sample.comment_code in (
|
|
164
|
+
CommentCode.ROCK_OR_BEDROCK_41,
|
|
165
|
+
CommentCode.BEDROCK_43,
|
|
166
|
+
StopCode.STOP_AGAINST_PRESUMED_ROCK_94,
|
|
167
|
+
CommentCode.ROCK_LEVEL_80,
|
|
168
|
+
):
|
|
169
|
+
_depth_in_soil = sample.depth
|
|
170
|
+
break
|
|
171
|
+
elif _depth_in_soil is None:
|
|
172
|
+
_depth_in_soil = sample.depth
|
|
173
|
+
|
|
174
|
+
return _depth_in_soil
|
|
175
|
+
|
|
176
|
+
@computed_field
|
|
177
|
+
def bedrock_elevation(self) -> Decimal | None:
|
|
178
|
+
# TODO: Unclear how to calculate bedrock elevation.
|
|
179
|
+
# Is it calculated in the same way as the norwegian total soundings?
|
|
180
|
+
# Does stop code 95 mean that the sounding was interrupted before reaching bedrock?
|
|
181
|
+
# Does stop code 80 mean that the sounding reached bedrock?
|
|
182
|
+
|
|
183
|
+
if self.point_z is None:
|
|
184
|
+
return None
|
|
185
|
+
|
|
186
|
+
_depth_in_soil: Decimal | None = self.depth_in_soil
|
|
187
|
+
|
|
188
|
+
if _depth_in_soil is None:
|
|
189
|
+
return None
|
|
190
|
+
|
|
191
|
+
if self.stopcode in (
|
|
192
|
+
StopCode.STOP_AGAINST_STONE_BLOCK_OR_ROCK_93,
|
|
193
|
+
StopCode.STOP_AGAINST_PRESUMED_ROCK_94,
|
|
194
|
+
StopCode.SOUNDING_INTERRUPTED_95, # TODO: Verify this ???
|
|
195
|
+
):
|
|
196
|
+
return Decimal(self.point_z) - _depth_in_soil
|
|
197
|
+
|
|
198
|
+
return None
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# # "VS": "vane_size", # Vingstorlek mm/mm Diameter/höjd
|
|
2
|
+
# "IV": "vane_diameter", # Not in speck, but seen in example files
|
|
3
|
+
from datetime import datetime
|
|
4
|
+
from decimal import Decimal
|
|
5
|
+
from typing import Literal
|
|
6
|
+
|
|
7
|
+
from pydantic import computed_field, Field
|
|
8
|
+
|
|
9
|
+
from sgf_parser.models import MethodData, MethodType, Method
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class MethodSVTData(MethodData):
|
|
13
|
+
def __init__(self, **kwargs):
|
|
14
|
+
super().__init__(**kwargs)
|
|
15
|
+
|
|
16
|
+
depth: Decimal = Field(..., alias="D", description="Depth (m)")
|
|
17
|
+
|
|
18
|
+
maximum_measurement_torque: Decimal | None = Field(None, alias="AB", description="Maximum measurement torque (Nm)")
|
|
19
|
+
maximum_measurement_torque_remoulded: Decimal | None = Field(
|
|
20
|
+
None, alias="AB2", description="Maximum measurement torque (Nm)"
|
|
21
|
+
)
|
|
22
|
+
shear_strength: Decimal | None = Field(None, alias="AS", description="Shear strength (kPa)")
|
|
23
|
+
shear_strength_remoulded: Decimal | None = Field(None, description="Shear strength (kPa)")
|
|
24
|
+
sensitivity: Decimal | None = Field(None, alias="SV", description="Sensitivity (unitless)")
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class MethodSVT(Method):
|
|
28
|
+
"""
|
|
29
|
+
Method SVT
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
def __init__(self, **kwargs):
|
|
33
|
+
super().__init__(**kwargs)
|
|
34
|
+
|
|
35
|
+
name: str = "SVT"
|
|
36
|
+
method_type: Literal[MethodType.SVT] = MethodType.SVT
|
|
37
|
+
method_data_type: type[MethodSVTData] = MethodSVTData
|
|
38
|
+
|
|
39
|
+
method_data: list[MethodSVTData] = []
|
|
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
|
+
vane_height: Decimal | None = Field(None, description="Height of the vane used (mm).")
|
|
56
|
+
serial_number: str | None = Field(None, alias="HN", description="Serial number of the vane used.")
|
|
57
|
+
calibration_date: datetime | None = Field(None, description="Date of calibration of the vane used.")
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
from decimal import Decimal
|
|
2
|
+
from typing import Literal
|
|
3
|
+
|
|
4
|
+
from pydantic import Field, computed_field
|
|
5
|
+
|
|
6
|
+
from sgf_parser.models import MethodType, Method, MethodData, StopCode
|
|
7
|
+
from sgf_parser.models.types import CommentCode
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class MethodTOTData(MethodData):
|
|
11
|
+
"""
|
|
12
|
+
Method TOT data
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
def __init__(self, **kwargs):
|
|
16
|
+
super().__init__(**kwargs)
|
|
17
|
+
|
|
18
|
+
# "A": "penetration_force", # "feed_force",
|
|
19
|
+
penetration_force: Decimal | None = Field(None, alias="A", description="Penetration force (kN)")
|
|
20
|
+
|
|
21
|
+
# "AB": "maximum_measurement_torque",
|
|
22
|
+
# "AB2": "maximum_measurement_torque_remoulded",
|
|
23
|
+
# "AP": "hammering",
|
|
24
|
+
hammering: bool | None = Field(None, alias="AP")
|
|
25
|
+
|
|
26
|
+
# "AZ": "hammering_pressure",
|
|
27
|
+
hammering_pressure: Decimal | None = Field(None, alias="AZ", description="Hammering pressure (MPa)")
|
|
28
|
+
|
|
29
|
+
# "AQ": "increased_rotation_rate",
|
|
30
|
+
increased_rotation_rate: bool | None = Field(None, alias="AQ")
|
|
31
|
+
|
|
32
|
+
# "AR": "flushing", # flushing
|
|
33
|
+
flushing: bool | None = Field(None, alias="AR")
|
|
34
|
+
|
|
35
|
+
# "AS": "shear_strength",
|
|
36
|
+
# "B": "penetration_rate", # "penetration_rate",
|
|
37
|
+
penetration_rate: Decimal | None = Field(None, alias="B", description="Penetration rate (mm/s)")
|
|
38
|
+
|
|
39
|
+
# # "C": "penetration_resistance", # B = 200/C (unit: s/0.2m)
|
|
40
|
+
# penetration_resistance: Decimal | None = Field(None, alias="C")
|
|
41
|
+
|
|
42
|
+
# "D": "depth", # "depth",
|
|
43
|
+
depth: Decimal = Field(..., alias="D", description="Depth (m)")
|
|
44
|
+
|
|
45
|
+
# # "F": "fs", # "friction" Envi format
|
|
46
|
+
# # "FS": "fs", # "friction" Geotech format
|
|
47
|
+
# "I": "flushing_pressure",
|
|
48
|
+
flushing_pressure: Decimal | None = Field(None, alias="I", description="Flushing pressure (MPa)")
|
|
49
|
+
|
|
50
|
+
# "J": "flushing_flow",
|
|
51
|
+
flushing_flow: Decimal | None = Field(None, alias="J", description="Flushing flow (l/min)")
|
|
52
|
+
|
|
53
|
+
# "M": "conductivity", # "conductivity",
|
|
54
|
+
# "NA": "zero_value_resistance", # "zero_value_resistance",
|
|
55
|
+
# "NB": "zero_value_friction", # "zero_value_friction",
|
|
56
|
+
# "NC": "zero_value_pressure", # "zero_value_pressure",
|
|
57
|
+
# "O": "temperature", # "temperature",
|
|
58
|
+
|
|
59
|
+
# "P": "engine_pressure",
|
|
60
|
+
engine_pressure: Decimal | None = Field(None, alias="P", description="Engine pressure (MPa)")
|
|
61
|
+
|
|
62
|
+
# # "Q": "qc", # "resistance" Envi format
|
|
63
|
+
# # "QC": "qc", # "resistance" Geotech format
|
|
64
|
+
# "R": "rotation_rate",
|
|
65
|
+
rotation_rate: Decimal | None = Field(None, alias="R", description="Rotation rate (rpm)")
|
|
66
|
+
|
|
67
|
+
# "SV": "sensitivity",
|
|
68
|
+
|
|
69
|
+
# "TA": "tilt", # "tilt",
|
|
70
|
+
# "U": "u2", # "shoulder_pressure",
|
|
71
|
+
|
|
72
|
+
# "V": "torque", # Vridmoment
|
|
73
|
+
torque: Decimal | None = Field(None, alias="V", description="Torque (kNm)")
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
class MethodTOT(Method):
|
|
77
|
+
"""
|
|
78
|
+
Method TOT
|
|
79
|
+
"""
|
|
80
|
+
|
|
81
|
+
def __init__(self, **kwargs):
|
|
82
|
+
super().__init__(**kwargs)
|
|
83
|
+
|
|
84
|
+
name: str = "TOT"
|
|
85
|
+
|
|
86
|
+
method_type: Literal[MethodType.TOT] = MethodType.TOT
|
|
87
|
+
method_data_type: type[MethodTOTData] = MethodTOTData
|
|
88
|
+
method_data: list[MethodTOTData] = []
|
|
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
|
+
@computed_field
|
|
112
|
+
def depth_in_rock(self) -> Decimal | None:
|
|
113
|
+
_rock_top_depth = None
|
|
114
|
+
_rock_base_depth = None
|
|
115
|
+
|
|
116
|
+
if not self.method_data:
|
|
117
|
+
return None
|
|
118
|
+
|
|
119
|
+
if self.stopcode not in (
|
|
120
|
+
StopCode.STOP_AGAINST_STONE_BLOCK_OR_ROCK_93,
|
|
121
|
+
StopCode.STOP_AGAINST_PRESUMED_ROCK_94,
|
|
122
|
+
):
|
|
123
|
+
return None
|
|
124
|
+
|
|
125
|
+
for sample in self.method_data[::-1]:
|
|
126
|
+
if sample.comment_code == CommentCode.ROCK_END_42:
|
|
127
|
+
# 42 false positive
|
|
128
|
+
break
|
|
129
|
+
elif sample.comment_code in (CommentCode.ROCK_OR_BEDROCK_41, CommentCode.BEDROCK_43):
|
|
130
|
+
_rock_top_depth = sample.depth
|
|
131
|
+
if _rock_base_depth is None:
|
|
132
|
+
_rock_base_depth = sample.depth
|
|
133
|
+
break
|
|
134
|
+
elif _rock_base_depth is None:
|
|
135
|
+
_rock_base_depth = sample.depth
|
|
136
|
+
|
|
137
|
+
if _rock_top_depth is None or _rock_base_depth is None:
|
|
138
|
+
depth_in_rock = None
|
|
139
|
+
else:
|
|
140
|
+
depth_in_rock = _rock_base_depth - _rock_top_depth
|
|
141
|
+
|
|
142
|
+
return depth_in_rock
|
|
143
|
+
|
|
144
|
+
@computed_field
|
|
145
|
+
def depth_in_soil(self) -> Decimal | None:
|
|
146
|
+
_depth_in_soil = None
|
|
147
|
+
|
|
148
|
+
if not self.method_data:
|
|
149
|
+
return None
|
|
150
|
+
|
|
151
|
+
if self.stopcode in (StopCode.INTERRUPTED_WITHOUT_STOP_90, StopCode.CANNOT_DRIVE_FURTHER_91):
|
|
152
|
+
return self.method_data[-1].depth
|
|
153
|
+
|
|
154
|
+
for sample in self.method_data[::-1]:
|
|
155
|
+
if sample.comment_code == CommentCode.ROCK_END_42:
|
|
156
|
+
# 42 false positive
|
|
157
|
+
if _depth_in_soil is None:
|
|
158
|
+
_depth_in_soil = sample.depth
|
|
159
|
+
break
|
|
160
|
+
elif sample.comment_code in (CommentCode.ROCK_OR_BEDROCK_41, CommentCode.BEDROCK_43):
|
|
161
|
+
_depth_in_soil = sample.depth
|
|
162
|
+
break
|
|
163
|
+
elif _depth_in_soil is None:
|
|
164
|
+
_depth_in_soil = sample.depth
|
|
165
|
+
|
|
166
|
+
return _depth_in_soil
|
|
167
|
+
|
|
168
|
+
@computed_field
|
|
169
|
+
def bedrock_elevation(self) -> Decimal | None:
|
|
170
|
+
if self.point_z is None:
|
|
171
|
+
return None
|
|
172
|
+
|
|
173
|
+
_depth_in_soil: Decimal | None = self.depth_in_soil
|
|
174
|
+
|
|
175
|
+
if _depth_in_soil is None:
|
|
176
|
+
return None
|
|
177
|
+
|
|
178
|
+
if self.stopcode in (StopCode.STOP_AGAINST_STONE_BLOCK_OR_ROCK_93, StopCode.STOP_AGAINST_PRESUMED_ROCK_94):
|
|
179
|
+
return Decimal(self.point_z) - _depth_in_soil
|
|
180
|
+
|
|
181
|
+
return None
|
|
182
|
+
|
|
183
|
+
def post_processing(self):
|
|
184
|
+
"""
|
|
185
|
+
Post-processing
|
|
186
|
+
|
|
187
|
+
"""
|
|
188
|
+
|
|
189
|
+
if not self.method_data:
|
|
190
|
+
return
|
|
191
|
+
|
|
192
|
+
# Update flushing, hammering and increased rotation
|
|
193
|
+
self.flushing_update()
|
|
194
|
+
self.hammering_update()
|
|
195
|
+
self.rotation_update()
|
|
@@ -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
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import enum
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class ApplicationClass(enum.IntEnum):
|
|
5
|
+
"""
|
|
6
|
+
(
|
|
7
|
+
ONE=1,
|
|
8
|
+
TWO=2,
|
|
9
|
+
THREE=3,
|
|
10
|
+
FOUR=4,
|
|
11
|
+
OUT_OF_BOUNDS=10,
|
|
12
|
+
UNKNOWN=100,
|
|
13
|
+
)
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
ONE = 1
|
|
17
|
+
TWO = 2
|
|
18
|
+
THREE = 3
|
|
19
|
+
FOUR = 4
|
|
20
|
+
OUT_OF_BOUNDS = 10
|
|
21
|
+
UNKNOWN = 100
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class StopCode(enum.IntEnum):
|
|
25
|
+
"""
|
|
26
|
+
SGF stop codes
|
|
27
|
+
|
|
28
|
+
# Different descriptions found in different documents:
|
|
29
|
+
# 90: Sondering avsluttet uten å ha oppnådd stopp
|
|
30
|
+
# 90: Avbruten utan stopp
|
|
31
|
+
# 91: Fast grunn. Sondering kan ikke drives videre etter normal prosedyre
|
|
32
|
+
# 91: Kan ej neddrivas ytterligare
|
|
33
|
+
# 92 Antatt stein eller blokk
|
|
34
|
+
# 92: Stopp mot sten eller block
|
|
35
|
+
# 93: Antatt berg
|
|
36
|
+
# 93: Stopp mot sten, block eller berg
|
|
37
|
+
# 94: Avsluttet etter boret ønsket dybde i fjell
|
|
38
|
+
# 94: Stopp mot förmodat berg
|
|
39
|
+
# 95: Brudd i borestenger eller spiss
|
|
40
|
+
# 95: Jordbergsondering avbruten
|
|
41
|
+
# 96: Annen material eller maskinfeil
|
|
42
|
+
# 96: Förutbestämt djup (Ny stoppkod enl. Europeiska fältstandarden för CPT-sondering)
|
|
43
|
+
# 97: Boring avsluttet (årsak notert)
|
|
44
|
+
# 97: Max kapacitet (Ny stoppkod enl. Europeiska fältstandarden för CPT-sondering)
|
|
45
|
+
# 98: Max lutning (Ny stoppkod enl. Europeiska fältstandarden för CPT-sondering)
|
|
46
|
+
# 99: Utrustning skadad
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
INTERRUPTED_WITHOUT_STOP_90 = 90
|
|
50
|
+
CANNOT_DRIVE_FURTHER_91 = 91
|
|
51
|
+
STOP_AGAINST_STONE_OR_BLOCK_92 = 92
|
|
52
|
+
STOP_AGAINST_STONE_BLOCK_OR_ROCK_93 = 93
|
|
53
|
+
STOP_AGAINST_PRESUMED_ROCK_94 = 94
|
|
54
|
+
SOUNDING_INTERRUPTED_95 = 95
|
|
55
|
+
PREDETERMINED_DEPTH_96 = 96
|
|
56
|
+
MAX_CAPACITY_97 = 97
|
|
57
|
+
MAX_INCLINATION_98 = 98
|
|
58
|
+
EQUIPMENT_DAMAGED_99 = 99
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class CommentCode(enum.IntEnum):
|
|
62
|
+
"""
|
|
63
|
+
Selected SGF comment codes
|
|
64
|
+
"""
|
|
65
|
+
|
|
66
|
+
SOIL_END_40 = 40
|
|
67
|
+
ROCK_OR_BEDROCK_41 = 41
|
|
68
|
+
ROCK_END_42 = 42
|
|
69
|
+
BEDROCK_43 = 43
|
|
70
|
+
ROCK_LEVEL_80 = 80
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class ParseState(enum.Enum):
|
|
74
|
+
"""
|
|
75
|
+
Parse state
|
|
76
|
+
"""
|
|
77
|
+
|
|
78
|
+
HEADER = 0
|
|
79
|
+
METHOD = 1
|
|
80
|
+
DATA = 2
|
|
81
|
+
QUIT = 3
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
class FlushingVariant(enum.StrEnum):
|
|
85
|
+
"""
|
|
86
|
+
Flushing variants
|
|
87
|
+
"""
|
|
88
|
+
|
|
89
|
+
CODE_K = "K"
|
|
90
|
+
CODE_AR = "AR"
|
|
91
|
+
CODE_I = "I"
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
class HammeringVariant(enum.StrEnum):
|
|
95
|
+
"""
|
|
96
|
+
Hammering variants
|
|
97
|
+
"""
|
|
98
|
+
|
|
99
|
+
K = "K"
|
|
100
|
+
AP = "AP"
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
class RotationVariant(enum.StrEnum):
|
|
104
|
+
"""
|
|
105
|
+
Rotation variants
|
|
106
|
+
"""
|
|
107
|
+
|
|
108
|
+
K = "K"
|
|
109
|
+
AQ = "AQ"
|
|
110
|
+
R = "R"
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
class SoundingClass(enum.StrEnum):
|
|
114
|
+
"""
|
|
115
|
+
Soil-Rock-Sounding (Swedish Jord-bergsondering) classes
|
|
116
|
+
(
|
|
117
|
+
JB1 = Jb-1,
|
|
118
|
+
JB2 = Jb-2,
|
|
119
|
+
JB3 = Jb-3,
|
|
120
|
+
JBTOT = Jb-tot,
|
|
121
|
+
)
|
|
122
|
+
"""
|
|
123
|
+
|
|
124
|
+
JB1 = "Jb-1"
|
|
125
|
+
JB2 = "Jb-2"
|
|
126
|
+
JB3 = "Jb-3"
|
|
127
|
+
JBTOT = "Jb-tot"
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
class Operation(enum.StrEnum):
|
|
131
|
+
"""
|
|
132
|
+
Operation
|
|
133
|
+
"""
|
|
134
|
+
|
|
135
|
+
MANUAL = "MANUAL"
|
|
136
|
+
MECHANICAL = "MECHANICAL"
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
class DPType(enum.StrEnum):
|
|
140
|
+
"""
|
|
141
|
+
DP Type (Dynamic Probing)
|
|
142
|
+
|
|
143
|
+
"""
|
|
144
|
+
|
|
145
|
+
DPSH_A = "DPSH-A"
|
|
146
|
+
DPL = "DPL"
|
|
147
|
+
DPM = "DPM"
|
|
148
|
+
DPH = "DPH"
|
|
149
|
+
DPSH_B = "DPSH-B"
|