def test_6s_example1(self): # Implements Example_In_1.txt from the 6S distribution in Py6S # Tests against manual run of that file s = SixS() s.geometry = Geometry.User() s.geometry.solar_z = 40 s.geometry.solar_a = 100 s.geometry.view_z = 45 s.geometry.view_a = 50 s.geometry.month = 7 s.geometry.day = 23 s.atmos_profile = AtmosProfile.UserWaterAndOzone(3.0, 3.5) s.aero_profile = AeroProfile.User(dust=0.25, water=0.25, oceanic=0.25, soot=0.25) s.aot550 = 0.5 s.altitudes.set_target_custom_altitude(0.2) s.altitudes.set_sensor_custom_altitude(3.3, aot=0.25) s.wavelength = Wavelength(PredefinedWavelengths.AVHRR_NOAA9_B1) s.ground_reflectance = GroundReflectance.HeterogeneousLambertian( 0.5, GroundReflectance.ClearWater, GroundReflectance.GreenVegetation) s.atmos_corr = AtmosCorr.AtmosCorrBRDFFromReflectance(0.1) s.run() self.assertAlmostEqual(s.outputs.apparent_radiance, 12.749, delta=0.002)
def test_aero_profile(self): user_ap = AeroProfile.UserProfile(AeroProfile.Maritime) user_ap.add_layer(5, 0.34) aps = [ AeroProfile.Continental, AeroProfile.NoAerosols, AeroProfile.User(dust=0.3, oceanic=0.7), user_ap, ] results = [122.854, 140.289, 130.866, 136.649] for i in range(len(aps)): s = SixS() s.aero_profile = aps[i] s.run() self.assertAlmostEqual( s.outputs.apparent_radiance, results[i], "Error in aerosol profile with ID %s. Got %f, expected %f." % (str(aps[i]), s.outputs.apparent_radiance, results[i]), delta=0.002, )
def test_aero_profile_errors(self): with self.assertRaises(ParameterError): AeroProfile.User(dust=0.8, oceanic=0.4)