Package: prosail
PROSAIL Python BindingsJ Gomez-Dans (NCEO & UCL)j.gomez-dans@ucl.ac.ukInstall using AnacondaYou should be able to easily install this using Anaconda (only tested on Linux!) withconda install -c jgomezdans prosailIthinkit might work on both Python 2.7 and 3.6. But I'm only a scientist, so expect car crashes!DescriptionThis repository contains the Python bindings to the PROSPECT and SAIL leaf and
canopy reflectance models, respectively. Both models have been rewritten and
coupled in Python, with some changes to improve on efficiency. The bindings implement
the following models:PROSPECT: versions 5 and D. Flexibility to add/modify leaf absorption profiles.SAIL: FourSAIL version. The thermal extension of the model is also implemented, although this hasn't been widely tested.Simple Lambertian soil reflectance modelI have used as a benchmark the codes available fromJussieu.A recent(ish) review on the use of both RT
models is availabe inthis paper_.Installing the bindingsThe installation of the bindings is quite straightforward: unpack the distribution
and run the following commandpython setup.py installThis assumes that you have the following things installed:NumpyScipyTheLRU_Cache library for Python 2.7NumbaMost of these things can be installed quite easily usingAnaconda Python.
In this case, you can probably just install everything you need withconda install python=2.7 numpy numba scipy
  pip install -U backports.functools_lru_cacheThe bindings should then install without any issue.Using the bindingsOnce you import the bindings into the namespace withimport prosailyou can then run SAIL (using prescribed leaf reflectance and transmittance spectra, as well as canopy structure/soil parameters), PROSPECT and both (e.g. use PROSPECT to provide the spectral leaf optical properties).run_sailTo run SAIl with two element arrays of leaf reflectance and transmittance sampled at 1nm between 400 and 2500 nmrhoandtau, using a black soil (e.g. zero reflectance), you can just dorho_canopy = prosail.run_sail(rho, tau, lai, lidfa, hspot, sza, vza, raa, rsoil0=np.zeros(2101))Here,laiis the LAI,lidfais the mean leaf angle in degrees,hspotis the hotspot parameter,sza,vzaandraaare the solar zenith, sensor zenith and relative azimuth angles, andrsoil0is set to an array of 0s to define the soil reflectance.You have quite a few other options:You can use a different way of specifying the leaf angle distribution (by default we use a Campbell distribution with one single parameter, but you might want to use the Verhoef distribution). The Verhoef distribution is selected by adding the extra keywordtypelidf=1and the two parameters are given bylidfaand the additional optional parameterlidfb.You can use the internal soil spectrum model. This model is basicallyrho_soil = rsoil*(psoil*soil_spectrum1+(1-psoil)*soil_spectrum2). The first spectrum is a dry soil, the second one a wet one. You can also set the spectra using thesoil_spectrum1andsoil_spectrum2keywords.By default, we return the surface directional reflectance, but you can choose other reflectance factors (e.g. BHR, DHR, HDR).run_prospectTo calculate leaf reflectance and transmittance using the PROSPECT model, you can use therun_prospectfunction. You can select either the PROSPECT-5 or PROSPECT-D versions (by default, version 'D' is used). A call to this would look like:lam, rho, tau = prosail.run_prospect(n, cab, car, cbrown, cw, cm, ant=8.0)Where the parameters are all scalars, and have their usual PROSPECT meanings (see table below).antstands for anthocyannins, which isn't present in PROSPECT-5.To do the same for PROSPECT-5...lam, rho, tau = prosail.run_prospect(n, cab, car, cbrown, cw, cm, prospect_version='5')You can change a number of things when calling PROSPECT, but I can't be arsed documenting it now.run_prosailThe marriage of heaven and hell, PROSPECT being fed into SAIL in one go! Same options as the two other functions put together:rho_canopy = prosail.run_prosail(n, cab, car, cbrown, cw, cm, lai, lidfa, hspot, tts, tto, psi, \
                    ant=0.0, alpha=40.0, prospect_version='5', typelidf=2, lidfb=0.0, \
                    factor='SDR', rsoil0=None, rsoil=None, psoil=None, \
                    soil_spectrum1=None, soil_spectrum2=None)The parametersThe parameters used by the models and their units are introduced below:ParameterDescription of parameterUnitsTypical minTypical maxNLeaf structure parameterN/A0.82.5cabChlorophyll a+b concentrationug/cm2080cawEquivalent water thickinesscm0200carCarotenoid concentrationug/cm2020cbrownBrown pigmentNA01cmDry matter contentg/cm20200laiLeaf Area IndexN/A010lidfaLeaf angle distributionN/A--lidfbLeaf angle distributionN/A--psoilDry/Wet soil factorN/A01rsoilSoil brigthness factorN/A--hspotHotspot parameterN/A--ttsSolar zenith angledeg090ttoObserver zenith angledeg090phiRelative azimuth angledeg0360typelidfLeaf angle distribution typeInteger--Specifying the leaf angle distributionThe parametertypelidfregulates the leaf angle distribution family being used. The following options are understood:typelidf = 1: use the two parameter LAD parameterisation, whereaandbcontrol the average leaf slope and the distribution bimodality, respectively. Typical distributions
are given by the following parameter  choices:LIDF typeLIDFaLIDFbPlanophile10Erectophile-10Plagiophile0-1Extremophile01Spherical-0.35-0.15Uniform00typelidf = 2Ellipsoidal distribution, whereLIDFaparameter stands for mean leaf angle (0 degrees is planophile, 90 degrees is erectophile).LIDFbparameter is ignored.The soil modelThe soil model is a fairly simple linear mixture model, where two spectra are mixed and then a brightness term added:rho_soil = rsoil*(psoil*soil_spectrum1+(1-psoil)*soil_spectrum2)The idea is that one of the spectra is a dry soil and the other a wet soil, so soil moisture is then contorlled bypsoil.rsoilis just a brightness scaling term.