No description
- Python 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
|
||
| oberkante | ||
| tests | ||
| .gitignore | ||
| .gitlab-ci.yml | ||
| LICENSE | ||
| pyproject.toml | ||
| README.md | ||
Oberkante
Oberkante parses E-Format tide data published by the German Federal Maritime and Hydrographic Agency (BSH).
Source data can be downloaded from the BSH Filebox (the previous Tableau download page links to the same files).
Features
- Parses BSH E-Format header (metadata) and data lines (tide events)
- Accepts
Path,str,BytesIO, or anyIOBaseas input - Extracts gauge coordinates (
latitude,longitude) from header field A08 - Extracts PNP-below-NHN offset from header field D01
Usage
from pathlib import Path
from oberkante import BSHTideParser
parser = BSHTideParser(Path("tide_data.txt"))
result = parser.parse()
# Metadata
print(result.gauge_name) # e.g. "Cuxhaven, Steubenhöft, Elbe"
print(result.year) # e.g. 2022
print(result.latitude) # e.g. 53.867778
print(result.longitude) # e.g. 8.7175
print(result.pnp_below_nhn) # e.g. -5.02
# Tide events
for entry in result.entries:
print(entry.timestamp, entry.event_type, entry.height)
You can also parse from a string or bytes stream:
from io import BytesIO
from oberkante import BSHTideParser
# From string
parser = BSHTideParser(raw_text)
result = parser.parse()
# From BytesIO
parser = BSHTideParser(BytesIO(raw_bytes))
result = parser.parse()