The SixS class¶
The SixS
class is the heart of Py6S. It has attributes and methods that allow you to set parameters, run 6S and access the outputs. These are described in detail below, but the basic usage pattern is:
from Py6S import *
s = SixS() # Instantiate the class
s.aero_profile = AeroProfile.PredefinedType(AeroProfile.Maritime) # Set various parameters
s.run() # Run the model
print(s.outputs.pixel_irradiance) # Access the outputs
-
class
Py6S.
SixS
(path=None)[source]¶ Wrapper for the 6S Radiative Transfer Model.
This is the main class which can be used to instantiate an object which has the key methods for running 6S.
The most import method in this class is the
run()
method which writes the 6S input file, runs the model and processes the output.The parameters of the model are set as the attributes of this class, and the outputs are available as attributes under the output attribute.
For a simple test to ensure that Py6S has found the correct executable for 6S simply run the
test()
method of this class:SixS.Test()
Attributes:
atmos_profile
– The atmospheric profile to use. Should be set to the output of an AtmosProfile method. For example:s.atmos_profile = AtmosProfile.PredefinedType(AtmosProfile.MidlatitudeSummer)
aero_profile
– The aerosol profile to use. Should be set to the output of an AeroProfile method. For example:s.aero_profile = AeroProfile.PredefinedType(AeroProfile.Urban)
ground_reflectance
– The ground reflectance to use. Should be set to the output of a GroundReflectance method. For example:s.ground_reflectance = GroundReflectance.HomogeneousLambertian(0.3)
geometry
– The geometrical settings, including solar and viewing angles. Should be set to an instance of a Geometry class, which can then have various attributes set. For example:s.geometry = GeometryUser() s.geometry.solar_z = 35 s.geometry.solar_a = 190
altitudes
– The settings for the sensor and target altitudes. This should be set to an instance of theAltitudes()
class, which can then have various attributes set. For example:s.altitudes = Altitudes() s.altitudes.set_target_custom_altitude(2.3) s.altitudes.set_sensor_sea_level()
wavelength
– The wavelength settings. Should be set to the output of theWavelength()
method. For example:s.wavelength = Wavelength(0.550)
atmos_corr
– The settings for whether to perform atmospheric correction or not, and the parameters for this correction. Should be set to the output of a AtmosCorr method. For example:s.atmos_corr = AtmosCorr.AtmosCorrLambertianFromReflectance(0.23)
aot550
– The Aerosol Optical Thickness value (measured at 550nm) to use for the simulation. For examples.aot550 = 0.2
Note: only one of
visibility
oraot550
can be set. When setting one, ensure the other is set toNone
. (By default,s.visibility
is set to None, so just settings.aot550
will work.)visibility
– The visibility value (in km) to use for the simulation. For example:s.visibility = 40
Note: only one of
visibility
oraot550
can be set. When setting one, ensure the other is set toNone
. (By default,s.visibility
is set to None, so to set a visibility value you must also dos.aot550 = None
)mie
– Optional name for a text file to save the results of the MIE subroutine. This only applies if
s.aero_profile
is not aAeroProfile.User
orAeroProfile.PredefinedType
. (By default,s.mie
- is set to None)
-
write_input_file
(filename=None)[source]¶ Generates a 6S input file from the parameters stored in the object and writes it to the given filename.
The input file is guaranteed to be a valid 6S input file which can be run manually if required
-
run
()[source]¶ Runs the 6S model and stores the outputs in the output variable.
May raise an
ExecutionError
if the 6S executable cannot be found.