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,278 @@
|
|
|
1
|
+
from decimal import Decimal
|
|
2
|
+
from typing import Literal
|
|
3
|
+
|
|
4
|
+
from pydantic import Field, AliasChoices, computed_field
|
|
5
|
+
|
|
6
|
+
from sgf_parser.models import MethodType, MethodData, Method
|
|
7
|
+
from sgf_parser.models.types import ApplicationClass
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class MethodCPTData(MethodData):
|
|
11
|
+
"""
|
|
12
|
+
Method CPT data
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
def __init__(self, **kwargs):
|
|
16
|
+
super().__init__(**kwargs)
|
|
17
|
+
|
|
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
|
+
depth: Decimal = Field(..., alias="D", description="Depth (m)")
|
|
21
|
+
|
|
22
|
+
# "F": Envi format (non-standard)
|
|
23
|
+
# "FS": SGF Standard and Geotech format
|
|
24
|
+
fs: Decimal | None = Field(None, description="Friction (kPa)", validation_alias=AliasChoices("FS", "F"))
|
|
25
|
+
|
|
26
|
+
# "M": "conductivity", # "conductivity",
|
|
27
|
+
conductivity: Decimal | None = Field(None, alias="M", description="Conductivity (S/m)")
|
|
28
|
+
|
|
29
|
+
zero_value_resistance: Decimal | None = Field(
|
|
30
|
+
None, description="Zero value resistance (MPa)", validation_alias=AliasChoices("NA", "NA2", "NA3")
|
|
31
|
+
)
|
|
32
|
+
zero_value_friction: Decimal | None = Field(
|
|
33
|
+
None, description="Zero value friction (kPa)", validation_alias=AliasChoices("NB", "NB2", "NB3")
|
|
34
|
+
)
|
|
35
|
+
zero_value_pressure: Decimal | None = Field(
|
|
36
|
+
None, description="Zero value pressure (kPa)", validation_alias=AliasChoices("NC", "NC2", "NC3")
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
temperature: Decimal | None = Field(None, alias="O", description="Temperature (degree C)")
|
|
40
|
+
qc: Decimal | None = Field(None, description="Resistance (MPa)", validation_alias=AliasChoices("QC", "Q"))
|
|
41
|
+
tilt: Decimal | None = Field(None, alias="TA", description="Inclination (degree)")
|
|
42
|
+
|
|
43
|
+
u2: Decimal | None = Field(None, alias="U", description="Shoulder pressure (kPa)")
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class MethodCPT(Method):
|
|
47
|
+
"""
|
|
48
|
+
Method CPT
|
|
49
|
+
"""
|
|
50
|
+
|
|
51
|
+
def __init__(self, **kwargs):
|
|
52
|
+
super().__init__(**kwargs)
|
|
53
|
+
|
|
54
|
+
name: str = "CPT"
|
|
55
|
+
method_type: Literal[MethodType.CPT] = MethodType.CPT
|
|
56
|
+
method_data_type: type[MethodCPTData] = MethodCPTData
|
|
57
|
+
|
|
58
|
+
method_data: list[MethodCPTData] = []
|
|
59
|
+
|
|
60
|
+
application_class_depth: ApplicationClass = ApplicationClass.UNKNOWN
|
|
61
|
+
application_class_resistance: ApplicationClass = ApplicationClass.UNKNOWN
|
|
62
|
+
application_class_friction: ApplicationClass = ApplicationClass.UNKNOWN
|
|
63
|
+
application_class_pressure: ApplicationClass = ApplicationClass.UNKNOWN
|
|
64
|
+
|
|
65
|
+
def _patch_zero_values_from_header_text(self: "MethodCPT"):
|
|
66
|
+
"""
|
|
67
|
+
Patch zero values on first data row, if present in the header field HT (remarks)
|
|
68
|
+
"""
|
|
69
|
+
if not self.remarks:
|
|
70
|
+
return
|
|
71
|
+
|
|
72
|
+
remarks = self.remarks.split(" ")
|
|
73
|
+
if len(remarks) != 6:
|
|
74
|
+
return
|
|
75
|
+
|
|
76
|
+
# NB: The values in the header are all in kPa, but we store NA in MPa.
|
|
77
|
+
# The diff at the end are OK (NA MPa, NB kPa, NC kPa).
|
|
78
|
+
# It is correct that the order is not A, B, C, ...:
|
|
79
|
+
NC_str, NA_str, NB_str, _, _, _ = remarks
|
|
80
|
+
|
|
81
|
+
try:
|
|
82
|
+
NA: Decimal = Decimal(NA_str)
|
|
83
|
+
NB: Decimal = Decimal(NB_str)
|
|
84
|
+
NC: Decimal = Decimal(NC_str)
|
|
85
|
+
except ValueError:
|
|
86
|
+
return
|
|
87
|
+
|
|
88
|
+
if self.method_data[0].zero_value_resistance:
|
|
89
|
+
return
|
|
90
|
+
|
|
91
|
+
if self.method_data[0].zero_value_friction:
|
|
92
|
+
return
|
|
93
|
+
|
|
94
|
+
if self.method_data[0].zero_value_pressure:
|
|
95
|
+
return
|
|
96
|
+
|
|
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
|
+
self.method_data[0].zero_value_friction = NB
|
|
100
|
+
self.method_data[0].zero_value_pressure = NC
|
|
101
|
+
|
|
102
|
+
def _get_data_field_max_value(self, field: str) -> Decimal:
|
|
103
|
+
"""
|
|
104
|
+
Return the max value for specified method data row field
|
|
105
|
+
"""
|
|
106
|
+
return max([getattr(row, field) if getattr(row, field) else Decimal("0") for row in self.method_data])
|
|
107
|
+
|
|
108
|
+
def _get_depth_delta(self) -> Decimal | None:
|
|
109
|
+
"""
|
|
110
|
+
Return the delta dept between the two first method data rows.
|
|
111
|
+
If no data rows, then return None
|
|
112
|
+
"""
|
|
113
|
+
if not self.method_data or len(self.method_data) < 2:
|
|
114
|
+
return None
|
|
115
|
+
|
|
116
|
+
return self.method_data[1].depth - self.method_data[0].depth
|
|
117
|
+
|
|
118
|
+
def _get_depth_class(self) -> ApplicationClass:
|
|
119
|
+
"""
|
|
120
|
+
Return the method's application class depending on the delta depth (not looking at any other factors)
|
|
121
|
+
|
|
122
|
+
Artificial Application Class 5 for returning error
|
|
123
|
+
|
|
124
|
+
+---------------------------|-- Class 1 ---|- Class 2 -----|-- Class 3 ----|-- Class 4 ----+
|
|
125
|
+
| delta Depth (delta D) <= | 20 mm | 20 mm | 50mm | 50mm |
|
|
126
|
+
|
|
127
|
+
"""
|
|
128
|
+
delta_depth = self._get_depth_delta()
|
|
129
|
+
if not delta_depth:
|
|
130
|
+
return ApplicationClass.UNKNOWN
|
|
131
|
+
|
|
132
|
+
if delta_depth <= 0.02:
|
|
133
|
+
return ApplicationClass.ONE
|
|
134
|
+
elif delta_depth <= 0.05:
|
|
135
|
+
return ApplicationClass.THREE
|
|
136
|
+
|
|
137
|
+
return ApplicationClass.OUT_OF_BOUNDS
|
|
138
|
+
|
|
139
|
+
def _get_zero_value_class(
|
|
140
|
+
self, field: str, pressure_class_map: list[tuple[Decimal, ApplicationClass]]
|
|
141
|
+
) -> ApplicationClass:
|
|
142
|
+
"""
|
|
143
|
+
Return the application class based on the absolute zero value from the last row of data form the pressure_class_map.
|
|
144
|
+
|
|
145
|
+
If value out of range, then return OUT_OF_BOUNDS (5) as a marker for error/not defined state
|
|
146
|
+
"""
|
|
147
|
+
if not self.method_data or len(self.method_data) < 2:
|
|
148
|
+
return ApplicationClass.UNKNOWN
|
|
149
|
+
|
|
150
|
+
value_last = getattr(self.method_data[-1], field)
|
|
151
|
+
|
|
152
|
+
if value_last is None:
|
|
153
|
+
return ApplicationClass.UNKNOWN
|
|
154
|
+
|
|
155
|
+
diff = abs(value_last)
|
|
156
|
+
|
|
157
|
+
for pressure, class_number in pressure_class_map:
|
|
158
|
+
if diff <= pressure:
|
|
159
|
+
return class_number
|
|
160
|
+
|
|
161
|
+
return ApplicationClass.OUT_OF_BOUNDS
|
|
162
|
+
|
|
163
|
+
def _calculate_application_class(
|
|
164
|
+
self,
|
|
165
|
+
) -> tuple[ApplicationClass, ApplicationClass, ApplicationClass, ApplicationClass]:
|
|
166
|
+
"""
|
|
167
|
+
Calculates the method's application class (also called quality class)
|
|
168
|
+
|
|
169
|
+
+-----------------------------------------------|-- Class 1 ---|- Class 2 -----|-- Class 3 ----|-- Class 4 ----+
|
|
170
|
+
| delta Depth (delta D) <= | 20 mm | 20 mm | 50mm | 50mm |
|
|
171
|
+
| NA = delta QC [MPa] - Zero value resistance<= | 35 kPa or 5% | 100 kPa or 5% | 200 kPa or 5% | 500 kPa or 5% |
|
|
172
|
+
| NB = delta fs [kPa] - Zero value friction <= | 5 kPa or 10% | 15 kPa or 15% | 25 kPa or 15% | 50 kPa or 20% |
|
|
173
|
+
| NC = delta u2 [kPa] - Zero value pressure <= | 10 kPa or 2% | 25 kPa or 3% | 50 kPa or 5% | |
|
|
174
|
+
+--------------------------------------------------------------------------------------------------------------+
|
|
175
|
+
"""
|
|
176
|
+
depth_class: ApplicationClass = self._get_depth_class()
|
|
177
|
+
|
|
178
|
+
qc_max_data_value = self._get_data_field_max_value(field="qc") # MPa
|
|
179
|
+
# convert to kPa
|
|
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")
|
|
182
|
+
|
|
183
|
+
NA_class = self._get_zero_value_class(
|
|
184
|
+
field="zero_value_resistance",
|
|
185
|
+
pressure_class_map=[
|
|
186
|
+
(max(Decimal("35"), qc_max_data_value * Decimal("0.05")) / Decimal("1000"), ApplicationClass.ONE),
|
|
187
|
+
(max(Decimal("100"), qc_max_data_value * Decimal("0.05")) / Decimal("1000"), ApplicationClass.TWO),
|
|
188
|
+
(max(Decimal("200"), qc_max_data_value * Decimal("0.05")) / Decimal("1000"), ApplicationClass.THREE),
|
|
189
|
+
(max(Decimal("500"), qc_max_data_value * Decimal("0.05")) / Decimal("1000"), ApplicationClass.FOUR),
|
|
190
|
+
],
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
fs_max_data_value = self._get_data_field_max_value(field="fs") # kPa
|
|
194
|
+
NB_class = self._get_zero_value_class(
|
|
195
|
+
field="zero_value_friction",
|
|
196
|
+
pressure_class_map=[
|
|
197
|
+
(max(Decimal("5"), fs_max_data_value * Decimal("0.1")), ApplicationClass.ONE),
|
|
198
|
+
(max(Decimal("15"), fs_max_data_value * Decimal("0.15")), ApplicationClass.TWO),
|
|
199
|
+
(max(Decimal("25"), fs_max_data_value * Decimal("0.15")), ApplicationClass.THREE),
|
|
200
|
+
(max(Decimal("50"), fs_max_data_value * Decimal("0.2")), ApplicationClass.FOUR),
|
|
201
|
+
],
|
|
202
|
+
)
|
|
203
|
+
|
|
204
|
+
u2_max_data_value = self._get_data_field_max_value(field="u2") # kPa
|
|
205
|
+
NC_class = self._get_zero_value_class(
|
|
206
|
+
field="zero_value_pressure",
|
|
207
|
+
pressure_class_map=[
|
|
208
|
+
(max(Decimal("10"), u2_max_data_value * Decimal("0.02")), ApplicationClass.ONE),
|
|
209
|
+
(max(Decimal("25"), u2_max_data_value * Decimal("0.03")), ApplicationClass.TWO),
|
|
210
|
+
(max(Decimal("50"), u2_max_data_value * Decimal("0.05")), ApplicationClass.THREE),
|
|
211
|
+
],
|
|
212
|
+
)
|
|
213
|
+
|
|
214
|
+
return depth_class, NA_class, NB_class, NC_class
|
|
215
|
+
|
|
216
|
+
def post_processing(self):
|
|
217
|
+
"""
|
|
218
|
+
Post-processing
|
|
219
|
+
|
|
220
|
+
"""
|
|
221
|
+
|
|
222
|
+
if not self.method_data:
|
|
223
|
+
return
|
|
224
|
+
|
|
225
|
+
self._patch_zero_values_from_header_text()
|
|
226
|
+
|
|
227
|
+
(
|
|
228
|
+
self.application_class_depth,
|
|
229
|
+
self.application_class_resistance,
|
|
230
|
+
self.application_class_friction,
|
|
231
|
+
self.application_class_pressure,
|
|
232
|
+
) = self._calculate_application_class()
|
|
233
|
+
|
|
234
|
+
@property
|
|
235
|
+
def application_class(self) -> ApplicationClass:
|
|
236
|
+
"""
|
|
237
|
+
Return the application class based on the method's application class
|
|
238
|
+
"""
|
|
239
|
+
if (
|
|
240
|
+
self.application_class_depth
|
|
241
|
+
and self.application_class_resistance
|
|
242
|
+
and self.application_class_friction
|
|
243
|
+
and self.application_class_pressure
|
|
244
|
+
):
|
|
245
|
+
return max(
|
|
246
|
+
self.application_class_depth,
|
|
247
|
+
self.application_class_resistance,
|
|
248
|
+
self.application_class_friction,
|
|
249
|
+
self.application_class_pressure,
|
|
250
|
+
)
|
|
251
|
+
else:
|
|
252
|
+
return ApplicationClass.UNKNOWN
|
|
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
|
+
# "MA": "cone_area_ratio", # same as header code IE
|
|
276
|
+
# "IE": "cone_area_ratio", # same as header code MA
|
|
277
|
+
# "MB": "sleeve_area_ratio", # same as header code IF
|
|
278
|
+
# "IF": "sleeve_area_ratio", # same as header code MB
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
from decimal import Decimal
|
|
2
|
+
from typing import Literal, Any
|
|
3
|
+
|
|
4
|
+
from pydantic import Field, model_validator, computed_field, AliasChoices
|
|
5
|
+
|
|
6
|
+
from sgf_parser.models import MethodData, Method, MethodType
|
|
7
|
+
from sgf_parser.models.types import DPType
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class MethodDPData(MethodData):
|
|
11
|
+
"""
|
|
12
|
+
Dynamic Probing Data
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
def __init__(self, **kwargs):
|
|
16
|
+
super().__init__(**kwargs)
|
|
17
|
+
|
|
18
|
+
depth: Decimal = Field(..., alias="D", description="Depth (m)")
|
|
19
|
+
|
|
20
|
+
penetration_force: Decimal | None = Field(None, alias="A", description="Penetration force (kN)")
|
|
21
|
+
penetration_rate: Decimal | None = Field(
|
|
22
|
+
None,
|
|
23
|
+
validation_alias=AliasChoices(
|
|
24
|
+
"B", # mm/s
|
|
25
|
+
"C", # s/0.2m
|
|
26
|
+
),
|
|
27
|
+
description="Penetration rate (mm/s)",
|
|
28
|
+
)
|
|
29
|
+
torque: Decimal | None = Field(
|
|
30
|
+
None,
|
|
31
|
+
validation_alias=AliasChoices(
|
|
32
|
+
"V", # kNm
|
|
33
|
+
"AB", # Nm
|
|
34
|
+
),
|
|
35
|
+
description="Torque (kNm)",
|
|
36
|
+
)
|
|
37
|
+
ramming: Decimal = Field(None, validation_alias=AliasChoices("S", "SA"), description="Ramming (Blow/0.2 m)")
|
|
38
|
+
rotation_rate: Decimal | None = Field(None, alias="R", description="Rotation rate (rpm)")
|
|
39
|
+
increased_rotation_rate: bool | None = Field(None, alias="AQ")
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class MethodDP(Method):
|
|
43
|
+
"""
|
|
44
|
+
Dynamic Probing (Swedish Hejarsondering)
|
|
45
|
+
"""
|
|
46
|
+
|
|
47
|
+
def __init__(self, **kwargs):
|
|
48
|
+
super().__init__(**kwargs)
|
|
49
|
+
|
|
50
|
+
name: str = "DP"
|
|
51
|
+
method_type: Literal[MethodType.DP] = MethodType.DP
|
|
52
|
+
method_data_type: type[MethodDPData] = MethodDPData
|
|
53
|
+
|
|
54
|
+
type: DPType
|
|
55
|
+
|
|
56
|
+
predrilling_depth: Decimal = Field(Decimal("0"), alias="HO")
|
|
57
|
+
|
|
58
|
+
cone_type: str | None = Field(
|
|
59
|
+
None, validation_alias=AliasChoices("KonTyp", "HN", "HC"), description="Type of cone used."
|
|
60
|
+
)
|
|
61
|
+
cushion_type: str | None = Field(None, alias="DynTyp", description="Type of impact cushion used.")
|
|
62
|
+
use_damper: bool | None = Field(None, alias="Gummi", description="Use of damper.")
|
|
63
|
+
|
|
64
|
+
method_data: list[MethodDPData] = []
|
|
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
|
+
@model_validator(mode="before")
|
|
81
|
+
@classmethod
|
|
82
|
+
def set_operation(cls, data: Any) -> Any:
|
|
83
|
+
if isinstance(data, dict):
|
|
84
|
+
if "HM" in data and data["HM"] is not None:
|
|
85
|
+
data["type"] = {
|
|
86
|
+
"8": DPType.DPSH_A,
|
|
87
|
+
"108A": DPType.DPSH_A,
|
|
88
|
+
"108B": DPType.DPL,
|
|
89
|
+
"108C": DPType.DPM,
|
|
90
|
+
"108D": DPType.DPH,
|
|
91
|
+
"9": DPType.DPSH_B,
|
|
92
|
+
"108E": DPType.DPSH_B,
|
|
93
|
+
}[data["HM"]]
|
|
94
|
+
|
|
95
|
+
return data
|
|
96
|
+
|
|
97
|
+
@computed_field
|
|
98
|
+
def stopcode(self) -> int | None:
|
|
99
|
+
if not self.method_data:
|
|
100
|
+
return None
|
|
101
|
+
|
|
102
|
+
return self.method_data[-1].comment_code
|
|
@@ -0,0 +1,50 @@
|
|
|
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, MethodData, Method
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class MethodDTData(MethodData):
|
|
10
|
+
"""
|
|
11
|
+
Method Pore Pressure Dissipation Test (placeholder)
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
def __init__(self, **kwargs):
|
|
15
|
+
super().__init__(**kwargs)
|
|
16
|
+
|
|
17
|
+
time: Decimal | None = Field(None, alias="AD", description="Elapsed time (s)")
|
|
18
|
+
u2: Decimal | None = Field(None, alias="AG", description="Shoulder pressure (kPa)")
|
|
19
|
+
depth: Decimal | None = Field(None, alias="D", description="Depth (m)")
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class MethodDT(Method):
|
|
23
|
+
"""
|
|
24
|
+
Method Pore Pressure Dissipation Test (placeholder)
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
def __init__(self, **kwargs):
|
|
28
|
+
super().__init__(**kwargs)
|
|
29
|
+
|
|
30
|
+
name: str = "DT"
|
|
31
|
+
method_type: Literal[MethodType.DT] = MethodType.DT
|
|
32
|
+
method_data_type: type[MethodDTData] = MethodDTData
|
|
33
|
+
|
|
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,75 @@
|
|
|
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, MethodData, Method
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class MethodRPData(MethodData):
|
|
10
|
+
"""
|
|
11
|
+
Method RP data
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
def __init__(self, **kwargs):
|
|
15
|
+
super().__init__(**kwargs)
|
|
16
|
+
|
|
17
|
+
depth: Decimal = Field(..., 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
|
+
|
|
21
|
+
flushing: bool | None = Field(None, alias="AR")
|
|
22
|
+
flushing_pressure: Decimal | None = Field(None, alias="I", description="Flushing pressure (MPa)")
|
|
23
|
+
flushing_flow: Decimal | None = Field(None, alias="J", description="Flushing flow (l/min)")
|
|
24
|
+
rotation_rate: Decimal | None = Field(None, alias="R", description="Rotation rate (rpm)")
|
|
25
|
+
increased_rotation_rate: bool | None = Field(None, alias="AQ")
|
|
26
|
+
torque: Decimal | None = Field(None, alias="V", description="Torque (kNm)")
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class MethodRP(Method):
|
|
30
|
+
"""
|
|
31
|
+
Method RP
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
def __init__(self, **kwargs):
|
|
35
|
+
super().__init__(**kwargs)
|
|
36
|
+
|
|
37
|
+
name: str = "RP"
|
|
38
|
+
method_type: Literal[MethodType.RP] = MethodType.RP
|
|
39
|
+
method_data_type: type[MethodRPData] = MethodRPData
|
|
40
|
+
|
|
41
|
+
method_data: list[MethodRPData] = []
|
|
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
|
+
def post_processing(self):
|
|
65
|
+
"""
|
|
66
|
+
Post-processing
|
|
67
|
+
|
|
68
|
+
"""
|
|
69
|
+
|
|
70
|
+
if not self.method_data:
|
|
71
|
+
return
|
|
72
|
+
|
|
73
|
+
# Update flushing and increased rotation
|
|
74
|
+
self.flushing_update()
|
|
75
|
+
self.rotation_update()
|