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

Fix FutureWarnings in stormtools module #132

Merged
merged 5 commits into from
Jan 31, 2025
Merged

Conversation

douglatornell
Copy link
Member

@douglatornell douglatornell commented Jan 30, 2025

re: issue #104

Affected functions:

Introduced tests to validate the correct behaviour of the
`load_tidal_predictions()` function, including handling of valid and invalid
inputs. These tests cover scenarios such as proper file parsing, file not found
errors, invalid file formats, and incorrect date formats.
@douglatornell douglatornell added bug Something isn't working SalishSeaTools labels Jan 30, 2025
@github-actions github-actions bot added this to the v25.1 milestone Jan 30, 2025
Copy link

codecov bot commented Jan 30, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 53.69%. Comparing base (80034c2) to head (479c6c7).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #132      +/-   ##
==========================================
+ Coverage   53.08%   53.69%   +0.61%     
==========================================
  Files          29       29              
  Lines        3506     3531      +25     
==========================================
+ Hits         1861     1896      +35     
+ Misses       1645     1635      -10     
Flag Coverage Δ
unittests 53.69% <100.00%> (+0.61%) ⬆️

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 Jan 30, 2025 that may be closed by this pull request
Updated `load_tidal_predictions()` to dynamically strip leading/trailing spaces
from column names when reading data. Adjusted the corresponding test case to
reflect the change, ensuring consistent column naming without embedded
whitespace.
The `tmp_csv_file_bad_date_format` fixture and its associated test were removed
because `pandas.read_csv()` date parsing is more robust than expected.
This prevents the FutureWarning from pandas.read_csv() related to the
deprecation of its date_parser argument.
Replaced ":kbd:" with `` for consistency with formatting conventions and
improved readability in the tidal prediction docstring. No functionality was
affected.
@douglatornell douglatornell merged commit b53b98d into main Jan 31, 2025
9 checks passed
@douglatornell douglatornell deleted the stormtools-date-parsing branch January 31, 2025 00:16
douglatornell added a commit to SalishSeaCast/SalishSeaNowcast that referenced this pull request Jan 31, 2025
The column renaming for "pred_noshallow" in the ttide dataset is no longer
required thanks to SalishSeaCast/tools#132 and has
been removed. This improves code clarity and eliminates an unneeded operation.
douglatornell added a commit to SalishSeaCast/SalishSeaNowcast that referenced this pull request Jan 31, 2025
Delete extra spaces in the "pred_noshallow" key that were eliminated at source
in SalishSeaCast/tools#132.
douglatornell added a commit to SalishSeaCast/SalishSeaNowcast that referenced this pull request Feb 1, 2025
… 3.13 (#327)

* Add missing SPDX short-form license identifiers

Ensures compliance with licensing practices by adding SPDX license identifiers
to `make_plots.py` and `tracer_thalweg_and_surface_hourly.py`. This improves
clarity and streamlines license management across the codebase.

* Update tracer_thalweg_and_surface_hourly fig test notebook

Update test notebook for `tracer_thalweg_and_surface_hourly` figure module and
confirm that the module works in a production environment based on Python 3.13.

* Correct bathymetry file name in fig test notebook

Updated bathymetry file name in test notebook for
`tracer_thalweg_and_surface_hourly` figure module to `bathymetry_202108.nc`.

* Update velocity_section_and_surface fig test notebook

Update test notebook for `velocity_section_and_surface` figure module and
confirm that the module works in a production environment based on Python 3.13.

* Update README for research figures notebooks

Modernized `make_readme.py` script.

* Update broken links to CONTRIBUTORS in docs

Replaced outdated "master" branch links with "main" branch links in `README.rst`
and `docs/license_description.txt`. Ensures references to CONTRIBUTORS file are
accurate and functional.

* Add TestPlotVelNEGridded figure test notebook

Introduced a new notebook to test the `research_VENUS.plot_vel_NE_gridded()`
function. It replicates production settings for validation and highlights the
need for a refactor into a proper figure module. Updated README.md with the new
notebook entry and corrected a link typo.

* Update time_series_plots fig test notebook

Update test notebook for `time_series_plots` figure module and confirm that the
module works in a production environment based on Python 3.13.

* Update README for comparison figures notebooks

Modernized `make_readme.py` script.

* Update sandheads_winds fig test notebook

Update test notebook for `sandheads_winds` figure module and confirm that the
module works in a production environment based on Python 3.13.

* Update compare_venus_ctd fig test notebook

Update test notebook for `compare_venus_ctd` figure module and confirm that the
module works in a production environment based on Python 3.13.

* Change 'np.NaN' to 'np.nan' re: Numpy 2.0

'numpy.nan' is the correct spelling in Numpy 2.0. All others are deprecated.

Missed in PR #272.

* Update storm_surge_alerts_thumbnail fig test notebook

Update test notebook for `storm_surge_alerts_thumbnail` figure module and
confirm that the module works in a production environment based on Python 3.13.

* Update storm_surge_alerts fig test notebook

Update test notebook for `storm_surge_alerts` figure module and
confirm that the module works in a production environment based on Python 3.13.

* Update pt_atkinson_tide fig test notebook

Update test notebook for `pt_atkinson_tide` figure module and
confirm that the module works in a production environment based on Python 3.13.

* Adjust 10-min averaging to correctly offset timestamps

Removed the deprecated `loffset` parameter and manually adjusted the timestamps
with a calculated offset. Ensures proper alignment of resampled data timestamps
for accurate comparison.

* Re-run notebooks with Bitstream Vera fonts installed

This gets rid of the huge number of
`findfont: Font family 'Bitstream Vera Sans' not found` messages.

* Update compare_tide_prediction_max_ssh fig test notebook

Update test notebook for `compare_tide_prediction_max_ssh` figure module and
confirm that the module works in a production environment based on Python 3.13.

Halfmoon Bay dn Squamish figures commented out due to disappearance of obs from
CHS server.

* Update README for publish figures notebooks

Modernized `make_readme.py` script.

* Remove unnecessary column renaming in tide predictions

The column renaming for "pred_noshallow" in the ttide dataset is no longer
required thanks to SalishSeaCast/tools#132 and has
been removed. This improves code clarity and eliminates an unneeded operation.

* Update dict key for tidal prediction difference

Delete extra spaces in the "pred_noshallow" key that were eliminated at source
in SalishSeaCast/tools#132.

* Re-run notebooks after stormtools date parsing fix

This gets rid of a large number of FutureWarning messages.

* Update surface_current_tiles fig test notebook

Update test notebook for `surface_current_tiles` figure module and confirm that
the module works in a production environment based on Python 3.13.

* Update wave_height_period fig test notebook

Update test notebook for `wave_height_period` figure module and confirm that
the module works in a production environment based on Python 3.13.

* Update README for wwatch3 figures notebooks

Modernized `make_readme.py` script.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working SalishSeaTools
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FutureWarning in stormtools.py
1 participant