oceanstream 0.0.3.dev0__py3-none-any.whl → 0.0.6.dev0__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.
- oceanstream/__init__.py +3 -0
- oceanstream/core.py +146 -0
- oceanstream/settings/defaults.config.json +120 -0
- {oceanstream-0.0.3.dev0.dist-info → oceanstream-0.0.6.dev0.dist-info}/METADATA +9 -33
- {oceanstream-0.0.3.dev0.dist-info → oceanstream-0.0.6.dev0.dist-info}/RECORD +9 -8
- oceanstream-0.0.3.dev0.dist-info/dependency_links.txt +0 -1
- {oceanstream-0.0.3.dev0.dist-info → oceanstream-0.0.6.dev0.dist-info}/LICENSE +0 -0
- {oceanstream-0.0.3.dev0.dist-info → oceanstream-0.0.6.dev0.dist-info}/WHEEL +0 -0
- {oceanstream-0.0.3.dev0.dist-info → oceanstream-0.0.6.dev0.dist-info}/entry_points.txt +0 -0
- {oceanstream-0.0.3.dev0.dist-info → oceanstream-0.0.6.dev0.dist-info}/top_level.txt +0 -0
oceanstream/__init__.py
CHANGED
oceanstream/core.py
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
import os
|
|
3
|
+
import logging
|
|
4
|
+
import sys
|
|
5
|
+
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from oceanstream.settings import load_config
|
|
8
|
+
|
|
9
|
+
DEFAULT_OUTPUT_FOLDER = "output"
|
|
10
|
+
DEFAULT_SONAR_MODEL = "EK60"
|
|
11
|
+
|
|
12
|
+
logging.basicConfig(level="ERROR", format='%(asctime)s - %(levelname)s - %(message)s')
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def initialize(settings, file_path, log_level=None):
|
|
16
|
+
logging.debug(f"Initializing with settings: {settings}, file path: {file_path}, log level: {log_level}")
|
|
17
|
+
config_data = load_config(settings["config"])
|
|
18
|
+
config_data["raw_path"] = file_path
|
|
19
|
+
|
|
20
|
+
if log_level is not None:
|
|
21
|
+
logging.basicConfig(level=log_level, format='%(asctime)s - %(levelname)s - %(message)s', force=True)
|
|
22
|
+
config_data["log_level"] = log_level
|
|
23
|
+
|
|
24
|
+
if 'sonar_model' in settings and settings["sonar_model"] is not None:
|
|
25
|
+
config_data["sonar_model"] = settings["sonar_model"]
|
|
26
|
+
|
|
27
|
+
if settings["output_folder"] is not None:
|
|
28
|
+
config_data["output_folder"] = settings["output_folder"]
|
|
29
|
+
|
|
30
|
+
return config_data
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def process_raw_file(source, output=None, sonar_model=None, plot_echogram=False, depth_offset=0.0, waveform_mode="CW",
|
|
34
|
+
config=None, log_level="WARNING", chunks=None):
|
|
35
|
+
logging.debug("Starting process_raw_file function")
|
|
36
|
+
settings = {
|
|
37
|
+
"config": config,
|
|
38
|
+
"sonar_model": sonar_model,
|
|
39
|
+
"output_folder": output or DEFAULT_OUTPUT_FOLDER
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
file_path = Path(source)
|
|
43
|
+
config_data = initialize(settings, file_path, log_level=log_level)
|
|
44
|
+
|
|
45
|
+
if chunks:
|
|
46
|
+
config_data['chunks'] = chunks
|
|
47
|
+
|
|
48
|
+
if file_path.is_file():
|
|
49
|
+
logging.debug(f"Processing raw file: {file_path}")
|
|
50
|
+
from oceanstream.process import process_raw_file_with_progress
|
|
51
|
+
asyncio.run(
|
|
52
|
+
process_raw_file_with_progress(config_data, plot_echogram, waveform_mode=waveform_mode,
|
|
53
|
+
depth_offset=depth_offset)
|
|
54
|
+
)
|
|
55
|
+
else:
|
|
56
|
+
logging.error(f"The provided path '{source}' is not a valid raw file.")
|
|
57
|
+
sys.exit(1)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def convert(source, output=None, workers_count=None, config=None, log_level="WARNING", chunks=None):
|
|
61
|
+
logging.debug("Starting convert function")
|
|
62
|
+
settings = {
|
|
63
|
+
"config": config,
|
|
64
|
+
"output_folder": output or DEFAULT_OUTPUT_FOLDER
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
file_path = Path(source)
|
|
68
|
+
config_data = initialize(settings, file_path, log_level=log_level)
|
|
69
|
+
|
|
70
|
+
if chunks:
|
|
71
|
+
config_data['chunks'] = chunks
|
|
72
|
+
|
|
73
|
+
if file_path.is_file():
|
|
74
|
+
logging.debug(f"Converting raw file: {file_path}")
|
|
75
|
+
from oceanstream.process import convert_raw_file
|
|
76
|
+
convert_raw_file(file_path, config_data)
|
|
77
|
+
logging.info(f"Converted raw file {source} to Zarr and wrote output to: {config_data['output_folder']}")
|
|
78
|
+
elif file_path.is_dir():
|
|
79
|
+
logging.debug(f"Converting raw files in directory: {file_path}")
|
|
80
|
+
from oceanstream.process import convert_raw_files
|
|
81
|
+
convert_raw_files(config_data, workers_count=workers_count)
|
|
82
|
+
else:
|
|
83
|
+
logging.error(f"The provided path '{source}' is not a valid file/folder.")
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def combine(source, output=None, config=None, log_level="WARNING", chunks=None):
|
|
87
|
+
logging.debug("Starting combine function")
|
|
88
|
+
settings = {
|
|
89
|
+
"config": config,
|
|
90
|
+
"output_folder": output or DEFAULT_OUTPUT_FOLDER
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
dir_path = Path(source)
|
|
94
|
+
config_data = initialize(settings, dir_path, log_level=log_level)
|
|
95
|
+
|
|
96
|
+
if chunks:
|
|
97
|
+
config_data['chunks'] = chunks
|
|
98
|
+
|
|
99
|
+
if dir_path.is_dir():
|
|
100
|
+
logging.debug(f"Combining Zarr files in directory: {dir_path}")
|
|
101
|
+
|
|
102
|
+
from oceanstream.process import combine_zarr_files
|
|
103
|
+
|
|
104
|
+
file_name = f"{Path(dir_path).stem}-combined.zarr"
|
|
105
|
+
zarr_output_file = os.path.join(config_data['output_folder'], file_name)
|
|
106
|
+
logging.info(
|
|
107
|
+
f"Combining Zarr files to {zarr_output_file}; navigate to http://localhost:8787/status for progress")
|
|
108
|
+
|
|
109
|
+
combine_zarr_files(dir_path, zarr_output_file=zarr_output_file, chunks=chunks)
|
|
110
|
+
logging.info("Zarr files have been combined successfully.")
|
|
111
|
+
else:
|
|
112
|
+
logging.error(f"The provided path '{source}' is not a valid folder.")
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def compute_sv(source, output=None, workers_count=None, sonar_model=DEFAULT_SONAR_MODEL, plot_echogram=False,
|
|
116
|
+
depth_offset=0.0, waveform_mode="CW", config=None, log_level="WARNING", chunks=None):
|
|
117
|
+
logging.debug("Starting compute_sv function")
|
|
118
|
+
settings_dict = {
|
|
119
|
+
"config": config,
|
|
120
|
+
"sonar_model": sonar_model,
|
|
121
|
+
"output_folder": output or DEFAULT_OUTPUT_FOLDER
|
|
122
|
+
}
|
|
123
|
+
file_path = Path(source)
|
|
124
|
+
config_data = initialize(settings_dict, file_path, log_level=log_level)
|
|
125
|
+
|
|
126
|
+
if chunks:
|
|
127
|
+
config_data['chunks'] = chunks
|
|
128
|
+
|
|
129
|
+
if file_path.is_dir() and source.endswith(".zarr"):
|
|
130
|
+
logging.debug(f"Computing Sv for Zarr root file: {file_path}")
|
|
131
|
+
from oceanstream.process import compute_single_file
|
|
132
|
+
|
|
133
|
+
compute_single_file(config_data, chunks=chunks, plot_echogram=plot_echogram, waveform_mode=waveform_mode,
|
|
134
|
+
depth_offset=depth_offset)
|
|
135
|
+
elif file_path.is_dir():
|
|
136
|
+
logging.debug(f"Processing Zarr files in directory: {file_path}")
|
|
137
|
+
from oceanstream.process import process_zarr_files
|
|
138
|
+
|
|
139
|
+
process_zarr_files(config_data, workers_count=workers_count, chunks=chunks, plot_echogram=plot_echogram,
|
|
140
|
+
waveform_mode=waveform_mode, depth_offset=depth_offset)
|
|
141
|
+
else:
|
|
142
|
+
logging.error(f"The provided path '{source}' is not a valid Zarr root.")
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
def export():
|
|
146
|
+
logging.info("Export data...")
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
{
|
|
2
|
+
"impulse": {
|
|
3
|
+
"enabled": true,
|
|
4
|
+
"method": "ryan",
|
|
5
|
+
"parameters": {
|
|
6
|
+
"thr": 10,
|
|
7
|
+
"m": 5,
|
|
8
|
+
"n": 1
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"attenuation": {
|
|
12
|
+
"enabled": true,
|
|
13
|
+
"method": "ryan",
|
|
14
|
+
"parameters": {
|
|
15
|
+
"r0": 180,
|
|
16
|
+
"r1": 280,
|
|
17
|
+
"n": 5,
|
|
18
|
+
"m": null,
|
|
19
|
+
"thr": -5,
|
|
20
|
+
"start": 0,
|
|
21
|
+
"offset": 0,
|
|
22
|
+
"dask_chunking": {
|
|
23
|
+
"ping_time": 100,
|
|
24
|
+
"range_sample": 100
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"transient": {
|
|
29
|
+
"enabled": true,
|
|
30
|
+
"method": "fielding",
|
|
31
|
+
"parameters": {
|
|
32
|
+
"r0": 200,
|
|
33
|
+
"r1": 1000,
|
|
34
|
+
"n": 5,
|
|
35
|
+
"thr": [
|
|
36
|
+
2,
|
|
37
|
+
0
|
|
38
|
+
],
|
|
39
|
+
"roff": 250,
|
|
40
|
+
"jumps": 5,
|
|
41
|
+
"maxts": -35,
|
|
42
|
+
"start": 0,
|
|
43
|
+
"dask_chunking": {
|
|
44
|
+
"ping_time": 100,
|
|
45
|
+
"range_sample": 100
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"false_seabed": {
|
|
50
|
+
"enabled": true,
|
|
51
|
+
"method": "blackwell",
|
|
52
|
+
"parameters": {
|
|
53
|
+
"r0": 10,
|
|
54
|
+
"r1": 1000,
|
|
55
|
+
"tSv": -35,
|
|
56
|
+
"ttheta": 702,
|
|
57
|
+
"tphi": 282,
|
|
58
|
+
"wtheta": 28,
|
|
59
|
+
"wphi": 52
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"seabed": {
|
|
63
|
+
"enabled": true,
|
|
64
|
+
"method": "ariza",
|
|
65
|
+
"parameters": {
|
|
66
|
+
"r0": 10,
|
|
67
|
+
"r1": 1000,
|
|
68
|
+
"roff": 0,
|
|
69
|
+
"thr": [
|
|
70
|
+
-40,
|
|
71
|
+
-40
|
|
72
|
+
],
|
|
73
|
+
"ec": 1,
|
|
74
|
+
"ek": [
|
|
75
|
+
3,
|
|
76
|
+
3
|
|
77
|
+
],
|
|
78
|
+
"dc": 3,
|
|
79
|
+
"dk": [
|
|
80
|
+
3,
|
|
81
|
+
3
|
|
82
|
+
],
|
|
83
|
+
"maximum_spike": 100
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"remove_background_noise": {
|
|
87
|
+
"enabled": true,
|
|
88
|
+
"parameters": {
|
|
89
|
+
"ping_num": 40,
|
|
90
|
+
"noise_max": -125,
|
|
91
|
+
"SNR_threshold": 3
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
"nasc": {
|
|
95
|
+
"enabled": true
|
|
96
|
+
},
|
|
97
|
+
"shoals": {
|
|
98
|
+
"enabled": true,
|
|
99
|
+
"method": "will",
|
|
100
|
+
"parameters": {
|
|
101
|
+
"thr": -55,
|
|
102
|
+
"maxvgap": -5,
|
|
103
|
+
"maxhgap": 0,
|
|
104
|
+
"minvlen": 5,
|
|
105
|
+
"minhlen": 5,
|
|
106
|
+
"dask_chunking": {
|
|
107
|
+
"ping_time": 100,
|
|
108
|
+
"range_sample": 100
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
"profile": false,
|
|
113
|
+
"base_chunk_sizes": {
|
|
114
|
+
"ping_time": 50,
|
|
115
|
+
"range_sample": 50
|
|
116
|
+
},
|
|
117
|
+
"sonar_model": null,
|
|
118
|
+
"output_folder": "output",
|
|
119
|
+
"plot_echogram": true
|
|
120
|
+
}
|
|
@@ -1,34 +1,14 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: oceanstream
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.6.dev0
|
|
4
4
|
Summary: OceanStream: process raw sonar data at scale
|
|
5
|
-
Home-page: https://
|
|
5
|
+
Home-page: https://oceanstream.io
|
|
6
6
|
Author: Pineview Labs
|
|
7
|
-
Author-email:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
14
|
-
in the Software without restriction, including without limitation the rights
|
|
15
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
17
|
-
furnished to do so, subject to the following conditions:
|
|
18
|
-
|
|
19
|
-
The above copyright notice and this permission notice shall be included in all
|
|
20
|
-
copies or substantial portions of the Software.
|
|
21
|
-
|
|
22
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
-
SOFTWARE.
|
|
29
|
-
|
|
7
|
+
Author-email: hello@pineview.io
|
|
8
|
+
Maintainer: Andrei Rusu
|
|
9
|
+
Maintainer-email: hello@pineview.io
|
|
10
|
+
License: MIT
|
|
30
11
|
Classifier: Programming Language :: Python :: 3
|
|
31
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
32
12
|
Classifier: Programming Language :: Python :: 3.11
|
|
33
13
|
Classifier: License :: OSI Approved :: MIT License
|
|
34
14
|
Classifier: Operating System :: OS Independent
|
|
@@ -42,22 +22,18 @@ Provides-Extra: cli
|
|
|
42
22
|
Requires-Dist: typer ; extra == 'cli'
|
|
43
23
|
Requires-Dist: rich ; extra == 'cli'
|
|
44
24
|
Provides-Extra: complete
|
|
45
|
-
Requires-Dist: cli ; extra == 'complete'
|
|
46
|
-
Requires-Dist: echodata ; extra == 'complete'
|
|
47
|
-
Requires-Dist: process ; extra == 'complete'
|
|
48
|
-
Requires-Dist: denoise ; extra == 'complete'
|
|
49
|
-
Requires-Dist: plot ; extra == 'complete'
|
|
50
|
-
Requires-Dist: exports ; extra == 'complete'
|
|
51
25
|
Requires-Dist: typer ; extra == 'complete'
|
|
52
26
|
Requires-Dist: rich ; extra == 'complete'
|
|
53
|
-
Requires-Dist: matplotlib ; extra == 'complete'
|
|
54
27
|
Requires-Dist: pydantic ; extra == 'complete'
|
|
28
|
+
Requires-Dist: matplotlib ; extra == 'complete'
|
|
29
|
+
Requires-Dist: cmocean ; extra == 'complete'
|
|
55
30
|
Provides-Extra: denoise
|
|
56
31
|
Provides-Extra: echodata
|
|
57
32
|
Requires-Dist: pydantic ; extra == 'echodata'
|
|
58
33
|
Provides-Extra: exports
|
|
59
34
|
Provides-Extra: plot
|
|
60
35
|
Requires-Dist: matplotlib ; extra == 'plot'
|
|
36
|
+
Requires-Dist: cmocean ; extra == 'plot'
|
|
61
37
|
Provides-Extra: process
|
|
62
38
|
|
|
63
39
|
# OceanStream
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
oceanstream/__init__.py,sha256=
|
|
1
|
+
oceanstream/__init__.py,sha256=sFoir3TVQ0vEEaVV3H9xVHDI16sz-3T-Ldf4dKhbi0Y,132
|
|
2
|
+
oceanstream/core.py,sha256=__4u1UsLutOYUB0kILapErEOam4N5aMiI4C17lvUJp4,5537
|
|
2
3
|
oceanstream/utils.py,sha256=meViPVwoDEmKA5zM5v226JyKjUMkOaj5ENGCpfipdv4,3127
|
|
3
4
|
oceanstream/cli/__init__.py,sha256=3cNr7Lft68oxlCiyflezy6dzuw4HEd5mvMZkSzNujWE,51
|
|
4
5
|
oceanstream/cli/main.py,sha256=T4JFFs7ngWNgEDsYlDb_u0XXfk_rmA22Tf31ewvufUU,11450
|
|
@@ -37,10 +38,10 @@ oceanstream/process/process.py,sha256=jK5a5AVQJnODEcDSZi_oYuOpljBl3vewxEsyK_OLSg
|
|
|
37
38
|
oceanstream/process/processed_data_io.py,sha256=aDKhh0-9kwgccjRIUS4D4GHkkRAyUyWgMSq1L13U4w4,4663
|
|
38
39
|
oceanstream/settings/__init__.py,sha256=Uh8oeGPgpLuLpEAv0ygUBOQAuQj0wG4f1Tj2zIqoIy4,32
|
|
39
40
|
oceanstream/settings/config.py,sha256=koIVrrbvPVz7TFPNKutPoxcXtbVrH5EFDVgESPyhE80,479
|
|
40
|
-
oceanstream
|
|
41
|
-
oceanstream-0.0.
|
|
42
|
-
oceanstream-0.0.
|
|
43
|
-
oceanstream-0.0.
|
|
44
|
-
oceanstream-0.0.
|
|
45
|
-
oceanstream-0.0.
|
|
46
|
-
oceanstream-0.0.
|
|
41
|
+
oceanstream/settings/defaults.config.json,sha256=U4WLeOl4Nx1etFvyTr2-shwta8rikweD8PphtRVW-yw,1984
|
|
42
|
+
oceanstream-0.0.6.dev0.dist-info/LICENSE,sha256=-5V4voa5xg_L9IVdMD881urt9gjA-k4rWk9Wew3uyf0,1078
|
|
43
|
+
oceanstream-0.0.6.dev0.dist-info/METADATA,sha256=a4IqcIftgysjxCIc94U_wl42txuW_obeSjsGMmj2syQ,5087
|
|
44
|
+
oceanstream-0.0.6.dev0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
45
|
+
oceanstream-0.0.6.dev0.dist-info/entry_points.txt,sha256=7NApSbVm7X53EC54ryz6q3zvyAF7aVAEL8IGLfJeOAU,58
|
|
46
|
+
oceanstream-0.0.6.dev0.dist-info/top_level.txt,sha256=rdOKWkpJy5DPBPPhjwxtclDVTea-S38kiQeIqoFcINs,12
|
|
47
|
+
oceanstream-0.0.6.dev0.dist-info/RECORD,,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
git+https://github.com/OceanStreamIO/echopype-dev.git@oceanstream#egg=echopype
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|