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

Update dataset variable dropping method in make_CHS_currents_file worker #294

Merged
merged 11 commits into from
Sep 2, 2024

Conversation

douglatornell
Copy link
Member

re: xarray DeprecationWarning (see issue #291).

Also:

  • corrected the name of the unlimited dimension in the netCDF file
  • modernized the test suite to use pytest fixtures instead of unit tests patch and mock
  • fixed typos in docstring type definitions

Test suite maintenance.

re: issue #81
Updated the run_type conditionals from if-elif to a match case statement for
better clarity and future extensibility. Added error handling to raise a
WorkerError if the run_type is unexpected. Although the CLI parser handles that
error, adding default case handling prevents static analysis warnings about
possible variables references before assignment.
Corrected the format of parameter type definitions in the docstrings for
consistency and clarity. This change ensures better readability and proper
documentation standards.
Replace unittest.mock.patch decorator with pytest caplog fixture for tests of
logging.

Test suite maintenance re: issue #82.
Replaced direct patching of fix_perms with a pytest fixture for better test
structure and readability. This ensures the mock is applied more cleanly and
isolated within the test context.
Replaced direct patching with a pytest fixture to mock the `_write_netcdf`
function in unit tests for `make_CHS_currents_file`. This improves test
maintainability and readability. Reorganized parameterized tests to adapt to the
new mocking approach.
Replace the @patch decorator with a pytest fixture for
mock_read_avg_unstagger_rotate. This approach provides better clarity and
modularity in the test structure, making it easier to manage and extend the
tests. Removed the outdated test method that relied on the @patch decorator.
Replaced the deprecated 'drop' method with 'drop_vars' for removing the
'time_centered' variable. This ensures compatibility with newer versions of the
xarray library.
Correct the unlimited dimension from "time" to "time_counter" when exporting
to netCDF in make_CHS_currents_file.py.
@douglatornell douglatornell added Workers maintenance Codebase maintenance labels Sep 2, 2024
@douglatornell douglatornell added this to the v24.2 milestone Sep 2, 2024
PyCharm generated an import from a build/ directory that was just plain wrong!
Corrected grammatical error and improved the wording of module docstring in
`make_CHS_currents_file.py` and its associated tests. Ensured consistent use of
terminology by changing "average" to "averages" and specifying "netCDF" instead
of "nc file".
Copy link

codecov bot commented Sep 2, 2024

Codecov Report

Attention: Patch coverage is 93.50649% with 5 lines in your changes missing coverage. Please review.

Project coverage is 77.68%. Comparing base (4b539f1) to head (d78c51a).
Report is 15 commits behind head on main.

Files with missing lines Patch % Lines
nowcast/workers/make_CHS_currents_file.py 68.75% 4 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #294   +/-   ##
=======================================
  Coverage   77.68%   77.68%           
=======================================
  Files         133      133           
  Lines       18733    18745   +12     
  Branches     1909     1912    +3     
=======================================
+ Hits        14552    14562   +10     
- Misses       4115     4117    +2     
  Partials       66       66           
Flag Coverage Δ
unittests 77.68% <93.50%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@douglatornell douglatornell linked an issue Sep 2, 2024 that may be closed by this pull request
@douglatornell douglatornell merged commit 6a75b51 into main Sep 2, 2024
7 checks passed
@douglatornell douglatornell deleted the issue291-make_CHS_currents-drop_vars branch September 2, 2024 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Codebase maintenance Workers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DeprecationWarning in make_CHS_currents_file
1 participant