def test_remove_sunearth_corr(self): """Test the removal of the sun-earth distance correction.""" out_refl = hf.remove_earthsun_distance_correction(self.corr_refl) np.testing.assert_allclose(out_refl, self.raw_refl) self.assertFalse( out_refl.attrs['sun_earth_distance_correction_applied']) assert isinstance(out_refl.data, da.Array)
def remove_sun_earth_distance_correction(scene): """Remove sun-earth-distance correction from visible channels. This is required because a downstream CLAAS module (CPP) does not recognize the "sun_earth_distance_correction_applied" attribute and applies the correction anyway. """ for band in BANDNAMES: is_vis = scene[band].attrs['calibration'] == 'reflectance' correction_applied = scene[band].attrs.get( 'sun_earth_distance_correction_applied', False) if is_vis and correction_applied: scene[band] = remove_earthsun_distance_correction(scene[band])