Skip to content

p_from_z: raise ValueError if any z > 5#228

Open
efiring wants to merge 1 commit intoTEOS-10:mainfrom
efiring:p_from_z-depth-check
Open

p_from_z: raise ValueError if any z > 5#228
efiring wants to merge 1 commit intoTEOS-10:mainfrom
efiring:p_from_z-depth-check

Conversation

@efiring
Copy link
Member

@efiring efiring commented Mar 2, 2026

The criterion for raising the exception is taken
from the Matlab version.

Closes #223.

The criterion for raising the exception is taken
from the Matlab version.

Closes TEOS-10#223.
@pytest.mark.parametrize("z", zvals_ok)
def test_p_from_z_ok(z):
# smoke test: doesn't raise an exception
gsw.p_from_z(z, 30)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess that this is fine b/c we don't expect it to fail and, if it fails the test runner will stop with an exception. Maybe we can integrate it more with pytest with a patter like this?

try:
    gsw.p_from_z(z, 30)
except Exception as e:
        pytest.fail(f"Failed test_p_from_z_ok.\n{e}.")

Or an expected result comparison?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Conversions p_from_z fails to use the same mask on numpy array

2 participants