├── pyprosail
├── _prosail_model.so
├── prosail_model.so
├── PROSAIL_5B_Fortran.rar
├── Makefile
├── __init__.py
├── dladgen.f
├── MODULE_PRO4SAIL.f90
├── tav_abs.f90
├── LIDF.f90
├── volscatt.f90
├── PyPROSAIL.py
├── prospect_5B.f90
├── PyPROSAIL.f90
└── PRO4SAIL.f90
├── test.py
├── .gitignore
├── CITATION
├── README.md
├── appveyor.yml
├── setup.py
├── doc
├── make.bat
├── Makefile
├── index.rst
└── conf.py
├── COPYING.LESSER
└── COPYING
/pyprosail/_prosail_model.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/robintw/PyProSAIL/HEAD/pyprosail/_prosail_model.so
--------------------------------------------------------------------------------
/pyprosail/prosail_model.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/robintw/PyProSAIL/HEAD/pyprosail/prosail_model.so
--------------------------------------------------------------------------------
/pyprosail/PROSAIL_5B_Fortran.rar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/robintw/PyProSAIL/HEAD/pyprosail/PROSAIL_5B_Fortran.rar
--------------------------------------------------------------------------------
/test.py:
--------------------------------------------------------------------------------
1 | import pyprosail
2 |
3 | res = pyprosail.run(1.5, 40, 8, 0, 0.01, 0.009, 1, 3, 0.01, 30, 0, 10, 0, pyprosail.Planophile)
4 | print res
--------------------------------------------------------------------------------
/pyprosail/Makefile:
--------------------------------------------------------------------------------
1 | mod:
2 | f2py -c -m prosail_model MODULE_PRO4SAIL.f90 dataSpec_P5B.f90 LIDF.f90 dladgen.f PRO4SAIL.f90 prospect_5B.f90 tav_abs.f90 volscatt.f90 PyPROSAIL.f90
--------------------------------------------------------------------------------
/pyprosail/__init__.py:
--------------------------------------------------------------------------------
1 | """A module that allows easy running of the ProSAIL (PROSPECT + SAIL) leaf and canopy
2 | reflectance model.
3 |
4 | The main function is `run`, which runs the ProSAIL model and returns the results as an array.
5 |
6 | """
7 |
8 | from .PyProSAIL import *
9 | #__all__ = ['PyPROSAIL']
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | tmp_in.txt
2 | *tmp.in*
3 | *.pyc
4 | .redcar
5 | build/*
6 | dist/*
7 | doc/build/*
8 | */._redcar/*
9 | ._redcar/
10 | Output.txt
11 | Py6S.egg-info
12 | OutputsJ.txt
13 | src/GetSpectra.py
14 | src/Test.py
15 | Py6S/build
16 | CHL
17 | *.mie
18 | *.png
19 | .ropeproject
20 | /doc/_build/*
21 | *.pyd
22 | MANIFEST
23 |
--------------------------------------------------------------------------------
/CITATION:
--------------------------------------------------------------------------------
1 | If you use PyProSAIL in your academic work then please cite it as follows:
2 |
3 | Wilson, R. T., PyProSAIL, Available from https://github.com/robintw/PyProSAIL
4 |
5 | In BibTeX format:
6 |
7 | @electronic{,
8 | author = {Wilson, R. T.},
9 | year = {2013},
10 | title = {PyProSAIL},
11 | url = {https://github.com/robintw/PyProSAIL}
12 | }
13 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # PyProSAIL
2 |
3 | **This version of PyProSAIL is no longer supported. Please use [this version](https://github.com/EOA-team/PyProSAIL) instead.**
4 |
5 | PyProSAIL is a Python interface to the ProSAIL combined leaf and canopy optical model.
6 |
7 | This Pyhon interface (note: not the ProSAIL model itself) is released under the GNU Lesser General Public License.
8 |
9 | For more information see http://pyprosail.readthedocs.org.
10 |
--------------------------------------------------------------------------------
/pyprosail/dladgen.f:
--------------------------------------------------------------------------------
1 | subroutine dladgen(a,b,freq)
2 | c
3 | real*8 a,b,freq(13),t
4 | real*8 dcum
5 | c
6 | do i1=1,8
7 | t=i1*10.
8 | freq(i1)=dcum(a,b,t)
9 | end do
10 | c
11 | do i2=9,12
12 | t=80.+(i2-8)*2.
13 | freq(i2)=dcum(a,b,t)
14 | end do
15 | c
16 | freq(13)=1.
17 | c
18 | do i=13,2,-1
19 | freq(i)=freq(i)-freq(i-1)
20 | end do
21 | c
22 | return
23 | end
24 |
25 |
26 | function dcum(a,b,t)
27 | c
28 | real*8 a,b,t,pi,rd,eps,delx,p,y,x,dx,dcum
29 | pi=atan(1.)*4.
30 | rd=pi/180.
31 |
32 | if (a.gt.1.) then
33 | c
34 | dcum=1.-cos(rd*t)
35 | c
36 | else
37 |
38 | eps=1.e-8
39 | delx=1.
40 | c
41 | x=2*rd*t
42 | p=x
43 | c
44 | do while (delx.gt.eps)
45 | y = a*sin(x)+.5*b*sin(2.*x)
46 | dx=.5*(y-x+p)
47 | x=x+dx
48 | delx=abs(dx)
49 | end do
50 | c
51 | dcum=(2.*y+p)/pi
52 | c
53 | endif
54 | c
55 | return
56 | end
57 |
--------------------------------------------------------------------------------
/pyprosail/MODULE_PRO4SAIL.f90:
--------------------------------------------------------------------------------
1 | MODULE MOD_ANGLE
2 | REAL*8,SAVE :: pi,rd
3 | END MODULE
4 |
5 | !*********************
6 |
7 | MODULE MOD_staticvar
8 | REAL*8,SAVE :: cts,cto,ctscto
9 | REAL*8,SAVE :: ddb,ddf,dob,dof,dso
10 | REAL*8,SAVE :: ko,ks,sdb,sdf
11 | REAL*8,SAVE :: sob,sof,sumint
12 | REAL*8,ALLOCATABLE,SAVE :: sb(:),sf(:),vb(:),vf(:),w(:)
13 | REAL*8,ALLOCATABLE,SAVE :: m(:),m2(:),att(:),sigb(:),rinf(:),lidf(:)
14 | END MODULE
15 |
16 | !*********************
17 |
18 | MODULE MOD_output_PROSPECT
19 | REAL*8,ALLOCATABLE,SAVE :: LRT(:,:),rho(:),tau(:)
20 | END MODULE
21 |
22 | !*********************
23 |
24 | MODULE MOD_flag_util
25 | LOGICAL flag(7),init_completed,init_completed0
26 | LOGICAL delta_geom,delta_lai,delta_hot,delta_leaf,delta_skyl,delta_soil,delta_lidf
27 | REAL*8,ALLOCATABLE,SAVE :: lidf_old(:),rsoil_old(:)
28 | REAL*8,SAVE :: N_old,Cab_old,Car_old,Cbrown_old,Cw_old,Cm_old
29 | REAL*8,SAVE :: LIDFa_old,LIDFb_old,lai_old,q_old,skyl_old
30 | REAL*8,SAVE :: tts_old,tto_old,psi_old
31 | END MODULE
32 |
33 | !*********************
34 |
35 | MODULE MOD_SAIL
36 | REAL*8,SAVE :: tss,too,tsstoo
37 | REAL*8,ALLOCATABLE,SAVE :: tso(:),tsd(:),tdd(:),tdo(:),rsd(:),rdd(:),rso(:),rdo(:)
38 | REAL*8,ALLOCATABLE,SAVE :: rsos(:),rsod(:),rddt(:),rsdt(:),rdot(:),rsodt(:),rsost(:),rsot(:)
39 | END MODULE
40 |
41 | !*********************
--------------------------------------------------------------------------------
/appveyor.yml:
--------------------------------------------------------------------------------
1 | environment:
2 | matrix:
3 | - PYTHON_VERSION: "2.7"
4 | - PYTHON_VERSION: "3.4"
5 |
6 | platform:
7 | - x86
8 | - x64
9 |
10 | matrix:
11 | fast_finish: true
12 |
13 | install:
14 | - set PATH=C:\Miniconda\Scripts
15 | - ps: If ($env:Platform -Match "x64") {$env:PATH="C:\Miniconda-x64\Scripts"}
16 | - conda config --set always_yes yes --set changeps1 no
17 | - conda update -q conda
18 | - conda create -q --name python%PYTHON_VERSION% python=%PYTHON_VERSION%
19 | - activate python%PYTHON_VERSION%
20 | - pip install -i https://pypi.anaconda.org/carlkl/simple mingwpy
21 | - conda install -q --name python%PYTHON_VERSION% setuptools numpy matplotlib nose pandas wheel scipy
22 | - python.exe setup.py config_fc
23 | - python.exe setup.py config --compiler=mingw32 --fcompiler=gfortran
24 | - python.exe setup.py build --compiler=mingw32
25 | - python.exe setup.py install
26 |
27 | build: off
28 |
29 | after_test:
30 | # This step builds your wheels.
31 | - python.exe setup.py bdist
32 | - python.exe setup.py sdist
33 |
34 | artifacts:
35 | # bdist_wheel puts your built wheel in the dist directory
36 | - path: dist\*
37 |
38 | #on_success:
39 | # You can use this step to upload your artifacts to a public website.
40 | # See Appveyor's documentation for more details. Or you can simply
41 | # access your wheels from the Appveyor "artifacts" tab for your build.
42 |
--------------------------------------------------------------------------------
/setup.py:
--------------------------------------------------------------------------------
1 | # File setup.py
2 | def configuration(parent_package='',top_path=None):
3 | from numpy.distutils.misc_util import Configuration
4 | config = Configuration('',parent_package,top_path,
5 | name = "PyPROSAIL",
6 | version = "1.0.1",
7 | description = """PyProSAIL is a Python interface to the ProSAIL combined leaf and canopy optical model.
8 | For more information see http://pyprosail.readthedocs.org.""",
9 | packages = ['pyprosail'],
10 | author = "Robin Wilson",
11 | author_email = "robin@rtwilson.com",
12 | url = "http://packages.python.org/PyPROSAIL",
13 | classifiers =[
14 | "Development Status :: 5 - Production/Stable",
15 | "Intended Audience :: Science/Research",
16 | "Topic :: Scientific/Engineering :: Atmospheric Science",
17 | "Topic :: Scientific/Engineering :: Physics",
18 | "Topic :: Software Development :: Libraries :: Python Modules",
19 | "License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)",
20 | "Programming Language :: Python"
21 |
22 | ])
23 |
24 | config.add_extension('_prosail_model',
25 | sources = ['./pyprosail/MODULE_PRO4SAIL.f90', './pyprosail/dataSpec_P5B.f90',
26 | './pyprosail/LIDF.f90', './pyprosail/dladgen.f', './pyprosail/PRO4SAIL.f90',
27 | './pyprosail/prospect_5B.f90', './pyprosail/tav_abs.f90', './pyprosail/volscatt.f90',
28 | './pyprosail/PyPROSAIL.f90'])
29 | return config
30 |
31 | if __name__ == "__main__":
32 | from numpy.distutils.core import setup
33 | setup(**configuration(top_path='').todict())
34 |
--------------------------------------------------------------------------------
/pyprosail/tav_abs.f90:
--------------------------------------------------------------------------------
1 | ! ********************************************************************************
2 | ! tav_abs.f90
3 | ! ********************************************************************************
4 | ! computation of the average transmittivity at the leaf surface within a given
5 | ! solid angle. teta is the incidence solid angle (in radian). The average angle
6 | ! that works in most cases is 40deg*pi/180. ref is the refaction index.
7 | ! ********************************************************************************
8 | ! Stern F. (1964), Transmission of isotropic radiation across an interface between
9 | ! two dielectrics, Applied Optics, 3:111-113.
10 | ! Allen W.A. (1973), Transmission of isotropic light across a dielectric surface in
11 | ! two and three dimensions, Journal of the Optical Society of America, 63:664-666.
12 | ! ********************************************************************************
13 | ! version 5.02 (25 July 2011)
14 | ! ********************************************************************************
15 |
16 | subroutine tav_abs(theta,refr,res)
17 |
18 | USE MOD_dataSpec_P5B
19 | IMPLICIT none
20 |
21 | REAL*8, intent(in) :: theta, refr(nw)
22 | REAL*8, intent(out) :: res(nw)
23 |
24 | REAL*8 :: pi, thetarad
25 | REAL*8 :: refr2(nw)
26 | REAL*8 :: ax(nw),bx(nw),b0(nw),b1(nw),b2(nw)
27 | REAL*8 :: ts(nw),tp(nw),tp1(nw),tp2(nw),tp3(nw),tp4(nw),tp5(nw)
28 |
29 | pi=atan(1.)*4.
30 | thetarad=pi*theta/180.
31 |
32 | if (theta.eq.0.) then
33 | res=4.*refr/(refr+1.)**2
34 | return
35 | endif
36 |
37 | refr2=refr*refr
38 | ax=(refr+1.)**2/2.
39 | bx=-(refr2-1.)**2/4.
40 |
41 | if (thetarad.eq.pi/2.) then
42 | b1=0.
43 | else
44 | b1=dsqrt((sin(thetarad)**2-(refr2+1.)/2.)**2+bx)
45 | endif
46 | b2=sin(thetarad)**2-(refr2+1.)/2.
47 | b0=b1-b2
48 | ts=(bx**2/(6.*b0**3)+bx/b0-b0/2.)-(bx**2/(6.*ax**3)+bx/ax-ax/2.)
49 | tp1=-2.*refr2*(b0-ax)/(refr2+1.)**2
50 | tp2=-2.*refr2*(refr2+1.)*dlog(b0/ax)/(refr2-1.)**2
51 | tp3=refr2*(1./b0-1./ax)/2.
52 | tp4=16.*refr2**2*(refr2**2+1.)*dlog((2.*(refr2+1.)*b0-(refr2-1.)**2)/ &
53 | (2.*(refr2+1.)*ax-(refr2-1.)**2))/((refr2+1.)**3*(refr2-1.)**2)
54 | tp5=16.*refr2**3*(1./(2.*(refr2+1.)*b0-((refr2-1.)**2))-1./(2.*(refr2+1.) &
55 | *ax-(refr2-1.)**2))/(refr2+1.)**3
56 | tp=tp1+tp2+tp3+tp4+tp5
57 | res=(ts+tp)/(2.*sin(thetarad)**2)
58 |
59 | return
60 | end
61 |
--------------------------------------------------------------------------------
/pyprosail/LIDF.f90:
--------------------------------------------------------------------------------
1 | !********************************************************************************
2 | !* Campbell.f
3 | !*
4 | !* Computation of the leaf angle distribution function value (freq)
5 | !* Ellipsoidal distribution function caracterised by the average leaf
6 | !* inclination angle in degree (ala)
7 | !* Campbell 1986
8 | !*
9 | !********************************************************************************
10 |
11 | SUBROUTINE campbell(n,ala,freq)
12 |
13 | IMPLICIT NONE
14 |
15 | INTEGER*4 :: i,n
16 | REAL*8 :: ala,freq(n),dum
17 | REAL*8 :: excent,tl1(n),tl2(n),x1,x2,alpha,alpha2
18 | REAL*8 :: tx1(13),tx2(13)
19 | REAL*8 :: x12,x22,almx1,almx2,alpx1,alpx2,sum0
20 | DATA tx2 /0, 10, 20, 30, 40, 50, 60, 70, 80, 82, 84, 86, 88/
21 | DATA tx1 /10, 20, 30, 40, 50, 60, 70, 80, 82, 84, 86, 88, 90/
22 |
23 | DO i=1,n
24 | tl1(i)=tx1(i)*ATAN(1.)/45.
25 | tl2(i)=tx2(i)*ATAN(1.)/45.
26 | ENDDO
27 | excent=EXP(-1.6184e-5*ala**3+2.1145e-3*ala**2-1.2390e-1*ala+3.2491)
28 | sum0 = 0.
29 | DO i=1,n
30 | x1 = excent/(SQRT(1.+excent**2*TAN(tl1(i))**2))
31 | x2 = excent/(SQRT(1.+excent**2*TAN(tl2(i))**2))
32 | IF (excent.eq.1.) THEN
33 | freq(i) = ABS(COS(tl1(i))-COS(tl2(i)))
34 | ELSE
35 | alpha = excent/SQRT(ABS(1.-excent**2))
36 | alpha2 = alpha**2
37 | x12 = x1**2
38 | x22 = x2**2
39 | IF (excent.gt.1) THEN
40 | alpx1 = SQRT(alpha2+x12)
41 | alpx2 = SQRT(alpha2+x22)
42 | dum = x1*alpx1+alpha2*LOG(x1+alpx1)
43 | freq(i) = ABS(dum-(x2*alpx2+alpha2*LOG(x2+alpx2)))
44 | ELSE
45 | almx1 = SQRT(alpha2-x12)
46 | almx2 = SQRT(alpha2-x22)
47 | dum = x1*almx1+alpha2*ASIN(x1/alpha)
48 | freq(i) = ABS(dum-(x2*almx2+alpha2*ASIN(x2/alpha)))
49 | ENDIF
50 | ENDIF
51 | sum0 = sum0+freq(i)
52 | ENDDO
53 | DO i=1,n
54 | freq(i)=freq(i)/sum0 !*100.
55 | ENDDO
56 |
57 | RETURN
58 | END SUBROUTINE
59 |
60 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
61 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
62 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
63 |
64 | SUBROUTINE calc_LIDF_ellipsoidal(na,alpha,freqvar)
65 | IMPLICIT NONE
66 |
67 | INTEGER*4 :: na,ia,icou,k
68 | REAL*8 :: opt,bemu,benu,alphadeg,alpha,freqvar(na),freq(na),pi
69 | !...............................................................................
70 | ! Call leaf angle distribution fonction
71 | !...............................................................................
72 |
73 | alphadeg=alpha
74 |
75 | CALL campbell(na,alphadeg,freq)
76 | DO ia=1,na
77 | freqvar(ia)=freq(ia)
78 | ENDDO
79 |
80 | RETURN
81 | END SUBROUTINE
82 |
--------------------------------------------------------------------------------
/pyprosail/volscatt.f90:
--------------------------------------------------------------------------------
1 | SUBROUTINE volscatt(tts,tto,psi,ttl,chi_s,chi_o,frho,ftau)
2 |
3 | !********************************************************************************
4 | !* tts = solar zenith
5 | !* tto = viewing zenith
6 | !* psi = azimuth
7 | !* ttl = leaf inclination angle
8 | !* chi_s = interception functions
9 | !* chi_o = interception functions
10 | !* frho = function to be multiplied by leaf reflectance rho
11 | !* ftau = functions to be multiplied by leaf transmittance tau
12 | !********************************************************************************
13 |
14 | ! Compute volume scattering functions and interception coefficients
15 | ! for given solar zenith, viewing zenith, azimuth and leaf inclination angle.
16 |
17 | ! chi_s and chi_o are the interception functions.
18 | ! frho and ftau are the functions to be multiplied by leaf reflectance rho and
19 | ! leaf transmittance tau, respectively, in order to obtain the volume scattering
20 | ! function.
21 |
22 | ! Wout Verhoef, april 2001, for CROMA
23 |
24 | USE MOD_ANGLE
25 | IMPLICIT NONE
26 |
27 | REAL*8,INTENT(in) :: tts,tto,psi,ttl
28 | REAL*8,INTENT(inout) :: chi_s,chi_o,frho,ftau
29 |
30 | REAL*8 costs,costo,sints,sinto,cospsi
31 | REAL*8 psir
32 | REAL*8 costl,sintl,cs,co,ss,so,ds
33 | REAL*8 cosbts,cosbto,bts,bto
34 | REAL*8 btran1,btran2,bt1,bt2,bt3,t1,t2
35 | REAL*8 doo,denom
36 |
37 | costs=COS(rd*tts)
38 | costo=COS(rd*tto)
39 | sints=SIN(rd*tts)
40 | sinto=SIN(rd*tto)
41 | cospsi=COS(rd*psi)
42 |
43 | psir=rd*psi
44 |
45 | costl=COS(rd*ttl)
46 | sintl=SIN(rd*ttl)
47 | cs=costl*costs
48 | co=costl*costo
49 | ss=sintl*sints
50 | so=sintl*sinto
51 |
52 | !c ..............................................................................
53 | !c betas -bts- and betao -bto- computation
54 | !c Transition angles (beta) for solar (betas) and view (betao) directions
55 | !c if thetav+thetal>pi/2, bottom side of the leaves is observed for leaf azimut
56 | !c interval betao+phi.
16 |
17 | from . import _prosail_model
18 | import numpy as np
19 |
20 | # Common leaf distributions
21 | Planophile = (1, 0)
22 | Erectophile = (-1, 0)
23 | Plagiophile = (0, -1)
24 | Extremophile = (0, 1)
25 | Spherical = (-0.35, -0.15)
26 | Uniform = (0, 0)
27 |
28 | def run(N, chloro, caroten, brown, EWT, LMA, psoil, LAI, hot_spot, solar_zenith, solar_azimuth, view_zenith, view_azimuth, LIDF):
29 | """
30 | Runs the ProSAIL model with the given parameters and returns a wavelength-reflectance
31 | array.
32 |
33 | Arguments:
34 |
35 | * ``N`` -- Structure co-efficient
36 | * ``chloro`` -- Chlorophyll content (ug per cm^2)
37 | * ``caroten`` -- Carotenoid content (ug per cm^2)
38 | * ``brown`` -- Brown pigment content (arbitrary units)
39 | * ``EWT`` -- Equivalent Water Thickness (cm)
40 | * ``LMA`` -- Leaf Mass per unit area (g per cm^2)
41 | * ``soil_reflectance`` -- Soil reflectance: wet soil = 0, dry soil = 1
42 | * ``LAI`` -- Leaf Area Index
43 | * ``hot_spot`` -- Hot spot parameter
44 | * ``solar_zenith`` -- Solar zenith angle (degrees)
45 | * ``solar_azimuth`` -- Solar azimuth angle (degrees)
46 | * ``view_zenith`` -- View zenith angle (degrees)
47 | * ``view_azimuth`` -- View azimuth angle (degrees)
48 | * ``LIDF`` -- Leaf distibution function parameter(s) (see below)
49 |
50 | The leaf distribution function parameter(s) argument can be either:
51 |
52 | * A single number giving the average leaf angle (in degrees) for an elipsoidal distribution. 0 is planophile and 90 is erectophile.
53 | * A tuple giving (average leaf slope, bimodality parameter). These parameters must sum to be less than 1.0. For
54 | convenience a number of predefined options are given including:
55 |
56 | * Planophile
57 | * Erectophile
58 | * Plagiophile
59 | * Extremophile
60 | * Spherical
61 | * Uniform
62 |
63 | Examples of valid values for the leaf distribution function parameter include:
64 |
65 | * 30 (a 30 degree average leaf angle)
66 | * (0, -1) (an average leaf slope of 0 and a bimodality parameter of -1)
67 | * PyProsail.Planophile
68 |
69 | Example usage:
70 |
71 |
72 |
73 | """
74 |
75 | try:
76 | l = len(LIDF)
77 | if l != 2:
78 | # Raise error
79 | pass
80 |
81 | TypeLidf = 1
82 | LIDFa = LIDF[0]
83 | LIDFb = LIDF[1]
84 | except TypeError:
85 | TypeLidf = 2
86 | LIDFa = LIDF
87 | LIDFb = 0
88 |
89 | return(_run_prosail(N, chloro, caroten, brown, EWT, LMA, psoil, LAI, hot_spot, solar_zenith, view_zenith, solar_azimuth, TypeLidf, LIDFa, LIDFb))
90 |
91 | def _run_prosail(N, Cab, Car, Cbrown, Cw, Cm, psoil, LAI, hspot, tts, tto, psi, TypeLidf, LIDFa, LIDFb):
92 | # Check parameters here
93 |
94 | # TypeLidf must be either 1 or 2
95 | if TypeLidf not in [1, 2]:
96 | # Raise exception
97 | pass
98 |
99 | if TypeLidf == 1 and LIDFa + LIDFb > 1:
100 | # Raise exception
101 | pass
102 |
103 | wavelengths = np.arange(400, 2501)
104 | res = _prosail_model.run(N, Cab, Car, Cbrown, Cw, Cm, psoil, LAI, hspot, tts, tto, psi, TypeLidf, LIDFa, LIDFb)
105 |
106 | arr = np.transpose(np.vstack( (wavelengths/1000.0, res) ))
107 | return arr
--------------------------------------------------------------------------------
/pyprosail/prospect_5B.f90:
--------------------------------------------------------------------------------
1 | ! ********************************************************************************
2 | ! prospect_5B.f90
3 | ! ********************************************************************************
4 | !
5 | ! Jean-Baptiste FERET
6 | !
7 | ! Department of Global Ecology / Carnegie Institution for Sciences
8 | ! 260 Panama Street
9 | ! Stanford, CA 94305, USA
10 | ! E-mail: jbferet@stanford.edu
11 | !
12 | ! Stephane JACQUEMOUD
13 | !
14 | ! Universite Paris Diderot / Institut de Physique du Globe de Paris
15 | ! 35 rue Helene Brion
16 | ! 75013 Paris, France
17 | ! E-mail: jacquemoud@ipgp.fr
18 | !
19 | ! http://teledetection.ipgp.fr/prosail/
20 | !
21 | ! ********************************************************************************
22 | ! Feret J.B., Francois C., Asner G.P., Gitelson A.A., Martin R.E., Bidel L.P.R.,
23 | ! Ustin S.L., le Maire G., Jacquemoud S. (2008), PROSPECT-4 and 5: Advances in the
24 | ! leaf optical properties model separating photosynthetic pigments, Remote Sensing
25 | ! of Environment, 112:3030-3043.
26 | ! Jacquemoud S., Ustin S.L., Verdebout J., Schmuck G., Andreoli G., Hosgood B.
27 | ! (1996), Estimating leaf biochemistry using the PROSPECT leaf optical properties
28 | ! model, Remote Sensing of Environment, 56:194-202.
29 | ! Jacquemoud S., Baret F. (1990), PROSPECT: a model of leaf optical properties
30 | ! spectra, Remote Sensing of Environment, 34:75-91.
31 | ! ********************************************************************************
32 | ! version 5.02 (25 July 2011)
33 | ! ********************************************************************************
34 |
35 | SUBROUTINE prospect_5B(N,Cab,Car,Cbrown,Cw,Cm,RT)
36 |
37 | USE MOD_dataSpec_P5B
38 | IMPLICIT none
39 |
40 | REAL*8, intent(in) :: N,Cab,Car,Cbrown,Cw,Cm
41 | REAL*8, intent(out) :: RT(nw,2)
42 |
43 | REAL*8 :: k(nw), tau(nw), xx(nw), yy(nw)
44 | REAL*8 :: x1(nw),x2(nw),x3(nw),x4(nw),x5(nw),x6(nw)
45 | REAL*8 :: theta1, theta2, t1(nw),t2(nw)
46 | REAL*8 :: r(nw),t(nw),ra(nw),ta(nw)
47 | REAL*8 :: delta(nw),beta(nw),va(nw),vb(nw),s1(nw),s2(nw),s3(nw)
48 |
49 | k=(Cab*k_Cab+Car*k_Car+Cbrown*k_Brown+Cw*k_Cw+Cm*k_Cm)/N
50 |
51 | ! ********************************************************************************
52 | ! reflectance and transmittance of one layer
53 | ! ********************************************************************************
54 | ! Allen W.A., Gausman H.W., Richardson A.J., Thomas J.R. (1969), Interaction of
55 | ! isotropic ligth with a compact plant leaf, Journal of the Optical Society of
56 | ! American, 59:1376-1379.
57 | ! ********************************************************************************
58 |
59 | ! exponential integral: S13AAF routine from the NAG library
60 |
61 | where (k.le.0.0)
62 | tau=1
63 | end where
64 | where (k.gt.0.0.and.k.le.4.0)
65 | xx=0.5*k-1.0
66 | yy=(((((((((((((((-3.60311230482612224d-13 &
67 | *xx+3.46348526554087424d-12)*xx-2.99627399604128973d-11) &
68 | *xx+2.57747807106988589d-10)*xx-2.09330568435488303d-9) &
69 | *xx+1.59501329936987818d-8)*xx-1.13717900285428895d-7) &
70 | *xx+7.55292885309152956d-7)*xx-4.64980751480619431d-6) &
71 | *xx+2.63830365675408129d-5)*xx-1.37089870978830576d-4) &
72 | *xx+6.47686503728103400d-4)*xx-2.76060141343627983d-3) &
73 | *xx+1.05306034687449505d-2)*xx-3.57191348753631956d-2) &
74 | *xx+1.07774527938978692d-1)*xx-2.96997075145080963d-1
75 | yy=(yy*xx+8.64664716763387311d-1)*xx+7.42047691268006429d-1
76 | yy=yy-log(k)
77 | tau=(1.0-k)*dexp(-k)+k**2*yy
78 | end where
79 | where (k.gt.4.0.and.k.le.85.0)
80 | xx=14.5/(k+3.25)-1.0
81 | yy=(((((((((((((((-1.62806570868460749d-12 &
82 | *xx-8.95400579318284288d-13)*xx-4.08352702838151578d-12) &
83 | *xx-1.45132988248537498d-11)*xx-8.35086918940757852d-11) &
84 | *xx-2.13638678953766289d-10)*xx-1.10302431467069770d-9) &
85 | *xx-3.67128915633455484d-9)*xx-1.66980544304104726d-8) &
86 | *xx-6.11774386401295125d-8)*xx-2.70306163610271497d-7) &
87 | *xx-1.05565006992891261d-6)*xx-4.72090467203711484d-6) &
88 | *xx-1.95076375089955937d-5)*xx-9.16450482931221453d-5) &
89 | *xx-4.05892130452128677d-4)*xx-2.14213055000334718d-3
90 | yy=((yy*xx-1.06374875116569657d-2)*xx-8.50699154984571871d-2)*xx+9.23755307807784058d-1
91 | yy=exp(-k)*yy/k
92 | tau=(1.0-k)*dexp(-k)+k**2*yy
93 | end where
94 | where (k.gt.85.0)
95 | tau=0
96 | end where
97 |
98 | ! transmissivity of the layer
99 |
100 | theta1=90.
101 | call tav_abs(theta1,refractive,t1)
102 | theta2=40.
103 | call tav_abs(theta2,refractive,t2)
104 | x1=1-t1
105 | x2=t1**2*tau**2*(refractive**2-t1)
106 | x3=t1**2*tau*refractive**2
107 | x4=refractive**4-tau**2*(refractive**2-t1)**2
108 | x5=t2/t1
109 | x6=x5*(t1-1)+1-t2
110 | r=x1+x2/x4
111 | t=x3/x4
112 | ra=x5*r+x6
113 | ta=x5*t
114 |
115 | ! ********************************************************************************
116 | ! reflectance and transmittance of N layers
117 | ! ********************************************************************************
118 | ! Stokes G.G. (1862), On the intensity of the light reflected from or transmitted
119 | ! through a pile of plates, Proceedings of the Royal Society of London, 11:545-556.
120 | ! ********************************************************************************
121 |
122 | delta=(t**2-r**2-1)**2-4*r**2
123 | beta=(1+r**2-t**2-sqrt(delta))/(2*r)
124 | va=(1+r**2-t**2+sqrt(delta))/(2*r)
125 | vb=sqrt(beta*(va-r)/(va*(beta-r)))
126 | s1=ra*(va*vb**(N-1)-va**(-1)*vb**(-(N-1)))+(ta*t-ra*r)*(vb**(N-1)-vb**(-(N-1)))
127 | s2=ta*(va-va**(-1))
128 | s3=va*vb**(N-1)-va**(-1)*vb**(-(N-1))-r*(vb**(N-1)-vb**(-(N-1)))
129 | RT(:,1)=s1/s3
130 | RT(:,2)=s2/s3
131 |
132 | end subroutine
133 |
--------------------------------------------------------------------------------
/doc/make.bat:
--------------------------------------------------------------------------------
1 | @ECHO OFF
2 |
3 | REM Command file for Sphinx documentation
4 |
5 | if "%SPHINXBUILD%" == "" (
6 | set SPHINXBUILD=sphinx-build
7 | )
8 | set BUILDDIR=_build
9 | set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
10 | set I18NSPHINXOPTS=%SPHINXOPTS% .
11 | if NOT "%PAPER%" == "" (
12 | set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
13 | set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
14 | )
15 |
16 | if "%1" == "" goto help
17 |
18 | if "%1" == "help" (
19 | :help
20 | echo.Please use `make ^` where ^ is one of
21 | echo. html to make standalone HTML files
22 | echo. dirhtml to make HTML files named index.html in directories
23 | echo. singlehtml to make a single large HTML file
24 | echo. pickle to make pickle files
25 | echo. json to make JSON files
26 | echo. htmlhelp to make HTML files and a HTML help project
27 | echo. qthelp to make HTML files and a qthelp project
28 | echo. devhelp to make HTML files and a Devhelp project
29 | echo. epub to make an epub
30 | echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
31 | echo. text to make text files
32 | echo. man to make manual pages
33 | echo. texinfo to make Texinfo files
34 | echo. gettext to make PO message catalogs
35 | echo. changes to make an overview over all changed/added/deprecated items
36 | echo. linkcheck to check all external links for integrity
37 | echo. doctest to run all doctests embedded in the documentation if enabled
38 | goto end
39 | )
40 |
41 | if "%1" == "clean" (
42 | for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
43 | del /q /s %BUILDDIR%\*
44 | goto end
45 | )
46 |
47 | if "%1" == "html" (
48 | %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
49 | if errorlevel 1 exit /b 1
50 | echo.
51 | echo.Build finished. The HTML pages are in %BUILDDIR%/html.
52 | goto end
53 | )
54 |
55 | if "%1" == "dirhtml" (
56 | %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
57 | if errorlevel 1 exit /b 1
58 | echo.
59 | echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
60 | goto end
61 | )
62 |
63 | if "%1" == "singlehtml" (
64 | %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
65 | if errorlevel 1 exit /b 1
66 | echo.
67 | echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
68 | goto end
69 | )
70 |
71 | if "%1" == "pickle" (
72 | %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
73 | if errorlevel 1 exit /b 1
74 | echo.
75 | echo.Build finished; now you can process the pickle files.
76 | goto end
77 | )
78 |
79 | if "%1" == "json" (
80 | %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
81 | if errorlevel 1 exit /b 1
82 | echo.
83 | echo.Build finished; now you can process the JSON files.
84 | goto end
85 | )
86 |
87 | if "%1" == "htmlhelp" (
88 | %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
89 | if errorlevel 1 exit /b 1
90 | echo.
91 | echo.Build finished; now you can run HTML Help Workshop with the ^
92 | .hhp project file in %BUILDDIR%/htmlhelp.
93 | goto end
94 | )
95 |
96 | if "%1" == "qthelp" (
97 | %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
98 | if errorlevel 1 exit /b 1
99 | echo.
100 | echo.Build finished; now you can run "qcollectiongenerator" with the ^
101 | .qhcp project file in %BUILDDIR%/qthelp, like this:
102 | echo.^> qcollectiongenerator %BUILDDIR%\qthelp\PyProSAIL.qhcp
103 | echo.To view the help file:
104 | echo.^> assistant -collectionFile %BUILDDIR%\qthelp\PyProSAIL.ghc
105 | goto end
106 | )
107 |
108 | if "%1" == "devhelp" (
109 | %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
110 | if errorlevel 1 exit /b 1
111 | echo.
112 | echo.Build finished.
113 | goto end
114 | )
115 |
116 | if "%1" == "epub" (
117 | %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
118 | if errorlevel 1 exit /b 1
119 | echo.
120 | echo.Build finished. The epub file is in %BUILDDIR%/epub.
121 | goto end
122 | )
123 |
124 | if "%1" == "latex" (
125 | %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
126 | if errorlevel 1 exit /b 1
127 | echo.
128 | echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
129 | goto end
130 | )
131 |
132 | if "%1" == "text" (
133 | %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
134 | if errorlevel 1 exit /b 1
135 | echo.
136 | echo.Build finished. The text files are in %BUILDDIR%/text.
137 | goto end
138 | )
139 |
140 | if "%1" == "man" (
141 | %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
142 | if errorlevel 1 exit /b 1
143 | echo.
144 | echo.Build finished. The manual pages are in %BUILDDIR%/man.
145 | goto end
146 | )
147 |
148 | if "%1" == "texinfo" (
149 | %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
150 | if errorlevel 1 exit /b 1
151 | echo.
152 | echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
153 | goto end
154 | )
155 |
156 | if "%1" == "gettext" (
157 | %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
158 | if errorlevel 1 exit /b 1
159 | echo.
160 | echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
161 | goto end
162 | )
163 |
164 | if "%1" == "changes" (
165 | %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
166 | if errorlevel 1 exit /b 1
167 | echo.
168 | echo.The overview file is in %BUILDDIR%/changes.
169 | goto end
170 | )
171 |
172 | if "%1" == "linkcheck" (
173 | %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
174 | if errorlevel 1 exit /b 1
175 | echo.
176 | echo.Link check complete; look for any errors in the above output ^
177 | or in %BUILDDIR%/linkcheck/output.txt.
178 | goto end
179 | )
180 |
181 | if "%1" == "doctest" (
182 | %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
183 | if errorlevel 1 exit /b 1
184 | echo.
185 | echo.Testing of doctests in the sources finished, look at the ^
186 | results in %BUILDDIR%/doctest/output.txt.
187 | goto end
188 | )
189 |
190 | :end
191 |
--------------------------------------------------------------------------------
/doc/Makefile:
--------------------------------------------------------------------------------
1 | # Makefile for Sphinx documentation
2 | #
3 |
4 | # You can set these variables from the command line.
5 | SPHINXOPTS =
6 | SPHINXBUILD = sphinx-build
7 | PAPER =
8 | BUILDDIR = _build
9 |
10 | # Internal variables.
11 | PAPEROPT_a4 = -D latex_paper_size=a4
12 | PAPEROPT_letter = -D latex_paper_size=letter
13 | ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
14 | # the i18n builder cannot share the environment and doctrees with the others
15 | I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
16 |
17 | .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
18 |
19 | help:
20 | @echo "Please use \`make ' where is one of"
21 | @echo " html to make standalone HTML files"
22 | @echo " dirhtml to make HTML files named index.html in directories"
23 | @echo " singlehtml to make a single large HTML file"
24 | @echo " pickle to make pickle files"
25 | @echo " json to make JSON files"
26 | @echo " htmlhelp to make HTML files and a HTML help project"
27 | @echo " qthelp to make HTML files and a qthelp project"
28 | @echo " devhelp to make HTML files and a Devhelp project"
29 | @echo " epub to make an epub"
30 | @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
31 | @echo " latexpdf to make LaTeX files and run them through pdflatex"
32 | @echo " text to make text files"
33 | @echo " man to make manual pages"
34 | @echo " texinfo to make Texinfo files"
35 | @echo " info to make Texinfo files and run them through makeinfo"
36 | @echo " gettext to make PO message catalogs"
37 | @echo " changes to make an overview of all changed/added/deprecated items"
38 | @echo " linkcheck to check all external links for integrity"
39 | @echo " doctest to run all doctests embedded in the documentation (if enabled)"
40 |
41 | clean:
42 | -rm -rf $(BUILDDIR)/*
43 |
44 | html:
45 | $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
46 | @echo
47 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
48 |
49 | dirhtml:
50 | $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
51 | @echo
52 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
53 |
54 | singlehtml:
55 | $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
56 | @echo
57 | @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
58 |
59 | pickle:
60 | $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
61 | @echo
62 | @echo "Build finished; now you can process the pickle files."
63 |
64 | json:
65 | $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
66 | @echo
67 | @echo "Build finished; now you can process the JSON files."
68 |
69 | htmlhelp:
70 | $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
71 | @echo
72 | @echo "Build finished; now you can run HTML Help Workshop with the" \
73 | ".hhp project file in $(BUILDDIR)/htmlhelp."
74 |
75 | qthelp:
76 | $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
77 | @echo
78 | @echo "Build finished; now you can run "qcollectiongenerator" with the" \
79 | ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
80 | @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/PyProSAIL.qhcp"
81 | @echo "To view the help file:"
82 | @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/PyProSAIL.qhc"
83 |
84 | devhelp:
85 | $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
86 | @echo
87 | @echo "Build finished."
88 | @echo "To view the help file:"
89 | @echo "# mkdir -p $$HOME/.local/share/devhelp/PyProSAIL"
90 | @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/PyProSAIL"
91 | @echo "# devhelp"
92 |
93 | epub:
94 | $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
95 | @echo
96 | @echo "Build finished. The epub file is in $(BUILDDIR)/epub."
97 |
98 | latex:
99 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
100 | @echo
101 | @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
102 | @echo "Run \`make' in that directory to run these through (pdf)latex" \
103 | "(use \`make latexpdf' here to do that automatically)."
104 |
105 | latexpdf:
106 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
107 | @echo "Running LaTeX files through pdflatex..."
108 | $(MAKE) -C $(BUILDDIR)/latex all-pdf
109 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
110 |
111 | text:
112 | $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
113 | @echo
114 | @echo "Build finished. The text files are in $(BUILDDIR)/text."
115 |
116 | man:
117 | $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
118 | @echo
119 | @echo "Build finished. The manual pages are in $(BUILDDIR)/man."
120 |
121 | texinfo:
122 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
123 | @echo
124 | @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
125 | @echo "Run \`make' in that directory to run these through makeinfo" \
126 | "(use \`make info' here to do that automatically)."
127 |
128 | info:
129 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
130 | @echo "Running Texinfo files through makeinfo..."
131 | make -C $(BUILDDIR)/texinfo info
132 | @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
133 |
134 | gettext:
135 | $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
136 | @echo
137 | @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
138 |
139 | changes:
140 | $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
141 | @echo
142 | @echo "The overview file is in $(BUILDDIR)/changes."
143 |
144 | linkcheck:
145 | $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
146 | @echo
147 | @echo "Link check complete; look for any errors in the above output " \
148 | "or in $(BUILDDIR)/linkcheck/output.txt."
149 |
150 | doctest:
151 | $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
152 | @echo "Testing of doctests in the sources finished, look at the " \
153 | "results in $(BUILDDIR)/doctest/output.txt."
154 |
--------------------------------------------------------------------------------
/pyprosail/PyPROSAIL.f90:
--------------------------------------------------------------------------------
1 | ! 09 22 2011
2 | ! This program allows modeling reflectance data from canopy
3 | ! - modeling leaf optical properties with PROSPECT-5 (feret et al. 2008)
4 | ! - modeling leaf inclination distribution function with the subroutine campbell
5 | ! (Ellipsoidal distribution function caracterised by the average leaf
6 | ! inclination angle in degree), or dladgen (2 parameters LIDF)
7 | ! - modeling canopy reflectance with 4SAIL (Verhoef et al., 2007)
8 |
9 | ! This version has been implemented by Jean-Baptiste Feret
10 | ! Jean-Baptiste Feret takes the entire responsibility for this version
11 | ! All comments, changes or questions should be sent to:
12 | ! jbferet@stanford.edu
13 |
14 | ! References:
15 | ! Verhoef et al. (2007) Unified Optical-Thermal Four-Stream Radiative
16 | ! Transfer Theory for Homogeneous Vegetation Canopies, IEEE TRANSACTIONS
17 | ! ON GEOSCIENCE AND REMOTE SENSING, VOL. 45, NO. 6, JUNE 2007
18 | ! Feret et al. (2008), PROSPECT-4 and 5: Advances in the Leaf Optical
19 | ! Properties Model Separating Photosynthetic Pigments, REMOTE SENSING OF
20 | ! ENVIRONMENT
21 | ! The specific absorption coefficient corresponding to brown pigment is
22 | ! provided by Frederic Baret (EMMAH, INRA Avignon, baret@avignon.inra.fr)
23 | ! and used with his autorization.
24 | ! the model PRO4SAIL is based on a version provided by
25 | ! Wout Verhoef
26 | ! NLR
27 | ! April/May 2003
28 |
29 | ! The original 2-parameter LIDF model is developed by and described in:
30 | ! W. Verhoef, 1998, "Theory of radiative transfer models applied in
31 | ! optical remote sensing of vegetation canopies", Wageningen Agricultural
32 | ! University, The Netherlands, 310 pp. (Ph. D. thesis)
33 | ! the Ellipsoidal LIDF is taken from:
34 | ! Campbell (1990), Derivtion of an angle density function for canopies
35 | ! with ellipsoidal leaf angle distribution, Agricultural and Forest
36 | ! Meteorology, 49 173-176
37 |
38 | subroutine run(N, Cab, Car, Cbrown, Cw, Cm, psoil, LAI, hspot, tts, tto, psi, TypeLidf, LIDFa, LIDFb, result)
39 | USE MOD_ANGLE ! defines pi & rad conversion
40 | USE MOD_staticvar ! static variables kept in memory for optimization
41 | USE MOD_flag_util ! flags for optimization
42 | USE MOD_output_PROSPECT ! output variables of PROSPECT
43 | USE MOD_SAIL ! variables of SAIL
44 | USE MOD_dataSpec_P5B
45 | IMPLICIT NONE
46 |
47 | REAL*8, intent(in) :: N,Cab, Car,Cbrown,Cw,Cm, psoil, LAI, hspot, tts, tto, psi, LIDFa,LIDFb
48 | INTEGER, intent(in) :: TypeLidf
49 | REAL*8, intent(out) :: result(nw)
50 |
51 |
52 | ! LEAF BIOCHEMISTRY
53 | !REAL*8 :: N,Car,Cbrown,Cw,Cm
54 | ! CANOPY
55 | REAL*8 :: skyl,ihot
56 | REAL*8,ALLOCATABLE,SAVE :: resh(:),resv(:)
57 | REAL*8,ALLOCATABLE,SAVE :: rsoil0(:),PARdiro(:),PARdifo(:)
58 | INTEGER :: ii
59 |
60 | ! ANGLE CONVERSION
61 | pi=ATAN(1.)*4.
62 | rd=pi/180.
63 |
64 | ! PROSPECT output
65 | ALLOCATE (LRT(nw,2),rho(nw),tau(nw))
66 | ! SAIL
67 | ALLOCATE (sb(nw),sf(nw),vb(nw),vf(nw),w(nw))
68 | ALLOCATE (m(nw),m2(nw),att(nw),sigb(nw),rinf(nw))
69 | ALLOCATE (PARdiro(nw),PARdifo(nw))
70 | ALLOCATE(tsd(nw),tdd(nw),tdo(nw),rsd(nw),rdd(nw),rso(nw),rdo(nw))
71 | ALLOCATE(rddt(nw),rsdt(nw),rdot(nw),rsodt(nw),rsost(nw),rsot(nw),rsos(nw),rsod(nw))
72 | ALLOCATE(lidf(13))
73 | ! resh : hemispherical reflectance
74 | ! resv : directional reflectance
75 | ALLOCATE (resh(nw),resv(nw))
76 | ALLOCATE (rsoil_old(nw))
77 |
78 | !TypeLidf=1
79 | ! if 2-parameters LIDF: TypeLidf=1
80 | !IF (TypeLidf.EQ.1) THEN
81 | ! LIDFa LIDF parameter a, which controls the average leaf slope
82 | ! LIDFb LIDF parameter b, which controls the distribution's bimodality
83 | ! LIDF type a b
84 | ! Planophile 1 0
85 | ! Erectophile -1 0
86 | ! Plagiophile 0 -1
87 | ! Extremophile 0 1
88 | ! Spherical -0.35 -0.15
89 | ! Uniform 0 0
90 | ! requirement: |LIDFa| + |LIDFb| < 1
91 | !LIDFa = -0.35
92 | !LIDFb = -0.15
93 | ! if ellipsoidal distribution: TypeLidf=2
94 | !ELSEIF (TypeLidf.EQ.2) THEN
95 | ! LIDFa = average leaf angle (degrees) 0 = planophile / 90 = erectophile
96 | ! LIDFb = 0
97 | !LIDFa = 30
98 | !LIDFb = 0
99 | !ENDIF
100 |
101 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
102 | !!LEAF CHEM & STR PROPERTIES!!
103 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
104 | ! INITIAL PARAMETERS
105 | !Cab = 40. ! chlorophyll content (ug.cm-2)
106 | !Car = 8. ! carotenoid content (ug.cm-2)
107 | !Cbrown = 0.0 ! brown pigment content (arbitrary units)
108 | !Cw = 0.01 ! EWT (cm)
109 | !Cm = 0.009 ! LMA (g.cm-2)
110 | !N = 1.5 ! structure coefficient
111 |
112 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
113 | !! Soil Reflectance Properties !!
114 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
115 | ! rsoil1 = dry soil
116 | ! rsoil2 = wet soil
117 | ALLOCATE (rsoil0(nw))
118 | !psoil = 1. ! soil factor (psoil=0: wet soil / psoil=1: dry soil)
119 | rsoil0=psoil*Rsoil1+(1-psoil)*Rsoil2
120 |
121 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
122 | !! 4SAIL canopy structure parm !!
123 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
124 | !LAI = 3. ! leaf area index (m^2/m^2)
125 | !hspot = 0.01 ! hot spot
126 | !tts = 30. ! solar zenith angle (degrees)
127 | !tto = 10. ! observer zenith angle (degrees)
128 | !psi = 0. ! azimuth (degrees)
129 |
130 | init_completed=.false. ! only at first call of PRO4SAIL
131 |
132 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
133 | !! CALL PRO4SAIL !!
134 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
135 | CALL PRO4SAIL(N,Cab,Car,Cbrown,Cw,Cm,LIDFa,LIDFb,TypeLIDF,LAI,hspot,tts,tto,psi,rsoil0)
136 |
137 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
138 | !! direct / diffuse light !!
139 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
140 | ! the direct and diffuse light are taken into account as proposed by:
141 | ! Francois et al. (2002) Conversion of 400-1100 nm vegetation albedo
142 | ! measurements into total shortwave broadband albedo using a canopy
143 | ! radiative transfer model, Agronomie
144 | skyl = 0.847- 1.61*sin((90-tts)*rd)+ 1.04*sin((90-tts)*rd)*sin((90-tts)*rd) ! % diffuse radiation
145 | ! Es = direct
146 | ! Ed = diffuse
147 | ! PAR direct
148 | PARdiro = (1-skyl)*Es
149 | ! PAR diffus
150 | PARdifo = (skyl)*Ed
151 | ! resv : directional reflectance
152 | resv = (rdot*PARdifo+rsot*PARdiro)/(PARdiro+PARdifo)
153 |
154 | result = resv
155 |
156 | ! PROSPECT output
157 | DEALLOCATE(LRT, rho, tau)
158 | ! SAIL
159 | DEALLOCATE(sb,sf,vb,vf,w)
160 | DEALLOCATE(m,m2,att,sigb,rinf)
161 | DEALLOCATE(PARdiro,PARdifo)
162 | DEALLOCATE(tsd,tdd,tdo,rsd,rdd,rso,rdo)
163 | DEALLOCATE(rddt,rsdt,rdot,rsodt,rsost,rsot,rsos,rsod)
164 | DEALLOCATE(lidf)
165 | ! resh : hemispherical reflectance
166 | ! resv : directional reflectance
167 | DEALLOCATE(resh,resv)
168 | DEALLOCATE(rsoil_old)
169 | DEALLOCATE(rsoil0)
170 |
171 | END
172 |
--------------------------------------------------------------------------------
/doc/index.rst:
--------------------------------------------------------------------------------
1 | .. PyProSAIL documentation master file, created by
2 | sphinx-quickstart on Tue Jan 1 18:02:06 2013.
3 | You can adapt this file completely to your liking, but it should at least
4 | contain the root `toctree` directive.
5 |
6 | Welcome to PyProSAIL's documentation!
7 | =====================================
8 |
9 | **Warning: PyProSAIL is no longer supported. It may work for you, or it may not, but I am no longer doing
10 | any updates, and will not be able to provide support.**
11 |
12 | PyProSAIL is a Python interface to the ProSAIL combined leaf optical properties (PROSPECT) and canopy bi-directional reflectance (SAIL) model. The Python code simply interfaces with the Fortran code provided `here `_ and, currently at least, does nothing more than let you run it easily from code.
13 |
14 | This interface is released under the GNU Lesser General Public License.
15 |
16 | (Very) Quickstart
17 | -----------------
18 | Install it from PyPI::
19 |
20 | pip install pyprosail
21 |
22 | Run it with some parameters, and look at the results::
23 |
24 | >>> import pyprosail
25 | >>> result = pyprosail.run(1.5, 40, 8, 0, 0.01, 0.009, 1, 3, 0.01, 30, 10, 0, pyprosail.Planophile)
26 | >>> result[:,0] # These are the wavelengths (in micrometres)
27 | array([ 0.4 , 0.401, 0.402, ..., 2.498, 2.499, 2.5 ])
28 | >>> result[:,1] # These are the reflectances (as a fraction)
29 | array([ 0.02119318, 0.02121176, 0.0212236 , ..., 0.02039977,
30 | 0.02024749, 0.02028665])
31 |
32 | That's basically it! For more details on how to install it, exactly what parameters you can give the ``run`` method, and how to use PyProSAIL with Py6S, then read on.
33 |
34 | Installation
35 | ------------
36 | PyProSAIL is available on the Python Package Index (PyPI), and can therefore be installed using easy_install or pip::
37 |
38 | pip install pyprosail
39 | # or
40 | easy_install pyprosail
41 |
42 | Or a Windows Installer can be downloaded from the `PyPI page `_. It depends on the ``numpy`` and ``scipy`` modules - which you are likely to already have installed if you do any scientific programming with Python. If not, I would suggest installing something like the `Enthought Python Distribution `_, or `Pythonxy `_.
43 |
44 | The actual installation process is a little more complicated than it is for many pure Python modules, as it involves compiling the original Fortran code of the ProSAIL model. If running the installation commands above does not give any errors then you can assume everything is working fine - but if it does, then read on below.
45 |
46 | As the installation requires compiling some Fortran code, it will need to be able to find a Fortran compiler. Thus, the most likely reason for the install to fail is because a Fortran compiler can't be found. The installation routine is fairly good at finding Fortran compilers (searching various sensible places - depending on the operating system), so simply installing one of the compilers listed below should make it all work:
47 |
48 | * **Windows:** The easiest way is to use the `Windows installer `_, but if you want to compile from the Fortran source then follow the steps 1-4 `here `_ to install the GFortran compiler and set it up so that it can be used by the PyProSAIL installation procedure.
49 | * **OS X:** Install GCC by following the instructions `here `_.
50 | * **Linux:** Install GFortran using the package manager for your system, for example ``apt-get install gfortran``.
51 |
52 | If you have any issues with installation, please contact me using the details in the Support section below.
53 |
54 | Running the model
55 | -----------------
56 | To run the model using some parameters, simply import the model::
57 |
58 | import pyprosail
59 |
60 | and then call the run method, as documented below.
61 |
62 | .. py:function:: pyprosail.run(N, chloro, caroten, brown, EWT, LMA, psoil, LAI, hot_spot, solar_zenith, solar_azimuth, view_zenith, view_azimuth, LIDF)
63 |
64 | Runs the ProSAIL model with the given parameters and returns a 2D array with two columns: wavelengths and reflectances. The model is always run for the entire wavelength range of 0.4--2.5 micrometres.
65 |
66 | Arguments:
67 |
68 | * ``N`` -- Structure co-efficient
69 | * ``chloro`` -- Chlorophyll content (ug per cm^2)
70 | * ``caroten`` -- Carotenoid content (ug per cm^2)
71 | * ``brown`` -- Brown pigment content (arbitrary units)
72 | * ``EWT`` -- Equivalent Water Thickness (cm)
73 | * ``LMA`` -- Leaf Mass per unit area (g per cm^2)
74 | * ``soil_reflectance`` -- Soil reflectance: wet soil = 0, dry soil = 1
75 | * ``LAI`` -- Leaf Area Index
76 | * ``hot_spot`` -- Hot spot parameter
77 | * ``solar_zenith`` -- Solar zenith angle (degrees)
78 | * ``solar_azimuth`` -- Solar azimuth angle (degrees)
79 | * ``view_zenith`` -- View zenith angle (degrees)
80 | * ``view_azimuth`` -- View azimuth angle (degrees)
81 | * ``LIDF`` -- Leaf distibution function parameter(s) (see below)
82 |
83 | The leaf distribution function parameter(s) argument can be either:
84 |
85 | * A single number giving the average leaf angle (in degrees) for an elipsoidal distribution. 0 is planophile and 90 is erectophile.
86 | * A tuple giving (average leaf slope, bimodality parameter). These parameters must sum to be less than 1.0. For convenience a number of predefined options are given including:
87 |
88 | * ``pyprosail.Planophile``
89 | * ``pyprosail.Erectophile``
90 | * ``pyprosail.Plagiophile``
91 | * ``pyprosail.Extremophile``
92 | * ``pyprosail.Spherical``
93 | * ``pyprosail.Uniform``
94 |
95 | Examples of valid values for the leaf distribution function parameter include:
96 |
97 | * ``30`` (a 30 degree average leaf angle)
98 | * ``(0, -1)`` (an average leaf slope of 0 and a bimodality parameter of -1)
99 | * ``PyProsail.Planophile``
100 |
101 | Using with Py6S
102 | ---------------
103 | PyProSAIL is very easy to use with Py6S (a Python interface to the 6S Radiative Transfer Model - see `here `_). PyProSAIL can be used to create a spectrum, which can then be used by Py6S as the ground reflectance for a simulation::
104 |
105 | # Make sure you have both PyProSAIL and Py6S installed
106 | import pyprosail
107 | from Py6S import *
108 |
109 | spectrum = pyprosail.run(1.5, 40, 8, 0, 0.01, 0.009, 1, 3, 0.01, 30, 0, 10, 0, pyprosail.Planophile)
110 | s = SixS()
111 | s.ground_reflectance = GroundReflectance.HomogeneousLambertian(spectrum)
112 | s.run()
113 |
114 | It's as simple as that! For more information on the parameters that you can pass to the GroundReflectance functions, see the `Py6S documentation `_.
115 |
116 | Support
117 | -------
118 | Py6S was developed by the author as part of his PhD (which has not yet finished). He is still developing the software, but has many other demands on his time. He will try to answer any support queries as soon as possible, but he cannot guarantee a quick response.
119 |
120 | **Email:** robin@rtwilson.com
--------------------------------------------------------------------------------
/COPYING.LESSER:
--------------------------------------------------------------------------------
1 | GNU LESSER GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 |
9 | This version of the GNU Lesser General Public License incorporates
10 | the terms and conditions of version 3 of the GNU General Public
11 | License, supplemented by the additional permissions listed below.
12 |
13 | 0. Additional Definitions.
14 |
15 | As used herein, "this License" refers to version 3 of the GNU Lesser
16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU
17 | General Public License.
18 |
19 | "The Library" refers to a covered work governed by this License,
20 | other than an Application or a Combined Work as defined below.
21 |
22 | An "Application" is any work that makes use of an interface provided
23 | by the Library, but which is not otherwise based on the Library.
24 | Defining a subclass of a class defined by the Library is deemed a mode
25 | of using an interface provided by the Library.
26 |
27 | A "Combined Work" is a work produced by combining or linking an
28 | Application with the Library. The particular version of the Library
29 | with which the Combined Work was made is also called the "Linked
30 | Version".
31 |
32 | The "Minimal Corresponding Source" for a Combined Work means the
33 | Corresponding Source for the Combined Work, excluding any source code
34 | for portions of the Combined Work that, considered in isolation, are
35 | based on the Application, and not on the Linked Version.
36 |
37 | The "Corresponding Application Code" for a Combined Work means the
38 | object code and/or source code for the Application, including any data
39 | and utility programs needed for reproducing the Combined Work from the
40 | Application, but excluding the System Libraries of the Combined Work.
41 |
42 | 1. Exception to Section 3 of the GNU GPL.
43 |
44 | You may convey a covered work under sections 3 and 4 of this License
45 | without being bound by section 3 of the GNU GPL.
46 |
47 | 2. Conveying Modified Versions.
48 |
49 | If you modify a copy of the Library, and, in your modifications, a
50 | facility refers to a function or data to be supplied by an Application
51 | that uses the facility (other than as an argument passed when the
52 | facility is invoked), then you may convey a copy of the modified
53 | version:
54 |
55 | a) under this License, provided that you make a good faith effort to
56 | ensure that, in the event an Application does not supply the
57 | function or data, the facility still operates, and performs
58 | whatever part of its purpose remains meaningful, or
59 |
60 | b) under the GNU GPL, with none of the additional permissions of
61 | this License applicable to that copy.
62 |
63 | 3. Object Code Incorporating Material from Library Header Files.
64 |
65 | The object code form of an Application may incorporate material from
66 | a header file that is part of the Library. You may convey such object
67 | code under terms of your choice, provided that, if the incorporated
68 | material is not limited to numerical parameters, data structure
69 | layouts and accessors, or small macros, inline functions and templates
70 | (ten or fewer lines in length), you do both of the following:
71 |
72 | a) Give prominent notice with each copy of the object code that the
73 | Library is used in it and that the Library and its use are
74 | covered by this License.
75 |
76 | b) Accompany the object code with a copy of the GNU GPL and this license
77 | document.
78 |
79 | 4. Combined Works.
80 |
81 | You may convey a Combined Work under terms of your choice that,
82 | taken together, effectively do not restrict modification of the
83 | portions of the Library contained in the Combined Work and reverse
84 | engineering for debugging such modifications, if you also do each of
85 | the following:
86 |
87 | a) Give prominent notice with each copy of the Combined Work that
88 | the Library is used in it and that the Library and its use are
89 | covered by this License.
90 |
91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license
92 | document.
93 |
94 | c) For a Combined Work that displays copyright notices during
95 | execution, include the copyright notice for the Library among
96 | these notices, as well as a reference directing the user to the
97 | copies of the GNU GPL and this license document.
98 |
99 | d) Do one of the following:
100 |
101 | 0) Convey the Minimal Corresponding Source under the terms of this
102 | License, and the Corresponding Application Code in a form
103 | suitable for, and under terms that permit, the user to
104 | recombine or relink the Application with a modified version of
105 | the Linked Version to produce a modified Combined Work, in the
106 | manner specified by section 6 of the GNU GPL for conveying
107 | Corresponding Source.
108 |
109 | 1) Use a suitable shared library mechanism for linking with the
110 | Library. A suitable mechanism is one that (a) uses at run time
111 | a copy of the Library already present on the user's computer
112 | system, and (b) will operate properly with a modified version
113 | of the Library that is interface-compatible with the Linked
114 | Version.
115 |
116 | e) Provide Installation Information, but only if you would otherwise
117 | be required to provide such information under section 6 of the
118 | GNU GPL, and only to the extent that such information is
119 | necessary to install and execute a modified version of the
120 | Combined Work produced by recombining or relinking the
121 | Application with a modified version of the Linked Version. (If
122 | you use option 4d0, the Installation Information must accompany
123 | the Minimal Corresponding Source and Corresponding Application
124 | Code. If you use option 4d1, you must provide the Installation
125 | Information in the manner specified by section 6 of the GNU GPL
126 | for conveying Corresponding Source.)
127 |
128 | 5. Combined Libraries.
129 |
130 | You may place library facilities that are a work based on the
131 | Library side by side in a single library together with other library
132 | facilities that are not Applications and are not covered by this
133 | License, and convey such a combined library under terms of your
134 | choice, if you do both of the following:
135 |
136 | a) Accompany the combined library with a copy of the same work based
137 | on the Library, uncombined with any other library facilities,
138 | conveyed under the terms of this License.
139 |
140 | b) Give prominent notice with the combined library that part of it
141 | is a work based on the Library, and explaining where to find the
142 | accompanying uncombined form of the same work.
143 |
144 | 6. Revised Versions of the GNU Lesser General Public License.
145 |
146 | The Free Software Foundation may publish revised and/or new versions
147 | of the GNU Lesser General Public License from time to time. Such new
148 | versions will be similar in spirit to the present version, but may
149 | differ in detail to address new problems or concerns.
150 |
151 | Each version is given a distinguishing version number. If the
152 | Library as you received it specifies that a certain numbered version
153 | of the GNU Lesser General Public License "or any later version"
154 | applies to it, you have the option of following the terms and
155 | conditions either of that published version or of any later version
156 | published by the Free Software Foundation. If the Library as you
157 | received it does not specify a version number of the GNU Lesser
158 | General Public License, you may choose any version of the GNU Lesser
159 | General Public License ever published by the Free Software Foundation.
160 |
161 | If the Library as you received it specifies that a proxy can decide
162 | whether future versions of the GNU Lesser General Public License shall
163 | apply, that proxy's public statement of acceptance of any version is
164 | permanent authorization for you to choose that version for the
165 | Library.
166 |
--------------------------------------------------------------------------------
/doc/conf.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | #
3 | # PyProSAIL documentation build configuration file, created by
4 | # sphinx-quickstart on Tue Jan 1 18:02:06 2013.
5 | #
6 | # This file is execfile()d with the current directory set to its containing dir.
7 | #
8 | # Note that not all possible configuration values are present in this
9 | # autogenerated file.
10 | #
11 | # All configuration values have a default; values that are commented out
12 | # serve to show the default.
13 |
14 | import sys, os
15 |
16 | # If extensions (or modules to document with autodoc) are in another directory,
17 | # add these directories to sys.path here. If the directory is relative to the
18 | # documentation root, use os.path.abspath to make it absolute, like shown here.
19 | #sys.path.insert(0, os.path.abspath('.'))
20 |
21 | # -- General configuration -----------------------------------------------------
22 |
23 | # If your documentation needs a minimal Sphinx version, state it here.
24 | #needs_sphinx = '1.0'
25 |
26 | # Add any Sphinx extension module names here, as strings. They can be extensions
27 | # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
28 | extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx', 'sphinx.ext.coverage', 'sphinx.ext.viewcode']
29 |
30 | # Add any paths that contain templates here, relative to this directory.
31 | templates_path = ['_templates']
32 |
33 | # The suffix of source filenames.
34 | source_suffix = '.rst'
35 |
36 | # The encoding of source files.
37 | #source_encoding = 'utf-8-sig'
38 |
39 | # The master toctree document.
40 | master_doc = 'index'
41 |
42 | # General information about the project.
43 | project = u'PyProSAIL'
44 | copyright = u'2013, Robin Wilson'
45 |
46 | # The version info for the project you're documenting, acts as replacement for
47 | # |version| and |release|, also used in various other places throughout the
48 | # built documents.
49 | #
50 | # The short X.Y version.
51 | version = '1.0'
52 | # The full version, including alpha/beta/rc tags.
53 | release = '1.0'
54 |
55 | # The language for content autogenerated by Sphinx. Refer to documentation
56 | # for a list of supported languages.
57 | #language = None
58 |
59 | # There are two options for replacing |today|: either, you set today to some
60 | # non-false value, then it is used:
61 | #today = ''
62 | # Else, today_fmt is used as the format for a strftime call.
63 | #today_fmt = '%B %d, %Y'
64 |
65 | # List of patterns, relative to source directory, that match files and
66 | # directories to ignore when looking for source files.
67 | exclude_patterns = ['_build']
68 |
69 | # The reST default role (used for this markup: `text`) to use for all documents.
70 | #default_role = None
71 |
72 | # If true, '()' will be appended to :func: etc. cross-reference text.
73 | #add_function_parentheses = True
74 |
75 | # If true, the current module name will be prepended to all description
76 | # unit titles (such as .. function::).
77 | #add_module_names = True
78 |
79 | # If true, sectionauthor and moduleauthor directives will be shown in the
80 | # output. They are ignored by default.
81 | #show_authors = False
82 |
83 | # The name of the Pygments (syntax highlighting) style to use.
84 | pygments_style = 'sphinx'
85 |
86 | # A list of ignored prefixes for module index sorting.
87 | #modindex_common_prefix = []
88 |
89 |
90 | # -- Options for HTML output ---------------------------------------------------
91 |
92 | # The theme to use for HTML and HTML Help pages. See the documentation for
93 | # a list of builtin themes.
94 | html_theme = 'default'
95 |
96 | # Theme options are theme-specific and customize the look and feel of a theme
97 | # further. For a list of options available for each theme, see the
98 | # documentation.
99 | #html_theme_options = {}
100 |
101 | # Add any paths that contain custom themes here, relative to this directory.
102 | #html_theme_path = []
103 |
104 | # The name for this set of Sphinx documents. If None, it defaults to
105 | # " v documentation".
106 | #html_title = None
107 |
108 | # A shorter title for the navigation bar. Default is the same as html_title.
109 | #html_short_title = None
110 |
111 | # The name of an image file (relative to this directory) to place at the top
112 | # of the sidebar.
113 | #html_logo = None
114 |
115 | # The name of an image file (within the static path) to use as favicon of the
116 | # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
117 | # pixels large.
118 | #html_favicon = None
119 |
120 | # Add any paths that contain custom static files (such as style sheets) here,
121 | # relative to this directory. They are copied after the builtin static files,
122 | # so a file named "default.css" will overwrite the builtin "default.css".
123 | html_static_path = ['_static']
124 |
125 | # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
126 | # using the given strftime format.
127 | #html_last_updated_fmt = '%b %d, %Y'
128 |
129 | # If true, SmartyPants will be used to convert quotes and dashes to
130 | # typographically correct entities.
131 | #html_use_smartypants = True
132 |
133 | # Custom sidebar templates, maps document names to template names.
134 | #html_sidebars = {}
135 |
136 | # Additional templates that should be rendered to pages, maps page names to
137 | # template names.
138 | #html_additional_pages = {}
139 |
140 | # If false, no module index is generated.
141 | #html_domain_indices = True
142 |
143 | # If false, no index is generated.
144 | #html_use_index = True
145 |
146 | # If true, the index is split into individual pages for each letter.
147 | #html_split_index = False
148 |
149 | # If true, links to the reST sources are added to the pages.
150 | #html_show_sourcelink = True
151 |
152 | # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
153 | #html_show_sphinx = True
154 |
155 | # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
156 | #html_show_copyright = True
157 |
158 | # If true, an OpenSearch description file will be output, and all pages will
159 | # contain a tag referring to it. The value of this option must be the
160 | # base URL from which the finished HTML is served.
161 | #html_use_opensearch = ''
162 |
163 | # This is the file name suffix for HTML files (e.g. ".xhtml").
164 | #html_file_suffix = None
165 |
166 | # Output file base name for HTML help builder.
167 | htmlhelp_basename = 'PyProSAILdoc'
168 |
169 |
170 | # -- Options for LaTeX output --------------------------------------------------
171 |
172 | latex_elements = {
173 | # The paper size ('letterpaper' or 'a4paper').
174 | #'papersize': 'letterpaper',
175 |
176 | # The font size ('10pt', '11pt' or '12pt').
177 | #'pointsize': '10pt',
178 |
179 | # Additional stuff for the LaTeX preamble.
180 | #'preamble': '',
181 | }
182 |
183 | # Grouping the document tree into LaTeX files. List of tuples
184 | # (source start file, target name, title, author, documentclass [howto/manual]).
185 | latex_documents = [
186 | ('index', 'PyProSAIL.tex', u'PyProSAIL Documentation',
187 | u'Robin Wilson', 'manual'),
188 | ]
189 |
190 | # The name of an image file (relative to this directory) to place at the top of
191 | # the title page.
192 | #latex_logo = None
193 |
194 | # For "manual" documents, if this is true, then toplevel headings are parts,
195 | # not chapters.
196 | #latex_use_parts = False
197 |
198 | # If true, show page references after internal links.
199 | #latex_show_pagerefs = False
200 |
201 | # If true, show URL addresses after external links.
202 | #latex_show_urls = False
203 |
204 | # Documents to append as an appendix to all manuals.
205 | #latex_appendices = []
206 |
207 | # If false, no module index is generated.
208 | #latex_domain_indices = True
209 |
210 |
211 | # -- Options for manual page output --------------------------------------------
212 |
213 | # One entry per manual page. List of tuples
214 | # (source start file, name, description, authors, manual section).
215 | man_pages = [
216 | ('index', 'pyprosail', u'PyProSAIL Documentation',
217 | [u'Robin Wilson'], 1)
218 | ]
219 |
220 | # If true, show URL addresses after external links.
221 | #man_show_urls = False
222 |
223 |
224 | # -- Options for Texinfo output ------------------------------------------------
225 |
226 | # Grouping the document tree into Texinfo files. List of tuples
227 | # (source start file, target name, title, author,
228 | # dir menu entry, description, category)
229 | texinfo_documents = [
230 | ('index', 'PyProSAIL', u'PyProSAIL Documentation',
231 | u'Robin Wilson', 'PyProSAIL', 'One line description of project.',
232 | 'Miscellaneous'),
233 | ]
234 |
235 | # Documents to append as an appendix to all manuals.
236 | #texinfo_appendices = []
237 |
238 | # If false, no module index is generated.
239 | #texinfo_domain_indices = True
240 |
241 | # How to display URL addresses: 'footnote', 'no', or 'inline'.
242 | #texinfo_show_urls = 'footnote'
243 |
244 |
245 | # Example configuration for intersphinx: refer to the Python standard library.
246 | intersphinx_mapping = {'http://docs.python.org/': None}
247 |
--------------------------------------------------------------------------------
/pyprosail/PRO4SAIL.f90:
--------------------------------------------------------------------------------
1 | SUBROUTINE PRO4SAIL(N,Cab,Car,Cbrown,Cw,Cm,LIDFa,LIDFb,TypeLIDF,lai,q,tts,tto,psi,rsoil)
2 |
3 | ! This version has been implemented by Jean-Baptiste Feret
4 | ! Jean-Baptiste Feret takes the entire responsibility for this version
5 | ! All comments, changes or questions should be sent to:
6 | ! jbferet@stanford.edu
7 |
8 | ! Jean-Baptiste Feret
9 | ! Institut de Physique du Globe de Paris
10 | ! Space and Planetary Geophysics
11 | ! October 2009
12 |
13 | ! this model PRO4SAIL is based on a version provided by
14 | ! Wout Verhoef
15 | ! NLR
16 | ! April/May 2003,
17 | ! original version downloadable at http://teledetection.ipgp.jussieu.fr/prosail/
18 | ! Improved and extended version of SAILH model that avoids numerical singularities
19 | ! and works more efficiently if only few parameters change.
20 | ! References:
21 | ! Verhoef et al. (2007) Unified Optical-Thermal Four-Stream Radiative
22 | ! Transfer Theory for Homogeneous Vegetation Canopies, IEEE TRANSACTIONS
23 | ! ON GEOSCIENCE AND REMOTE SENSING, VOL. 45, NO. 6, JUNE 2007
24 |
25 | ! The module "staticvar" is meant for internal use in order to keep
26 | ! several variables static between successive calls of the subroutine.
27 | ! For calculation of vertical flux profiles inside the canopy, the quantities
28 | ! m, sb, sf, ks, and rinf are needed by the calling routine, so in this case
29 | ! this module must also be declared in the calling routine.
30 |
31 | USE MOD_ANGLE
32 | USE MOD_dataSpec_P5B
33 | USE MOD_output_PROSPECT
34 | USE MOD_SAIL
35 | USE MOD_flag_util
36 | USE MOD_staticvar
37 | IMPLICIT NONE
38 |
39 | !!!!!!!! INPUT / OUTPUT !!!!!!!!
40 | REAL*8,INTENT(in) :: N,Cab,Car,Cbrown,Cw,Cm
41 | REAL*8,INTENT(in) :: LIDFa,LIDFb,lai,q,rsoil(nw)
42 | REAL*8,INTENT(in) :: tts,tto,psi
43 | INTEGER*4,INTENT(in) :: TypeLIDF
44 | !!!!!!!! END INPUT / OUTPUT !!!!!!!!
45 |
46 | REAL*8 :: chi_o,chi_s,ctl,sto,sts,tanto,tants,cospsi,koli,ksli,bf,bfli,alf,litab(13)
47 | REAL*8 :: f1,f2,g1(nw),g2(nw),ttl,sigf(nw),sobli,sofli,x1,x2,y1,y2,z
48 | REAL*8 :: fhot,fint,frho,ftau,J1ko(nw),J1ks(nw),J2ko(nw),J2ks(nw),Jfunc3
49 | REAL*8 :: T1(nw),T2(nw),T3(nw),Tv1(nw),Tv2(nw)
50 | REAL*8 :: e1(nw),e2(nw),rinf2(nw),re(nw),denom(nw)
51 | REAL*8 :: Ps(nw),Qs(nw),Pv(nw),Qv(nw),dn(nw)
52 | INTEGER*4 :: na
53 | data litab/5.,15.,25.,35.,45.,55.,65.,75.,81.,83.,85.,87.,89./
54 |
55 | ! Raise all flags if we arrive here for the first time, lower them at other times
56 | DO i=1,7
57 | flag(i)=.not.init_completed
58 | ENDDO
59 |
60 | IF (init_completed) THEN
61 | ! Detect which inputs have changed (if it is not the first time)
62 | delta_lai = (lai.ne.lai_old)
63 | delta_hot = (q.ne.q_old)
64 | delta_geom = (tts.ne.tts_old).or.(tto.ne.tto_old).or.&
65 | (psi.ne.psi_old)
66 | delta_soil = (SUM((rsoil-rsoil_old)**2).ne.0)
67 | delta_lidf = (LIDFa.ne.LIDFa_old).or.(LIDFb.ne.LIDFb_old)
68 | delta_leaf = (N.ne.N_old).or.(Cab.ne.Cab_old).or.(Car.ne.Car_old).or.&
69 | (Cbrown.ne.Cbrown_old).or.(Cw.ne.Cw_old).or.(Cm.ne.Cm_old)
70 |
71 | ! Raise the flags for the modules to be executed
72 | flag(1) = delta_geom
73 | flag(2) = delta_lidf
74 | flag(3) = delta_geom.or.delta_lidf
75 | flag(4) = flag(3).or.delta_leaf
76 | flag(5) = flag(4).or.delta_lai.or.delta_soil
77 | flag(6) = flag(3).or.delta_lai.or.delta_hot
78 | flag(7) = delta_leaf
79 | ENDIF
80 |
81 | ! Make sure that on next occasions init is regarded as being completed
82 | init_completed=.true.
83 |
84 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
85 | !!LEAF CHEM & STR PROPERTIES!!
86 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
87 | IF(flag(7)) THEN !!
88 | CALL prospect_5B(N,Cab,Car,Cbrown,Cw,Cm,LRT)
89 | rho = LRT(:,1)
90 | tau = LRT(:,2)
91 | ENDIF
92 |
93 | IF(flag(1)) THEN
94 | ! Geometric quantities
95 | cts = COS(rd*tts)
96 | cto = COS(rd*tto)
97 | ctscto = cts*cto
98 | tants = TAN(rd*tts)
99 | tanto = TAN(rd*tto)
100 | cospsi = COS(rd*psi)
101 | dso = SQRT(tants*tants+tanto*tanto-2.*tants*tanto*cospsi)
102 | ENDIF
103 |
104 | na=13
105 | IF (flag(2)) THEN
106 | ! Generate leaf angle distribution from average leaf angle (ellipsoidal) or (a,b) parameters
107 | IF(TypeLidf.EQ.1) THEN
108 | CALL dladgen(LIDFa,LIDFb,lidf)
109 | ELSEIF(TypeLidf.EQ.2) THEN
110 | CALL calc_LIDF_ellipsoidal(na,LIDFa,lidf)
111 | ENDIF
112 | ENDIF
113 |
114 | ! angular distance, compensation of shadow length
115 | IF (flag(3)) THEN
116 | ! Calculate geometric factors associated with extinction and scattering
117 | ! Initialise sums
118 | ks = 0
119 | ko = 0
120 | bf = 0
121 | sob = 0
122 | sof = 0
123 |
124 | ! Weighted sums over LIDF
125 | DO i=1,na
126 | ttl = litab(i) ! leaf inclination discrete values
127 | ctl = COS(rd*ttl)
128 | ! SAIL volume scattering phase function gives interception and portions to be
129 | ! multiplied by rho and tau
130 | CALL volscatt(tts,tto,psi,ttl,chi_s,chi_o,frho,ftau)
131 |
132 | !********************************************************************************
133 | !* SUITS SYSTEM COEFFICIENTS
134 | !*
135 | !* ks : Extinction coefficient for direct solar flux
136 | !* ko : Extinction coefficient for direct observed flux
137 | !* att : Attenuation coefficient for diffuse flux
138 | !* sigb : Backscattering coefficient of the diffuse downward flux
139 | !* sigf : Forwardscattering coefficient of the diffuse upward flux
140 | !* sf : Scattering coefficient of the direct solar flux for downward diffuse flux
141 | !* sb : Scattering coefficient of the direct solar flux for upward diffuse flux
142 | !* vf : Scattering coefficient of upward diffuse flux in the observed direction
143 | !* vb : Scattering coefficient of downward diffuse flux in the observed direction
144 | !* w : Bidirectional scattering coefficient
145 | !********************************************************************************
146 |
147 | ! Extinction coefficients
148 | ksli = chi_s/cts
149 | koli = chi_o/cto
150 |
151 | ! Area scattering coefficient fractions
152 | sobli = frho*pi/ctscto
153 | sofli = ftau*pi/ctscto
154 | bfli = ctl*ctl
155 | ks = ks+ksli*lidf(i)
156 | ko = ko+koli*lidf(i)
157 | bf = bf+bfli*lidf(i)
158 | sob = sob+sobli*lidf(i)
159 | sof = sof+sofli*lidf(i)
160 |
161 | ENDDO
162 | ! Geometric factors to be used later with rho and tau
163 | sdb = 0.5*(ks+bf)
164 | sdf = 0.5*(ks-bf)
165 | dob = 0.5*(ko+bf)
166 | dof = 0.5*(ko-bf)
167 | ddb = 0.5*(1.+bf)
168 | ddf = 0.5*(1.-bf)
169 | ENDIF
170 |
171 | IF(flag(4)) THEN
172 | ! Here rho and tau come in
173 | sigb= ddb*rho+ddf*tau
174 | sigf= ddf*rho+ddb*tau
175 | att = 1.-sigf
176 | m2=(att+sigb)*(att-sigb)
177 | WHERE (m2.LT.0)
178 | m2=0
179 | ENDWHERE
180 | m=SQRT(m2)
181 | sb = sdb*rho+sdf*tau
182 | sf = sdf*rho+sdb*tau
183 | vb = dob*rho+dof*tau
184 | vf = dof*rho+dob*tau
185 | w = sob*rho+sof*tau
186 | ENDIF
187 |
188 | IF (flag(5)) THEN
189 | ! Here the LAI comes in
190 | ! Outputs for the case LAI = 0
191 | IF (lai.le.0) THEN
192 | tss = 1.; too = 1.; tsstoo = 1.
193 | rdd = 0.; tdd = 1.; rsd = 0.
194 | tsd = 0.; rdo = 0.; tdo = 0.
195 | rso = 0.; rsos = 0.; rsod = 0.
196 |
197 | rddt = rsoil; rsdt = rsoil; rdot = rsoil
198 | rsodt = 0.; rsost = rsoil; rsot = rsoil
199 | RETURN
200 | ENDIF
201 |
202 | ! Other cases (LAI > 0)
203 | e1 = EXP(-m*lai)
204 | e2 = e1*e1
205 | rinf = (att-m)/sigb
206 | rinf2 = rinf*rinf
207 | re = rinf*e1
208 | denom = 1.-rinf2*e2
209 |
210 | CALL Jfunc1(ks,m,lai,J1ks)
211 | CALL Jfunc2(ks,m,lai,J2ks)
212 | CALL Jfunc1(ko,m,lai,J1ko)
213 | CALL Jfunc2(ko,m,lai,J2ko)
214 |
215 | Ps = (sf+sb*rinf)*J1ks
216 | Qs = (sf*rinf+sb)*J2ks
217 | Pv = (vf+vb*rinf)*J1ko
218 | Qv = (vf*rinf+vb)*J2ko
219 |
220 | rdd = rinf*(1.-e2)/denom
221 | tdd = (1.-rinf2)*e1/denom
222 | tsd = (Ps-re*Qs)/denom
223 | rsd = (Qs-re*Ps)/denom
224 | tdo = (Pv-re*Qv)/denom
225 | rdo = (Qv-re*Pv)/denom
226 |
227 | tss = EXP(-ks*lai)
228 | too = EXP(-ko*lai)
229 | z = Jfunc3(ks,ko,lai)
230 | g1 = (z-J1ks*too)/(ko+m)
231 | g2 = (z-J1ko*tss)/(ks+m)
232 |
233 | Tv1 = (vf*rinf+vb)*g1
234 | Tv2 = (vf+vb*rinf)*g2
235 | T1 = Tv1*(sf+sb*rinf)
236 | T2 = Tv2*(sf*rinf+sb)
237 | T3 = (rdo*Qs+tdo*Ps)*rinf
238 |
239 | ! Multiple scattering contribution to bidirectional canopy reflectance
240 | rsod = (T1+T2-T3)/(1.-rinf2)
241 | ENDIF
242 |
243 | IF (flag(6)) THEN
244 | ! Treatment of the hotspot-effect
245 | alf=1e6
246 | ! Apply correction 2/(K+k) suggested by F.-M. Breon
247 | IF (q.gt.0.) THEN
248 | alf=(dso/q)*2./(ks+ko)
249 | ENDIF
250 | IF (alf.GT.200.) THEN !inserted H. Bach 1/3/04
251 | alf=200.
252 | ENDIF
253 | IF (alf.eq.0.) THEN
254 | ! The pure hotspot - no shadow
255 | tsstoo = tss
256 | sumint = (1-tss)/(ks*lai)
257 | ELSE
258 | ! Outside the hotspot
259 | fhot=lai*SQRT(ko*ks)
260 | ! Integrate by exponential Simpson method in 20 steps
261 | ! the steps are arranged according to equal partitioning
262 | ! of the slope of the joint probability function
263 | x1=0.
264 | y1=0.
265 | f1=1.
266 | fint=(1.-EXP(-alf))*.05
267 | sumint=0.
268 |
269 | DO i=1,20
270 | IF (i.lt.20) THEN
271 | x2=-LOG(1.-i*fint)/alf
272 | ELSE
273 | x2=1.
274 | ENDIF
275 | y2=-(ko+ks)*lai*x2+fhot*(1.-EXP(-alf*x2))/alf
276 | f2=EXP(y2)
277 | sumint=sumint+(f2-f1)*(x2-x1)/(y2-y1)
278 | x1=x2
279 | y1=y2
280 | f1=f2
281 | ENDDO
282 | tsstoo=f1
283 | ENDIF
284 | ENDIF
285 |
286 | ! Bidirectional reflectance
287 | ! Single scattering contribution
288 | rsos = w*lai*sumint
289 |
290 | ! Total canopy contribution
291 | rso=rsos+rsod
292 |
293 | ! Interaction with the soil
294 | dn=1.-rsoil*rdd
295 |
296 | ! rddt: bi-hemispherical reflectance factor
297 | rddt=rdd+tdd*rsoil*tdd/dn
298 | ! rsdt: directional-hemispherical reflectance factor for solar incident flux
299 | rsdt=rsd+(tsd+tss)*rsoil*tdd/dn
300 | ! rdot: hemispherical-directional reflectance factor in viewing direction
301 | rdot=rdo+tdd*rsoil*(tdo+too)/dn
302 | ! rsot: bi-directional reflectance factor
303 | rsodt=rsod+((tss+tsd)*tdo+(tsd+tss*rsoil*rdd)*too)*rsoil/dn
304 | rsost=rsos+tsstoo*rsoil
305 | rsot=rsost+rsodt
306 |
307 | ! Before returning, save current parameters as old ones
308 | N_old = N ; Cab_old = Cab; Car_old = Car
309 | Cbrown_old = Cbrown; Cw_old = Cw; Cm_old = Cm
310 | lai_old = lai; LIDFa_old = LIDFa; LIDFb_old = LIDFb
311 | tts_old = tts; tto_old = tto; psi_old = psi
312 | q_old = q; rsoil_old = rsoil
313 |
314 | RETURN
315 | END
316 |
317 |
318 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
319 | !****************************************************
320 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
321 |
322 |
323 | SUBROUTINE Jfunc1(k,l,t,Jout)
324 |
325 | USE MOD_dataSpec_P5B
326 | IMPLICIT NONE
327 |
328 | ! J1 function with avoidance of singularity problem
329 | !
330 | REAL*8,INTENT(in) :: k,l(nw),t
331 | REAL*8,INTENT(out) :: Jout(nw)
332 | REAL*8 :: del(nw)
333 |
334 |
335 | del=(k-l)*t
336 | WHERE (ABS(del)>1e-3)
337 | Jout=(EXP(-l*t)-EXP(-k*t))/(k-l)
338 | ELSEWHERE
339 | Jout=0.5*t*(EXP(-k*t)+EXP(-l*t))*(1.-del*del/12.)
340 | END WHERE
341 |
342 | END
343 |
344 |
345 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
346 | !****************************************************
347 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
348 |
349 |
350 | SUBROUTINE Jfunc2(k,l,t,Jout)
351 |
352 | USE MOD_dataSpec_P5B
353 | IMPLICIT NONE
354 |
355 | ! J2 function
356 |
357 | REAL*8,INTENT(in) :: k,l(nw),t
358 | REAL*8,INTENT(out) :: Jout(nw)
359 | REAL*8 :: del(nw)
360 |
361 | Jout=(1.-EXP(-(k+l)*t))/(k+l)
362 |
363 | END
364 |
365 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
366 | !****************************************************
367 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
368 |
369 |
370 | FUNCTION Jfunc3(k,l,t)
371 |
372 | USE MOD_dataSpec_P5B
373 | IMPLICIT NONE
374 |
375 | ! J2 function
376 |
377 | REAL*8 :: k,l,t
378 | REAL*8 :: Jfunc3
379 |
380 | Jfunc3=(1.-EXP(-(k+l)*t))/(k+l)
381 |
382 | END
--------------------------------------------------------------------------------
/COPYING:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
--------------------------------------------------------------------------------