def test_xarray_input(self): t = xr.DataArray(self.t1) rh = xr.DataArray(self.rh1) assert np.allclose(heat_index(t, rh), self.ncl_gt_1, atol=0.005)
def test_alternate_xarray_tag(self): t = xr.DataArray([15, 20]) rh = xr.DataArray([15, 20]) out = heat_index(t, rh) assert out.tag == "NCL: heat_index_nws; (Steadman+t)*0.5"
def test_list_input(self): assert np.allclose(heat_index(self.t1.tolist(), self.rh1.tolist()), self.ncl_gt_1, atol=0.005)
def test_float_input(self): assert np.allclose(heat_index(80, 75), 83.5751, atol=0.005)
def test_alt_coef(self): assert np.allclose(heat_index(self.t2, self.rh2, True), self.ncl_gt_2, atol=0.005)
def test_multi_dimensional_input(self): assert np.allclose(heat_index(self.t2.reshape(2, 5), self.rh2.reshape(2, 5), True), np.asarray(self.ncl_gt_2).reshape(2, 5), atol=0.005)
def test_numpy_input(self): assert np.allclose(heat_index(self.t1, self.rh1, False), self.ncl_gt_1, atol=0.005)