MHKiT-Software / MHKiT-Python

MHKiT-Python provides the marine renewable energy (MRE) community tools for data processing, visualization, quality control, resource assessment, and device performance.
https://mhkit-software.github.io/MHKiT/
BSD 3-Clause "New" or "Revised" License
47 stars 45 forks source link

Replace asserts with errors, resolves #242 #276

Closed akeeste closed 7 months ago

akeeste commented 8 months ago

This PR replaces all non-testing asserts with code that will raise errors. For the vast majority of asserts, the error messages are unchanged or have additions to say the parameter type or value that was given and is causing an issue.

Some try-except statements appeared like they should be errors, but just defined unused strings. I updated these to throw error messages.

Modules completed:

I left river/io/d3d.py alone for now because #271 edits it and I wanted to avoid conflicts if possible.

Other items

ssolson commented 7 months ago

@akeeste just checking if this is ready for another review

akeeste commented 7 months ago

@akeeste just checking if this is ready for another review

@ssolson Yes. I implemented all of the suggested changes. Let me know if there's any other changes you'd like to see.

I'm debating if the update to the min parameter of plot_directional_spectrum is necessary. How much of an issue is it to overwrite the python function min? Seems safer to not overwrite it, but the function call won't be backwards compatible then.

ssolson commented 7 months ago

I'm debating if the update to the min parameter of plot_directional_spectrum is necessary. How much of an issue is it to overwrite the python function min? Seems safer to not overwrite it, but the function call won't be backwards compatible then.

Its a very easy fix for the user to change a kwarg from min to color_bar_min and is the correct way to handle.

akeeste commented 7 months ago

Thanks @ssolson. I resolved those last few issues and will merge