water-column-sonar-annotation 26.1.8__tar.gz → 26.2.1__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.
- {water_column_sonar_annotation-26.1.8/water_column_sonar_annotation.egg-info → water_column_sonar_annotation-26.2.1}/PKG-INFO +5 -4
- {water_column_sonar_annotation-26.1.8 → water_column_sonar_annotation-26.2.1}/README.md +3 -3
- {water_column_sonar_annotation-26.1.8 → water_column_sonar_annotation-26.2.1}/pyproject.toml +3 -4
- {water_column_sonar_annotation-26.1.8 → water_column_sonar_annotation-26.2.1}/tests/astronomical/test_astronomical_manager.py +10 -10
- water_column_sonar_annotation-26.2.1/tests/conftest.py +60 -0
- {water_column_sonar_annotation-26.1.8 → water_column_sonar_annotation-26.2.1}/tests/cruise/test_cruise_manager.py +4 -5
- {water_column_sonar_annotation-26.1.8 → water_column_sonar_annotation-26.2.1}/tests/geospatial/test_geospatial_manager.py +8 -12
- {water_column_sonar_annotation-26.1.8 → water_column_sonar_annotation-26.2.1}/tests/record/test_echoview_record_manager.py +135 -13
- water_column_sonar_annotation-26.2.1/water_column_sonar_annotation/__init__.py +5 -0
- {water_column_sonar_annotation-26.1.8 → water_column_sonar_annotation-26.2.1}/water_column_sonar_annotation/astronomical/astronomical_manager.py +5 -5
- {water_column_sonar_annotation-26.1.8 → water_column_sonar_annotation-26.2.1}/water_column_sonar_annotation/geospatial/geospatial_manager.py +6 -9
- {water_column_sonar_annotation-26.1.8 → water_column_sonar_annotation-26.2.1}/water_column_sonar_annotation/record/echoview_record_manager.py +103 -84
- {water_column_sonar_annotation-26.1.8 → water_column_sonar_annotation-26.2.1}/water_column_sonar_annotation/record/graph_record_manager.py +1 -0
- water_column_sonar_annotation-26.2.1/water_column_sonar_annotation/record/parquet_record_manager.py +155 -0
- water_column_sonar_annotation-26.2.1/water_column_sonar_annotation/shape/shape_manager.py +29 -0
- {water_column_sonar_annotation-26.1.8 → water_column_sonar_annotation-26.2.1/water_column_sonar_annotation.egg-info}/PKG-INFO +5 -4
- {water_column_sonar_annotation-26.1.8 → water_column_sonar_annotation-26.2.1}/water_column_sonar_annotation.egg-info/requires.txt +1 -0
- water_column_sonar_annotation-26.1.8/tests/conftest.py +0 -60
- water_column_sonar_annotation-26.1.8/water_column_sonar_annotation/__init__.py +0 -5
- water_column_sonar_annotation-26.1.8/water_column_sonar_annotation/record/parquet_record_manager.py +0 -83
- water_column_sonar_annotation-26.1.8/water_column_sonar_annotation/shape/shape_manager.py +0 -29
- {water_column_sonar_annotation-26.1.8 → water_column_sonar_annotation-26.2.1}/LICENSE +0 -0
- {water_column_sonar_annotation-26.1.8 → water_column_sonar_annotation-26.2.1}/setup.cfg +0 -0
- {water_column_sonar_annotation-26.1.8 → water_column_sonar_annotation-26.2.1}/tests/__init__.py +0 -0
- {water_column_sonar_annotation-26.1.8 → water_column_sonar_annotation-26.2.1}/tests/astronomical/__init__.py +0 -0
- {water_column_sonar_annotation-26.1.8 → water_column_sonar_annotation-26.2.1}/tests/cruise/__init__.py +0 -0
- {water_column_sonar_annotation-26.1.8 → water_column_sonar_annotation-26.2.1}/tests/geospatial/__init__.py +0 -0
- {water_column_sonar_annotation-26.1.8 → water_column_sonar_annotation-26.2.1}/water_column_sonar_annotation/astronomical/__init__.py +0 -0
- {water_column_sonar_annotation-26.1.8 → water_column_sonar_annotation-26.2.1}/water_column_sonar_annotation/cruise/__init__.py +0 -0
- {water_column_sonar_annotation-26.1.8 → water_column_sonar_annotation-26.2.1}/water_column_sonar_annotation/cruise/cruise_manager.py +0 -0
- {water_column_sonar_annotation-26.1.8 → water_column_sonar_annotation-26.2.1}/water_column_sonar_annotation/geospatial/__init__.py +0 -0
- {water_column_sonar_annotation-26.1.8 → water_column_sonar_annotation-26.2.1}/water_column_sonar_annotation/record/__init__.py +0 -0
- {water_column_sonar_annotation-26.1.8 → water_column_sonar_annotation-26.2.1}/water_column_sonar_annotation/shape/__init__.py +0 -0
- {water_column_sonar_annotation-26.1.8 → water_column_sonar_annotation-26.2.1}/water_column_sonar_annotation.egg-info/SOURCES.txt +0 -0
- {water_column_sonar_annotation-26.1.8 → water_column_sonar_annotation-26.2.1}/water_column_sonar_annotation.egg-info/dependency_links.txt +0 -0
- {water_column_sonar_annotation-26.1.8 → water_column_sonar_annotation-26.2.1}/water_column_sonar_annotation.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: water-column-sonar-annotation
|
|
3
|
-
Version: 26.1
|
|
3
|
+
Version: 26.2.1
|
|
4
4
|
Summary: Processing Tool for Working with Water Column Sonar Annotations
|
|
5
5
|
Author-email: Rudy Klucik <rudy.klucik@noaa.gov>
|
|
6
6
|
Maintainer-email: Rudy Klucik <rudy.klucik@noaa.gov>
|
|
@@ -25,6 +25,7 @@ Requires-Dist: pooch
|
|
|
25
25
|
Requires-Dist: pvlib
|
|
26
26
|
Requires-Dist: pyarrow
|
|
27
27
|
Requires-Dist: pyogrio
|
|
28
|
+
Requires-Dist: pyspark
|
|
28
29
|
Requires-Dist: python-dotenv
|
|
29
30
|
Requires-Dist: s3fs
|
|
30
31
|
Requires-Dist: scipy
|
|
@@ -40,7 +41,7 @@ Dynamic: license-file
|
|
|
40
41
|
Tool for converting EVR files to annotated regions of interest in parquet format
|
|
41
42
|
|
|
42
43
|

|
|
43
|
-
  
|
|
44
45
|
|
|
45
46
|
# Setting up the Python Environment
|
|
46
47
|
|
|
@@ -82,9 +83,9 @@ TODO
|
|
|
82
83
|
Step 1 --> increment the semantic version in the zarr_manager.py "metadata" & the "pyproject.toml"
|
|
83
84
|
|
|
84
85
|
```commandline
|
|
85
|
-
git tag -a v26.
|
|
86
|
+
git tag -a v26.2.0 -m "Releasing v26.2.0"
|
|
86
87
|
git push origin --tags
|
|
87
|
-
gh release create v26.
|
|
88
|
+
gh release create v26.2.0
|
|
88
89
|
```
|
|
89
90
|
|
|
90
91
|
# To Publish To PROD
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Tool for converting EVR files to annotated regions of interest in parquet format
|
|
4
4
|
|
|
5
5
|

|
|
6
|
-
  
|
|
7
7
|
|
|
8
8
|
# Setting up the Python Environment
|
|
9
9
|
|
|
@@ -45,9 +45,9 @@ TODO
|
|
|
45
45
|
Step 1 --> increment the semantic version in the zarr_manager.py "metadata" & the "pyproject.toml"
|
|
46
46
|
|
|
47
47
|
```commandline
|
|
48
|
-
git tag -a v26.
|
|
48
|
+
git tag -a v26.2.0 -m "Releasing v26.2.0"
|
|
49
49
|
git push origin --tags
|
|
50
|
-
gh release create v26.
|
|
50
|
+
gh release create v26.2.0
|
|
51
51
|
```
|
|
52
52
|
|
|
53
53
|
# To Publish To PROD
|
{water_column_sonar_annotation-26.1.8 → water_column_sonar_annotation-26.2.1}/pyproject.toml
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "water-column-sonar-annotation"
|
|
3
|
-
version = "26.1
|
|
3
|
+
version = "26.2.1"
|
|
4
4
|
authors = [
|
|
5
5
|
{ name = "Rudy Klucik", email = "rudy.klucik@noaa.gov" },
|
|
6
6
|
]
|
|
@@ -28,13 +28,13 @@ dependencies = [
|
|
|
28
28
|
"pvlib",
|
|
29
29
|
"pyarrow",
|
|
30
30
|
"pyogrio",
|
|
31
|
+
"pyspark",
|
|
31
32
|
"python-dotenv",
|
|
32
|
-
"s3fs",
|
|
33
|
+
"s3fs",
|
|
33
34
|
"scipy",
|
|
34
35
|
"shapely",
|
|
35
36
|
"setuptools",
|
|
36
37
|
"timezonefinder",
|
|
37
|
-
# "wheel",
|
|
38
38
|
"xarray",
|
|
39
39
|
"zarr",
|
|
40
40
|
]
|
|
@@ -44,7 +44,6 @@ dependencies = [
|
|
|
44
44
|
dev = [
|
|
45
45
|
"bandit[toml]",
|
|
46
46
|
"build",
|
|
47
|
-
"pooch",
|
|
48
47
|
"pre-commit",
|
|
49
48
|
"pytest",
|
|
50
49
|
"pytest-cov",
|
|
@@ -51,7 +51,7 @@ def test_phase_of_day_at_noon():
|
|
|
51
51
|
latitude=39.9674884, # Boulder
|
|
52
52
|
longitude=-105.2532602,
|
|
53
53
|
)
|
|
54
|
-
assert phase ==
|
|
54
|
+
assert phase == "day"
|
|
55
55
|
|
|
56
56
|
|
|
57
57
|
def test_phase_of_day_at_midnight():
|
|
@@ -61,7 +61,7 @@ def test_phase_of_day_at_midnight():
|
|
|
61
61
|
latitude=39.9674884, # Boulder
|
|
62
62
|
longitude=-105.2532602,
|
|
63
63
|
)
|
|
64
|
-
assert phase ==
|
|
64
|
+
assert phase == "night"
|
|
65
65
|
|
|
66
66
|
|
|
67
67
|
def test_phase_of_day_before_sunset():
|
|
@@ -72,7 +72,7 @@ def test_phase_of_day_before_sunset():
|
|
|
72
72
|
latitude=39.9674884, # Boulder
|
|
73
73
|
longitude=-105.2532602,
|
|
74
74
|
)
|
|
75
|
-
assert phase ==
|
|
75
|
+
assert phase == "day" # day
|
|
76
76
|
|
|
77
77
|
|
|
78
78
|
def test_phase_of_day_after_sunset():
|
|
@@ -83,7 +83,7 @@ def test_phase_of_day_after_sunset():
|
|
|
83
83
|
latitude=39.9674884, # Boulder
|
|
84
84
|
longitude=-105.2532602,
|
|
85
85
|
)
|
|
86
|
-
assert phase ==
|
|
86
|
+
assert phase == "dusk" # dusk
|
|
87
87
|
|
|
88
88
|
|
|
89
89
|
def test_phase_of_day_before_nautical_sunset():
|
|
@@ -94,7 +94,7 @@ def test_phase_of_day_before_nautical_sunset():
|
|
|
94
94
|
latitude=39.9674884, # Boulder
|
|
95
95
|
longitude=-105.2532602,
|
|
96
96
|
)
|
|
97
|
-
assert phase_before_nautical_sunset ==
|
|
97
|
+
assert phase_before_nautical_sunset == "dusk" # dusk
|
|
98
98
|
|
|
99
99
|
|
|
100
100
|
def test_phase_of_day_after_nautical_sunset():
|
|
@@ -104,7 +104,7 @@ def test_phase_of_day_after_nautical_sunset():
|
|
|
104
104
|
latitude=39.9674884, # Boulder
|
|
105
105
|
longitude=-105.2532602,
|
|
106
106
|
)
|
|
107
|
-
assert phase_after_nautical_sunset ==
|
|
107
|
+
assert phase_after_nautical_sunset == "night" # night
|
|
108
108
|
|
|
109
109
|
|
|
110
110
|
def test_phase_of_day_before_sunrise():
|
|
@@ -114,7 +114,7 @@ def test_phase_of_day_before_sunrise():
|
|
|
114
114
|
latitude=39.9674884, # Boulder
|
|
115
115
|
longitude=-105.2532602,
|
|
116
116
|
)
|
|
117
|
-
assert phase_at_sunrise ==
|
|
117
|
+
assert phase_at_sunrise == "dawn" # dawn
|
|
118
118
|
|
|
119
119
|
|
|
120
120
|
def test_phase_of_day_after_sunrise():
|
|
@@ -124,7 +124,7 @@ def test_phase_of_day_after_sunrise():
|
|
|
124
124
|
latitude=39.9674884, # Boulder
|
|
125
125
|
longitude=-105.2532602,
|
|
126
126
|
)
|
|
127
|
-
assert phase_at_sunrise ==
|
|
127
|
+
assert phase_at_sunrise == "day" # day
|
|
128
128
|
|
|
129
129
|
|
|
130
130
|
def test_phase_of_day_before_nautical_sunrise():
|
|
@@ -135,7 +135,7 @@ def test_phase_of_day_before_nautical_sunrise():
|
|
|
135
135
|
latitude=39.9674884, # Boulder
|
|
136
136
|
longitude=-105.2532602,
|
|
137
137
|
)
|
|
138
|
-
assert phase_before_nautical_sunrise ==
|
|
138
|
+
assert phase_before_nautical_sunrise == "night" # night
|
|
139
139
|
|
|
140
140
|
|
|
141
141
|
def test_phase_of_day_after_nautical_sunrise():
|
|
@@ -145,4 +145,4 @@ def test_phase_of_day_after_nautical_sunrise():
|
|
|
145
145
|
latitude=39.9674884, # Boulder
|
|
146
146
|
longitude=-105.2532602,
|
|
147
147
|
)
|
|
148
|
-
assert phase ==
|
|
148
|
+
assert phase == "dawn" # dawn
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# from pathlib import Path
|
|
2
|
+
#
|
|
3
|
+
# import pooch
|
|
4
|
+
# import pytest
|
|
5
|
+
#
|
|
6
|
+
# HERE = Path(__file__).parent.absolute()
|
|
7
|
+
# TEST_DATA_FOLDER = HERE / "test_resources"
|
|
8
|
+
#
|
|
9
|
+
# HB1906_DATA = pooch.create(
|
|
10
|
+
# path=pooch.os_cache("water-column-sonar-annotation"),
|
|
11
|
+
# base_url="https://github.com/CI-CMG/water-column-sonar-annotation/releases/download/v26.1.0/",
|
|
12
|
+
# retry_if_failed=1,
|
|
13
|
+
# registry={
|
|
14
|
+
# "HB201906_BOTTOMS.zip": "sha256:20609581493ea3326c1084b6868e02aafbb6c0eae871d946f30b8b5f0e7ba059",
|
|
15
|
+
# "HB201906_EVR.zip": "sha256:256778122e9c8b05884f5f2c5cf5cdad5502aa3dae61d417ec5e4278262d937a",
|
|
16
|
+
# #
|
|
17
|
+
# # "ne_50m_coastline.shp": "sha256:797d675af9613f80b51ab6049fa32e589974d7a97c6497ca56772965f179ed26",
|
|
18
|
+
# # "ne_50m_coastline.shx": "sha256:0ff1792f2d16b58246d074215edd9d12fa280880ecaad61a91b9382fee854065",
|
|
19
|
+
# #
|
|
20
|
+
# "ne_10m_coastline.shp": "sha256:459a4a97c09db19aadf5244026612de9d43748be27f83a360242b99f7fabb3c1",
|
|
21
|
+
# "ne_10m_coastline.shx": "sha256:f873afee7f56779ce52253f740ec251c2f12244aea911dc40f0a85d75de8d5f2",
|
|
22
|
+
# },
|
|
23
|
+
# )
|
|
24
|
+
#
|
|
25
|
+
#
|
|
26
|
+
# def fetch_raw_files():
|
|
27
|
+
# # HB1906_DATA.fetch(fname="HB201906_BOTTOMS.zip", progressbar=True)
|
|
28
|
+
# # HB1906_DATA.fetch(fname="HB201906_EVR.zip", progressbar=True)
|
|
29
|
+
#
|
|
30
|
+
# # HB1906_DATA.fetch(fname="ne_50m_coastline.shp", progressbar=True)
|
|
31
|
+
# # HB1906_DATA.fetch(fname="ne_50m_coastline.shx", progressbar=True)
|
|
32
|
+
#
|
|
33
|
+
# # HB1906_DATA.fetch(fname="ne_10m_coastline.shp", progressbar=True)
|
|
34
|
+
# # HB1906_DATA.fetch(fname="ne_10m_coastline.shx", progressbar=True)
|
|
35
|
+
#
|
|
36
|
+
# file_name = HB1906_DATA.fetch(fname="HB201906_EVR.zip", progressbar=True)
|
|
37
|
+
#
|
|
38
|
+
# """
|
|
39
|
+
# water-column-sonar-annotation user$ ls /Users/user/Library/Caches/water-column-sonar-annotation
|
|
40
|
+
# HB201906_BOTTOMS.zip HB201906_EVR.zip ne_10m_coastline.shp ne_10m_coastline.shx
|
|
41
|
+
# """
|
|
42
|
+
# return Path(file_name).parent
|
|
43
|
+
#
|
|
44
|
+
#
|
|
45
|
+
# @pytest.fixture(scope="session")
|
|
46
|
+
# def test_path():
|
|
47
|
+
# return {
|
|
48
|
+
# "DATA_TEST_PATH": fetch_raw_files(),
|
|
49
|
+
# }
|
|
50
|
+
#
|
|
51
|
+
#
|
|
52
|
+
# # """
|
|
53
|
+
# # Folder locations in mac and windows:
|
|
54
|
+
# #
|
|
55
|
+
# # Windows
|
|
56
|
+
# # C:\Users\<user>\AppData\Local\echopype\Cache\2024.12.23.10.10
|
|
57
|
+
# #
|
|
58
|
+
# # MacOS
|
|
59
|
+
# # /Users//Library/Caches/echopype/2024.12.23.10.10
|
|
60
|
+
# # """
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import numpy as np
|
|
2
|
-
import pytest
|
|
3
2
|
|
|
4
3
|
from water_column_sonar_annotation.cruise import CruiseManager
|
|
5
4
|
|
|
@@ -13,9 +12,9 @@ def teardown_module():
|
|
|
13
12
|
print("teardown")
|
|
14
13
|
|
|
15
14
|
|
|
16
|
-
@pytest.fixture
|
|
17
|
-
def process_cruise_path(test_path):
|
|
18
|
-
|
|
15
|
+
# @pytest.fixture
|
|
16
|
+
# def process_cruise_path(test_path):
|
|
17
|
+
# return test_path["DATA_TEST_PATH"]
|
|
19
18
|
|
|
20
19
|
|
|
21
20
|
#######################################################
|
|
@@ -26,7 +25,7 @@ def process_cruise_path(test_path):
|
|
|
26
25
|
# assert len(cruise.Sv.shape) == 3
|
|
27
26
|
|
|
28
27
|
|
|
29
|
-
def test_get_cruise(
|
|
28
|
+
def test_get_cruise():
|
|
30
29
|
cruise_manager = CruiseManager()
|
|
31
30
|
cruise = cruise_manager.get_cruise()
|
|
32
31
|
assert len(cruise.Sv.shape) == 3
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import numpy as np
|
|
2
|
-
import pytest
|
|
3
2
|
|
|
4
3
|
from water_column_sonar_annotation.geospatial import GeospatialManager
|
|
5
4
|
|
|
@@ -13,33 +12,30 @@ def teardown_module():
|
|
|
13
12
|
print("teardown")
|
|
14
13
|
|
|
15
14
|
|
|
16
|
-
@pytest.fixture
|
|
17
|
-
def process_check_distance_from_coastline(test_path):
|
|
18
|
-
|
|
15
|
+
# @pytest.fixture
|
|
16
|
+
# def process_check_distance_from_coastline(test_path):
|
|
17
|
+
# return test_path["DATA_TEST_PATH"]
|
|
19
18
|
|
|
20
19
|
|
|
21
20
|
#######################################################
|
|
22
|
-
def test_check_distance_from_coastline(process_check_distance_from_coastline, tmp_path):
|
|
21
|
+
# def test_check_distance_from_coastline(process_check_distance_from_coastline, tmp_path):
|
|
22
|
+
def test_check_distance_from_coastline():
|
|
23
23
|
geospatial_manager = GeospatialManager()
|
|
24
24
|
# Point in middle of atlantic https://wktmap.com/?ab28cbae
|
|
25
25
|
distance = geospatial_manager.check_distance_from_coastline(
|
|
26
26
|
latitude=51.508742,
|
|
27
27
|
longitude=-30.410156,
|
|
28
|
-
shapefile_path=process_check_distance_from_coastline,
|
|
29
28
|
)
|
|
30
|
-
#
|
|
31
|
-
assert np.isclose(distance, 1_233_910.720702243
|
|
29
|
+
# distance should be ~1,200 km away
|
|
30
|
+
assert np.isclose(distance, 1_233_911) # 1_233_910.720702243
|
|
32
31
|
|
|
33
32
|
|
|
34
|
-
def test_check_distance_from_coastline_woods_hole(
|
|
35
|
-
process_check_distance_from_coastline, tmp_path
|
|
36
|
-
):
|
|
33
|
+
def test_check_distance_from_coastline_woods_hole():
|
|
37
34
|
geospatial_manager = GeospatialManager()
|
|
38
35
|
# Point in middle of woods hole vineyard sound: https://wktmap.com/?9b405aa9
|
|
39
36
|
distance = geospatial_manager.check_distance_from_coastline(
|
|
40
37
|
latitude=41.494692,
|
|
41
38
|
longitude=-70.647926,
|
|
42
|
-
shapefile_path=process_check_distance_from_coastline,
|
|
43
39
|
)
|
|
44
40
|
# The sound is 5 km across
|
|
45
41
|
# assert np.isclose(distance, 4_457.0347) # 4.5 km --> should be 2.5 km?
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import numpy as np
|
|
1
2
|
import pytest
|
|
2
3
|
|
|
3
4
|
from water_column_sonar_annotation.record import EchoviewRecordManager
|
|
@@ -92,7 +93,6 @@ AH_School
|
|
|
92
93
|
20191106 1314583780 25.4929369108 20191106 1314583780 30.2941528987 20191106 1314593790 30.2941528987 20191106 1314593790 25.3008882713 20191106 1314583780 25.3008882713 1
|
|
93
94
|
Region 23"""
|
|
94
95
|
|
|
95
|
-
|
|
96
96
|
ah_school_example2 = """13 16 28 0 7 -1 1 20191106 1317305715 31.8305420148 20191106 1317335745 35.8635634446
|
|
97
97
|
0
|
|
98
98
|
10
|
|
@@ -120,41 +120,163 @@ atlantic_herring
|
|
|
120
120
|
|
|
121
121
|
def test_process_evr_record_possible_herring():
|
|
122
122
|
echoview_record_manager = EchoviewRecordManager()
|
|
123
|
-
echoview_record_manager.
|
|
124
|
-
evr_record=possible_herring_example,
|
|
123
|
+
output = echoview_record_manager.process_evr_record_full_geometry(
|
|
124
|
+
evr_record=possible_herring_example, file_name="test.evr"
|
|
125
|
+
)
|
|
126
|
+
assert output.time_start == np.datetime64("2019-09-25 22:47:24.213000")
|
|
127
|
+
assert output.time_end == np.datetime64("2019-09-25 22:47:36.246000")
|
|
128
|
+
assert output.depth_min == 24.13
|
|
129
|
+
assert output.depth_max == 35.17
|
|
130
|
+
assert output.altitude == 1.62
|
|
131
|
+
assert output.latitude == 41.29728
|
|
132
|
+
assert output.longitude == -70.96354
|
|
133
|
+
assert output.distance_from_coastline == 11249
|
|
134
|
+
assert output.local_time == "2019-09-25T18:47:24.213000-04:00"
|
|
135
|
+
assert output.month == 9
|
|
136
|
+
assert output.solar_altitude == -2.92
|
|
137
|
+
assert output.phase_of_day == "dusk"
|
|
138
|
+
assert output.classification == "possible_herring"
|
|
139
|
+
assert output.filename == "test.evr"
|
|
140
|
+
assert output.region_id == 7
|
|
141
|
+
assert output.ship == "Henry_B._Bigelow"
|
|
142
|
+
assert output.cruise == "HB1906"
|
|
143
|
+
assert output.instrument == "EK60"
|
|
144
|
+
assert output.point_count == 4
|
|
145
|
+
assert (
|
|
146
|
+
output.geometry_hash
|
|
147
|
+
== "a5032c1ae6a14cb534ae2dfcfcf15056a9dfc23c04270f7e7f1e44f3d23beb7c"
|
|
125
148
|
)
|
|
149
|
+
assert len(output.geometry) == 120 # TODO: elaborate
|
|
126
150
|
|
|
127
151
|
|
|
128
152
|
def test_process_evr_record_fish_school():
|
|
129
153
|
echoview_record_manager = EchoviewRecordManager()
|
|
130
|
-
echoview_record_manager.
|
|
131
|
-
evr_record=fish_school_example,
|
|
154
|
+
output = echoview_record_manager.process_evr_record_full_geometry(
|
|
155
|
+
evr_record=fish_school_example, file_name="test.evr"
|
|
156
|
+
)
|
|
157
|
+
assert output.time_start == np.datetime64("2019-09-25 17:49:45.160500")
|
|
158
|
+
assert output.time_end == np.datetime64("2019-09-25 17:49:50.164500")
|
|
159
|
+
assert output.depth_min == 20.28
|
|
160
|
+
assert output.depth_max == 26.3
|
|
161
|
+
assert output.altitude == 6.83
|
|
162
|
+
assert output.latitude == 41.38583
|
|
163
|
+
assert output.longitude == -71.31283
|
|
164
|
+
assert output.distance_from_coastline == 8145
|
|
165
|
+
assert output.local_time == "2019-09-25T13:49:45.160500-04:00"
|
|
166
|
+
assert output.month == 9
|
|
167
|
+
assert output.solar_altitude == 44.57
|
|
168
|
+
assert output.phase_of_day == "day"
|
|
169
|
+
assert output.classification == "fish_school"
|
|
170
|
+
assert output.filename == "test.evr"
|
|
171
|
+
assert output.region_id == 8
|
|
172
|
+
assert output.ship == "Henry_B._Bigelow"
|
|
173
|
+
assert output.cruise == "HB1906"
|
|
174
|
+
assert output.instrument == "EK60"
|
|
175
|
+
assert output.point_count == 30
|
|
176
|
+
assert (
|
|
177
|
+
output.geometry_hash
|
|
178
|
+
== "e8f26554fa6ade664adc7c2b60896cf86d47092636ed8f2152c4cfa45dd962a9"
|
|
132
179
|
)
|
|
180
|
+
assert len(output.geometry) == 898 # TODO: elaborate
|
|
133
181
|
|
|
134
182
|
|
|
135
183
|
def test_process_evr_record_unclassified_regions():
|
|
136
184
|
echoview_record_manager = EchoviewRecordManager()
|
|
137
|
-
echoview_record_manager.
|
|
138
|
-
evr_record=unclassified_regions_example,
|
|
185
|
+
output = echoview_record_manager.process_evr_record_full_geometry(
|
|
186
|
+
evr_record=unclassified_regions_example, file_name="test.evr"
|
|
139
187
|
)
|
|
188
|
+
# print(output)
|
|
189
|
+
assert output.time_start == np.datetime64("2019-09-25 20:53:45.895300")
|
|
190
|
+
assert output.time_end == np.datetime64("2019-09-25 20:54:11.931800")
|
|
191
|
+
assert output.depth_min == 9.28
|
|
192
|
+
assert output.depth_max == 11.53
|
|
193
|
+
assert output.altitude == 21.68
|
|
194
|
+
assert output.latitude == 41.346
|
|
195
|
+
assert output.longitude == -70.90754
|
|
196
|
+
assert output.distance_from_coastline == 5132
|
|
197
|
+
assert output.local_time == "2019-09-25T16:53:45.895300-04:00"
|
|
198
|
+
assert output.month == 9
|
|
199
|
+
assert output.solar_altitude == 18.07
|
|
200
|
+
assert output.phase_of_day == "day"
|
|
201
|
+
assert output.classification == "Unclassified regions"
|
|
202
|
+
assert output.filename == "test.evr"
|
|
203
|
+
assert output.region_id == 1
|
|
204
|
+
assert output.ship == "Henry_B._Bigelow"
|
|
205
|
+
assert output.cruise == "HB1906"
|
|
206
|
+
assert output.instrument == "EK60"
|
|
207
|
+
assert output.point_count == 12
|
|
208
|
+
assert (
|
|
209
|
+
output.geometry_hash
|
|
210
|
+
== "521b9994ebcc00cb4640a9e9cfddf7470f3903e3eab8c918604269c48e723d8a"
|
|
211
|
+
)
|
|
212
|
+
assert len(output.geometry) == 352 # TODO: elaborate
|
|
140
213
|
|
|
141
214
|
|
|
142
215
|
def test_process_evr_record_krill_schools():
|
|
143
216
|
echoview_record_manager = EchoviewRecordManager()
|
|
144
|
-
echoview_record_manager.
|
|
145
|
-
evr_record=krill_schools_example,
|
|
217
|
+
output = echoview_record_manager.process_evr_record_full_geometry(
|
|
218
|
+
evr_record=krill_schools_example, file_name="test.evr"
|
|
146
219
|
)
|
|
220
|
+
assert output is None
|
|
147
221
|
|
|
148
222
|
|
|
149
223
|
def test_process_evr_record_ah_school_1():
|
|
150
224
|
echoview_record_manager = EchoviewRecordManager()
|
|
151
|
-
echoview_record_manager.
|
|
152
|
-
evr_record=ah_school_example1,
|
|
225
|
+
output = echoview_record_manager.process_evr_record_full_geometry(
|
|
226
|
+
evr_record=ah_school_example1, file_name="test.evr"
|
|
227
|
+
)
|
|
228
|
+
assert output.time_start == np.datetime64("2019-11-06 13:14:58.378000")
|
|
229
|
+
assert output.time_end == np.datetime64("2019-11-06 13:14:59.379000")
|
|
230
|
+
assert output.depth_min == 25.3
|
|
231
|
+
assert output.depth_max == 30.29
|
|
232
|
+
assert output.altitude == 70.28
|
|
233
|
+
assert output.latitude == 44.13652
|
|
234
|
+
assert output.longitude == -67.0766
|
|
235
|
+
assert output.distance_from_coastline == 51279
|
|
236
|
+
assert output.local_time == "2019-11-06T09:14:58.378000-04:00"
|
|
237
|
+
assert output.month == 11
|
|
238
|
+
assert output.solar_altitude == 17.61
|
|
239
|
+
assert output.phase_of_day == "day"
|
|
240
|
+
assert output.classification == "AH_School"
|
|
241
|
+
assert output.filename == "test.evr"
|
|
242
|
+
assert output.region_id == 23
|
|
243
|
+
assert output.ship == "Henry_B._Bigelow"
|
|
244
|
+
assert output.cruise == "HB1906"
|
|
245
|
+
assert output.instrument == "EK60"
|
|
246
|
+
assert output.point_count == 5
|
|
247
|
+
assert (
|
|
248
|
+
output.geometry_hash
|
|
249
|
+
== "6b976f373a3e035a3d0df62984cbdacf9e9df81e36369352637c7ae5458924a2"
|
|
153
250
|
)
|
|
251
|
+
assert len(output.geometry) == 148 # TODO: elaborate
|
|
154
252
|
|
|
155
253
|
|
|
156
254
|
def test_process_evr_record_ah_school_2():
|
|
157
255
|
echoview_record_manager = EchoviewRecordManager()
|
|
158
|
-
echoview_record_manager.
|
|
159
|
-
evr_record=ah_school_example2,
|
|
256
|
+
output = echoview_record_manager.process_evr_record_full_geometry(
|
|
257
|
+
evr_record=ah_school_example2, file_name="test.evr"
|
|
258
|
+
)
|
|
259
|
+
assert output.time_start == np.datetime64("2019-11-06 13:17:30.571500")
|
|
260
|
+
assert output.time_end == np.datetime64("2019-11-06 13:17:33.574500")
|
|
261
|
+
assert output.depth_min == 31.83
|
|
262
|
+
assert output.depth_max == 35.86
|
|
263
|
+
assert output.altitude == 70.93
|
|
264
|
+
assert output.latitude == 44.1376
|
|
265
|
+
assert output.longitude == -67.06638
|
|
266
|
+
assert output.distance_from_coastline == 50464
|
|
267
|
+
assert output.local_time == "2019-11-06T09:17:30.571500-04:00"
|
|
268
|
+
assert output.month == 11
|
|
269
|
+
assert output.solar_altitude == 17.93
|
|
270
|
+
assert output.phase_of_day == "day"
|
|
271
|
+
assert output.classification == "AH_School"
|
|
272
|
+
assert output.filename == "test.evr"
|
|
273
|
+
assert output.region_id == 28
|
|
274
|
+
assert output.ship == "Henry_B._Bigelow"
|
|
275
|
+
assert output.cruise == "HB1906"
|
|
276
|
+
assert output.instrument == "EK60"
|
|
277
|
+
assert output.point_count == 16
|
|
278
|
+
assert (
|
|
279
|
+
output.geometry_hash
|
|
280
|
+
== "038c6e57dd95bf9c836ae8ef6145ae53a4fa64bd6f836050c8fa8f2601ba2a41"
|
|
160
281
|
)
|
|
282
|
+
assert len(output.geometry) == 480 # TODO: elaborate
|
|
@@ -47,7 +47,7 @@ class AstronomicalManager:
|
|
|
47
47
|
iso_time: str,
|
|
48
48
|
latitude: float,
|
|
49
49
|
longitude: float,
|
|
50
|
-
) ->
|
|
50
|
+
) -> str:
|
|
51
51
|
"""
|
|
52
52
|
Returns whether the time/gps references a Nautical Daylight time
|
|
53
53
|
Going to need to verify the az is correctly computed
|
|
@@ -62,12 +62,12 @@ class AstronomicalManager:
|
|
|
62
62
|
longitude=longitude,
|
|
63
63
|
)
|
|
64
64
|
if solar_azimuth < self.NAUTICAL_TWILIGHT_DEGREES:
|
|
65
|
-
return
|
|
65
|
+
return "night" # night
|
|
66
66
|
if solar_azimuth >= 0.0:
|
|
67
|
-
return
|
|
67
|
+
return "day" # day
|
|
68
68
|
if local_hour < 12:
|
|
69
|
-
return
|
|
70
|
-
return
|
|
69
|
+
return "dawn" # dawn
|
|
70
|
+
return "dusk" # dusk
|
|
71
71
|
|
|
72
72
|
# def get_moon_phase(self):
|
|
73
73
|
# # TODO: add method for getting the moon phase
|
|
@@ -58,30 +58,27 @@ class GeospatialManager:
|
|
|
58
58
|
self, # -30.410156 51.508742)
|
|
59
59
|
latitude: float = 51.508742, # 42.682435,
|
|
60
60
|
longitude: float = -30.410156, # -68.741455,
|
|
61
|
-
|
|
62
|
-
) -> np.float32 | None:
|
|
61
|
+
) -> int | None:
|
|
63
62
|
"""
|
|
64
63
|
# Note this takes about 14 seconds each, very slow!!!
|
|
65
64
|
"""
|
|
66
65
|
try:
|
|
67
66
|
# requires the shape file too
|
|
68
|
-
geometry_one = gpd.read_file(
|
|
67
|
+
geometry_one = gpd.read_file(
|
|
68
|
+
f"{data_path()['DATA_PATH']}/ne_10m_coastline.shp"
|
|
69
|
+
)
|
|
69
70
|
geometry_one = geometry_one.set_crs(self.crs)
|
|
70
71
|
geometry_two = Point([longitude, latitude])
|
|
71
72
|
gdf_p = gpd.GeoDataFrame(geometry=[geometry_two], crs=self.crs)
|
|
72
73
|
gdf_l = geometry_one
|
|
73
74
|
gdf_p = gdf_p.to_crs(gdf_p.estimate_utm_crs())
|
|
74
|
-
# print(gdf_p.to_string())
|
|
75
75
|
gdf_l = gdf_l.to_crs(gdf_p.crs)
|
|
76
|
-
# TODO: index 1399 has inf values, investigate
|
|
77
|
-
# RuntimeWarning: invalid value encountered in distance
|
|
78
|
-
# return lib.distance(a, b, **kwargs)
|
|
79
76
|
all_distances = [
|
|
80
77
|
gdf_p.geometry.distance(gdf_l.get_geometry(0)[i])[0]
|
|
81
78
|
for i in range(len(gdf_l.get_geometry(0)))
|
|
82
79
|
if gdf_l.get_geometry(0)[i].is_valid
|
|
83
80
|
]
|
|
84
|
-
return
|
|
81
|
+
return int(np.min(all_distances))
|
|
85
82
|
except Exception as e:
|
|
86
83
|
print(f"Could not process the distance: {e}")
|
|
87
84
|
|
|
@@ -102,8 +99,8 @@ class GeospatialManager:
|
|
|
102
99
|
local_time = utc.astimezone(to_zone)
|
|
103
100
|
return local_time.isoformat() # [:19]
|
|
104
101
|
|
|
102
|
+
@staticmethod
|
|
105
103
|
def get_local_hour_of_day(
|
|
106
|
-
self,
|
|
107
104
|
iso_time: str = "2026-01-26T20:35:00Z",
|
|
108
105
|
latitude: float = 51.508742,
|
|
109
106
|
longitude: float = -30.410156,
|