Skip to content

Commit 733a945

Browse files
committed
Fix bug that excluded lines containing " 01".
Upgrade pipline to use Poetry version 1.4.2. Upgrade packages. Bump version number to 0.0.15
1 parent f110a3d commit 733a945

9 files changed

Lines changed: 524 additions & 393 deletions

File tree

.github/workflows/branch.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
fail-fast: false
88
matrix:
99
python-version: ['3.9']
10-
poetry-version: ['1.2.2']
10+
poetry-version: ['1.4.2']
1111
os: [ubuntu-latest]
1212
runs-on: ${{ matrix.os }}
1313
steps:
@@ -30,7 +30,7 @@ jobs:
3030
fail-fast: false
3131
matrix:
3232
python-version: ['3.9']
33-
poetry-version: ['1.2.2']
33+
poetry-version: ['1.4.2']
3434
os: [ubuntu-latest]
3535
runs-on: ${{ matrix.os }}
3636
steps:

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
python-version: ['3.9']
13-
poetry-version: ['1.1.14']
13+
poetry-version: ['1.4.2']
1414
os: [ubuntu-latest]
1515
runs-on: ${{ matrix.os }}
1616
steps:

CHANGES.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Python KOF Parser Package
22

3+
## Version 0.0.15
4+
5+
_2023-04-25_
6+
7+
Fix
8+
9+
- A bug that skipped lines beginning with " 05" (space, zero, five) that contained " 01" (space, zero, one), is fixed.
10+
311
## Version 0.0.14
412

513
_2023-03-14_

README.md

Lines changed: 123 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -1,124 +1,124 @@
1-
# KOF Parser
2-
3-
[![security: bandit](https://img.shields.io/badge/security-bandit-yellow.svg)](https://github.com/PyCQA/bandit)
4-
[![security: safety](https://img.shields.io/badge/security-safety-yellow.svg)](https://github.com/pyupio/safety)
5-
[![code style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
6-
[![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)
7-
[![python](https://img.shields.io/badge/Python-3.9-3776AB.svg?style=flat&logo=python&logoColor=white)](https://www.python.org)
8-
9-
10-
Python package for parsing and generating KOF files.
11-
12-
References:
13-
14-
NORWEGIAN GEOTECHNICAL SOCIETY
15-
- [NGF - VEILEDNING FOR
16-
SYMBOLER OG DEFINISJONER I GEOTEKNIKK](http://ngf.no/wp-content/uploads/2015/03/2_NGF-ny-melding-2-endelig-utgave-2011-12-04-med-topp-og-bunntekst-Alt-3.pdf)
17-
- [Norkart KOF specification](http://www.anleggsdata.no/wp-content/uploads/2018/04/KOF-BESKRIVELSE-Oppdatert2005.pdf)
18-
19-
Latest releases see [CHANGES.md](https://github.com/norwegian-geotechnical-institute/kof-parser/blob/main/CHANGES.md)
20-
21-
# Installation (end user)
22-
23-
```bash
24-
pip install kof-parser
25-
```
26-
27-
## Basic usage
28-
29-
### Read a kof file
30-
31-
```python
32-
from kof_parser import KOFParser
33-
34-
parser = KOFParser()
35-
36-
# ETRS89/NTM10:
37-
srid = 5110
38-
39-
locations = parser.parse('tests/data/test.kof', result_srid=srid, file_srid=srid)
40-
41-
for location in locations:
42-
print(location)
43-
44-
# Output:
45-
# name='SMPLOC1' methods=[] point_easting=112892.81 point_northing=1217083.64 point_z=1.0 srid=5110
46-
# name='SMPLOC2' methods=['TOT'] point_easting=112893.15 point_northing=1217079.46 point_z=2.0 srid=5110
47-
# name='SMPLOC3' methods=['CPT'] point_easting=112891.88 point_northing=1217073.01 point_z=0.0 srid=5110
48-
# name='SMPLOC4' methods=['RP'] point_easting=112891.9 point_northing=1217067.54 point_z=0.0 srid=5110
49-
# name='SMPLOC5' methods=['SA'] point_easting=112902.92 point_northing=1217074.73 point_z=0.0 srid=5110
50-
# name='SMPLOC6' methods=['PZ'] point_easting=112901.11 point_northing=1217069.56 point_z=0.0 srid=5110
51-
# name='SMPLOC7' methods=['PZ'] point_easting=1217069.56 point_northing=112901.11 point_z=0.0 srid=5110
52-
53-
```
54-
55-
### Write a kof file
56-
57-
To write a KOF file you need to build up a model of locations and methods.
58-
59-
```python
60-
from kof_parser import KOFWriter
61-
from kof_parser import Location
62-
63-
kof_writer = KOFWriter()
64-
65-
srid = 5110
66-
locations = [Location(name='SMPLOC1', point_easting=112892.81, point_northing=1217083.64, point_z=1.0),
67-
Location(name='SMPLOC2', point_easting=112893.15, point_northing=1217079.46, point_z=2.0, methods=['TOT']),
68-
Location(name='SMPLOC3', point_easting=112891.88, point_northing=1217073.01, point_z=0.0, methods=['CPT'])]
69-
70-
kof_string = kof_writer.writeKOF(
71-
project_id='project_id', project_name='cool-name', locations=locations, srid=srid
72-
)
73-
74-
print(kof_string)
75-
# Output:
76-
# 00 KOF Export from NGI's KOF parser
77-
# 00 Project: project_id. Name: cool-name
78-
# 00 Spatial Reference ID (SRID): 5110
79-
# 00 Export date (UTC): 2022-08-22 13:49:44.394607
80-
# 00 Oppdrag Dato Ver K.sys Komm $21100000000 Observer
81-
# 01 cool-name 22082022 1 210 $11100000000
82-
# 05 SMPLOC1 1217083.640 112892.810 1.000
83-
# 05 SMPLOC2 2418 1217079.460 112893.150 2.000
84-
# 05 SMPLOC3 2407 1217073.010 112891.880 0.000
85-
```
86-
87-
# Getting Started developing
88-
89-
## Software dependencies
90-
91-
Before you start, install:
92-
93-
- Python 3.9 or higher
94-
- Poetry
95-
- black code formatter
96-
97-
## Clone this repository
98-
99-
Use git to clone this repository.
100-
101-
## Install
102-
103-
There are several combinations of how to set up a local development environment.
104-
105-
We use Poetry for dependency management. See [Install poetry](https://python-poetry.org/docs/) if needed.
106-
107-
Then, from the project root folder run:
108-
109-
poetry install
110-
111-
112-
# Build and Test
113-
114-
Run in the project root folder:
115-
116-
poetry run pytest
117-
118-
Build the package wheel:
119-
120-
poetry build
121-
122-
# Contribute
123-
1+
# KOF Parser
2+
3+
[![security: bandit](https://img.shields.io/badge/security-bandit-yellow.svg)](https://github.com/PyCQA/bandit)
4+
[![security: safety](https://img.shields.io/badge/security-safety-yellow.svg)](https://github.com/pyupio/safety)
5+
[![code style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
6+
[![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)
7+
[![python](https://img.shields.io/badge/Python-3.9-3776AB.svg?style=flat&logo=python&logoColor=white)](https://www.python.org)
8+
9+
10+
Python package for parsing and generating KOF files.
11+
12+
References:
13+
14+
NORWEGIAN GEOTECHNICAL SOCIETY
15+
- [NGF - VEILEDNING FOR
16+
SYMBOLER OG DEFINISJONER I GEOTEKNIKK](http://ngf.no/wp-content/uploads/2015/03/2_NGF-ny-melding-2-endelig-utgave-2011-12-04-med-topp-og-bunntekst-Alt-3.pdf)
17+
- [Norkart KOF specification](http://www.anleggsdata.no/wp-content/uploads/2018/04/KOF-BESKRIVELSE-Oppdatert2005.pdf)
18+
19+
Latest releases see [CHANGES.md](https://github.com/norwegian-geotechnical-institute/kof-parser/blob/main/CHANGES.md)
20+
21+
# Installation (end user)
22+
23+
```bash
24+
pip install kof-parser
25+
```
26+
27+
## Basic usage
28+
29+
### Read a kof file
30+
31+
```python
32+
from kof_parser import KOFParser
33+
34+
parser = KOFParser()
35+
36+
# ETRS89/NTM10:
37+
srid = 5110
38+
39+
locations = parser.parse('tests/data/test.kof', result_srid=srid, file_srid=srid)
40+
41+
for location in locations:
42+
print(location)
43+
44+
# Output:
45+
# name='SMPLOC1' methods=[] point_easting=112892.81 point_northing=1217083.64 point_z=1.0 srid=5110
46+
# name='SMPLOC2' methods=['TOT'] point_easting=112893.15 point_northing=1217079.46 point_z=2.0 srid=5110
47+
# name='SMPLOC3' methods=['CPT'] point_easting=112891.88 point_northing=1217073.01 point_z=0.0 srid=5110
48+
# name='SMPLOC4' methods=['RP'] point_easting=112891.9 point_northing=1217067.54 point_z=0.0 srid=5110
49+
# name='SMPLOC5' methods=['SA'] point_easting=112902.92 point_northing=1217074.73 point_z=0.0 srid=5110
50+
# name='SMPLOC6' methods=['PZ'] point_easting=112901.11 point_northing=1217069.56 point_z=0.0 srid=5110
51+
# name='SMPLOC7' methods=['PZ'] point_easting=1217069.56 point_northing=112901.11 point_z=0.0 srid=5110
52+
53+
```
54+
55+
### Write a kof file
56+
57+
To write a KOF file you need to build up a model of locations and methods.
58+
59+
```python
60+
from kof_parser import KOFWriter
61+
from kof_parser import Location
62+
63+
kof_writer = KOFWriter()
64+
65+
srid = 5110
66+
locations = [Location(name='SMPLOC1', point_easting=112892.81, point_northing=1217083.64, point_z=1.0),
67+
Location(name='SMPLOC2', point_easting=112893.15, point_northing=1217079.46, point_z=2.0, methods=['TOT']),
68+
Location(name='SMPLOC3', point_easting=112891.88, point_northing=1217073.01, point_z=0.0, methods=['CPT'])]
69+
70+
kof_string = kof_writer.writeKOF(
71+
project_id='project_id', project_name='cool-name', locations=locations, srid=srid
72+
)
73+
74+
print(kof_string)
75+
# Output:
76+
# 00 KOF Export from NGI's KOF parser
77+
# 00 Project: project_id. Name: cool-name
78+
# 00 Spatial Reference ID (SRID): 5110
79+
# 00 Export date (UTC): 2022-08-22 13:49:44.394607
80+
# 00 Oppdrag Dato Ver K.sys Komm $21100000000 Observer
81+
# 01 cool-name 22082022 1 210 $11100000000
82+
# 05 SMPLOC1 1217083.640 112892.810 1.000
83+
# 05 SMPLOC2 2418 1217079.460 112893.150 2.000
84+
# 05 SMPLOC3 2407 1217073.010 112891.880 0.000
85+
```
86+
87+
# Getting Started developing
88+
89+
## Software dependencies
90+
91+
Before you start, install:
92+
93+
- Python 3.9 or higher
94+
- Poetry 1.4.2
95+
- black code formatter
96+
97+
## Clone this repository
98+
99+
Use git to clone this repository.
100+
101+
## Install
102+
103+
There are several combinations of how to set up a local development environment.
104+
105+
We use Poetry for dependency management. See [Install poetry](https://python-poetry.org/docs/) if needed.
106+
107+
Then, from the project root folder run:
108+
109+
poetry install
110+
111+
112+
# Build and Test
113+
114+
Run in the project root folder:
115+
116+
poetry run pytest
117+
118+
Build the package wheel:
119+
120+
poetry build
121+
122+
# Contribute
123+
124124
Please start by adding an issue before submitting any pull requests.

0 commit comments

Comments
 (0)