water-column-sonar-processing 0.0.4__tar.gz → 0.0.6__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 water-column-sonar-processing might be problematic. Click here for more details.

Files changed (62) hide show
  1. {water_column_sonar_processing-0.0.4/src/water_column_sonar_processing.egg-info → water_column_sonar_processing-0.0.6}/PKG-INFO +31 -1
  2. {water_column_sonar_processing-0.0.4 → water_column_sonar_processing-0.0.6}/README.md +11 -1
  3. {water_column_sonar_processing-0.0.4 → water_column_sonar_processing-0.0.6}/pyproject.toml +14 -4
  4. water_column_sonar_processing-0.0.6/requirements.txt +27 -0
  5. water_column_sonar_processing-0.0.6/src/water_column_sonar_processing/__init__.py +16 -0
  6. water_column_sonar_processing-0.0.6/src/water_column_sonar_processing/aws/__init__.py +7 -0
  7. {water_column_sonar_processing-0.0.4/src/aws_manager → water_column_sonar_processing-0.0.6/src/water_column_sonar_processing/aws}/dynamodb_manager.py +71 -50
  8. {water_column_sonar_processing-0.0.4/src/aws_manager → water_column_sonar_processing-0.0.6/src/water_column_sonar_processing/aws}/s3_manager.py +120 -130
  9. {water_column_sonar_processing-0.0.4/src/aws_manager → water_column_sonar_processing-0.0.6/src/water_column_sonar_processing/aws}/s3fs_manager.py +13 -19
  10. {water_column_sonar_processing-0.0.4/src/aws_manager → water_column_sonar_processing-0.0.6/src/water_column_sonar_processing/aws}/sns_manager.py +10 -21
  11. {water_column_sonar_processing-0.0.4/src/aws_manager → water_column_sonar_processing-0.0.6/src/water_column_sonar_processing/aws}/sqs_manager.py +10 -18
  12. water_column_sonar_processing-0.0.6/src/water_column_sonar_processing/cruise/__init__.py +4 -0
  13. {water_column_sonar_processing-0.0.4/src → water_column_sonar_processing-0.0.6/src/water_column_sonar_processing}/cruise/create_empty_zarr_store.py +62 -44
  14. {water_column_sonar_processing-0.0.4/src → water_column_sonar_processing-0.0.6/src/water_column_sonar_processing}/cruise/resample_regrid.py +117 -66
  15. water_column_sonar_processing-0.0.6/src/water_column_sonar_processing/geometry/__init__.py +5 -0
  16. {water_column_sonar_processing-0.0.4/src/geometry_manager → water_column_sonar_processing-0.0.6/src/water_column_sonar_processing/geometry}/geometry_manager.py +80 -49
  17. {water_column_sonar_processing-0.0.4/src/geometry_manager → water_column_sonar_processing-0.0.6/src/water_column_sonar_processing/geometry}/geometry_simplification.py +13 -12
  18. {water_column_sonar_processing-0.0.4/src/geometry_manager → water_column_sonar_processing-0.0.6/src/water_column_sonar_processing/geometry}/pmtile_generation.py +25 -24
  19. water_column_sonar_processing-0.0.6/src/water_column_sonar_processing/index/__init__.py +3 -0
  20. {water_column_sonar_processing-0.0.4/src/index_manager → water_column_sonar_processing-0.0.6/src/water_column_sonar_processing/index}/index_manager.py +106 -82
  21. water_column_sonar_processing-0.0.6/src/water_column_sonar_processing/model/__init__.py +3 -0
  22. {water_column_sonar_processing-0.0.4/src/zarr_manager → water_column_sonar_processing-0.0.6/src/water_column_sonar_processing/model}/zarr_manager.py +119 -83
  23. water_column_sonar_processing-0.0.6/src/water_column_sonar_processing/process.py +147 -0
  24. water_column_sonar_processing-0.0.6/src/water_column_sonar_processing/utility/__init__.py +6 -0
  25. {water_column_sonar_processing-0.0.4/src → water_column_sonar_processing-0.0.6/src/water_column_sonar_processing}/utility/cleaner.py +6 -7
  26. water_column_sonar_processing-0.0.6/src/water_column_sonar_processing/utility/constants.py +63 -0
  27. {water_column_sonar_processing-0.0.4/src → water_column_sonar_processing-0.0.6/src/water_column_sonar_processing}/utility/pipeline_status.py +37 -10
  28. {water_column_sonar_processing-0.0.4/src → water_column_sonar_processing-0.0.6/src/water_column_sonar_processing}/utility/timestamp.py +3 -2
  29. {water_column_sonar_processing-0.0.4 → water_column_sonar_processing-0.0.6/src/water_column_sonar_processing.egg-info}/PKG-INFO +31 -1
  30. water_column_sonar_processing-0.0.6/src/water_column_sonar_processing.egg-info/SOURCES.txt +45 -0
  31. water_column_sonar_processing-0.0.6/src/water_column_sonar_processing.egg-info/requires.txt +20 -0
  32. water_column_sonar_processing-0.0.6/src/water_column_sonar_processing.egg-info/top_level.txt +1 -0
  33. water_column_sonar_processing-0.0.6/tests/test_create_empty_zarr_store.py +226 -0
  34. water_column_sonar_processing-0.0.6/tests/test_dynamodb_manager.py +204 -0
  35. {water_column_sonar_processing-0.0.4 → water_column_sonar_processing-0.0.6}/tests/test_geometry_manager.py +20 -15
  36. {water_column_sonar_processing-0.0.4 → water_column_sonar_processing-0.0.6}/tests/test_geometry_simplification.py +9 -9
  37. water_column_sonar_processing-0.0.6/tests/test_index.py +164 -0
  38. water_column_sonar_processing-0.0.6/tests/test_process.py +487 -0
  39. {water_column_sonar_processing-0.0.4 → water_column_sonar_processing-0.0.6}/tests/test_resample_regrid.py +16 -15
  40. {water_column_sonar_processing-0.0.4 → water_column_sonar_processing-0.0.6}/tests/test_s3_manager.py +24 -17
  41. {water_column_sonar_processing-0.0.4 → water_column_sonar_processing-0.0.6}/tests/test_s3fs_manager.py +107 -96
  42. water_column_sonar_processing-0.0.6/tests/test_s3fs_with_moto.py +31 -0
  43. {water_column_sonar_processing-0.0.4 → water_column_sonar_processing-0.0.6}/tests/test_sns_sqs_manager.py +20 -25
  44. {water_column_sonar_processing-0.0.4 → water_column_sonar_processing-0.0.6}/tests/test_zarr_manager.py +74 -66
  45. water_column_sonar_processing-0.0.4/src/__init__.py +0 -0
  46. water_column_sonar_processing-0.0.4/src/aws_manager/__init__.py +0 -4
  47. water_column_sonar_processing-0.0.4/src/cruise/__init__.py +0 -0
  48. water_column_sonar_processing-0.0.4/src/geometry_manager/__init__.py +0 -0
  49. water_column_sonar_processing-0.0.4/src/index_manager/__init__.py +0 -0
  50. water_column_sonar_processing-0.0.4/src/model.py +0 -140
  51. water_column_sonar_processing-0.0.4/src/utility/__init__.py +0 -0
  52. water_column_sonar_processing-0.0.4/src/utility/constants.py +0 -56
  53. water_column_sonar_processing-0.0.4/src/water_column_sonar_processing.egg-info/SOURCES.txt +0 -42
  54. water_column_sonar_processing-0.0.4/src/water_column_sonar_processing.egg-info/top_level.txt +0 -8
  55. water_column_sonar_processing-0.0.4/src/zarr_manager/__init__.py +0 -0
  56. water_column_sonar_processing-0.0.4/tests/test_create_empty_zarr_store.py +0 -97
  57. water_column_sonar_processing-0.0.4/tests/test_dynamodb_manager.py +0 -233
  58. water_column_sonar_processing-0.0.4/tests/test_index.py +0 -167
  59. water_column_sonar_processing-0.0.4/tests/test_model.py +0 -488
  60. {water_column_sonar_processing-0.0.4 → water_column_sonar_processing-0.0.6}/LICENSE +0 -0
  61. {water_column_sonar_processing-0.0.4 → water_column_sonar_processing-0.0.6}/setup.cfg +0 -0
  62. {water_column_sonar_processing-0.0.4 → water_column_sonar_processing-0.0.6}/src/water_column_sonar_processing.egg-info/dependency_links.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: water_column_sonar_processing
3
- Version: 0.0.4
3
+ Version: 0.0.6
4
4
  Summary: A processing tool for water column sonar data.
5
5
  Author-email: Rudy Klucik <rudy.klucik@noaa.gov>
6
6
  Project-URL: Homepage, https://github.com/CI-CMG/water-column-sonar-processing
@@ -11,6 +11,26 @@ Classifier: Operating System :: OS Independent
11
11
  Requires-Python: >=3.10
12
12
  Description-Content-Type: text/markdown
13
13
  License-File: LICENSE
14
+ Requires-Dist: aiobotocore~=2.9.0
15
+ Requires-Dist: aiohttp~=3.10.10
16
+ Requires-Dist: boto3==1.33.13
17
+ Requires-Dist: botocore~=1.33.13
18
+ Requires-Dist: echopype==0.9.0
19
+ Requires-Dist: geopandas==1.0.1
20
+ Requires-Dist: mock~=5.1.0
21
+ Requires-Dist: moto~=5.0.18
22
+ Requires-Dist: numcodecs==0.13.1
23
+ Requires-Dist: numpy==1.26.4
24
+ Requires-Dist: pandas==2.2.3
25
+ Requires-Dist: pytest~=8.3.3
26
+ Requires-Dist: python-dotenv==1.0.0
27
+ Requires-Dist: requests==2.32.3
28
+ Requires-Dist: s3fs==2024.10.0
29
+ Requires-Dist: scipy==1.14.1
30
+ Requires-Dist: shapely==2.0.3
31
+ Requires-Dist: typing-extensions==4.10.0
32
+ Requires-Dist: xarray==2022.12.0
33
+ Requires-Dist: zarr==2.18.3
14
34
 
15
35
  # Water Column Sonar Processing
16
36
  Processing tool for converting L0 data to L1 and L2 as well as generating geospatial information
@@ -72,6 +92,8 @@ https://packaging.python.org/en/latest/tutorials/packaging-projects/
72
92
  # To Publish To TEST
73
93
  ```commandline
74
94
  python -m build
95
+ # python -m build --sdist
96
+ # python -m build --wheel
75
97
  python -m twine upload --repository testpypi dist/*
76
98
  pytho -m pip install --index-url https://test.pypi.org/simple/ hello-pypi-rudy-klucik
77
99
  python
@@ -87,7 +109,15 @@ python -m build
87
109
  python -m twine upload --repository pypi dist/*
88
110
  ```
89
111
 
112
+ # Pre Commit Hook
113
+ https://dev.to/rafaelherik/using-trufflehog-and-pre-commit-hook-to-prevent-secret-exposure-edo
114
+ ```
115
+ pre-commit install --allow-missing-config
116
+ ```
90
117
 
91
118
  # Linting
92
119
  Ruff
93
120
  https://plugins.jetbrains.com/plugin/20574-ruff
121
+
122
+ # Colab Test
123
+ https://colab.research.google.com/drive/1KiLMueXiz9WVB9o4RuzYeGjNZ6PsZU7a#scrollTo=AayVyvpBdfIZ
@@ -58,6 +58,8 @@ https://packaging.python.org/en/latest/tutorials/packaging-projects/
58
58
  # To Publish To TEST
59
59
  ```commandline
60
60
  python -m build
61
+ # python -m build --sdist
62
+ # python -m build --wheel
61
63
  python -m twine upload --repository testpypi dist/*
62
64
  pytho -m pip install --index-url https://test.pypi.org/simple/ hello-pypi-rudy-klucik
63
65
  python
@@ -73,7 +75,15 @@ python -m build
73
75
  python -m twine upload --repository pypi dist/*
74
76
  ```
75
77
 
78
+ # Pre Commit Hook
79
+ https://dev.to/rafaelherik/using-trufflehog-and-pre-commit-hook-to-prevent-secret-exposure-edo
80
+ ```
81
+ pre-commit install --allow-missing-config
82
+ ```
76
83
 
77
84
  # Linting
78
85
  Ruff
79
- https://plugins.jetbrains.com/plugin/20574-ruff
86
+ https://plugins.jetbrains.com/plugin/20574-ruff
87
+
88
+ # Colab Test
89
+ https://colab.research.google.com/drive/1KiLMueXiz9WVB9o4RuzYeGjNZ6PsZU7a#scrollTo=AayVyvpBdfIZ
@@ -1,10 +1,13 @@
1
1
  [build-system]
2
- requires = ["setuptools", "wheel"]
2
+ requires = [
3
+ "setuptools>=61.0",
4
+ "wheel >= 0.29.0",
5
+ ]
3
6
  build-backend = "setuptools.build_meta"
4
7
 
5
8
  [project]
6
9
  name = "water_column_sonar_processing"
7
- version = "0.0.4"
10
+ version = "0.0.6"
8
11
  authors = [
9
12
  { name="Rudy Klucik", email="rudy.klucik@noaa.gov" },
10
13
  ]
@@ -16,6 +19,7 @@ classifiers = [
16
19
  "License :: OSI Approved :: MIT License",
17
20
  "Operating System :: OS Independent",
18
21
  ]
22
+ dynamic = ["dependencies"]
19
23
 
20
24
  [project.urls]
21
25
  Homepage = "https://github.com/CI-CMG/water-column-sonar-processing"
@@ -27,7 +31,13 @@ Issues = "https://github.com/CI-CMG/water-column-sonar-processing/issues"
27
31
 
28
32
  [tool.pytest.ini_options]
29
33
  minversion = "6.0"
30
- addopts = "-ra -q"
34
+ #addopts = "-ra -q"
31
35
  testpaths = [
32
36
  "tests",
33
- ]
37
+ ]
38
+
39
+ [tool.setuptools.dynamic]
40
+ dependencies = {file = ["requirements.txt"]}
41
+ optional-dependencies = {dev = { file = ["requirements-dev.txt"] }}
42
+
43
+ # https://packaging.python.org/en/latest/guides/writing-pyproject-toml/
@@ -0,0 +1,27 @@
1
+ # https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html
2
+ # defined for Python 3.12
3
+ # Note: be careful with conversions for pandas >=2.0.0, timestamps will have a lot of problems
4
+
5
+ aiobotocore~=2.9.0
6
+ aiohttp~=3.10.10
7
+ boto3==1.33.13
8
+ botocore~=1.33.13
9
+ echopype==0.9.0
10
+ #fiona==1.10.1
11
+ geopandas==1.0.1
12
+ mock~=5.1.0
13
+ moto~=5.0.18
14
+ numcodecs==0.13.1
15
+ numpy==1.26.4
16
+ pandas==2.2.3
17
+ pytest~=8.3.3
18
+ python-dotenv==1.0.0
19
+ requests==2.32.3
20
+ #s3fs==2023.12.2
21
+ s3fs==2024.10.0
22
+ scipy==1.14.1
23
+ shapely==2.0.3
24
+ typing-extensions==4.10.0
25
+ xarray==2022.12.0
26
+ #zarr==2.16.1
27
+ zarr==2.18.3
@@ -0,0 +1,16 @@
1
+ from __future__ import absolute_import
2
+
3
+ from . import aws, cruise, geometry, index, model, utility, process
4
+ from .model import ZarrManager
5
+ from .process import Process
6
+
7
+ __all__ = [
8
+ "aws",
9
+ "cruise",
10
+ "geometry",
11
+ "index",
12
+ "model",
13
+ "utility",
14
+ "process",
15
+ "Process",
16
+ ]
@@ -0,0 +1,7 @@
1
+ from .dynamodb_manager import DynamoDBManager
2
+ from .s3_manager import S3Manager
3
+ from .s3fs_manager import S3FSManager
4
+ from .sns_manager import SNSManager
5
+ from .sqs_manager import SQSManager
6
+
7
+ __all__ = ["DynamoDBManager", "S3Manager", "S3FSManager", "SNSManager", "SQSManager"]
@@ -1,7 +1,8 @@
1
1
  import os
2
+
2
3
  import boto3
3
4
  import pandas as pd
4
- from boto3.dynamodb.types import TypeSerializer, TypeDeserializer
5
+ from boto3.dynamodb.types import TypeDeserializer, TypeSerializer
5
6
 
6
7
 
7
8
  #########################################################################
@@ -9,9 +10,9 @@ class DynamoDBManager:
9
10
  #####################################################################
10
11
  def __init__(self):
11
12
  self.__dynamodb_session = boto3.Session(
12
- aws_access_key_id=os.environ.get('ACCESS_KEY_ID'),
13
- aws_secret_access_key=os.environ.get('SECRET_ACCESS_KEY'),
14
- region_name=os.environ.get("AWS_REGION", default="us-east-1")
13
+ aws_access_key_id=os.environ.get("ACCESS_KEY_ID"),
14
+ aws_secret_access_key=os.environ.get("SECRET_ACCESS_KEY"),
15
+ region_name=os.environ.get("AWS_REGION", default="us-east-1"),
15
16
  )
16
17
  self.__dynamodb_resource = self.__dynamodb_session.resource(
17
18
  service_name="dynamodb",
@@ -23,7 +24,7 @@ class DynamoDBManager:
23
24
  self.type_deserializer = TypeDeserializer()
24
25
 
25
26
  #####################################################################
26
- ### defined in raw-to-zarr_manager, not used
27
+ ### defined in raw-to-model, not used
27
28
  # def put_item(
28
29
  # self,
29
30
  # table_name,
@@ -35,10 +36,10 @@ class DynamoDBManager:
35
36
 
36
37
  #####################################################################
37
38
  def create_table(
38
- self,
39
- table_name,
40
- key_schema,
41
- attribute_definitions,
39
+ self,
40
+ table_name,
41
+ key_schema,
42
+ attribute_definitions,
42
43
  ):
43
44
  self.__dynamodb_client.create_table(
44
45
  AttributeDefinitions=attribute_definitions,
@@ -52,98 +53,118 @@ class DynamoDBManager:
52
53
  )
53
54
 
54
55
  #####################################################################
55
- def get_item(
56
- self,
57
- table_name,
58
- key
56
+ def create_water_column_sonar_table(
57
+ self,
58
+ table_name,
59
59
  ):
60
+ self.create_table(
61
+ table_name=table_name,
62
+ key_schema=[
63
+ {
64
+ "AttributeName": "FILE_NAME",
65
+ "KeyType": "HASH",
66
+ },
67
+ {
68
+ "AttributeName": "CRUISE_NAME",
69
+ "KeyType": "RANGE",
70
+ },
71
+ ],
72
+ attribute_definitions=[
73
+ {"AttributeName": "FILE_NAME", "AttributeType": "S"},
74
+ {"AttributeName": "CRUISE_NAME", "AttributeType": "S"},
75
+ ],
76
+ )
77
+
78
+ #####################################################################
79
+ def get_item(self, table_name, key):
60
80
  response = self.__dynamodb_client.get_item(TableName=table_name, Key=key)
61
81
  item = None
62
- if response['ResponseMetadata']['HTTPStatusCode'] == 200:
63
- if 'Item' in response:
64
- item = response['Item']
82
+ if response["ResponseMetadata"]["HTTPStatusCode"] == 200:
83
+ if "Item" in response:
84
+ item = response["Item"]
65
85
  return item
66
86
 
67
87
  #####################################################################
68
88
  def update_item(
69
- self,
70
- table_name,
71
- key,
72
- expression_attribute_names,
73
- expression_attribute_values,
74
- update_expression
89
+ self,
90
+ table_name,
91
+ key,
92
+ expression_attribute_names,
93
+ expression_attribute_values,
94
+ update_expression,
75
95
  ):
76
96
  response = self.__dynamodb_client.update_item(
77
97
  TableName=table_name,
78
98
  Key=key,
79
99
  ExpressionAttributeNames=expression_attribute_names,
80
100
  ExpressionAttributeValues=expression_attribute_values,
81
- UpdateExpression=update_expression
101
+ UpdateExpression=update_expression,
82
102
  )
83
- status_code = response['ResponseMetadata']['HTTPStatusCode']
103
+ status_code = response["ResponseMetadata"]["HTTPStatusCode"]
84
104
  # TODO: change to exception
85
- assert (status_code == 200), "Problem, unable to update dynamodb table."
105
+ assert status_code == 200, "Problem, unable to update dynamodb table."
86
106
 
87
107
  #####################################################################
88
108
  def get_table_as_df(
89
- self,
90
- ship_name,
91
- cruise_name,
92
- sensor_name,
93
- table_name,
109
+ self,
110
+ ship_name,
111
+ cruise_name,
112
+ sensor_name,
113
+ table_name,
94
114
  ):
95
115
  expression_attribute_values = {
96
- ':cr': {'S': cruise_name},
97
- ':se': {'S': sensor_name},
98
- ':sh': {'S': ship_name},
116
+ ":cr": {"S": cruise_name},
117
+ ":se": {"S": sensor_name},
118
+ ":sh": {"S": ship_name},
99
119
  }
100
120
 
101
- filter_expression = 'CRUISE_NAME = :cr and SENSOR_NAME = :se and SHIP_NAME = :sh'
121
+ filter_expression = (
122
+ "CRUISE_NAME = :cr and SENSOR_NAME = :se and SHIP_NAME = :sh"
123
+ )
102
124
  response = self.__dynamodb_client.scan(
103
125
  TableName=table_name,
104
- Select='ALL_ATTRIBUTES',
126
+ Select="ALL_ATTRIBUTES",
105
127
  ExpressionAttributeValues=expression_attribute_values,
106
128
  FilterExpression=filter_expression,
107
129
  )
108
130
  # Note: table.scan() has 1 MB limit on results so pagination is used
109
- data = response['Items']
131
+ data = response["Items"]
110
132
 
111
- while 'LastEvaluatedKey' in response:
133
+ while "LastEvaluatedKey" in response:
112
134
  response = self.__dynamodb_client.scan(
113
135
  TableName=table_name,
114
- Select='ALL_ATTRIBUTES',
136
+ Select="ALL_ATTRIBUTES",
115
137
  ExpressionAttributeValues=expression_attribute_values,
116
138
  FilterExpression=filter_expression,
117
- ExclusiveStartKey=response['LastEvaluatedKey']
139
+ ExclusiveStartKey=response["LastEvaluatedKey"],
118
140
  )
119
- data.extend(response['Items'])
141
+ data.extend(response["Items"])
120
142
 
121
143
  deserializer = self.type_deserializer
122
144
  df = pd.DataFrame([deserializer.deserialize({"M": i}) for i in data])
123
145
 
124
- return df.sort_values(by='START_TIME', ignore_index=True)
146
+ return df.sort_values(by="START_TIME", ignore_index=True)
125
147
 
126
148
  #####################################################################
127
149
  # is this used?
128
150
  def get_table_item(
129
- self,
130
- table_name,
131
- key,
151
+ self,
152
+ table_name,
153
+ key,
132
154
  ):
133
155
  # a bit more high level, uses resource to get table item
134
156
  table = self.__dynamodb_resource.Table(table_name)
135
- response = table.get_item(
136
- Key=key
137
- )
157
+ response = table.get_item(Key=key)
138
158
  return response
139
159
 
140
160
  #####################################################################
141
161
  # TODO: add helper method to delete the data
142
162
  def delete_cruise(
143
- self,
144
- table_name,
145
- cruise_name,
163
+ self,
164
+ table_name,
165
+ cruise_name,
146
166
  ):
147
167
  pass
148
168
 
169
+
149
170
  #########################################################################