@@ -744,28 +744,6 @@ def test_lfc_profile_nan_with_parcel_profile():
744744 assert_almost_equal (lfc_temperature , 9.6977 * units .degC , 3 )
745745
746746
747- def test_sensitive_sounding ():
748- """Test quantities for a sensitive sounding (#902)."""
749- # This sounding has a very small positive area in the low level. It's only captured
750- # properly if the parcel profile includes the LCL, otherwise it breaks LFC and CAPE
751- p = units .Quantity ([1004. , 1000. , 943. , 928. , 925. , 850. , 839. , 749. , 700. , 699. ,
752- 603. , 500. , 404. , 400. , 363. , 306. , 300. , 250. , 213. , 200. ,
753- 176. , 150. ], 'hectopascal' )
754- t = units .Quantity ([25.1 , 24.5 , 20.2 , 21.6 , 21.4 , 20.4 , 20.2 , 14.4 , 13.2 , 13. , 6.8 , - 3.3 ,
755- - 13.1 , - 13.7 , - 17.9 , - 25.5 , - 26.9 , - 37.9 , - 46.7 , - 48.7 , - 52.1 , - 58.9 ],
756- 'degC' )
757- td = units .Quantity ([21.9 , 22.1 , 19.2 , 20.5 , 20.4 , 18.4 , 17.4 , 8.4 , - 2.8 , - 3.0 , - 15.2 ,
758- - 20.3 , - 29.1 , - 27.7 , - 24.9 , - 39.5 , - 41.9 , - 51.9 , - 60.7 , - 62.7 , - 65.1 ,
759- - 71.9 ], 'degC' )
760- lfc_pressure , lfc_temp = lfc (p , t , td )
761- assert_almost_equal (lfc_pressure , 952.8445 * units .mbar , 2 )
762- assert_almost_equal (lfc_temp , 20.94469 * units .degC , 2 )
763-
764- pos , neg = surface_based_cape_cin (p , t , td )
765- assert_almost_equal (pos , 0.106791 * units ('J/kg' ), 3 )
766- assert_almost_equal (neg , - 282.620677 * units ('J/kg' ), 3 )
767-
768-
769747def test_lfc_sfc_precision ():
770748 """Test LFC when there are precision issues with the parcel path."""
771749 levels = np .array ([839. , 819.4 , 816. , 807. , 790.7 , 763. , 736.2 ,
@@ -1200,8 +1178,8 @@ def test_cape_cin():
12001178 dewpoint = np .array ([19. , - 11.2 , - 10.8 , - 10.4 , - 10. , - 53.2 ]) * units .celsius
12011179 parcel_prof = parcel_profile (p , temperature [0 ], dewpoint [0 ])
12021180 cape , cin = cape_cin (p , temperature , dewpoint , parcel_prof )
1203- assert_almost_equal (cape , 215.056976 * units ('joule / kilogram' ), 2 )
1204- assert_almost_equal (cin , - 9.94798721 * units ('joule / kilogram' ), 2 )
1181+ assert_almost_equal (cape , 228.61081997000744 * units ('joule / kilogram' ), 2 )
1182+ assert_almost_equal (cin , - 20.8938 * units ('joule / kilogram' ), 2 )
12051183
12061184
12071185def test_cape_cin_no_el ():
@@ -1211,8 +1189,8 @@ def test_cape_cin_no_el():
12111189 dewpoint = np .array ([19. , - 11.2 , - 10.8 , - 10.4 ]) * units .celsius
12121190 parcel_prof = parcel_profile (p , temperature [0 ], dewpoint [0 ]).to ('degC' )
12131191 cape , cin = cape_cin (p , temperature , dewpoint , parcel_prof )
1214- assert_almost_equal (cape , 12.74623773 * units ('joule / kilogram' ), 2 )
1215- assert_almost_equal (cin , - 9.947987213 * units ('joule / kilogram' ), 2 )
1192+ assert_almost_equal (cape , 11.10149 * units ('joule / kilogram' ), 2 )
1193+ assert_almost_equal (cin , - 20.8938 * units ('joule / kilogram' ), 2 )
12161194
12171195
12181196def test_cape_cin_no_lfc ():
@@ -1609,8 +1587,8 @@ def test_surface_based_cape_cin(array_class):
16091587 temperature = array_class ([22.2 , 14.6 , 12. , 9.4 , 7. , - 38. ], units .celsius )
16101588 dewpoint = array_class ([19. , - 11.2 , - 10.8 , - 10.4 , - 10. , - 53.2 ], units .celsius )
16111589 cape , cin = surface_based_cape_cin (p , temperature , dewpoint )
1612- assert_almost_equal (cape , 215.05697634 * units ('joule / kilogram' ), 2 )
1613- assert_almost_equal (cin , - 33.0633599455 * units ('joule / kilogram' ), 2 )
1590+ assert_almost_equal (cape , 228.61081997000744 * units ('joule / kilogram' ), 2 )
1591+ assert_almost_equal (cin , - 52.46449098033761 * units ('joule / kilogram' ), 2 )
16141592
16151593
16161594def test_surface_based_cape_cin_with_xarray ():
@@ -1633,8 +1611,8 @@ def test_surface_based_cape_cin_with_xarray():
16331611 data ['temperature' ],
16341612 data ['dewpoint' ]
16351613 )
1636- assert_almost_equal (cape , 215.056976346 * units ('joule / kilogram' ), 2 )
1637- assert_almost_equal (cin , - 33.0633599455 * units ('joule / kilogram' ), 2 )
1614+ assert_almost_equal (cape , 228.61081997000744 * units ('joule / kilogram' ), 2 )
1615+ assert_almost_equal (cin , - 52.46449098033761 * units ('joule / kilogram' ), 2 )
16381616
16391617
16401618def test_profile_with_nans ():
@@ -1674,8 +1652,8 @@ def test_most_unstable_cape_cin_surface():
16741652 temperature = np .array ([22.2 , 14.6 , 12. , 9.4 , 7. , - 38. ]) * units .celsius
16751653 dewpoint = np .array ([19. , - 11.2 , - 10.8 , - 10.4 , - 10. , - 53.2 ]) * units .celsius
16761654 mucape , mucin = most_unstable_cape_cin (pressure , temperature , dewpoint )
1677- assert_almost_equal (mucape , 215.056976346 * units ('joule / kilogram' ), 2 )
1678- assert_almost_equal (mucin , - 33.0633599455 * units ('joule / kilogram' ), 2 )
1655+ assert_almost_equal (mucape , 228.61081997000744 * units ('joule / kilogram' ), 2 )
1656+ assert_almost_equal (mucin , - 52.46449098033761 * units ('joule / kilogram' ), 2 )
16791657
16801658
16811659def test_most_unstable_cape_cin ():
@@ -1684,8 +1662,8 @@ def test_most_unstable_cape_cin():
16841662 temperature = np .array ([18.2 , 22.2 , 17.4 , 10. , 0. , 15 ]) * units .celsius
16851663 dewpoint = np .array ([19. , 19. , 14.3 , 0. , - 10. , 0. ]) * units .celsius
16861664 mucape , mucin = most_unstable_cape_cin (pressure , temperature , dewpoint )
1687- assert_almost_equal (mucape , 173.749389796 * units ('joule / kilogram' ), 4 )
1688- assert_almost_equal (mucin , - 20.968278741 * units ('joule / kilogram' ), 4 )
1665+ assert_almost_equal (mucape , 189.41067504060692 * units ('joule / kilogram' ), 4 )
1666+ assert_almost_equal (mucin , - 26.225902591840672 * units ('joule / kilogram' ), 4 )
16891667
16901668
16911669def test_mixed_parcel ():
@@ -1705,17 +1683,17 @@ def test_mixed_layer_cape_cin(multiple_intersections):
17051683 """Test the calculation of mixed layer cape/cin."""
17061684 pressure , temperature , dewpoint = multiple_intersections
17071685 mlcape , mlcin = mixed_layer_cape_cin (pressure , temperature , dewpoint )
1708- assert_almost_equal (mlcape , 1132.706800436 * units ('joule / kilogram' ), 2 )
1709- assert_almost_equal (mlcin , - 13.4809966289 * units ('joule / kilogram' ), 2 )
1686+ assert_almost_equal (mlcape , 1143.3981 * units ('joule / kilogram' ), 2 )
1687+ assert_almost_equal (mlcin , - 16.240379524041845 * units ('joule / kilogram' ), 2 )
17101688
17111689
17121690def test_mixed_layer_cape_cin_bottom_pressure (multiple_intersections ):
17131691 """Test the calculation of mixed layer cape/cin with a specified bottom pressure."""
17141692 pressure , temperature , dewpoint = multiple_intersections
17151693 mlcape_middle , mlcin_middle = mixed_layer_cape_cin (pressure , temperature , dewpoint ,
17161694 parcel_start_pressure = 903 * units .hPa )
1717- assert_almost_equal (mlcape_middle , 1177.86 * units ('joule / kilogram' ), 2 )
1718- assert_almost_equal (mlcin_middle , - 37. * units ('joule / kilogram' ), 2 )
1695+ assert_almost_equal (mlcape_middle , 1200.528254 * units ('joule / kilogram' ), 2 )
1696+ assert_almost_equal (mlcin_middle , - 46.99243161905505 * units ('joule / kilogram' ), 2 )
17191697
17201698
17211699def test_dcape ():
@@ -2220,17 +2198,17 @@ def test_cape_cin_top_el_lfc(multiple_intersections):
22202198 levels , temperatures , dewpoints = multiple_intersections
22212199 parcel_prof = parcel_profile (levels , temperatures [0 ], dewpoints [0 ]).to ('degC' )
22222200 cape , cin = cape_cin (levels , temperatures , dewpoints , parcel_prof , which_lfc = 'top' )
2223- assert_almost_equal (cape , 1345.18884959 * units ('joule / kilogram' ), 3 )
2224- assert_almost_equal (cin , - 35.179268355 * units ('joule / kilogram' ), 3 )
2201+ assert_almost_equal (cape , 1371.747661 * units ('joule / kilogram' ), 3 )
2202+ assert_almost_equal (cin , - 46.084968610767184 * units ('joule / kilogram' ), 3 )
22252203
22262204
22272205def test_cape_cin_bottom_el_lfc (multiple_intersections ):
22282206 """Test using LFC/EL options for CAPE/CIN."""
22292207 levels , temperatures , dewpoints = multiple_intersections
22302208 parcel_prof = parcel_profile (levels , temperatures [0 ], dewpoints [0 ]).to ('degC' )
22312209 cape , cin = cape_cin (levels , temperatures , dewpoints , parcel_prof , which_el = 'bottom' )
2232- assert_almost_equal (cape , 4.57262449 * units ('joule / kilogram' ), 3 )
2233- assert_almost_equal (cin , - 5.9471237534 * units ('joule / kilogram' ), 3 )
2210+ assert_almost_equal (cape , 4.76113 * units ('joule / kilogram' ), 3 )
2211+ assert_almost_equal (cin , - 7.058249615394496 * units ('joule / kilogram' ), 3 )
22342212
22352213
22362214def test_cape_cin_wide_el_lfc (multiple_intersections ):
@@ -2239,8 +2217,8 @@ def test_cape_cin_wide_el_lfc(multiple_intersections):
22392217 parcel_prof = parcel_profile (levels , temperatures [0 ], dewpoints [0 ]).to ('degC' )
22402218 cape , cin = cape_cin (levels , temperatures , dewpoints , parcel_prof , which_lfc = 'wide' ,
22412219 which_el = 'wide' )
2242- assert_almost_equal (cape , 1345.1888496 * units ('joule / kilogram' ), 3 )
2243- assert_almost_equal (cin , - 35.179268355 * units ('joule / kilogram' ), 3 )
2220+ assert_almost_equal (cape , 1371.747661 * units ('joule / kilogram' ), 3 )
2221+ assert_almost_equal (cin , - 46.084968610767184 * units ('joule / kilogram' ), 3 )
22442222
22452223
22462224def test_cape_cin_custom_profile ():
@@ -2250,7 +2228,7 @@ def test_cape_cin_custom_profile():
22502228 dewpoint = np .array ([19. , - 11.2 , - 10.8 , - 10.4 , - 10. , - 53.2 ]) * units .celsius
22512229 parcel_prof = parcel_profile (p , temperature [0 ], dewpoint [0 ]) + 5 * units .delta_degC
22522230 cape , cin = cape_cin (p , temperature , dewpoint , parcel_prof )
2253- assert_almost_equal (cape , 1650.61208729 * units ('joule / kilogram' ), 2 )
2231+ assert_almost_equal (cape , 1785.7865489238366 * units ('joule / kilogram' ), 2 )
22542232 assert_almost_equal (cin , 0.0 * units ('joule / kilogram' ), 2 )
22552233
22562234
@@ -2344,7 +2322,7 @@ def test_cape_cin_value_error():
23442322 - 35.9 , - 26.7 , - 37.7 , - 43.1 , - 33.9 , - 40.9 , - 46.1 , - 34.9 , - 33.9 ,
23452323 - 33.7 , - 33.3 , - 42.5 , - 50.3 , - 49.7 , - 49.5 , - 58.3 , - 61.3 ]) * units .degC
23462324 cape , cin = surface_based_cape_cin (pressure , temperature , dewpoint )
2347- expected_cape , expected_cin = 2098.688061 * units ('joules/kg' ), 0.0 * units ('joules/kg' )
2325+ expected_cape , expected_cin = 2182.6035338 * units ('joules/kg' ), 0.0 * units ('joules/kg' )
23482326 assert_almost_equal (cape , expected_cape , 3 )
23492327 assert_almost_equal (cin , expected_cin , 3 )
23502328
0 commit comments