def test_gsi_sglval(self): """test entire gsi calculation with scalar inputs""" tmin = (gsi.TMIN_MIN + gsi.TMIN_MAX) / 2.0 photo = (gsi.PHOTO_MIN + gsi.PHOTO_MAX) / 2.0 vpd = (gsi.VPD_MIN + gsi.VPD_MAX) / 2.0 self.assertLess(gsi.calc_gsi(tmin, vpd, photo) - (0.5 ** 3), 1e-5)
def test_gsi_sglval(self): """test entire gsi calculation with scalar inputs""" tmin = (gsi.TMIN_MIN + gsi.TMIN_MAX) / 2. photo = (gsi.PHOTO_MIN + gsi.PHOTO_MAX) / 2. vpd = (gsi.VPD_MIN + gsi.VPD_MAX) / 2. self.assertLess(gsi.calc_gsi(tmin, vpd, photo) - (0.5**3), 1e-5)
def test_gsi_array(self): """test entire gsi calculation with array inputs""" frac = np.arange(0.0, 1.0, 0.2) tmin = frac * (gsi.TMIN_MAX - gsi.TMIN_MIN) + gsi.TMIN_MIN photo = frac * (gsi.PHOTO_MAX - gsi.PHOTO_MIN) + gsi.PHOTO_MIN vpd = (1 - frac) * (gsi.VPD_MAX - gsi.VPD_MIN) + gsi.VPD_MIN i_gsi = gsi.calc_gsi(tmin, vpd, photo) for i in range(len(frac)): self.assertLess(i_gsi[i] - (frac[i] ** 3), 1e-5)
def test_gsi_array(self): """test entire gsi calculation with array inputs""" frac = np.arange(0.0, 1.0, 0.2) tmin = frac * (gsi.TMIN_MAX - gsi.TMIN_MIN) + gsi.TMIN_MIN photo = frac * (gsi.PHOTO_MAX - gsi.PHOTO_MIN) + gsi.PHOTO_MIN vpd = (1 - frac) * (gsi.VPD_MAX - gsi.VPD_MIN) + gsi.VPD_MIN i_gsi = gsi.calc_gsi(tmin, vpd, photo) for i in range(len(frac)): self.assertLess(i_gsi[i] - (frac[i]**3), 1e-5)