oceanstream 0.0.4.dev0__py3-none-any.whl → 0.0.8.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 CHANGED
@@ -0,0 +1,3 @@
1
+ from .core import compute_sv, combine, convert, process_raw_file
2
+
3
+ __all__ = ["compute_sv", "combine", "convert", "process_raw_file"]
@@ -0,0 +1,2 @@
1
+ typer
2
+ rich
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...")
File without changes
@@ -0,0 +1 @@
1
+ pydantic
@@ -0,0 +1,4 @@
1
+ haversine
2
+ pandas
3
+ scipy
4
+ numpy
@@ -0,0 +1,2 @@
1
+ matplotlib
2
+ cmocean
File without changes
@@ -1,34 +1,14 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: oceanstream
3
- Version: 0.0.4.dev0
3
+ Version: 0.0.8.dev0
4
4
  Summary: OceanStream: process raw sonar data at scale
5
- Home-page: https://github.com/OceanStreamIO/oceanstream
5
+ Home-page: https://oceanstream.io
6
6
  Author: Pineview Labs
7
- Author-email: Pineview Labs <hello@pineview.io>
8
- License: MIT License
9
-
10
- Copyright (c) 2023 Pine View Software AS
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,18 +1,22 @@
1
- oceanstream/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
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
6
+ oceanstream/cli/requirements.txt,sha256=Ui83FHUAHe6Ir7De-fN5CXnsTdZn5o3gVYKtblpcWME,10
5
7
  oceanstream/denoise/__init__.py,sha256=K8j5OCDJlGmjqQPuQidO77J289Z17hSsslIitUJnGpo,133
6
8
  oceanstream/denoise/apply_masks.py,sha256=zWqYW0qANbPOPG5m6UDGbvN2dqUikzLZB_5G-ZVyY_g,1425
7
9
  oceanstream/denoise/applying_masks_handler.py,sha256=VP2R_vBiQmcnUaCxLUh7Txv3bbh9bT1aK6okLRMNklU,5880
8
10
  oceanstream/denoise/background_noise_remover.py,sha256=9NWHM8-XQH11lNSUnc-IgMa9btaehWOU2pTTv9lniqc,3783
9
11
  oceanstream/denoise/create_masks.py,sha256=9FuOeUDMi3AyHcJ8dSsUQ-rLcIw8-dk9QEDjUHOX_v4,2941
10
12
  oceanstream/denoise/noise_masks.py,sha256=EPY2w6RR45CjnMSPcEDg3FKs_0hDt9y1Q4QbUfTTKfw,12109
13
+ oceanstream/denoise/requirements.txt,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
14
  oceanstream/denoise/types.py,sha256=Agikt2zU6Zbh3Ln5zJ4TC_LkuoVMvO7B3fSXZWVXV_w,1305
12
15
  oceanstream/echodata/__init__.py,sha256=WGIEXQxemdP5s26ldlzqixVfFPyxn90Z1Tt0V7yPOz8,351
13
16
  oceanstream/echodata/ensure_time_continuity.py,sha256=QL3xvwCsGSi04iACeIOYYxFUrp-vdBcv8wdjbBc8YYo,2506
14
17
  oceanstream/echodata/mvbs_computation.py,sha256=7ILXIPMQ7Mf-jNx9SDWqjNbI_9Qbs8lzE_TTXo2RW70,3150
15
18
  oceanstream/echodata/raw_handler.py,sha256=tgXqvRBebphzSR3qkjNaWwMcYPozcwuIHd-__1v9rqU,19311
19
+ oceanstream/echodata/requirements.txt,sha256=cmo_5n0F_YY5td5nPZBfdjBENkmGg_pE5ShWXYbXxTM,9
16
20
  oceanstream/echodata/sv_computation.py,sha256=OvmgnLV1akx2pqnANNnQzX5olpY0smo3EeoD19hn4lM,3603
17
21
  oceanstream/echodata/sv_dataset_extension.py,sha256=Hmu0vZDIql11FOc_sx_QVoRq_J7HyPzMPiuRgjrzL0I,4382
18
22
  oceanstream/echodata/sv_interpolation.py,sha256=nvhtBKlIVT_77aDl7BrU0PC6ZYwhhQpVErXCyPrdoBM,11405
@@ -21,6 +25,7 @@ oceanstream/exports/__init__.py,sha256=5BrGFSzGKatg_0TtBFzSAGDd5TdleKYCiJxIpsVNa
21
25
  oceanstream/exports/frequency_differencing_handler.py,sha256=ZbbBek5phcsO4zodOrhCtDA21ksR7ilEuKFiUvVCGy0,8358
22
26
  oceanstream/exports/nasc.py,sha256=i1m50PFoq5WJOoFXFgs4Q77hQIoEhC1cRvBr7QMEy6s,626
23
27
  oceanstream/exports/nasc_computation.py,sha256=xqV13ADCQhRZZ7lRBPug2J8Q6bj_iJg5Q-P6Iv3OBMo,2281
28
+ oceanstream/exports/requirements.txt,sha256=9xwFFJIkCrRBrL3zprEAkVIO_vAkXqxXElyCXIfd-XU,29
24
29
  oceanstream/exports/csv/csv_export_from_Sv.py,sha256=JoNrhi6kW-aGxb_OUutjevJzIPMT6Drs9jqBP1tK-_E,2559
25
30
  oceanstream/exports/csv/csv_export_from_raw.py,sha256=Kb6Gs5w1ZSMymJeLMa341T-qcKvOglZhUj2aoI3dtLE,2784
26
31
  oceanstream/exports/csv/csv_export_nasc.py,sha256=huSzY_Xf4k3E66JoouVGgys2c0mK9sGODKRWInkG_tg,4534
@@ -29,19 +34,20 @@ oceanstream/exports/shoals/shoal_process.py,sha256=yTDU4qeZ7DraEsoXEvOVDaqANh2hW
29
34
  oceanstream/exports/shoals/shoals_handler.py,sha256=UB48tQz0IPGEM9K4XYV5X6x7awdubYB_ExULXSgyMu0,1039
30
35
  oceanstream/plot/__init__.py,sha256=HFu67GwAxdm0nOS2IUbGgeF8gZ4MKvP0vH6eJDGu1PU,136
31
36
  oceanstream/plot/echogram.py,sha256=REeWWiXbpsWkWArDQd7FUr1ISS42b0sUTHd-NWxFENM,22016
37
+ oceanstream/plot/requirements.txt,sha256=CKWyfMfq42Innw74FAz4RvWV2zBcG0qOnN6DN6Whk8c,19
32
38
  oceanstream/process/__init__.py,sha256=3JgO18BS5z3w2Mh7Y3IcmTCytqqEJZiSlZBnJrUZ8ZE,753
33
39
  oceanstream/process/combine_zarr.py,sha256=F_ZA5twGIHd6z7dv_wHsfaCsIZbAtSEY4kYBx1WzoP4,2791
34
40
  oceanstream/process/file_processor.py,sha256=8GVHLOqOSvu9TIRFR47G3wsf75wxd2AIZ8YbZ6Vjp1g,6186
35
41
  oceanstream/process/folder_processor.py,sha256=QAujhDR393T2mstG5BaBsr2EzUAiwMGe0Rh7urT7SDI,9824
36
42
  oceanstream/process/process.py,sha256=jK5a5AVQJnODEcDSZi_oYuOpljBl3vewxEsyK_OLSgY,2263
37
43
  oceanstream/process/processed_data_io.py,sha256=aDKhh0-9kwgccjRIUS4D4GHkkRAyUyWgMSq1L13U4w4,4663
44
+ oceanstream/process/requirements.txt,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
38
45
  oceanstream/settings/__init__.py,sha256=Uh8oeGPgpLuLpEAv0ygUBOQAuQj0wG4f1Tj2zIqoIy4,32
39
46
  oceanstream/settings/config.py,sha256=koIVrrbvPVz7TFPNKutPoxcXtbVrH5EFDVgESPyhE80,479
40
47
  oceanstream/settings/defaults.config.json,sha256=U4WLeOl4Nx1etFvyTr2-shwta8rikweD8PphtRVW-yw,1984
41
- oceanstream-0.0.4.dev0.dist-info/LICENSE,sha256=-5V4voa5xg_L9IVdMD881urt9gjA-k4rWk9Wew3uyf0,1078
42
- oceanstream-0.0.4.dev0.dist-info/METADATA,sha256=_m9DM-6bArnS_aTsun7SVCi3kqSTtijodJwiANmopdI,6537
43
- oceanstream-0.0.4.dev0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
44
- oceanstream-0.0.4.dev0.dist-info/dependency_links.txt,sha256=3WquP_0TQR8DRjSvUjJMeJB5VvYg5VFE2VGC9ruFUOg,79
45
- oceanstream-0.0.4.dev0.dist-info/entry_points.txt,sha256=7NApSbVm7X53EC54ryz6q3zvyAF7aVAEL8IGLfJeOAU,58
46
- oceanstream-0.0.4.dev0.dist-info/top_level.txt,sha256=rdOKWkpJy5DPBPPhjwxtclDVTea-S38kiQeIqoFcINs,12
47
- oceanstream-0.0.4.dev0.dist-info/RECORD,,
48
+ oceanstream-0.0.8.dev0.dist-info/LICENSE,sha256=-5V4voa5xg_L9IVdMD881urt9gjA-k4rWk9Wew3uyf0,1078
49
+ oceanstream-0.0.8.dev0.dist-info/METADATA,sha256=vp0O0g1c8Euf5IA16xeUseVWuKqVNUAyibwqPtdUHm0,5087
50
+ oceanstream-0.0.8.dev0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
51
+ oceanstream-0.0.8.dev0.dist-info/entry_points.txt,sha256=7NApSbVm7X53EC54ryz6q3zvyAF7aVAEL8IGLfJeOAU,58
52
+ oceanstream-0.0.8.dev0.dist-info/top_level.txt,sha256=rdOKWkpJy5DPBPPhjwxtclDVTea-S38kiQeIqoFcINs,12
53
+ oceanstream-0.0.8.dev0.dist-info/RECORD,,
@@ -1 +0,0 @@
1
- git+https://github.com/OceanStreamIO/echopype-dev.git@oceanstream#egg=echopype