-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.py
More file actions
165 lines (150 loc) · 3.99 KB
/
Copy pathapp.py
File metadata and controls
165 lines (150 loc) · 3.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
import streamlit as st
import numpy as np
from prosail import run_prosail
import plotly.express as px
import plotly.graph_objects as go
st.set_page_config(page_title="PROSAIL-Viz", layout="wide")
st.title("PROSAIL-Viz")
st.write(
"""
A visualization tool for PROSAIL simulation from given input parameters.
"""
)
row1_1, row1_2, row1_3 = st.columns((1, 1, 1))
with st.sidebar:
n = st.slider(
"Leaf Structure Index, N",
min_value=1.0,
max_value=2.6,
#value=1.5,
step=0.001
)
cab = st.slider(
"Chlorophyll a+b Content, cab (ug/cm2)",
min_value=1.0,
max_value=80.0,
#value=np.random.uniform(0.001, 80.0),
step=0.01
)
car = st.slider(
"Total Carotenoid Content, car (ug/cm2)",
min_value=1.0,
max_value=24.0,
#value=np.random.uniform(1.0, 24.0),
step=0.01
)
ant = st.slider(
"Total Anthocyanin Content, ant (ug/cm2)",
min_value=0.001,
max_value=0.5,
#value=np.random.uniform(0.001, 0.5),
step=0.001
)
cbrown = st.slider(
"Brown Pigments, cbrown",
min_value=0.01,
max_value=1.0,
#value=np.random.uniform(0.0, 1.0),
step=0.01
)
cw = st.slider(
"Equivalent Water Thickness, cw (cm)",
min_value=0.01,
max_value=0.08,
#value=np.random.uniform(0.01, 0.03),
step=0.001
)
cm = st.slider(
"Leaf Mass per Area, cm (g/cm2)",
min_value=0.001,
max_value=0.02,
#value=np.random.uniform(0.004, 0.0075),
step=0.001
)
hspot = st.slider(
"Hotspot Parameter, hot",
min_value=0.01,
max_value=0.2,
#value=np.random.uniform(0.01, 0.2),
step=0.001
)
lai = st.slider(
"Leaf Area Index, lai (m2/m2)",
min_value=0.5,
max_value=10.0,
#value=np.random.uniform(0.0, 7.0),
step=0.01
)
lidfa = st.slider(
"Average Leaf Inclination Angle, lidfa (degree)",
min_value=0.1,
max_value=90.0,
#value=np.random.uniform(0.1, 90.0),
step=0.1
)
tts = st.slider(
"Solar Zenith Angle, tts (degrees)",
min_value=0.0,
max_value=90.0,
#value=np.random.uniform(0.0, 90.0),
step=0.1
)
tto = st.slider(
"Viewing Zenith Angle, tto (degrees)",
min_value=0.0,
max_value=90.0,
#value=np.random.uniform(0.0, 90.0),
step=0.1
)
psi = st.slider(
"Relative Solar-Sensor Azimuth Angle, psi (degrees)",
min_value=0.0,
max_value=360.0,
#value=np.random.uniform(0.0, 360.0),
step=1.0
)
# Read soil spectra
soil = np.load('soil.npy')
spectra = run_prosail(
n,
cab,
car,
cbrown,
cw,
cm,
lai,
lidfa,
hspot,
tts,
tto,
psi,
ant,
prospect_version="D",
typelidf=2,
rsoil0=0.1,
soil_spectrum1=soil,
factor="SDR"
)
fig = px.line(
x=np.arange(400, 2501),
y=spectra,
template="simple_white"
)
fig.update_traces(line_color='#25523B', line_width=2)
# Edit the layout
fig.update_layout(title='PROSAIL-Simulated Spectra',
xaxis_title='Wavelength (nm)',
yaxis_title='Reflectance')
st.plotly_chart(fig, use_container_width=True)
row2_1, row2_2 = st.columns((2, 1))
with row2_1:
st.write(
"""
#### Disclaimer
This application is only for educational purposes. Use of this application in commercial cases is strictly prohibited.
**Map Author:** *Sourav Bhadra* [souravbhadra.github.io](https://souravbhadra.github.io) | [GitHub](https://github.com/souravbhadra) | [LinkedIn](https://www.linkedin.com/in/bhadrasourav/) | [Twitter](https://twitter.com/sbhadra19)
**Acknowldgements:** José Gómez-Dans (Creator of [PROSAIL Python Bindings](https://github.com/jgomezdans/prosail))
"""
)
with row2_2:
st.image('assets/rsl-logo.png')