Skip to content

Commit 86f6bb7

Browse files
committed
Bump version to 0.0.9 and enhance support for Dissipation Tests (DT)
1 parent 78ef420 commit 86f6bb7

10 files changed

Lines changed: 3637 additions & 518 deletions

File tree

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
strategy:
1111
fail-fast: false
1212
matrix:
13-
python-version: ['3.12']
13+
python-version: ['3.13']
1414
steps:
1515
- uses: actions/checkout@v4
1616

CHANGES.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# NGI Python SGF Parser Package
22

3+
_2025-08-12_
4+
5+
Version 0.0.9
6+
7+
- Better support for importing Dissipation Tests (DT). Still need the code `HM=35`, and we do not handle dissipation
8+
tests with `HM=7`.
9+
310
_2025-05-13_
411

512
Version 0.0.8

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "sgf-parser"
3-
version = "0.0.8"
3+
version = "0.0.9"
44
description = "Parser for the Swedish Geotechnical Society / Svenska Geotekniska Föreningen (SGF) data format"
55
authors = [{ name = "Jostein Leira", email = "jostein@leira.net" }]
66
requires-python = ">=3.11,<4"

src/sgf_parser/models/method_dt.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from decimal import Decimal
22
from typing import Literal
33

4-
from pydantic import Field
4+
from pydantic import Field, AliasChoices
55

66
from sgf_parser.models import MethodType, MethodData, Method
77

@@ -15,9 +15,14 @@ def __init__(self, **kwargs):
1515
super().__init__(**kwargs)
1616

1717
time: Decimal | None = Field(None, alias="AD", description="Elapsed time (s)")
18-
u2: Decimal | None = Field(None, alias="AG", description="Shoulder pressure (kPa)")
18+
u2: Decimal | None = Field(None, description="Shoulder pressure (kPa)", validation_alias=AliasChoices("U", "AG"))
19+
fs: Decimal | None = Field(None, description="Friction (kPa)", validation_alias=AliasChoices("FS", "F"))
20+
qc: Decimal | None = Field(None, description="Resistance (MPa)", validation_alias=AliasChoices("QC", "Q"))
1921
depth: Decimal | None = Field(None, alias="D", description="Depth (m)")
2022

23+
def __repr__(self):
24+
return f"<{self.__class__.__name__} {self.time}>"
25+
2126

2227
class MethodDT(Method):
2328
"""

src/sgf_parser/parser.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import copy
12
import re
23
from typing import TextIO, Any
34

@@ -82,6 +83,13 @@ def parse(self, file: TextIO) -> list[Method]:
8283
# Starting a new data block, so store the current collected header in a new method
8384
method = self.parse_header(header)
8485
header = {}
86+
elif _new_state == ParseState.DATA and _old_state == ParseState.DATA:
87+
# Starting a new data block, while handling data. No new header,
88+
# so use the previous method to create a new method of the same type
89+
if method:
90+
methods.append(method)
91+
method = copy.copy(method)
92+
method.method_data = []
8593
elif _new_state in (ParseState.HEADER, ParseState.METHOD) and _old_state == ParseState.DATA:
8694
# Finished populating current method, since new method is starting
8795
# Store the current method, and empty the current method
@@ -143,7 +151,7 @@ def parse_data(self, method: Method, row: str) -> MethodData:
143151
row_dict = self._convert_str_to_dict(row)
144152
method_data = method.method_data_type.model_validate(row_dict)
145153
if hasattr(method_data, "flushing"):
146-
method_data.flushing = method.is_flushing_active(method_data)
154+
method_data.flushing = method.is_flushing_active(method_data)
147155
if hasattr(method_data, "hammering"):
148156
method_data.hammering = method.is_hammer_active(method_data)
149157
if hasattr(method_data, "increased_rotation_rate"):

0 commit comments

Comments
 (0)