seabirdfilehandler 0.5.1__tar.gz → 0.5.2__tar.gz
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.
Potentially problematic release.
This version of seabirdfilehandler might be problematic. Click here for more details.
- {seabirdfilehandler-0.5.1 → seabirdfilehandler-0.5.2}/PKG-INFO +1 -1
- {seabirdfilehandler-0.5.1 → seabirdfilehandler-0.5.2}/pyproject.toml +1 -1
- {seabirdfilehandler-0.5.1 → seabirdfilehandler-0.5.2}/src/seabirdfilehandler/__init__.py +1 -0
- seabirdfilehandler-0.5.2/src/seabirdfilehandler/geomar_ctd_file_parser.py +80 -0
- {seabirdfilehandler-0.5.1 → seabirdfilehandler-0.5.2}/LICENSE +0 -0
- {seabirdfilehandler-0.5.1 → seabirdfilehandler-0.5.2}/README.md +0 -0
- {seabirdfilehandler-0.5.1 → seabirdfilehandler-0.5.2}/src/seabirdfilehandler/bottlefile.py +0 -0
- {seabirdfilehandler-0.5.1 → seabirdfilehandler-0.5.2}/src/seabirdfilehandler/bottlelogfile.py +0 -0
- {seabirdfilehandler-0.5.1 → seabirdfilehandler-0.5.2}/src/seabirdfilehandler/cnvfile.py +0 -0
- {seabirdfilehandler-0.5.1 → seabirdfilehandler-0.5.2}/src/seabirdfilehandler/datafiles.py +0 -0
- {seabirdfilehandler-0.5.1 → seabirdfilehandler-0.5.2}/src/seabirdfilehandler/file_collection.py +0 -0
- {seabirdfilehandler-0.5.1 → seabirdfilehandler-0.5.2}/src/seabirdfilehandler/parameter.py +0 -0
- {seabirdfilehandler-0.5.1 → seabirdfilehandler-0.5.2}/src/seabirdfilehandler/utils.py +0 -0
- {seabirdfilehandler-0.5.1 → seabirdfilehandler-0.5.2}/src/seabirdfilehandler/validation_modules.py +0 -0
- {seabirdfilehandler-0.5.1 → seabirdfilehandler-0.5.2}/src/seabirdfilehandler/xmlfiles.py +0 -0
|
@@ -19,7 +19,7 @@ classifiers = [
|
|
|
19
19
|
urls.homepage = "https://git.io-warnemuende.de/CTD-Software/SeabirdFileHandler"
|
|
20
20
|
urls.repository = "https://git.io-warnemuende.de/CTD-Software/SeabirdFileHandler"
|
|
21
21
|
dynamic = []
|
|
22
|
-
version = "0.5.
|
|
22
|
+
version = "0.5.2"
|
|
23
23
|
|
|
24
24
|
[tool.poetry]
|
|
25
25
|
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
import pandas as pd
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class GEOMARCTDFile:
|
|
6
|
+
"""
|
|
7
|
+
A parser to read .ctd files created by the GEOMAR processing software.
|
|
8
|
+
|
|
9
|
+
Goes through the file line by line and sorts the individual lines in
|
|
10
|
+
corresponding lists. That way, data and different types of metadata are
|
|
11
|
+
structured on a basic level.
|
|
12
|
+
In general, this parser is meant to stick close to the way the Seabird-
|
|
13
|
+
Parsers are written.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
def __init__(
|
|
17
|
+
self,
|
|
18
|
+
path_to_file: Path | str,
|
|
19
|
+
only_header: bool = False,
|
|
20
|
+
create_dataframe: bool = True,
|
|
21
|
+
):
|
|
22
|
+
self.path_to_file = Path(path_to_file)
|
|
23
|
+
self.only_header = only_header
|
|
24
|
+
self.raw_input = []
|
|
25
|
+
self.metadata = {}
|
|
26
|
+
self.history = []
|
|
27
|
+
self.comment = []
|
|
28
|
+
self.data_header = []
|
|
29
|
+
self.raw_data = []
|
|
30
|
+
self.read_file()
|
|
31
|
+
if create_dataframe:
|
|
32
|
+
self.create_dataframe()
|
|
33
|
+
|
|
34
|
+
def __str__(self) -> str:
|
|
35
|
+
return "/n".join(self.raw_data)
|
|
36
|
+
|
|
37
|
+
def __repr__(self) -> str:
|
|
38
|
+
return str(self.path_to_file.absolute())
|
|
39
|
+
|
|
40
|
+
def __eq__(self, other) -> bool:
|
|
41
|
+
return self.raw_data == other.raw_data
|
|
42
|
+
|
|
43
|
+
def read_file(self):
|
|
44
|
+
with open(self.path_to_file, "r") as file:
|
|
45
|
+
past_header = False
|
|
46
|
+
for line in file:
|
|
47
|
+
self.raw_input.append(line)
|
|
48
|
+
if line.startswith("History"):
|
|
49
|
+
self.history.append(
|
|
50
|
+
line.removeprefix("History = # GEOMAR").strip()
|
|
51
|
+
)
|
|
52
|
+
elif line.startswith("Comment"):
|
|
53
|
+
self.comment.append(
|
|
54
|
+
line.removeprefix("Comment =").strip()
|
|
55
|
+
)
|
|
56
|
+
elif line.startswith("Columns"):
|
|
57
|
+
self.data_header = [
|
|
58
|
+
column.removeprefix("Columns =").strip()
|
|
59
|
+
for column in line.split(":")
|
|
60
|
+
]
|
|
61
|
+
past_header = True
|
|
62
|
+
if self.only_header:
|
|
63
|
+
break
|
|
64
|
+
else:
|
|
65
|
+
if not past_header:
|
|
66
|
+
try:
|
|
67
|
+
key, value = line.split("=")
|
|
68
|
+
except ValueError:
|
|
69
|
+
key = line
|
|
70
|
+
value = ""
|
|
71
|
+
self.metadata[key.strip()] = value.strip()
|
|
72
|
+
else:
|
|
73
|
+
self.raw_data.append(line)
|
|
74
|
+
|
|
75
|
+
def create_dataframe(self):
|
|
76
|
+
self.df = pd.DataFrame(
|
|
77
|
+
[row.split() for row in self.raw_data],
|
|
78
|
+
dtype=float,
|
|
79
|
+
columns=self.data_header,
|
|
80
|
+
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{seabirdfilehandler-0.5.1 → seabirdfilehandler-0.5.2}/src/seabirdfilehandler/bottlelogfile.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{seabirdfilehandler-0.5.1 → seabirdfilehandler-0.5.2}/src/seabirdfilehandler/file_collection.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{seabirdfilehandler-0.5.1 → seabirdfilehandler-0.5.2}/src/seabirdfilehandler/validation_modules.py
RENAMED
|
File without changes
|
|
File without changes
|