No input file writing

Don't spend your time manually writing 6S input files, trying to remember exactly how each option should be specified, and - if you're anything like me - constantly making mistakes. Let Py6S take care of all of this for you, while you focus on the science.

# Write this code
from Py6S import *
s = SixS()
s.atmosprofile = AtmosProfile.UserWaterAndOzone(3.6, 0.9)

# Rather than this input file manually
40.0 100.0 45.0 50.0 7 23
3.6 0.9

Easily run many times

Do you want to run a simulation for multiple wavelengths? Easy - there's a simple function for it. How about iterating over a variety of aerosol parameterisations? Just write a simple for loop. How about building a lookup table from a wide range of possible parameterisations? Yup, that's possible too!

# Run for Visible-NIR wavelengths
# Run for multiple aerosol types
for aero in [AeroProfile.Urban, AeroProfile.Maritime]:
  s.aero_profile = AeroProfile.PredefinedType(aero)
  print s.outputs.apparent_radiance

Use the rest of Python

As Py6S is a Python module, you can use the rest of Python along with all of the Py6S functions. Of course, you can use other Python modules too - anything from plotting graphs with matplotlib, to creating a webapp with Flask.

# Plot previously-generated Py6S results
from matplotlib.pyplot import *
plot(wavelengths, results_1, 'b--')
plot(wavelengths, results_2, 'g--')
# Use PyProSAIL to generate ground reflectance spectrum
import pyprosail
spectrum = pyprosail.run(1.5, 40, 8, 0, 0.01, 0.009, 1, 3, 0.01, 30, 0, 10, 0, pyprosail.Planophile)
s.ground_reflectance = GroundReflectance.HomogeneousLambertian(spectrum)

Import real-world data

Often you'll want to run a simulation of a particular situation in the real-world. Py6S can help you do this, allowing you to import aerosol data (from AERONET), radiosonde data (from various sources) and ground reflectance spectra (from various spectral libraries), as well as to set geometrical parameters based on location and time.

# Import spectrum from ASTER spectral library
s.ground_reflectance = GroundReflectance.HomogeneousLambertian(Spectra.import_from_aster("http://speclib.jpl.nasa.gov/speclibdata/jhu.becknic.vegetation.trees.conifers.solid.conifer.spectrum.txt"))
# Import atmospheric data from U of Wyoming Radiosonde website
s.atmos_profile = SixSHelpers.Radiosonde.import_uow_radiosonde_data("http://weather.uwyo.edu/cgi-bin/sounding?region=europe&TYPE=TEXT%3ALIST&YEAR=2012&MONTH=02&FROM=2712&TO=2712&STNM=03808", AtmosProfile.MidlatitudeWinter)

Automatically run in parallel

6S can take a while to run some complex simulations, which makes running for multiple wavelengths or angles very time-consuming. However, when you use the built-in helper functions to do this, the simulations will automatically be run in parallel. That means, if you've got a quad-core processor, the simulations should be almost four times faster!

# Run for multiple wavelengths with automatic parallelisation
# Run for multiple angles with automatic parallelisation
result = SixSHelpers.Angles.run360(s, 'view', output_name='pixel_reflectance')

More reproducible

Rather than manually writing 6S incomprehensible input files and trying to come up with sensible names for them all, write all of your simulations as simple Python functions using the easy-to-understand Py6S interface. Then, when you come back to the project a year later, you've actually got a chance of understanding what you did!

Directly wraps 6S

You don't need to worry about getting different results using Py6S compared to using 6S manually. They're guaranteed to be exactly the same as Py6S simply writes 6S input files and interprets the output files - using the original 6S executable.

Supports all 6S functions

You can access all of the functionality of 6S from within Py6S. All of the parameter options available in 6S are supported - yes, even the really weird ones that no-one ever uses!