def test_scalar(self):
     """Should return a two-tuple of scalars for scalar input"""
     SA = 35.0
     CT = 10.0
     output = gsw.entropy_first_derivatives(SA, CT)
     self.assertEqual(type(output), tuple)
     self.assertEqual(len(output), 2)
     self.assertTrue(np.isscalar(output[0]))
    def test_standard_values(self):
        """Test some standard values"""
        SA = [34.7118, 34.8915, 35.0256, 34.8472, 34.7366, 34.7324]
        CT = [28.8099, 28.4392, 22.7862, 10.2262,  6.8272,  4.3236]

        eta_SA_standard = np.array((-0.263286800711655,
                                    -0.263977276574528,
                                    -0.255367497912925,
                                    -0.238066586439561,
                                    -0.234438260606436,
                                    -0.232820684341694))
        eta_CT_standard = np.array((13.221031210083824,
                                    13.236911191313675,
                                    13.489004628681361,
                                    14.086599016583795,
                                    14.257729576432077,
                                    14.386429945649411))
        eta_SA, eta_CT = gsw.entropy_first_derivatives(SA, CT)
        self.assertTrue(np.all(abs(eta_SA - eta_SA_standard) < 1.0e-15))
        self.assertTrue(np.all(abs(eta_CT - eta_CT_standard) < 1.0e-16))
Example #3
0
#CT_SA_SA, CT_SA_pt, CT_pt_pt = gsw.CT_second_derivatives(SA_chck_cast, pt)
#test_print("CT_SA_SA")
#test_print("CT_SA_pt")
#test_print("CT_pt_pt")

#h_SA, h_CT, h_P = gsw.enthalpy_first_derivatives(SA_chck_cast, CT_chck_cast, gsw_cv.p_chck_cast)
#test_print("h_SA")
#test_print("h_CT")
#test_print("h_P")

#h_SA_SA, h_SA_CT, h_CT_CT = gsw.enthalpy_second_derivatives(SA_chck_cast, CT_chck_cast, gsw_cv.p_chck_cast)
#test_print("h_SA_SA")
#test_print("h_SA_CT")
#test_print("h_CT_CT")

eta_SA, eta_CT = gsw.entropy_first_derivatives(SA_chck_cast, CT_chck_cast)
test_print("eta_SA")
test_print("eta_CT")

eta_SA_SA, eta_SA_CT, eta_CT_CT = gsw.entropy_second_derivatives(SA_chck_cast, CT_chck_cast)
test_print("eta_SA_SA") #FIXME: diffs are not found in the original
test_print("eta_SA_CT") #FIXME: diffs are not found in the original
test_print("eta_CT_CT") #FIXME: diffs are not found in the original

#pt_SA,  pt_CT = gsw.pt_first_derivatives(SA_chck_cast, CT_chck_cast)
#test_print("pt_SA")
#test_print("pt_CT")

#pt_SA_SA, pt_SA_CT, pt_CT_CT = gsw.pt_second_derivatives(SA_chck_cast, CT_chck_cast)
#test_print("pt_SA_SA")
#test_print("pt_SA_CT")