Example #1
0
    def test_6s_example3(self):
        s = SixS()
        s.geometry = Geometry.Landsat_TM()
        s.geometry.month = 5
        s.geometry.day = 9
        s.geometry.gmt_decimal_hour = 11.222
        s.geometry.latitude = 40
        s.geometry.longitude = 30

        s.atmos_profile = AtmosProfile.PredefinedType(
            AtmosProfile.MidlatitudeSummer)

        s.aero_profile = AeroProfile.MultimodalLogNormalDistribution(0.001, 20)
        s.aero_profile.add_component(
            0.05,
            2.03,
            0.538,
            [
                1.508,
                1.500,
                1.500,
                1.500,
                1.500,
                1.500,
                1.500,
                1.500,
                1.495,
                1.490,
                1.490,
                1.490,
                1.486,
                1.480,
                1.470,
                1.460,
                1.456,
                1.443,
                1.430,
                1.470,
            ],
            [
                3.24e-07,
                3.0e-08,
                2.86e-08,
                2.51e-08,
                2.2e-08,
                2.0e-08,
                1.0e-08,
                1.0e-08,
                1.48e-08,
                2.0e-08,
                6.85e-08,
                1.0e-07,
                1.25e-06,
                3.0e-06,
                3.5e-04,
                6.0e-04,
                6.86e-04,
                1.7e-03,
                4.0e-03,
                1.4e-03,
            ],
        )
        s.aero_profile.add_component(
            0.0695,
            2.03,
            0.457,
            [
                1.452,
                1.440,
                1.438,
                1.433,
                1.432,
                1.431,
                1.431,
                1.430,
                1.429,
                1.429,
                1.429,
                1.428,
                1.427,
                1.425,
                1.411,
                1.401,
                1.395,
                1.385,
                1.364,
                1.396,
            ],
            [
                1.0e-08,
                1.0e-08,
                1.0e-08,
                1.0e-08,
                1.0e-08,
                1.0e-08,
                1.0e-08,
                1.0e-08,
                1.38e-08,
                1.47e-08,
                1.68e-08,
                1.93e-08,
                4.91e-08,
                1.75e-07,
                9.66e-06,
                1.94e-04,
                3.84e-04,
                1.12e-03,
                2.51e-03,
                1.31e-01,
            ],
        )
        s.aero_profile.add_component(
            0.4,
            2.03,
            0.005,
            [
                1.508,
                1.500,
                1.500,
                1.500,
                1.500,
                1.500,
                1.500,
                1.500,
                1.495,
                1.490,
                1.490,
                1.490,
                1.486,
                1.480,
                1.470,
                1.460,
                1.456,
                1.443,
                1.430,
                1.470,
            ],
            [
                3.24e-07,
                3.0e-08,
                2.86e-08,
                2.51e-08,
                2.2e-08,
                2.0e-08,
                1.0e-08,
                1.0e-08,
                1.48e-08,
                2.0e-08,
                6.85e-08,
                1.0e-07,
                1.25e-06,
                3.0e-06,
                3.5e-04,
                6.0e-04,
                6.86e-04,
                1.7e-03,
                4.0e-03,
                1.4e-03,
            ],
        )

        s.aot550 = 0.8

        s.altitudes.set_target_custom_altitude(2)
        s.altitudes.set_sensor_satellite_level()

        s.wavelength = Wavelength(PredefinedWavelengths.MODIS_B4)

        s.ground_reflectance = GroundReflectance.HomogeneousOcean(
            11, 30, 35, 3)

        s.run()

        self.assertAlmostEqual(s.outputs.apparent_reflectance,
                               0.1234623,
                               delta=0.002)
Example #2
0
    def test_6s_example2(self):
        # Implements Example_In_2.txt from the 6S distribution in Py6S
        # Tests against manual run of that file

        s = SixS()
        s.geometry = Geometry.User()
        s.geometry.solar_z = 0
        s.geometry.solar_a = 20
        s.geometry.view_z = 30
        s.geometry.view_a = 0
        s.geometry.month = 8
        s.geometry.day = 22

        s.atmos_profile = AtmosProfile.PredefinedType(
            AtmosProfile.NoGaseousAbsorption)

        s.aero_profile = AeroProfile.SunPhotometerDistribution(
            [
                0.050000001,
                0.065604001,
                0.086076997,
                0.112939,
                0.148184001,
                0.194428995,
                0.255104989,
                0.334715992,
                0.439173013,
                0.576227009,
                0.756052017,
                0.99199599,
                1.30157101,
                1.707757,
                2.24070191,
                2.93996596,
                3.85745192,
                5.06126022,
                6.64074516,
                8.71314526,
                11.4322901,
                15,
            ],
            [
                0.001338098,
                0.007492487,
                0.026454749,
                0.058904506,
                0.082712278,
                0.073251031,
                0.040950641,
                0.014576218,
                0.003672085,
                0.001576356,
                0.002422644,
                0.004472982,
                0.007452302,
                0.011037065,
                0.014523974,
                0.016981738,
                0.017641816,
                0.016284294,
                0.01335547,
                0.009732267,
                0.006301342,
                0.003625077,
            ],
            [1.47] * 20,
            [0.0093] * 20,
        )

        s.aot550 = 1.0
        s.altitudes.set_target_sea_level()
        s.altitudes.set_sensor_satellite_level()
        s.wavelength = Wavelength(0.550)
        s.ground_reflectance = GroundReflectance.HomogeneousRoujean(
            0.037, 0.0, 0.133)

        s.run()

        self.assertAlmostEqual(s.outputs.apparent_radiance,
                               76.999,
                               delta=0.002)
        self.assertAlmostEqual(s.outputs.background_radiance,
                               10.017,
                               delta=0.002)
Example #3
0
    def test_from_lat_and_date(self):
        ap = AtmosProfile.FromLatitudeAndDate(53, "2015-07-14")

        assert ap == AtmosProfile.PredefinedType(AtmosProfile.SubarcticSummer)