Skip to content

Commit 0cdc52e

Browse files
authored
Add SP as an alias for hammering pressure (#25)
* Add `SP` as an alias for hammering pressure. * Update CHANGES.md. * Bump version to 0.0.7
1 parent 0f1a58c commit 0cdc52e

6 files changed

Lines changed: 182 additions & 146 deletions

File tree

.github/workflows/branch.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,4 @@ jobs:
5757
run: uv run safety check
5858

5959
- name: Check for acceptable licenses
60-
run: uv run pip-licenses --allow-only="MIT License;BSD License;Python Software Foundation License;Apache Software License;Mozilla Public License 2.0 (MPL 2.0);ISC License (ISCL);The Unlicense (Unlicense)"
60+
run: uv run pip-licenses --allow-only="MIT License;BSD License;Python Software Foundation License;Apache Software License;Mozilla Public License 2.0 (MPL 2.0);ISC License (ISCL);The Unlicense (Unlicense);UNKNOWN;Apache-2.0"

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-04-11_
4+
5+
Version 0.0.7
6+
7+
- Add `SP` as an alias for hammering pressure.
8+
Affects method Total sounding (TOT) and Soil Rock Sounding (SRS).
9+
310
_2025-03-13_
411

512
Version 0.0.6

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.6"
3+
version = "0.0.7"
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_srs.py

Lines changed: 4 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, Any
33

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

66
from sgf_parser.models import MethodType, Method, MethodData
77
from sgf_parser.models.types import SoundingClass, StopCode, CommentCode
@@ -28,7 +28,9 @@ def __init__(self, **kwargs):
2828
penetration_force: Decimal | None = Field(None, alias="A", description="Penetration force (kN)")
2929
penetration_rate: Decimal | None = Field(None, alias="B", description="Penetration rate (mm/s)")
3030
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)")
31+
hammering_pressure: Decimal | None = Field(
32+
None, validation_alias=AliasChoices("AZ", "SP"), description="Hammering pressure (MPa)"
33+
)
3234
rotation_rate: Decimal | None = Field(None, alias="R", description="Rotation rate (rpm)")
3335
flushing_pressure: Decimal | None = Field(None, alias="I", description="Flushing pressure (MPa)")
3436
flushing_flow: Decimal | None = Field(None, alias="J", description="Flushing flow (l/min)")

src/sgf_parser/models/method_tot.py

Lines changed: 4 additions & 3 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, computed_field
4+
from pydantic import Field, computed_field, AliasChoices
55

66
from sgf_parser.models import MethodType, Method, MethodData, StopCode
77
from sgf_parser.models.types import CommentCode
@@ -24,8 +24,9 @@ def __init__(self, **kwargs):
2424
hammering: bool | None = Field(None, alias="AP")
2525

2626
# "AZ": "hammering_pressure",
27-
hammering_pressure: Decimal | None = Field(None, alias="AZ", description="Hammering pressure (MPa)")
28-
27+
hammering_pressure: Decimal | None = Field(
28+
None, validation_alias=AliasChoices("AZ", "SP"), description="Hammering pressure (MPa)"
29+
)
2930
# "AQ": "increased_rotation_rate",
3031
increased_rotation_rate: bool | None = Field(None, alias="AQ")
3132

0 commit comments

Comments
 (0)