|
1 | 1 | import numpy as np
|
2 |
| -from prosail_fortran import run_sail, run_prosail, prospect_5b |
| 2 | +from prosail_fortran import run_sail as sail, run_prosail as prosail |
| 3 | +from prosail_fortran import prospect_5b |
| 4 | +from prosail_fortran import mod_dataspec_p5b as spectral_libs |
| 5 | + |
| 6 | +def run_prosail (n,cab,car,cbrown,cw,cm,lai,lidfa,lidfb,rsoil,psoil,hspot, |
| 7 | + tts,tto,psi,typelidf, |
| 8 | + soil_spectrum1=None,soil_spectrum2=None ): |
| 9 | + """Run the PROSPECT_5B and SAILh radiative transfer models. The soil |
| 10 | + model is a linear mixture model, where two spectra are combined together as |
| 11 | + |
| 12 | + rho_soil = rsoil*(psoil*soil_spectrum1+(1-psoil)*soil_spectrum2) |
| 13 | + By default, ``soil_spectrum1`` is a dry soil, and ``soil_spectrum2`` is a |
| 14 | + wet soil, so in that case, ``psoil`` is a surface soil moisture parameter. |
| 15 | + ``rsoil`` is a soil brightness term. You can provide one or the two |
| 16 | + soil spectra if you want. The soil spectra must be defined |
| 17 | + between 400 and 2500 nm with 1nm spacing. |
| 18 | + |
| 19 | + Parameters |
| 20 | + ---------- |
| 21 | + n: float |
| 22 | + Leaf layers |
| 23 | + cab: float |
| 24 | + leaf chlorophyll concentration |
| 25 | + car: float |
| 26 | + leaf carotenoid concentration |
| 27 | + cbrown: float |
| 28 | + senescent pigment |
| 29 | + cw: float |
| 30 | + equivalent leaf water |
| 31 | + cm: float |
| 32 | + leaf dry matter |
| 33 | + lai: float |
| 34 | + leaf area index |
| 35 | + lidfa: float |
| 36 | + a parameter for leaf angle distribution. If ``typliedf``=2, average |
| 37 | + leaf inclination angle. |
| 38 | + lidfb: float |
| 39 | + b parameter for leaf angle distribution. If ``typelidf``=2, ignored |
| 40 | + rsoil: float |
| 41 | + Soil scalar |
| 42 | + psoil: float |
| 43 | + Soil scalar |
| 44 | + tts: float |
| 45 | + Solar zenith angle |
| 46 | + tto: float |
| 47 | + Sensor zenith angle |
| 48 | + psi: float |
| 49 | + Relative sensor-solar azimuth angle ( saa - vaa ) |
| 50 | + soil_spectrum1: 2101-element array |
| 51 | + First component of the soil spectrum |
| 52 | + soil_spectrum2: 2101-element array |
| 53 | + Second component of the soil spectrum |
| 54 | + |
| 55 | + Returns |
| 56 | + -------- |
| 57 | + Directional surface reflectance between 400 and 2500 nm |
| 58 | +
|
| 59 | + |
| 60 | + """ |
| 61 | + |
| 62 | + if soil_spectrum1 is not None: |
| 63 | + assert ( len(soil_spectrum1) == 2101 ) |
| 64 | + else: |
| 65 | + soil_spectrum1 = spectral_libs.rsoil1 |
| 66 | + |
| 67 | + if soil_spectrum2 is not None: |
| 68 | + assert ( len(soil_spectrum1) == 2101 ) |
| 69 | + else: |
| 70 | + soil_spectrum2 = spectral_libs.rsoil1 |
| 71 | + |
| 72 | + rho = prosail (n,cab,car,cbrown,cw,cm,lai,lidfa,lidfb,rsoil,psoil,hspot, |
| 73 | + tts,tto,psi,typelidf, soil_spectrum1, soil_spectrum2 ) |
| 74 | + return rho |
| 75 | + |
| 76 | +def run_sail (refl,trans,lai,lidfa,lidfb,rsoil,psoil,hspot,tts,tto,psi,typelidf, |
| 77 | + soil_spectrum1=None,soil_spectrum2=None ): |
| 78 | + """Run the SAILh radiative transfer model. The soil model is a linear |
| 79 | + mixture model, where two spectra are combined together as |
| 80 | + |
| 81 | + rho_soil = rsoil*(psoil*soil_spectrum1+(1-psoil)*soil_spectrum2) |
| 82 | + |
| 83 | + By default, ``soil_spectrum1`` is a dry soil, and ``soil_spectrum2`` is a |
| 84 | + wet soil, so in that case, ``psoil`` is a surface soil moisture parameter. |
| 85 | + ``rsoil`` is a soil brightness term. You can provide one or the two |
| 86 | + soil spectra if you want. The soil spectra, and leaf spectra must be defined |
| 87 | + between 400 and 2500 nm with 1nm spacing. |
| 88 | + |
| 89 | + Parameters |
| 90 | + ---------- |
| 91 | + refl: 2101-element array |
| 92 | + Leaf reflectance |
| 93 | + trans: 2101-element array |
| 94 | + leaf transmittance |
| 95 | + lai: float |
| 96 | + leaf area index |
| 97 | + lidfa: float |
| 98 | + a parameter for leaf angle distribution. If ``typliedf``=2, average |
| 99 | + leaf inclination angle. |
| 100 | + lidfb: float |
| 101 | + b parameter for leaf angle distribution. If ``typelidf``=2, ignored |
| 102 | + rsoil: float |
| 103 | + Soil scalar |
| 104 | + psoil: float |
| 105 | + Soil scalar |
| 106 | + tts: float |
| 107 | + Solar zenith angle |
| 108 | + tto: float |
| 109 | + Sensor zenith angle |
| 110 | + psi: float |
| 111 | + Relative sensor-solar azimuth angle ( saa - vaa ) |
| 112 | + soil_spectrum1: 2101-element array |
| 113 | + First component of the soil spectrum |
| 114 | + soil_spectrum2: 2101-element array |
| 115 | + Second component of the soil spectrum |
| 116 | + |
| 117 | + Returns |
| 118 | + -------- |
| 119 | + Directional surface reflectance between 400 and 2500 nm |
| 120 | +
|
| 121 | + |
| 122 | + """ |
| 123 | + |
| 124 | + |
| 125 | + if soil_spectrum1 is not None: |
| 126 | + assert ( len(soil_spectrum1) == 2101 ) |
| 127 | + else: |
| 128 | + soil_spectrum1 = spectral_libs.rsoil1 |
| 129 | + |
| 130 | + if soil_spectrum2 is not None: |
| 131 | + assert ( len(soil_spectrum1) == 2101 ) |
| 132 | + else: |
| 133 | + soil_spectrum2 = spectral_libs.rsoil1 |
| 134 | + |
| 135 | + rho = sail (refl,trans,lai,lidfa,lidfb,rsoil,psoil,hspot,tts,tto,psi,typelidf, |
| 136 | + soil_spectrum1, soil_spectrum2 ) |
| 137 | + return rho |
| 138 | + |
3 | 139 |
|
4 | 140 |
|
5 | 141 | def trans_prosail ( N, cab, car, cbrown, cw, cm, lai, lidfa, lidfb, rsoil, psoil, \
|
|
0 commit comments