seabirdfilehandler 0.7.0__py3-none-any.whl → 0.7.1__py3-none-any.whl
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/cnvfile.py +5 -4
- seabirdfilehandler/file_collection.py +1 -1
- seabirdfilehandler/parameter.py +37 -4
- {seabirdfilehandler-0.7.0.dist-info → seabirdfilehandler-0.7.1.dist-info}/METADATA +1 -1
- {seabirdfilehandler-0.7.0.dist-info → seabirdfilehandler-0.7.1.dist-info}/RECORD +7 -7
- {seabirdfilehandler-0.7.0.dist-info → seabirdfilehandler-0.7.1.dist-info}/LICENSE +0 -0
- {seabirdfilehandler-0.7.0.dist-info → seabirdfilehandler-0.7.1.dist-info}/WHEEL +0 -0
seabirdfilehandler/cnvfile.py
CHANGED
|
@@ -95,7 +95,7 @@ class CnvFile(DataFile):
|
|
|
95
95
|
|
|
96
96
|
"""
|
|
97
97
|
time_parameter = None
|
|
98
|
-
for parameter in self.
|
|
98
|
+
for parameter in self.parameters.keys():
|
|
99
99
|
if parameter.lower().startswith("time"):
|
|
100
100
|
time_parameter = parameter
|
|
101
101
|
if time_parameter and self.start_time:
|
|
@@ -106,8 +106,9 @@ class CnvFile(DataFile):
|
|
|
106
106
|
timedelta(days=float(time)) + self.start_time
|
|
107
107
|
if time_parameter == "timeJ"
|
|
108
108
|
else timedelta(seconds=float(time)) + self.start_time
|
|
109
|
-
for time in self.
|
|
110
|
-
]
|
|
109
|
+
for time in self.parameters[time_parameter].data
|
|
110
|
+
],
|
|
111
|
+
dtype=str,
|
|
111
112
|
),
|
|
112
113
|
)
|
|
113
114
|
return True
|
|
@@ -159,7 +160,7 @@ class CnvFile(DataFile):
|
|
|
159
160
|
def array2cnv(self) -> list:
|
|
160
161
|
result = []
|
|
161
162
|
for row in self.parameters.full_data_array:
|
|
162
|
-
formatted_row = "".join(
|
|
163
|
+
formatted_row = "".join(elem.rjust(11) for elem in row)
|
|
163
164
|
result.append(formatted_row + "\n")
|
|
164
165
|
return result
|
|
165
166
|
|
|
@@ -445,7 +445,7 @@ class CnvCollection(FileCollection):
|
|
|
445
445
|
A list of ProcessingSteps.
|
|
446
446
|
"""
|
|
447
447
|
individual_processing_steps = [
|
|
448
|
-
file.processing_steps for file in self.data
|
|
448
|
+
file.processing_steps.modules for file in self.data
|
|
449
449
|
]
|
|
450
450
|
for index, step_info in enumerate(individual_processing_steps):
|
|
451
451
|
if step_info != individual_processing_steps[0]:
|
seabirdfilehandler/parameter.py
CHANGED
|
@@ -78,7 +78,7 @@ class Parameters(UserDict):
|
|
|
78
78
|
for i in range(0, len(line) - n, n)
|
|
79
79
|
]
|
|
80
80
|
)
|
|
81
|
-
return np.array(row_list, dtype=
|
|
81
|
+
return np.array(row_list, dtype="<U20")
|
|
82
82
|
|
|
83
83
|
def create_parameter_instances(
|
|
84
84
|
self,
|
|
@@ -176,7 +176,7 @@ class Parameters(UserDict):
|
|
|
176
176
|
for line in post
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
-
def add_parameter(self, parameter: Parameter):
|
|
179
|
+
def add_parameter(self, parameter: Parameter, position: str = ""):
|
|
180
180
|
"""
|
|
181
181
|
Adds one parameter instance to the collection.
|
|
182
182
|
|
|
@@ -186,13 +186,36 @@ class Parameters(UserDict):
|
|
|
186
186
|
The new parameter
|
|
187
187
|
|
|
188
188
|
"""
|
|
189
|
-
|
|
189
|
+
position_index = -1
|
|
190
|
+
# add to parameter dict at given
|
|
191
|
+
if position:
|
|
192
|
+
new_dict = {}
|
|
193
|
+
for index, (key, value) in enumerate(self.data.items()):
|
|
194
|
+
new_dict[key] = value
|
|
195
|
+
if key == position:
|
|
196
|
+
new_dict[parameter.name] = parameter
|
|
197
|
+
position_index = index + 1
|
|
198
|
+
self.data = new_dict
|
|
199
|
+
|
|
200
|
+
else:
|
|
201
|
+
self.data[parameter.name] = parameter
|
|
202
|
+
|
|
203
|
+
# update metadata dict
|
|
204
|
+
self.metadata = {
|
|
205
|
+
parameter.name: parameter.metadata
|
|
206
|
+
for parameter in self.data.values()
|
|
207
|
+
}
|
|
208
|
+
# add to full numpy data array
|
|
209
|
+
self.full_data_array = np.insert(
|
|
210
|
+
self.full_data_array, position_index, parameter.data, axis=1
|
|
211
|
+
)
|
|
190
212
|
|
|
191
213
|
def create_parameter(
|
|
192
214
|
self,
|
|
193
215
|
data: np.ndarray | int | float | str,
|
|
194
216
|
metadata: dict = {},
|
|
195
217
|
name: str = "",
|
|
218
|
+
position: str = "",
|
|
196
219
|
) -> Parameter:
|
|
197
220
|
"""
|
|
198
221
|
Creates a new parameter instance with the given data and metadata.
|
|
@@ -233,7 +256,7 @@ class Parameters(UserDict):
|
|
|
233
256
|
shape=self.full_data_array.shape[0],
|
|
234
257
|
)
|
|
235
258
|
parameter = Parameter(data=data, metadata=metadata)
|
|
236
|
-
self.add_parameter(parameter)
|
|
259
|
+
self.add_parameter(parameter, position)
|
|
237
260
|
return parameter
|
|
238
261
|
|
|
239
262
|
def add_default_metadata(
|
|
@@ -426,6 +449,7 @@ class Parameter:
|
|
|
426
449
|
self.data = data
|
|
427
450
|
self.metadata = metadata
|
|
428
451
|
self.name = metadata["shortname"]
|
|
452
|
+
self.parse_to_float()
|
|
429
453
|
self.update_span()
|
|
430
454
|
|
|
431
455
|
def __str__(self) -> str:
|
|
@@ -457,6 +481,15 @@ class Parameter:
|
|
|
457
481
|
except KeyError:
|
|
458
482
|
return
|
|
459
483
|
|
|
484
|
+
def parse_to_float(self):
|
|
485
|
+
"""
|
|
486
|
+
Tries to parse the data array type to float.
|
|
487
|
+
"""
|
|
488
|
+
try:
|
|
489
|
+
self.data = self.data.astype("float64")
|
|
490
|
+
except ValueError:
|
|
491
|
+
pass
|
|
492
|
+
|
|
460
493
|
def update_span(self):
|
|
461
494
|
"""
|
|
462
495
|
Updates the data span.
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
seabirdfilehandler/__init__.py,sha256=PSokwgSgsmpFh-2Xv2T2d3yxmmahLnIq58WLZ51l86I,276
|
|
2
2
|
seabirdfilehandler/bottlefile.py,sha256=qCh506J3MWZXM11243aw_oJRocVB0ZIipXQLEgkD5M0,6046
|
|
3
3
|
seabirdfilehandler/bottlelogfile.py,sha256=MtMmEebdAktO3mk6KbmJC7dfx9sRLbV5qqDQt2qtpJE,4310
|
|
4
|
-
seabirdfilehandler/cnvfile.py,sha256=
|
|
4
|
+
seabirdfilehandler/cnvfile.py,sha256=e90-1NDc3na8d1UCRG0qo3N6hhxicPcHYaYbCvajWEg,10105
|
|
5
5
|
seabirdfilehandler/datafiles.py,sha256=HQungz24lRw4OiTwWs_curAGhzkI1rPiCmMXXcdQFNE,9423
|
|
6
|
-
seabirdfilehandler/file_collection.py,sha256=
|
|
6
|
+
seabirdfilehandler/file_collection.py,sha256=oLdjS-Q4_33T0qo_SYxkqg2bsaeg4gLVKBkOPxoTXx4,16111
|
|
7
7
|
seabirdfilehandler/geomar_ctd_file_parser.py,sha256=4eCnkE0mvPKC8Dic8sXP4xpfwnk3K2MQcGFBf6loT8k,2655
|
|
8
8
|
seabirdfilehandler/hexfile.py,sha256=TBplwbWHrTuJzv2qlx6xYNtoX43I2YUabDmaGZuBEDQ,2144
|
|
9
|
-
seabirdfilehandler/parameter.py,sha256=
|
|
9
|
+
seabirdfilehandler/parameter.py,sha256=h-iaDFUdKDVpm_N1TX3jv7VCot-lGO7j_0an901BIhI,15938
|
|
10
10
|
seabirdfilehandler/processing_steps.py,sha256=TYqzzVjFxz3EbLZcNTlZIFpMguyJcT6S2bLCFG35NDY,6185
|
|
11
11
|
seabirdfilehandler/utils.py,sha256=5KXdB8Hdv65dv5tPyXxNMct1mCEOyA3S8XP54AFAnx0,1745
|
|
12
12
|
seabirdfilehandler/xmlfiles.py,sha256=XqqbVNjyINySoe2ZC_qJglkAqshavZxT2-jorDOSj7Y,5084
|
|
13
|
-
seabirdfilehandler-0.7.
|
|
14
|
-
seabirdfilehandler-0.7.
|
|
15
|
-
seabirdfilehandler-0.7.
|
|
16
|
-
seabirdfilehandler-0.7.
|
|
13
|
+
seabirdfilehandler-0.7.1.dist-info/LICENSE,sha256=Ifd1VPmYv32oJd2QVh3wIQP9X05vYJlcY6kONz360ws,34603
|
|
14
|
+
seabirdfilehandler-0.7.1.dist-info/METADATA,sha256=WXPaDmBRjaJPw29GB_z_-zglgbbP_EhEeQvMw0q_O6s,2307
|
|
15
|
+
seabirdfilehandler-0.7.1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
16
|
+
seabirdfilehandler-0.7.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|