예제 #1
0
 def test_convert_units(self, tasmax_series):
     tx = np.zeros(366)
     tx[:10] = np.array([29, 31, 31, 31, 29, 31, 31, 31, 31, 31])
     tx = tasmax_series(tx, start='1/1/2000')
     tx.attrs['units'] = 'C'
     hwi = atmos.heat_wave_index(tx, freq='YS')
     np.testing.assert_array_equal(hwi, [10])
예제 #2
0
 def test_convert_units(self, tasmax_series):
     tx = np.zeros(366)
     tx[:10] = np.array([29, 31, 31, 31, 29, 31, 31, 31, 31, 31])
     tx = tasmax_series(tx, start="1/1/2000")
     tx.attrs["units"] = "C"
     hwi = atmos.heat_wave_index(tx, freq="YS")
     np.testing.assert_array_equal(hwi, [10])
예제 #3
0
    def test_nan_presence(self, tasmax_series):
        tx = np.zeros(366)
        tx[:10] = np.array([29, 31, 31, 31, 29, 31, 31, 31, 31, 31])
        tx[-1] = np.nan
        tx = tasmax_series(tx + K2C, start="1/1/2000")

        hwi = atmos.heat_wave_index(tx, freq="YS")
        np.testing.assert_array_equal(hwi, [np.nan])
예제 #4
0
 def test_simple(self, tasmax_series):
     tx = np.zeros(366)
     tx[:10] = np.array([29, 31, 31, 31, 29, 31, 31, 31, 31, 31])
     tx = tasmax_series(tx + K2C, start='1/1/2000')
     hwi = atmos.heat_wave_index(tx, freq='YS')
     np.testing.assert_array_equal(hwi, [10])