Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lint Tidal #386

Merged
merged 28 commits into from
Apr 8, 2025
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
bc1eadc
Use `main` as Primary Branch (#367)
ssolson Dec 9, 2024
c27bc3a
lint tidal io
ssolson Mar 10, 2025
d08d4c3
Merge branch 'develop' of https://github.com/MHKiT-Software/MHKiT-Pyt…
ssolson Mar 10, 2025
3a4751c
linted graphics
ssolson Mar 11, 2025
ca64da2
lint performance
ssolson Mar 12, 2025
63f8d74
lint resource
ssolson Mar 12, 2025
b11392e
pylint tidal
ssolson Mar 12, 2025
fb9fce0
fix examples
ssolson Mar 12, 2025
1da136e
noaa typehints
ssolson Mar 18, 2025
e349897
resource type hints
ssolson Mar 18, 2025
16cd953
graphics type hints
ssolson Mar 18, 2025
b7dc99e
performance type hints
ssolson Mar 18, 2025
8abb811
pylint performance.py
ssolson Mar 18, 2025
d5808f6
add doc strings where missing
ssolson Mar 18, 2025
8156135
pylint: fix line too long
ssolson Mar 18, 2025
d7b532e
consistent module docstrings
ssolson Mar 18, 2025
1ea8c5d
Merge branch 'develop' of https://github.com/MHKiT-Software/MHKiT-Pyt…
ssolson Mar 31, 2025
1d35e5c
Update mhkit/tidal/graphics.py
ssolson Apr 3, 2025
d59396c
Update mhkit/tidal/performance.py
ssolson Apr 3, 2025
242826e
Update mhkit/tidal/resource.py
ssolson Apr 3, 2025
3094054
Update mhkit/tidal/io/__init__.py
ssolson Apr 3, 2025
3c65d9b
Update mhkit/tidal/graphics.py
ssolson Apr 3, 2025
5d0e3f0
Update mhkit/tidal/__init__.py
ssolson Apr 3, 2025
92fe7e1
pylink, black, remove functions
ssolson Apr 3, 2025
6c1ffb9
black
ssolson Apr 3, 2025
bf3aed4
standardize the docstrings
ssolson Apr 7, 2025
005e9e1
clean up docstring
ssolson Apr 7, 2025
065fbb7
docstring formatting
ssolson Apr 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,7 @@ jobs:
- name: Run Pylint on mhkit/acoustics/
run: |
pylint mhkit/acoustics/

- name: Run Pylint on mhkit/tidal
run: |
pylint mhkit/tidal/
16 changes: 8 additions & 8 deletions examples/metocean_example.ipynb

Large diffs are not rendered by default.

22 changes: 15 additions & 7 deletions examples/tidal_example.ipynb

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions examples/tidal_performance_example.ipynb

Large diffs are not rendered by default.

37 changes: 26 additions & 11 deletions mhkit/tests/tidal/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,16 @@ def test_request_noaa_data_basic(self):
and verify that the returned DataFrame and metadata have the
correct shape and columns.
"""
options = {
"proxy": None,
"write_json": None,
}
data, metadata = tidal.io.noaa.request_noaa_data(
station="s08010",
parameter="currents",
start_date="20180101",
end_date="20180102",
proxy=None,
write_json=None,
options=options,
)
self.assertTrue(np.all(data.columns == ["s", "d", "b"]))
self.assertEqual(data.shape, (183, 3))
Expand All @@ -92,14 +95,17 @@ def test_request_noaa_data_basic_xarray(self):
and verify that the returned DataFrame and metadata have the
correct shape and columns.
"""
options = {
"proxy": None,
"write_json": None,
"to_pandas": False,
}
data = tidal.io.noaa.request_noaa_data(
station="s08010",
parameter="currents",
start_date="20180101",
end_date="20180102",
proxy=None,
write_json=None,
to_pandas=False,
options=options,
)
# Check if the variable sets are equal
data_variables = list(data.variables)
Expand All @@ -117,13 +123,16 @@ def test_request_noaa_data_write_json(self):
and can be loaded back into a dictionary.
"""
test_json_file = "test_noaa_data.json"
options = {
"proxy": None,
"write_json": test_json_file,
}
_, _ = tidal.io.noaa.request_noaa_data(
station="s08010",
parameter="currents",
start_date="20180101",
end_date="20180102",
proxy=None,
write_json=test_json_file,
options=options,
)
self.assertTrue(os.path.isfile(test_json_file))

Expand All @@ -142,29 +151,35 @@ def test_request_noaa_data_invalid_dates(self):
Test the request_noaa_data function with an invalid date format
and verify that it raises a ValueError.
"""
options = {
"proxy": None,
"write_json": None,
}
with self.assertRaises(ValueError):
tidal.io.noaa.request_noaa_data(
station="s08010",
parameter="currents",
start_date="2018-01-01", # Invalid date format
end_date="20180102",
proxy=None,
write_json=None,
options=options,
)

def test_request_noaa_data_end_before_start(self):
"""
Test the request_noaa_data function with the end date before
the start date and verify that it raises a ValueError.
"""
options = {
"proxy": None,
"write_json": None,
}
with self.assertRaises(ValueError):
tidal.io.noaa.request_noaa_data(
station="s08010",
parameter="currents",
start_date="20180102",
end_date="20180101", # End date before start date
proxy=None,
write_json=None,
options=options,
)


Expand Down
6 changes: 6 additions & 0 deletions mhkit/tidal/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
"""
MHKiT Tidal Module

This module provides tools for analyzing and processing tidal data.
"""

from mhkit.tidal import graphics
from mhkit.tidal import io
from mhkit.tidal import resource
Expand Down
Loading
Loading