Mercurial > repos > ecology > srs_diversity_maps
annotate prosail-master/R/Lib_PROSAIL.R @ 0:9adccd3da70c draft default tip
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
author | ecology |
---|---|
date | Mon, 09 Jan 2023 13:37:37 +0000 |
parents | |
children |
rev | line source |
---|---|
0
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1 # ============================================================================= = |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
2 # prosail |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
3 # Lib_PROSAIL.R |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
4 # ============================================================================= = |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
5 # PROGRAMMERS: |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
6 # Jean-Baptiste FERET <jb.feret@teledetection.fr > |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
7 # Florian de BOISSIEU <fdeboiss@gmail.com > |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
8 # copyright 2019 / 11 Jean-Baptiste FERET |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
9 # ============================================================================= = |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
10 # This Library includes functions dedicated to PROSAIL simulation |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
11 # SAIL versions available are 4SAIL and 4SAIL2 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
12 # ============================================================================= = |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
13 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
14 #" computes bidirectional reflectance factor based on outputs from PROSAIL and sun position |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
15 #" |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
16 #" The direct and diffuse light are taken into account as proposed by: |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
17 #" Francois et al. (2002) conversion of 400-1100 nm vegetation albedo |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
18 #" measurements into total shortwave broadband albedo using a canopy |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
19 #" radiative transfer model, Agronomie |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
20 #" Es = direct |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
21 #" Ed = diffuse |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
22 #" |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
23 #" @param rdot numeric. Hemispherical-directional reflectance factor in viewing direction |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
24 #" @param rsot numeric. Bi-directional reflectance factor |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
25 #" @param tts numeric. Solar zenith angle |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
26 #" @param specatm_sensor list. direct and diffuse radiation for clear conditions |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
27 #" @return brf numeric. Bidirectional reflectance factor |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
28 #" @export |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
29 compute_brf <- function(rdot, rsot, tts, specatm_sensor) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
30 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
31 ############################## # |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
32 ## direct / diffuse light ## |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
33 ############################## # |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
34 es <- specatm_sensor$Direct_Light |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
35 ed <- specatm_sensor$Diffuse_Light |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
36 rd <- pi / 180 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
37 skyl <- 0.847 - 1.61 * sin((90 - tts) * rd) + 1.04 * sin((90 - tts) * rd) * sin((90 - tts) * rd) # diffuse radiation (Francois et al., 2002) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
38 pardiro <- (1 - skyl) * es |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
39 pardifo <- skyl * ed |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
40 brf <- (rdot * pardifo + rsot * pardiro) / (pardiro + pardifo) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
41 return(brf) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
42 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
43 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
44 #" Performs PROSAIL simulation based on a set of combinations of input parameters |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
45 #" @param spec_sensor list. Includes optical constants required for PROSPECT |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
46 #" refractive index, specific absorption coefficients and corresponding spectral bands |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
47 #" @param input_prospect list. PROSPECT input variables |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
48 #" @param n numeric. Leaf structure parameter |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
49 #" @param chl numeric. chlorophyll content (microg.cm-2) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
50 #" @param car numeric. carotenoid content (microg.cm-2) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
51 #" @param ant numeric. anthocyain content (microg.cm-2) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
52 #" @param brown numeric. brown pigment content (Arbitrary units) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
53 #" @param ewt numeric. Equivalent Water Thickness (g.cm-2) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
54 #" @param lma numeric. Leaf Mass per Area (g.cm-2) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
55 #" @param prot numeric. protein content (g.cm-2) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
56 #" @param cbc numeric. nonprotcarbon-based constituent content (g.cm-2) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
57 #" @param alpha numeric. Solid angle for incident light at surface of leaf (simulation of roughness) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
58 #" @param typelidf numeric. Type of leaf inclination distribution function |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
59 #" @param lidfa numeric. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
60 #" if typelidf == 1, controls the average leaf slope |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
61 #" if typelidf == 2, corresponds to average leaf angle |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
62 #" @param lidfb numeric. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
63 #" if typelidf == 1, unused |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
64 #" if typelidf == 2, controls the distribution"s bimodality |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
65 #" @param lai numeric. Leaf Area Index |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
66 #" @param q numeric. Hot Spot parameter |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
67 #" @param tts numeric. Sun zeith angle |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
68 #" @param tto numeric. Observer zeith angle |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
69 #" @param psi numeric. Azimuth Sun / Observer |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
70 #" @param rsoil numeric. Soil reflectance |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
71 #" @param fraction_brown numeric. Fraction of brown leaf area |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
72 #" @param diss numeric. Layer dissociation factor |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
73 #" @param cv numeric. vertical crown cover percentage |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
74 #" = % ground area covered with crowns as seen from nadir direction |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
75 #" @param zeta numeric. Tree shape factor |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
76 #" = ratio of crown diameter to crown height |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
77 #" @param sailversion character. choose between 4SAIL and 4SAIL2 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
78 #" @param brownvegetation list. Defines optical properties for brown vegetation, if not nULL |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
79 #" - WVL, reflectance, Transmittance |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
80 #" - Set to nULL if use PROSPECT to generate it |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
81 #" |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
82 #" @return list. rdot, rsot, rddt, rsdt |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
83 #" rdot: hemispherical-directional reflectance factor in viewing direction |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
84 #" rsot: bi-directional reflectance factor |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
85 #" rsdt: directional-hemispherical reflectance factor for solar incident flux |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
86 #" rddt: bi-hemispherical reflectance factor |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
87 #" @import prospect |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
88 #" @export |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
89 pro4sail <- function(spec_sensor, input_prospect = nULL, n = 1.5, chl = 40.0, |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
90 car = 8.0, ant = 0.0, brown = 0.0, ewt = 0.01, |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
91 lma = 0.008, prot = 0.0, cbc = 0.0, alpha = 40.0, |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
92 typelidf = 2, lidfa = nULL, lidfb = nULL, lai = nULL, |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
93 q = nULL, tts = nULL, tto = nULL, psi = nULL, rsoil = nULL, |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
94 fraction_brown = 0.0, diss = 0.0, cv = 1, zeta = 1, |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
95 sailversion = "4SAIL", brownvegetation = nULL) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
96 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
97 ############################ # |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
98 # LEAF OPTICAL PROPERTIES ## |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
99 ############################ # |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
100 if (is.null(input_prospect)) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
101 input_prospect <- data.frame("chl" = chl, "car" = car, "ant" = ant, "brown" = brown, "ewt" = ewt, |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
102 "lma" = lma, "prot" = prot, "cbc" = cbc, "n" = n, "alpha" = alpha) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
103 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
104 greenvegetation <- prospect::PROSPECT(SpecPROSPECT = spec_sensor, |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
105 n = input_prospect$n[1], |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
106 chl = input_prospect$chl[1], |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
107 car = input_prospect$car[1], |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
108 ant = input_prospect$ant[1], |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
109 brown = input_prospect$brown[1], |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
110 ewt = input_prospect$ewt[1], |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
111 lma = input_prospect$lma[1], |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
112 prot = input_prospect$prot[1], |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
113 cbc = input_prospect$cbc[1], |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
114 alpha = input_prospect$alpha[1]) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
115 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
116 if (sailversion == "4SAIL2") { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
117 # 4SAIL2 requires one of the following combination of input parameters |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
118 # Case #1: valid optical properties for brown vegetation |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
119 if (!is.null(brownvegetation)) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
120 # need to define reflectance and Transmittance for brownvegetation |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
121 if (length(grep("reflectance", names(brownvegetation))) == 0 || length(grep("Transmittance", names(brownvegetation))) == 0) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
122 message("Please define brownvegetation as a list including reflectance and Transmittance") |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
123 stop() |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
124 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
125 # check if spectral domain for optical properties of brown vegetation match |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
126 # with spectral domain for optical properties of green vegetation |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
127 if (length(setdiff(spec_sensor$lambda, brownvegetation$wvl)) > 0) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
128 message("Please define same spectral domain for brownvegetation and SpecPROSPECT") |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
129 stop() |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
130 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
131 if (length(unique(lengths(input_prospect))) == 1) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
132 if (!unique(lengths(input_prospect)) == 1) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
133 message("brownvegetation defined along with multiple leaf chemical properties") |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
134 message("Only first set of leaf chemical properties will be used to simulate green vegetation") |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
135 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
136 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
137 # if no leaf optical properties brown vegetation defined |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
138 } else if (is.null(brownvegetation)) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
139 # if all PROSPECT input parameters have the same length |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
140 if (length(unique(lengths(input_prospect))) == 1) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
141 # if all PROSPECT input parameters are unique (no possibility to simulate 2 types of leaf optics) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
142 if (unique(lengths(input_prospect)) == 1) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
143 # if fraction_brown set to 0, then assign green vegetation optics to brown vegetation optics |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
144 if (fraction_brown == 0) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
145 brownvegetation <- greenvegetation |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
146 # else run 4SAIL |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
147 } else { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
148 message("4SAIL2 needs two sets of optical properties for green and brown vegetation") |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
149 message("Currently one set is defined. will run 4SAIL instead of 4SAIL2") |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
150 sailversion <- "4SAIL" |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
151 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
152 # if all PROSPECT parameters have at least 2 elements |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
153 } else if (unique(lengths(input_prospect)) >= 2) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
154 # compute leaf optical properties |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
155 brownvegetation <- prospect::PROSPECT(SpecPROSPECT = spec_sensor, |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
156 n = input_prospect$n[2], |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
157 chl = input_prospect$chl[2], |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
158 car = input_prospect$car[2], |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
159 ant = input_prospect$ant[2], |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
160 brown = input_prospect$brown[2], |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
161 ewt = input_prospect$ewt[2], |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
162 lma = input_prospect$lma[2], |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
163 prot = input_prospect$prot[2], |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
164 cbc = input_prospect$cbc[2], |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
165 alpha = input_prospect$alpha[2]) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
166 if (unique(lengths(input_prospect)) > 2) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
167 message("4SAIL2 needs two sets of optical properties for green and brown vegetation") |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
168 message("Currently more than 2 sets are defined. will only use the first 2") |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
169 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
170 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
171 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
172 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
173 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
174 if (sailversion == "4SAIL") { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
175 if (length(unique(lengths(input_prospect))) == 1) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
176 if (unique(lengths(input_prospect)) > 1) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
177 message("4SAIL needs only one set of optical properties") |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
178 message("Currently more than one set of leaf chemical constituents is defined.") |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
179 message("Will run 4SAIL with the first set of leaf chemical constituents") |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
180 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
181 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
182 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
183 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
184 if (sailversion == "4SAIL") { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
185 # run 4SAIL |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
186 ref <- foursail(leafoptics = greenvegetation, |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
187 typelidf, lidfa, lidfb, lai, q, tts, tto, psi, rsoil) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
188 } else if (sailversion == "4SAIL2") { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
189 # run 4SAIL2 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
190 ref <- foursail2(leafgreen = greenvegetation, leafbrown = brownvegetation, |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
191 typelidf, lidfa, lidfb, lai, q, tts, tto, psi, rsoil, |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
192 fraction_brown, diss, cv, zeta) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
193 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
194 return(ref) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
195 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
196 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
197 #" Performs PROSAIL simulation based on a set of combinations of input parameters |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
198 #" @param leafoptics list. Includes leaf optical properties (reflectance and transmittance) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
199 #" and corresponding spectral bands |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
200 #" @param typelidf numeric. Type of leaf inclination distribution function |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
201 #" @param lidfa numeric. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
202 #" if typelidf == 1, controls the average leaf slope |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
203 #" if typelidf == 2, corresponds to average leaf angle |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
204 #" @param lidfb numeric. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
205 #" if typelidf == 1, unused |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
206 #" if typelidf == 2, controls the distribution"s bimodality |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
207 #" @param lai numeric. Leaf Area Index |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
208 #" @param q numeric. Hot Spot parameter |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
209 #" @param tts numeric. Sun zeith angle |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
210 #" @param tto numeric. Observer zeith angle |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
211 #" @param psi numeric. Azimuth Sun / Observer |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
212 #" @param rsoil numeric. Soil reflectance |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
213 #" |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
214 #" @return list. rdot, rsot, rddt, rsdt |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
215 #" rdot: hemispherical-directional reflectance factor in viewing direction |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
216 #" rsot: bi-directional reflectance factor |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
217 #" rsdt: directional-hemispherical reflectance factor for solar incident flux |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
218 #" rddt: bi-hemispherical reflectance factor |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
219 #" @export |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
220 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
221 foursail <- function(leafoptics, typelidf = 2, lidfa = nULL, lidfb = nULL, lai = nULL, |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
222 q = nULL, tts = nULL, tto = nULL, psi = nULL, rsoil = nULL) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
223 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
224 ############################## # |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
225 # LEAF OPTICAL PROPERTIES ## |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
226 ############################## # |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
227 rho <- leafoptics$Reflectance |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
228 tau <- leafoptics$Transmittance |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
229 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
230 # Geometric quantities |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
231 rd <- pi / 180 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
232 cts <- cos(rd * tts) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
233 cto <- cos(rd * tto) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
234 ctscto <- cts * cto |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
235 tants <- tan(rd * tts) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
236 tanto <- tan(rd * tto) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
237 cospsi <- cos(rd * psi) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
238 dso <- sqrt(tants * tants + tanto * tanto - 2. * tants * tanto * cospsi) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
239 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
240 # Generate leaf angle distribution from average leaf angle (ellipsoidal) or (a, b) parameters |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
241 if (typelidf == 1) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
242 foliar_distrib <- dladgen(lidfa, lidfb) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
243 lidf <- foliar_distrib$lidf |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
244 litab <- foliar_distrib$litab |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
245 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
246 } else if (typelidf == 2) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
247 foliar_distrib <- campbell(lidfa) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
248 lidf <- foliar_distrib$lidf |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
249 litab <- foliar_distrib$litab |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
250 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
251 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
252 # angular distance, compensation of shadow length |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
253 # Calculate geometric factors associated with extinction and scattering |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
254 # Initialise sums |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
255 ks <- 0 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
256 ko <- 0 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
257 bf <- 0 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
258 sob <- 0 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
259 sof <- 0 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
260 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
261 # Weighted sums over LIDF |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
262 na <- length(litab) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
263 for (i in 1:na) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
264 ttl <- litab[i] # leaf inclination discrete values |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
265 ctl <- cos(rd * ttl) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
266 # SAIL volume scattering phase function gives interception and portions to be |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
267 # multiplied by rho and tau |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
268 resvolscatt <- volscatt(tts, tto, psi, ttl) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
269 chi_s <- resvolscatt$chi_s |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
270 chi_o <- resvolscatt$chi_o |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
271 frho <- resvolscatt$frho |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
272 ftau <- resvolscatt$ftau |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
273 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
274 #******************************************************************************** |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
275 #* SUITS SYSTEM coEFFICIEnTS |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
276 #* |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
277 #* ks : Extinction coefficient for direct solar flux |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
278 #* ko : Extinction coefficient for direct observed flux |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
279 #* att : Attenuation coefficient for diffuse flux |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
280 #* sigb : Backscattering coefficient of the diffuse downward flux |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
281 #* sigf : Forwardscattering coefficient of the diffuse upward flux |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
282 #* sf : Scattering coefficient of the direct solar flux for downward diffuse flux |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
283 #* sb : Scattering coefficient of the direct solar flux for upward diffuse flux |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
284 #* vf : Scattering coefficient of upward diffuse flux in the observed direction |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
285 #* vb : Scattering coefficient of downward diffuse flux in the observed direction |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
286 #* w : Bidirectional scattering coefficient |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
287 #******************************************************************************** |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
288 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
289 # Extinction coefficients |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
290 ksli <- chi_s / cts |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
291 koli <- chi_o / cto |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
292 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
293 # Area scattering coefficient fractions |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
294 sobli <- frho * pi / ctscto |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
295 sofli <- ftau * pi / ctscto |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
296 bfli <- ctl * ctl |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
297 ks <- ks + ksli * lidf[i] |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
298 ko <- ko + koli * lidf[i] |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
299 bf <- bf + bfli * lidf[i] |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
300 sob <- sob + sobli * lidf[i] |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
301 sof <- sof + sofli * lidf[i] |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
302 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
303 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
304 # Geometric factors to be used later with rho and tau |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
305 sdb <- 0.5 * (ks + bf) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
306 sdf <- 0.5 * (ks - bf) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
307 dob <- 0.5 * (ko + bf) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
308 dof <- 0.5 * (ko - bf) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
309 ddb <- 0.5 * (1. + bf) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
310 ddf <- 0.5 * (1. - bf) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
311 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
312 # Here rho and tau come in |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
313 sigb <- ddb * rho + ddf * tau |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
314 sigf <- ddf * rho + ddb * tau |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
315 att <- 1 - sigf |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
316 m2 <- (att + sigb) * (att - sigb) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
317 m2[which(m2 <= 0)] <- 0 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
318 m <- sqrt(m2) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
319 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
320 sb <- sdb * rho + sdf * tau |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
321 sf <- sdf * rho + sdb * tau |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
322 vb <- dob * rho + dof * tau |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
323 vf <- dof * rho + dob * tau |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
324 w <- sob * rho + sof * tau |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
325 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
326 # Here the LAI comes in |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
327 # Outputs for the case LAI = 0 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
328 if (lai < 0) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
329 tss <- 1 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
330 too <- 1 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
331 tsstoo <- 1 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
332 rdd <- 0 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
333 tdd <- 1 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
334 rsd <- 0 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
335 tsd <- 0 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
336 rdo <- 0 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
337 tdo <- 0 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
338 rso <- 0 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
339 rsos <- 0 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
340 rsod <- 0 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
341 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
342 rddt <- rsoil |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
343 rsdt <- rsoil |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
344 rdot <- rsoil |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
345 rsodt <- 0 * rsoil |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
346 rsost <- rsoil |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
347 rsot <- rsoil |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
348 } else { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
349 # Other cases (LAI > 0) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
350 e1 <- exp(-m * lai) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
351 e2 <- e1 * e1 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
352 rinf <- (att - m) / sigb |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
353 rinf2 <- rinf * rinf |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
354 re <- rinf * e1 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
355 denom <- 1. - rinf2 * e2 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
356 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
357 j1ks <- jfunc1(ks, m, lai) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
358 j2ks <- jfunc2(ks, m, lai) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
359 j1ko <- jfunc1(ko, m, lai) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
360 j2ko <- jfunc2(ko, m, lai) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
361 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
362 ps <- (sf + sb * rinf) * j1ks |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
363 qs <- (sf * rinf + sb) * j2ks |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
364 pv <- (vf + vb * rinf) * j1ko |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
365 qv <- (vf * rinf + vb) * j2ko |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
366 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
367 rdd <- rinf * (1. - e2) / denom |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
368 tdd <- (1. - rinf2) * e1 / denom |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
369 tsd <- (ps - re * qs) / denom |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
370 rsd <- (qs - re * ps) / denom |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
371 tdo <- (pv - re * qv) / denom |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
372 rdo <- (qv - re * pv) / denom |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
373 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
374 tss <- exp(-ks * lai) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
375 too <- exp(-ko * lai) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
376 z <- jfunc3(ks, ko, lai) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
377 g1 <- (z - j1ks * too) / (ko + m) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
378 g2 <- (z - j1ko * tss) / (ks + m) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
379 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
380 tv1 <- (vf * rinf + vb) * g1 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
381 tv2 <- (vf + vb * rinf) * g2 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
382 t1 <- tv1 * (sf + sb * rinf) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
383 t2 <- tv2 * (sf * rinf + sb) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
384 t3 <- (rdo * qs + tdo * ps) * rinf |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
385 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
386 # Multiple scattering contribution to bidirectional canopy reflectance |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
387 rsod <- (t1 + t2 - t3) / (1. - rinf2) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
388 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
389 # Treatment of the hotspot-effect |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
390 alf <- 1e6 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
391 # Apply correction 2 / (K + k) suggested by F.-M. Breon |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
392 if (q > 0) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
393 alf <- (dso / q) * 2. / (ks + ko) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
394 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
395 if (alf > 200) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
396 # inserted H. Bach 1 / 3 / 04 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
397 alf <- 200 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
398 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
399 if (alf == 0) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
400 # The pure hotspot - no shadow |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
401 tsstoo <- tss |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
402 sumint <- (1 - tss) / (ks * lai) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
403 } else { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
404 # Outside the hotspot |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
405 fhot <- lai * sqrt(ko * ks) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
406 # Integrate by exponential Simpson method in 20 steps |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
407 # the steps are arranged according to equal partitioning |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
408 # of the slope of the joint probability function |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
409 x1 <- 0 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
410 y1 <- 0 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
411 f1 <- 1 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
412 fint <- (1. - exp(-alf)) * 0.05 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
413 sumint <- 0 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
414 for (i in 1:20) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
415 if (i < 20) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
416 x2 <- -log(1. - i * fint) / alf |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
417 } else { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
418 x2 <- 1 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
419 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
420 y2 <- -(ko + ks) * lai * x2 + fhot * (1. - exp(-alf * x2)) / alf |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
421 f2 <- exp(y2) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
422 sumint <- sumint + (f2 - f1) * (x2 - x1) / (y2 - y1) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
423 x1 <- x2 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
424 y1 <- y2 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
425 f1 <- f2 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
426 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
427 tsstoo <- f1 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
428 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
429 # Bidirectional reflectance |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
430 # Single scattering contribution |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
431 rsos <- w * lai * sumint |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
432 # Total canopy contribution |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
433 rso <- rsos + rsod |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
434 # Interaction with the soil |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
435 dn <- 1. - rsoil * rdd |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
436 # rddt: bi-hemispherical reflectance factor |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
437 rddt <- rdd + tdd * rsoil * tdd / dn |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
438 # rsdt: directional-hemispherical reflectance factor for solar incident flux |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
439 rsdt <- rsd + (tsd + tss) * rsoil * tdd / dn |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
440 # rdot: hemispherical-directional reflectance factor in viewing direction |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
441 rdot <- rdo + tdd * rsoil * (tdo + too) / dn |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
442 # rsot: bi-directional reflectance factor |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
443 rsodt <- rsod + ((tss + tsd) * tdo + (tsd + tss * rsoil * rdd) * too) * rsoil / dn |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
444 rsost <- rsos + tsstoo * rsoil |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
445 rsot <- rsost + rsodt |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
446 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
447 my_list <- list("rdot" = rdot, "rsot" = rsot, "rddt" = rddt, "rsdt" = rsdt) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
448 return(my_list) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
449 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
450 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
451 #" Performs pro4sail2 simulation based on a set of combinations of input parameters |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
452 #" @param leafgreen list. includes relfectance and transmittance for vegetation #1 (e.g. green vegetation) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
453 #" @param leafbrown list. includes relfectance and transmittance for vegetation #2 (e.g. brown vegetation) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
454 #" @param typelidf numeric. Type of leaf inclination distribution function |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
455 #" @param lidfa numeric. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
456 #" if typelidf == 1, controls the average leaf slope |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
457 #" if typelidf == 2, corresponds to average leaf angle |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
458 #" @param lidfb numeric. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
459 #" if typelidf == 1, unused |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
460 #" if typelidf == 2, controls the distribution"s bimodality |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
461 #" @param lai numeric. Leaf Area Index |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
462 #" @param hot numeric. Hot Spot parameter = ratio of the correlation length of leaf projections in the horizontal plane and the canopy height (doi:10.1016 / j.rse.2006.12.013) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
463 #" @param tts numeric. Sun zeith angle |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
464 #" @param tto numeric. Observer zeith angle |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
465 #" @param psi numeric. Azimuth Sun / Observer |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
466 #" @param rsoil numeric. Soil reflectance |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
467 #" @param fraction_brown numeric. Fraction of brown leaf area |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
468 #" @param diss numeric. Layer dissociation factor |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
469 #" @param cv numeric. vertical crown cover percentage |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
470 #" = % ground area covered with crowns as seen from nadir direction |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
471 #" @param zeta numeric. Tree shape factor |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
472 #" = ratio of crown diameter to crown height |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
473 #" |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
474 #" @return list. rdot, rsot, rddt, rsdt |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
475 #" rdot: hemispherical-directional reflectance factor in viewing direction |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
476 #" rsot: bi-directional reflectance factor |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
477 #" rsdt: directional-hemispherical reflectance factor for solar incident flux |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
478 #" rddt: bi-hemispherical reflectance factor |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
479 #" alfast: canopy absorptance for direct solar incident flux |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
480 #" alfadt: canopy absorptance for hemispherical diffuse incident flux |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
481 #" @export |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
482 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
483 foursail2 <- function(leafgreen, leafbrown, |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
484 typelidf = 2, lidfa = nULL, lidfb = nULL, |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
485 lai = nULL, hot = nULL, tts = nULL, tto = nULL, psi = nULL, rsoil = nULL, |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
486 fraction_brown = 0.5, diss = 0.5, cv = 1, zeta = 1) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
487 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
488 # This version does not include non-Lambertian soil properties. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
489 # original codes do, and only need to add the following variables as input |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
490 rddsoil <- rdosoil <- rsdsoil <- rsosoil <- rsoil |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
491 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
492 # Geometric quantities |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
493 rd <- pi / 180 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
494 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
495 # Generate leaf angle distribution from average leaf angle (ellipsoidal) or (a, b) parameters |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
496 if (typelidf == 1) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
497 foliar_distrib <- dladgen(lidfa, lidfb) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
498 lidf <- foliar_distrib$lidf |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
499 litab <- foliar_distrib$litab |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
500 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
501 } else if (typelidf == 2) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
502 foliar_distrib <- campbell(lidfa) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
503 lidf <- foliar_distrib$lidf |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
504 litab <- foliar_distrib$litab |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
505 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
506 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
507 if (lai < 0) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
508 message("Please define positive LAI value") |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
509 rddt <- rsdt <- rdot <- rsost <- rsot <- rsoil |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
510 alfast <- alfadt <- 0 * rsoil |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
511 } else if (lai == 0) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
512 tss <- too <- tsstoo <- tdd <- 1.0 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
513 rdd <- rsd <- tsd <- rdo <- tdo <- 0.0 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
514 rso <- rsos <- rsod <- rsodt <- 0.0 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
515 rddt <- rsdt <- rdot <- rsost <- rsot <- rsoil |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
516 alfast <- alfadt <- 0 * rsoil |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
517 } else if (lai > 0) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
518 cts <- cos(rd * tts) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
519 cto <- cos(rd * tto) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
520 ctscto <- cts * cto |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
521 tants <- tan(rd * tts) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
522 tanto <- tan(rd * tto) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
523 cospsi <- cos(rd * psi) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
524 dso <- sqrt(tants * tants + tanto * tanto - 2.0 * tants * tanto * cospsi) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
525 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
526 # Clumping effects |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
527 cs <- co <- 1.0 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
528 if (cv <= 1.0) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
529 cs <- 1.0 - (1.0 - cv)^(1.0 / cts) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
530 co <- 1.0 - (1.0 - cv)^(1.0 / cto) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
531 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
532 overlap <- 0.0 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
533 if (zeta > 0.0) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
534 overlap <- min(cs * (1.0 - co), co * (1.0 - cs)) * exp(-dso / zeta) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
535 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
536 fcd <- cs * co + overlap |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
537 fcs <- (1.0 - cs) * co - overlap |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
538 fod <- cs * (1.0 - co) - overlap |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
539 fos <- (1.0 - cs) * (1.0 - co) + overlap |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
540 fcdc <- 1.0 - (1.0 - fcd)^(0.5 / cts + 0.5 / cto) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
541 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
542 # Part depending on diss, fraction_brown, and leaf optical properties |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
543 # First save the input fraction_brown as the old fraction_brown, as the following change is only artificial |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
544 # Better define an fraction_brown that is actually used: fb, so that the input is not modified! |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
545 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
546 fb <- fraction_brown |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
547 # if only green leaves |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
548 if (fraction_brown == 0.0) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
549 fb <- 0.5 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
550 leafbrown$Reflectance <- leafgreen$Reflectance |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
551 leafbrown$Transmittance <- leafgreen$Transmittance |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
552 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
553 if (fraction_brown == 1.0) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
554 fb <- 0.5 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
555 leafgreen$Reflectance <- leafbrown$Reflectance |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
556 leafgreen$Transmittance <- leafbrown$Transmittance |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
557 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
558 s <- (1.0 - diss) * fb * (1.0 - fb) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
559 # rho1 && tau1 : green foliage |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
560 # rho2 && tau2 : brown foliage (bottom layer) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
561 rho1 <- ((1 - fb - s) * leafgreen$Reflectance + s * leafbrown$Reflectance) / (1 - fb) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
562 tau1 <- ((1 - fb - s) * leafgreen$Transmittance + s * leafbrown$Transmittance) / (1 - fb) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
563 rho2 <- (s * leafgreen$Reflectance + (fb - s) * leafbrown$Reflectance) / fb |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
564 tau2 <- (s * leafgreen$Transmittance + (fb - s) * leafbrown$Transmittance) / fb |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
565 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
566 # angular distance, compensation of shadow length |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
567 # Calculate geometric factors associated with extinction and scattering |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
568 # Initialise sums |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
569 ks <- ko <- bf <- sob <- sof <- 0 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
570 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
571 # Weighted sums over LIDF |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
572 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
573 for (i in 1:seq_along(litab)) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
574 ttl <- litab[i] |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
575 ctl <- cos(rd * ttl) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
576 # SAIL volscatt function gives interception coefficients |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
577 # and two portions of the volume scattering phase function to be |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
578 # multiplied by rho and tau, respectively |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
579 resvolscatt <- volscatt(tts, tto, psi, ttl) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
580 chi_s <- resvolscatt$chi_s |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
581 chi_o <- resvolscatt$chi_o |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
582 frho <- resvolscatt$frho |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
583 ftau <- resvolscatt$ftau |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
584 # Extinction coefficients |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
585 ksli <- chi_s / cts |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
586 koli <- chi_o / cto |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
587 # Area scattering coefficient fractions |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
588 sobli <- frho * pi / ctscto |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
589 sofli <- ftau * pi / ctscto |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
590 bfli <- ctl * ctl |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
591 ks <- ks + ksli * lidf[i] |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
592 ko <- ko + koli * lidf[i] |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
593 bf <- bf + bfli * lidf[i] |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
594 sob <- sob + sobli * lidf[i] |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
595 sof <- sof + sofli * lidf[i] |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
596 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
597 # Geometric factors to be used later in combination with rho and tau |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
598 sdb <- 0.5 * (ks + bf) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
599 sdf <- 0.5 * (ks - bf) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
600 dob <- 0.5 * (ko + bf) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
601 dof <- 0.5 * (ko - bf) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
602 ddb <- 0.5 * (1. + bf) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
603 ddf <- 0.5 * (1. - bf) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
604 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
605 # LAIs in two layers |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
606 lai1 <- (1 - fb) * lai |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
607 lai2 <- fb * lai |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
608 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
609 tss <- exp(-ks * lai) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
610 ck <- exp(-ks * lai1) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
611 alf <- 1e6 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
612 if (hot > 0.0) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
613 alf <- (dso / hot) * 2.0 / (ks + ko) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
614 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
615 if (alf > 200.0) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
616 alf <- 200.0 # inserted H. Bach 1 / 3 / 04 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
617 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
618 if (alf == 0.0) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
619 # The pure hotspot |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
620 tsstoo <- tss |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
621 s1 <- (1 - ck) / (ks * lai) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
622 s2 <- (ck - tss) / (ks * lai) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
623 } else { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
624 # Outside the hotspot |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
625 fhot <- lai * sqrt(ko * ks) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
626 # Integrate 2 layers by exponential simpson method in 20 steps |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
627 # the steps are arranged according to equal partitioning |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
628 # of the derivative of the joint probability function |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
629 x1 <- y1 <- 0.0 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
630 f1 <- 1.0 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
631 ca <- exp(alf * (fb - 1.0)) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
632 fint <- (1.0 - ca) * .05 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
633 s1 <- 0.0 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
634 for (istep in 1:20) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
635 if (istep < 20) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
636 x2 <- -log(1. - istep * fint) / alf |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
637 } else { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
638 x2 <- 1. - fb |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
639 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
640 y2 <- -(ko + ks) * lai * x2 + fhot * (1.0 - exp(-alf * x2)) / alf |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
641 f2 <- exp(y2) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
642 s1 <- s1 + (f2 - f1) * (x2 - x1) / (y2 - y1) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
643 x1 <- x2 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
644 y1 <- y2 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
645 f1 <- f2 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
646 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
647 fint <- (ca - exp(-alf)) * .05 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
648 s2 <- 0.0 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
649 for (istep in 1:20) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
650 if (istep < 20) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
651 x2 <- -log(ca - istep * fint) / alf |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
652 } else { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
653 x2 <- 1.0 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
654 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
655 y2 <- -(ko + ks) * lai * x2 + fhot * (1.0 - exp(-alf * x2)) / alf |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
656 f2 <- exp(y2) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
657 s2 <- s2 + (f2 - f1) * (x2 - x1) / (y2 - y1) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
658 x1 <- x2 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
659 y1 <- y2 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
660 f1 <- f2 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
661 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
662 tsstoo <- f1 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
663 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
664 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
665 # Calculate reflectances and transmittances |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
666 # Bottom layer |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
667 tss <- exp(-ks * lai2) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
668 too <- exp(-ko * lai2) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
669 sb <- sdb * rho2 + sdf * tau2 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
670 sf <- sdf * rho2 + sdb * tau2 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
671 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
672 vb <- dob * rho2 + dof * tau2 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
673 vf <- dof * rho2 + dob * tau2 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
674 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
675 w2 <- sob * rho2 + sof * tau2 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
676 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
677 sigb <- ddb * rho2 + ddf * tau2 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
678 sigf <- ddf * rho2 + ddb * tau2 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
679 att <- 1.0 - sigf |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
680 m2 <- (att + sigb) * (att - sigb) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
681 m2[m2 < 0] <- 0 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
682 m <- sqrt(m2) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
683 which_ncs <- which(m > 0.01) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
684 which_cs <- which(m <= 0.01) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
685 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
686 tdd <- rdd <- tsd <- rsd <- tdo <- rdo <- 0 * m |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
687 rsod <- 0 * m |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
688 if (length(which_ncs) > 0) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
689 resncs <- nonconservativescattering(m[which_ncs], lai2, att[which_ncs], sigb[which_ncs], |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
690 ks, ko, sf[which_ncs], sb[which_ncs], vf[which_ncs], vb[which_ncs], tss, too) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
691 tdd[which_ncs] <- resncs$tdd |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
692 rdd[which_ncs] <- resncs$rdd |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
693 tsd[which_ncs] <- resncs$tsd |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
694 rsd[which_ncs] <- resncs$rsd |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
695 tdo[which_ncs] <- resncs$tdo |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
696 rdo[which_ncs] <- resncs$rdo |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
697 rsod[which_ncs] <- resncs$rsod |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
698 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
699 if (length(which_cs) > 0) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
700 rescs <- conservativescattering(m[which_cs], lai2, att[which_cs], sigb[which_cs], |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
701 ks, ko, sf[which_cs], sb[which_cs], vf[which_cs], vb[which_cs], tss, too) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
702 tdd[which_cs] <- rescs$tdd |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
703 rdd[which_cs] <- rescs$rdd |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
704 tsd[which_cs] <- rescs$tsd |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
705 rsd[which_cs] <- rescs$rsd |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
706 tdo[which_cs] <- rescs$tdo |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
707 rdo[which_cs] <- rescs$rdo |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
708 rsod[which_cs] <- rescs$rsod |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
709 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
710 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
711 # Set background properties equal to those of the bottom layer on a black soil |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
712 rddb <- rdd |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
713 rsdb <- rsd |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
714 rdob <- rdo |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
715 rsodb <- rsod |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
716 tddb <- tdd |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
717 tsdb <- tsd |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
718 tdob <- tdo |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
719 toob <- too |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
720 tssb <- tss |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
721 # Top layer |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
722 tss <- exp(-ks * lai1) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
723 too <- exp(-ko * lai1) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
724 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
725 sb <- sdb * rho1 + sdf * tau1 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
726 sf <- sdf * rho1 + sdb * tau1 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
727 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
728 vb <- dob * rho1 + dof * tau1 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
729 vf <- dof * rho1 + dob * tau1 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
730 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
731 w1 <- sob * rho1 + sof * tau1 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
732 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
733 sigb <- ddb * rho1 + ddf * tau1 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
734 sigf <- ddf * rho1 + ddb * tau1 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
735 att <- 1.0 - sigf |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
736 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
737 m2 <- (att + sigb) * (att - sigb) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
738 m2[m2 < 0] <- 0 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
739 m <- sqrt(m2) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
740 which_ncs <- which(m > 0.01) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
741 which_cs <- which(m <= 0.01) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
742 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
743 tdd <- rdd <- tsd <- rsd <- tdo <- rdo <- 0 * m |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
744 rsod <- 0 * m |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
745 if (length(which_ncs) > 0) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
746 resncs <- nonconservativescattering(m[which_ncs], lai1, att[which_ncs], sigb[which_ncs], |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
747 ks, ko, sf[which_ncs], sb[which_ncs], vf[which_ncs], vb[which_ncs], tss, too) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
748 tdd[which_ncs] <- resncs$tdd |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
749 rdd[which_ncs] <- resncs$rdd |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
750 tsd[which_ncs] <- resncs$tsd |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
751 rsd[which_ncs] <- resncs$rsd |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
752 tdo[which_ncs] <- resncs$tdo |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
753 rdo[which_ncs] <- resncs$rdo |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
754 rsod[which_ncs] <- resncs$rsod |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
755 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
756 if (length(which_cs) > 0) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
757 rescs <- conservativescattering(m[which_cs], lai1, att[which_cs], sigb[which_cs], |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
758 ks, ko, sf[which_cs], sb[which_cs], vf[which_cs], vb[which_cs], tss, too) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
759 tdd[which_cs] <- rescs$tdd |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
760 rdd[which_cs] <- rescs$rdd |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
761 tsd[which_cs] <- rescs$tsd |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
762 rsd[which_cs] <- rescs$rsd |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
763 tdo[which_cs] <- rescs$tdo |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
764 rdo[which_cs] <- rescs$rdo |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
765 rsod[which_cs] <- rescs$rsod |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
766 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
767 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
768 # combine with bottom layer reflectances and transmittances (adding method) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
769 rn <- 1.0 - rdd * rddb |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
770 tup <- (tss * rsdb + tsd * rddb) / rn |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
771 tdn <- (tsd + tss * rsdb * rdd) / rn |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
772 rsdt <- rsd + tup * tdd |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
773 rdot <- rdo + tdd * (rddb * tdo + rdob * too) / rn |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
774 rsodt <- rsod + (tss * rsodb + tdn * rdob) * too + tup * tdo |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
775 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
776 rsost <- (w1 * s1 + w2 * s2) * lai |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
777 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
778 rsot <- rsost + rsodt |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
779 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
780 # Diffuse reflectances at the top and the bottom are now different |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
781 rddt_t <- rdd + tdd * rddb * tdd / rn |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
782 rddt_b <- rddb + tddb * rdd * tddb / rn |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
783 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
784 # Transmittances of the combined canopy layers |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
785 tsst <- tss * tssb |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
786 toot <- too * toob |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
787 tsdt <- tss * tsdb + tdn * tddb |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
788 tdot <- tdob * too + tddb * (tdo + rdd * rdob * too) / rn |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
789 tddt <- tdd * tddb / rn |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
790 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
791 # Apply clumping effects to vegetation layer |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
792 rddcb <- cv * rddt_b |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
793 rddct <- cv * rddt_t |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
794 tddc <- 1 - cv + cv * tddt |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
795 rsdc <- cs * rsdt |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
796 tsdc <- cs * tsdt |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
797 rdoc <- co * rdot |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
798 tdoc <- co * tdot |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
799 tssc <- 1 - cs + cs * tsst |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
800 tooc <- 1 - co + co * toot |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
801 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
802 # new weight function fcdc for crown contribution (W. Verhoef, 22-05-08) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
803 rsoc <- fcdc * rsot |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
804 tssooc <- fcd * tsstoo + fcs * toot + fod * tsst + fos |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
805 # Canopy absorptance for black background (W. Verhoef, 02-03-04) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
806 alfas <- 1. - tssc - tsdc - rsdc |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
807 alfad <- 1. - tddc - rddct |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
808 # Add the soil background |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
809 rn <- 1 - rddcb * rddsoil |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
810 tup <- (tssc * rsdsoil + tsdc * rddsoil) / rn |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
811 tdn <- (tsdc + tssc * rsdsoil * rddcb) / rn |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
812 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
813 rddt <- rddct + tddc * rddsoil * tddc / rn |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
814 rsdt <- rsdc + tup * tddc |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
815 rdot <- rdoc + tddc * (rddsoil * tdoc + rdosoil * tooc) / rn |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
816 rsot <- rsoc + tssooc * rsosoil + tdn * rdosoil * tooc + tup * tdoc |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
817 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
818 # Effect of soil background on canopy absorptances (W. Verhoef, 02-03-04) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
819 alfast <- alfas + tup * alfad |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
820 alfadt <- alfad * (1. + tddc * rddsoil / rn) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
821 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
822 my_list <- list("rdot" = rdot, "rsot" = rsot, "rddt" = rddt, "rsdt" = rsdt, |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
823 "alfast" = alfast, "alfadt" = alfadt) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
824 return(my_list) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
825 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
826 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
827 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
828 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
829 #" computes non conservative scattering conditions |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
830 #" @param m numeric. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
831 #" @param lai numeric. Leaf Area Index |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
832 #" @param att numeric. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
833 #" @param sigb numeric. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
834 #" @param ks numeric. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
835 #" @param ko numeric. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
836 #" @param sf numeric. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
837 #" @param sb numeric. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
838 #" @param vf numeric. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
839 #" @param vb numeric. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
840 #" @param tss numeric. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
841 #" @param too numeric. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
842 #" |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
843 #" @return list. tdd, rdd, tsd, rsd, tdo, rdo, rsod |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
844 #" |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
845 #" @export |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
846 nonconservativescattering <- function(m, lai, att, sigb, ks, ko, sf, sb, vf, vb, tss, too) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
847 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
848 e1 <- exp(-m * lai) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
849 e2 <- e1 * e1 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
850 rinf <- (att - m) / sigb |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
851 rinf2 <- rinf * rinf |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
852 re <- rinf * e1 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
853 denom <- 1. - rinf2 * e2 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
854 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
855 j1ks <- jfunc1(ks, m, lai) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
856 j2ks <- jfunc2(ks, m, lai) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
857 j1ko <- jfunc1(ko, m, lai) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
858 j2ko <- jfunc2(ko, m, lai) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
859 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
860 ps <- (sf + sb * rinf) * j1ks |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
861 qs <- (sf * rinf + sb) * j2ks |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
862 pv <- (vf + vb * rinf) * j1ko |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
863 qv <- (vf * rinf + vb) * j2ko |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
864 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
865 tdd <- (1. - rinf2) * e1 / denom |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
866 rdd <- rinf * (1. - e2) / denom |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
867 tsd <- (ps - re * qs) / denom |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
868 rsd <- (qs - re * ps) / denom |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
869 tdo <- (pv - re * qv) / denom |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
870 rdo <- (qv - re * pv) / denom |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
871 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
872 z <- jfunc2(ks, ko, lai) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
873 g1 <- (z - j1ks * too) / (ko + m) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
874 g2 <- (z - j1ko * tss) / (ks + m) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
875 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
876 tv1 <- (vf * rinf + vb) * g1 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
877 tv2 <- (vf + vb * rinf) * g2 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
878 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
879 t1 <- tv1 * (sf + sb * rinf) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
880 t2 <- tv2 * (sf * rinf + sb) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
881 t3 <- (rdo * qs + tdo * ps) * rinf |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
882 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
883 # Multiple scattering contribution to bidirectional canopy reflectance |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
884 rsod <- (t1 + t2 - t3) / (1. - rinf2) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
885 my_list <- list("tdd" = tdd, "rdd" = rdd, "tsd" = tsd, |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
886 "rsd" = rsd, "tdo" = tdo, "rdo" = rdo, |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
887 "rsod" = rsod) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
888 return(my_list) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
889 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
890 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
891 #" computes conservative scattering conditions |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
892 #" @param m numeric. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
893 #" @param lai numeric. Leaf Area Index |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
894 #" @param att numeric. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
895 #" @param sigb numeric. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
896 #" @param ks numeric. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
897 #" @param ko numeric. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
898 #" @param sf numeric. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
899 #" @param sb numeric. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
900 #" @param vf numeric. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
901 #" @param vb numeric. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
902 #" @param tss numeric. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
903 #" @param too numeric. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
904 #" |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
905 #" @return list. tdd, rdd, tsd, rsd, tdo, rdo, rsod |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
906 #" |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
907 #" @export |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
908 conservativescattering <- function(m, lai, att, sigb, ks, ko, sf, sb, vf, vb, tss, too) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
909 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
910 # near or complete conservative scattering |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
911 j4 <- jfunc4(m, lai) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
912 amsig <- att - sigb |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
913 apsig <- att + sigb |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
914 rtp <- (1 - amsig * j4) / (1 + amsig * j4) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
915 rtm <- (-1 + apsig * j4) / (1 + apsig * j4) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
916 rdd <- 0.5 * (rtp + rtm) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
917 tdd <- 0.5 * (rtp - rtm) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
918 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
919 dns <- ks * ks - m * m |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
920 dno <- ko * ko - m * m |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
921 cks <- (sb * (ks - att) - sf * sigb) / dns |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
922 cko <- (vb * (ko - att) - vf * sigb) / dno |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
923 dks <- (-sf * (ks + att) - sb * sigb) / dns |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
924 dko <- (-vf * (ko + att) - vb * sigb) / dno |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
925 ho <- (sf * cko + sb * dko) / (ko + ks) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
926 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
927 rsd <- cks * (1 - tss * tdd) - dks * rdd |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
928 rdo <- cko * (1 - too * tdd) - dko * rdd |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
929 tsd <- dks * (tss - tdd) - cks * tss * rdd |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
930 tdo <- dko * (too - tdd) - cko * too * rdd |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
931 # Multiple scattering contribution to bidirectional canopy reflectance |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
932 rsod <- ho * (1 - tss * too) - cko * tsd * too - dko * rsd |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
933 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
934 my_list <- list("tdd" = tdd, "rdd" = rdd, "tsd" = tsd, |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
935 "rsd" = rsd, "tdo" = tdo, "rdo" = rdo, |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
936 "rsod" = rsod) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
937 return(my_list) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
938 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
939 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
940 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
941 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
942 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
943 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
944 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
945 #" computes the leaf angle distribution function value (freq) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
946 #" |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
947 #" Ellipsoidal distribution function characterised by the average leaf |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
948 #" inclination angle in degree (ala) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
949 #" Campbell 1986 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
950 #" @param ala average leaf angle |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
951 #" @return foliar_distrib list. lidf and litab |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
952 #" @export |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
953 campbell <- function(ala) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
954 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
955 tx1 <- c(10., 20., 30., 40., 50., 60., 70., 80., 82., 84., 86., 88., 90.) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
956 tx2 <- c(0., 10., 20., 30., 40., 50., 60., 70., 80., 82., 84., 86., 88.) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
957 litab <- (tx2 + tx1) / 2 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
958 n <- length(litab) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
959 tl1 <- tx1 * (pi / 180) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
960 tl2 <- tx2 * (pi / 180) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
961 excent <- exp(-1.6184e-5 * ala**3 + 2.1145e-3 * ala**2 - 1.2390e-1 * ala + 3.2491) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
962 sum0 <- 0 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
963 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
964 freq <- c() |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
965 for (i in 1:n) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
966 x1 <- excent / (sqrt(1. + excent**2. * tan(tl1[i])**2)) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
967 x2 <- excent / (sqrt(1. + excent**2. * tan(tl2[i])**2)) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
968 if (excent == 1) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
969 freq[i] <- abs(cos(tl1[i]) - cos(tl2[i])) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
970 } else { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
971 alpha <- excent / sqrt(abs(1 - excent**2)) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
972 alpha2 <- alpha**2 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
973 x12 <- x1**2 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
974 x22 <- x2**2 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
975 alpx1 <- 0 * alpha2 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
976 alpx2 <- 0 * alpha2 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
977 almx1 <- 0 * alpha2 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
978 almx2 <- 0 * alpha2 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
979 if (excent > 1) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
980 alpx1 <- sqrt(alpha2[excent > 1] + x12[excent > 1]) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
981 alpx2[excent > 1] <- sqrt(alpha2[excent > 1] + x22[excent > 1]) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
982 dum <- x1 * alpx1 + alpha2 * log(x1 + alpx1) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
983 freq[i] <- abs(dum - (x2 * alpx2 + alpha2 * log(x2 + alpx2))) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
984 } else { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
985 almx1 <- sqrt(alpha2 - x12) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
986 almx2 <- sqrt(alpha2 - x22) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
987 dum <- x1 * almx1 + alpha2 * asin(x1 / alpha) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
988 freq[i] <- abs(dum - (x2 * almx2 + alpha2 * asin(x2 / alpha))) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
989 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
990 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
991 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
992 sum0 <- sum(freq) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
993 freq0 <- freq / sum0 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
994 foliar_distrib <- list("lidf" = freq0, "litab" = litab) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
995 return(foliar_distrib) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
996 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
997 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
998 #" computes the leaf angle distribution function value (freq) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
999 #" |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1000 #" Using the original bimodal distribution function initially proposed in SAIL |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1001 #" references |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1002 #" ---------- |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1003 #" (Verhoef1998) Verhoef, Wout. Theory of radiative transfer models applied |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1004 #" in optical remote sensing of vegetation canopies. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1005 #" nationaal Lucht en Ruimtevaartlaboratorium, 1998. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1006 #" http: / / library.wur.nl / WebQuery / clc / 945481. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1007 #" @param a controls the average leaf slope |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1008 #" @param b controls the distribution"s bimodality |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1009 #" LIDF type a b |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1010 #" Planophile 1 0 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1011 #" Erectophile -1 0 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1012 #" Plagiophile 0 -1 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1013 #" Extremophile 0 1 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1014 #" Spherical -0.35 -0.15 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1015 #" Uniform 0 0 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1016 #" requirement: ||lidfa|| + ||lidfb|| < 1 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1017 #" |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1018 #" @return foliar_distrib list. lidf and litab |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1019 #" @export |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1020 dladgen <- function(a, b) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1021 litab <- c(5., 15., 25., 35., 45., 55., 65., 75., 81., 83., 85., 87., 89.) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1022 freq <- c() |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1023 for (i1 in 1:8) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1024 t <- i1 * 10 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1025 freq[i1] <- dcum(a, b, t) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1026 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1027 for (i2 in 9:12) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1028 t <- 80. + (i2 - 8) * 2. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1029 freq[i2] <- dcum(a, b, t) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1030 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1031 freq[13] <- 1 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1032 for (i in 13:2) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1033 freq[i] <- freq[i] - freq[i - 1] |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1034 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1035 foliar_distrib <- list("lidf" = freq, "litab" = litab) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1036 return(foliar_distrib) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1037 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1038 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1039 #" dcum function |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1040 #" @param a numeric. controls the average leaf slope |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1041 #" @param b numeric. controls the distribution"s bimodality |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1042 #" @param t numeric. angle |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1043 #" @return f |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1044 #" @export |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1045 dcum <- function(a, b, t) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1046 rd <- pi / 180 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1047 if (a >= 1) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1048 f <- 1 - cos(rd * t) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1049 } else { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1050 eps <- 1e-8 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1051 delx <- 1 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1052 x <- 2 * rd * t |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1053 p <- x |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1054 while (delx >= eps) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1055 y <- a * sin(x) + .5 * b * sin(2. * x) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1056 dx <- .5 * (y - x + p) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1057 x <- x + dx |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1058 delx <- abs(dx) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1059 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1060 f <- (2. * y + p) / pi |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1061 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1062 return(f) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1063 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1064 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1065 #" J1 function with avoidance of singularity problem |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1066 #" |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1067 #" @param k numeric. Extinction coefficient for direct (solar or observer) flux |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1068 #" @param l numeric. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1069 #" @param t numeric. Leaf Area Index |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1070 #" @return jout numeric. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1071 #" @export |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1072 jfunc1 <- function(k, l, t) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1073 # J1 function with avoidance of singularity problem |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1074 del <- (k - l) * t |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1075 jout <- 0 * l |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1076 jout[which(abs(del) > 1e-3)] <- (exp(-l[which(abs(del) > 1e-3)] * t) - exp(-k * t)) / (k - l[which(abs(del) > 1e-3)]) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1077 jout[which(abs(del) <= 1e-3)] <- 0.5 * t * (exp(-k * t) + exp(-l[which(abs(del) <= 1e-3)] * t)) * (1 - del[which(abs(del) <= 1e-3)] * del[which(abs(del) <= 1e-3)] / 12) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1078 return(jout) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1079 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1080 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1081 #" J2 function with avoidance of singularity problem |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1082 #" |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1083 #" @param k numeric. Extinction coefficient for direct (solar or observer) flux |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1084 #" @param l numeric. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1085 #" @param t numeric. Leaf Area Index |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1086 #" @return jout numeric. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1087 #" @export |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1088 jfunc2 <- function(k, l, t) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1089 # J2 function |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1090 jout <- (1. - exp(-(k + l) * t)) / (k + l) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1091 return(jout) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1092 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1093 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1094 #" J3 function with avoidance of singularity problem |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1095 #" |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1096 #" @param k numeric. Extinction coefficient for direct (solar or observer) flux |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1097 #" @param l numeric. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1098 #" @param t numeric. Leaf Area Index |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1099 #" @return jout numeric. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1100 #" @export |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1101 jfunc3 <- function(k, l, t) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1102 out <- (1. - exp(-(k + l) * t)) / (k + l) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1103 return(out) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1104 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1105 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1106 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1107 #" j4 function for treating (near) conservative scattering |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1108 #" |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1109 #" @param m numeric. Extinction coefficient for direct (solar or observer) flux |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1110 #" @param t numeric. Leaf Area Index |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1111 #" @return jout numeric. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1112 #" @export |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1113 jfunc4 <- function(m, t) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1114 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1115 del <- m * t |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1116 out <- 0 * del |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1117 out[del > 1e-3] <- (1 - exp(-del)) / (m * (1 + exp(-del))) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1118 out[del <= 1e-3] <- 0.5 * t * (1. - del * del / 12.) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1119 return(out) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1120 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1121 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1122 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1123 #" compute volume scattering functions and interception coefficients |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1124 #" for given solar zenith, viewing zenith, azimuth and leaf inclination angle. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1125 #" |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1126 #" @param tts numeric. solar zenith |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1127 #" @param tto numeric. viewing zenith |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1128 #" @param psi numeric. azimuth |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1129 #" @param ttl numeric. leaf inclination angle |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1130 #" @return res list. includes chi_s, chi_o, frho, ftau |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1131 #" @export |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1132 volscatt <- function(tts, tto, psi, ttl) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1133 #******************************************************************************** |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1134 #* chi_s = interception functions |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1135 #* chi_o = interception functions |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1136 #* frho = function to be multiplied by leaf reflectance rho |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1137 #* ftau = functions to be multiplied by leaf transmittance tau |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1138 #******************************************************************************** |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1139 # Wout Verhoef, april 2001, for CROMA |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1140 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1141 rd <- pi / 180 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1142 costs <- cos(rd * tts) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1143 costo <- cos(rd * tto) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1144 sints <- sin(rd * tts) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1145 sinto <- sin(rd * tto) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1146 cospsi <- cos(rd * psi) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1147 psir <- rd * psi |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1148 costl <- cos(rd * ttl) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1149 sintl <- sin(rd * ttl) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1150 cs <- costl * costs |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1151 co <- costl * costo |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1152 ss <- sintl * sints |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1153 so <- sintl * sinto |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1154 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1155 #c .............................................................................. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1156 #c betas -bts- and betao -bto- computation |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1157 #c Transition angles (beta) for solar (betas) and view (betao) directions |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1158 #c if thetav + thetal > pi / 2, bottom side of the leaves is observed for leaf azimut |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1159 #c interval betao + phi<leaf azimut<2pi-betao + phi. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1160 #c if thetav + thetal<pi / 2, top side of the leaves is always observed, betao=pi |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1161 #c same consideration for solar direction to compute betas |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1162 #c .............................................................................. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1163 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1164 cosbts <- 5 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1165 if (abs(ss) > 1e-6) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1166 cosbts <- -cs / ss |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1167 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1168 cosbto <- 5 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1169 if (abs(so) > 1e-6) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1170 cosbto <- -co / so |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1171 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1172 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1173 if (abs(cosbts) < 1) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1174 bts <- acos(cosbts) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1175 ds <- ss |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1176 } else { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1177 bts <- pi |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1178 ds <- cs |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1179 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1180 chi_s <- 2. / pi * ((bts - pi * .5) * cs + sin(bts) * ss) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1181 if (abs(cosbto) < 1) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1182 bto <- acos(cosbto) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1183 doo <- so |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1184 } else if (tto < 90) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1185 bto <- pi |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1186 doo <- co |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1187 } else { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1188 bto <- 0 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1189 doo <- -co |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1190 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1191 chi_o <- 2. / pi * ((bto - pi * .5) * co + sin(bto) * so) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1192 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1193 #c .............................................................................. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1194 #c computation of auxiliary azimut angles bt1, bt2, bt3 used |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1195 #c for the computation of the bidirectional scattering coefficient w |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1196 #c ............................................................................. |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1197 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1198 btran1 <- abs(bts - bto) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1199 btran2 <- pi - abs(bts + bto - pi) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1200 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1201 if (psir <= btran1) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1202 bt1 <- psir |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1203 bt2 <- btran1 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1204 bt3 <- btran2 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1205 } else { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1206 bt1 <- btran1 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1207 if (psir <= btran2) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1208 bt2 <- psir |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1209 bt3 <- btran2 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1210 } else { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1211 bt2 <- btran2 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1212 bt3 <- psir |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1213 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1214 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1215 t1 <- 2. * cs * co + ss * so * cospsi |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1216 t2 <- 0 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1217 if (bt2 > 0) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1218 t2 <- sin(bt2) * (2. * ds * doo + ss * so * cos(bt1) * cos(bt3)) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1219 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1220 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1221 denom <- 2. * pi * pi |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1222 frho <- ((pi - bt2) * t1 + t2) / denom |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1223 ftau <- (-bt2 * t1 + t2) / denom |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1224 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1225 if (frho < 0) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1226 frho <- 0 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1227 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1228 if (ftau < 0) { |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1229 ftau <- 0 |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1230 } |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1231 res <- list("chi_s" = chi_s, "chi_o" = chi_o, "frho" = frho, "ftau" = ftau) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1232 return(res) |
9adccd3da70c
planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
ecology
parents:
diff
changeset
|
1233 } |