Skip to content

Commit

Permalink
simple attempt at #281
Browse files Browse the repository at this point in the history
  • Loading branch information
billmills committed Feb 9, 2024
1 parent 8732fab commit 0f0890b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions qctests/EN_stability_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ def run_qc(p, parameters):
t = p.t()
s = p.s()
P = p.p()
if numpy.ma.all(P.mask):
P = 0.9806652*p.z()
print(P)

# initialize qc as a bunch of falses;
qc = numpy.zeros(p.n_levels(), dtype=bool)
Expand Down
10 changes: 10 additions & 0 deletions tests/EN_stability_check_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ def test_EN_stability_check_padded(self):
truth = numpy.ma.array([False, True, True, False, False, False, False, False, False], mask=False)
assert numpy.array_equal(qc, truth), 'failed to flag padded stability example'

def test_EN_stability_check_no_pressures(self):
'''
same as above but with pressures inferred from depth
'''

p = util.testingProfile.fakeProfile([13.5, 25.5, 20.4, 13.5, 13.5, 13.5, 13.5, 13.5, 13.5], [8000, 2000, 1000, 8000, 8000, 8000, 8000, 8000, 8000], salinities=[40, 35, 20, 40, 40, 40, 40, 40, 40], uid=8888)
qc = qctests.EN_stability_check.test(p, self.parameters)
truth = numpy.ma.array([False, True, True, False, False, False, False, False, False], mask=False)
assert numpy.array_equal(qc, truth), 'failed to flag padded stability example'

def test_EN_stability_check_unpadded(self):
'''
Expand All @@ -63,3 +72,4 @@ def test_EN_stability_check_unpadded(self):
qc = qctests.EN_stability_check.test(p, self.parameters)
truth = numpy.ma.array([True, True, True, True], mask=False)
assert numpy.array_equal(qc, truth), 'failed to flag unpadded stability example'

0 comments on commit 0f0890b

Please sign in to comment.