diff --git a/qctests/EN_stability_check.py b/qctests/EN_stability_check.py index 4bb2a28..896a8fa 100644 --- a/qctests/EN_stability_check.py +++ b/qctests/EN_stability_check.py @@ -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) diff --git a/tests/EN_stability_check_validation.py b/tests/EN_stability_check_validation.py index 63dbac8..13b21e6 100644 --- a/tests/EN_stability_check_validation.py +++ b/tests/EN_stability_check_validation.py @@ -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): ''' @@ -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' +