def test_simple(self, areacella): area, sic = self.values(areacella) a = sea_ice_area(sic, area) expected = 4 * np.pi * area.r**2 / 2.0 / 2.0 np.testing.assert_array_almost_equal(a / expected, 1, 3) assert a.units == "m^2"
def test_dimensionless(self, areacella): area, sic = self.values(areacella) sic /= 100 sic.attrs["units"] = "" a = sea_ice_area(sic, area) expected = 4 * np.pi * area.r**2 / 2.0 / 2.0 np.testing.assert_array_almost_equal(a / expected, 1, 3) assert a.units == "m^2"
def test_area_units(self, areacella): area, sic = self.values(areacella) # Convert area to km^2 area /= 1e6 area.attrs["units"] = "km^2" a = sea_ice_area(sic, area) assert a.units == "km^2" expected = 4 * np.pi * area.r**2 / 2.0 / 2.0 / 1e6 np.testing.assert_array_almost_equal(a / expected, 1, 3)