Spaces:
Sleeping
Sleeping
Upload 14 files
Browse files- pages/01_Agro-Clima.py +391 -387
- pages/02_Solos.py +190 -241
- pages/03_Culturas.py +132 -0
- requirements.txt +1 -0
pages/01_Agro-Clima.py
CHANGED
@@ -1,387 +1,391 @@
|
|
1 |
-
import os
|
2 |
-
import leafmap
|
3 |
-
import solara
|
4 |
-
import ipywidgets as widgets
|
5 |
-
from leafmap import leafmap
|
6 |
-
import leafmap.colormaps as cm
|
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 |
-
"Tropics, lowland;
|
48 |
-
"Tropics, lowland;
|
49 |
-
"Tropics,
|
50 |
-
"Tropics,
|
51 |
-
"Tropics,
|
52 |
-
"Tropics,
|
53 |
-
"Tropics, highland;
|
54 |
-
"Tropics, highland;
|
55 |
-
"
|
56 |
-
"
|
57 |
-
"
|
58 |
-
"
|
59 |
-
"Sub-tropics, warm;
|
60 |
-
"Sub-tropics, warm;
|
61 |
-
"Sub-tropics,
|
62 |
-
"Sub-tropics,
|
63 |
-
"Sub-tropics,
|
64 |
-
"Sub-tropics,
|
65 |
-
"Sub-tropics, mud, cool;
|
66 |
-
"Sub-tropics, mud, cool;
|
67 |
-
"Sub-tropics, cool;
|
68 |
-
"Sub-tropics, cool; sub-humid,
|
69 |
-
"Sub-tropics, cool; humid,
|
70 |
-
"Sub-tropics, cool; humid,
|
71 |
-
"
|
72 |
-
"
|
73 |
-
"
|
74 |
-
"
|
75 |
-
"Temperature, moderate;
|
76 |
-
"Temperature, moderate;
|
77 |
-
"Temperature,
|
78 |
-
"Temperature,
|
79 |
-
"Temperature,
|
80 |
-
"Temperature,
|
81 |
-
"Temperature, cool;
|
82 |
-
"Temperature, cool;
|
83 |
-
"
|
84 |
-
"
|
85 |
-
"
|
86 |
-
"
|
87 |
-
"Cold, no permafrost;
|
88 |
-
"Cold, no permafrost;
|
89 |
-
"
|
90 |
-
"
|
91 |
-
"
|
92 |
-
"
|
93 |
-
"
|
94 |
-
"
|
95 |
-
"
|
96 |
-
"Dominantly
|
97 |
-
"
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
"
|
107 |
-
"Tropics, lowland;
|
108 |
-
"Tropics, lowland;
|
109 |
-
"Tropics,
|
110 |
-
"Tropics,
|
111 |
-
"Tropics,
|
112 |
-
"Tropics,
|
113 |
-
"Tropics, highland;
|
114 |
-
"Tropics, highland;
|
115 |
-
"
|
116 |
-
"
|
117 |
-
"
|
118 |
-
"
|
119 |
-
"Sub-tropics, warm;
|
120 |
-
"Sub-tropics, warm;
|
121 |
-
"Sub-tropics,
|
122 |
-
"Sub-tropics,
|
123 |
-
"Sub-tropics,
|
124 |
-
"Sub-tropics,
|
125 |
-
"Sub-tropics, mod. cool;
|
126 |
-
"Sub-tropics, mod. cool;
|
127 |
-
"Sub-tropics, cool;
|
128 |
-
"Sub-tropics, cool;
|
129 |
-
"Sub-tropics, cool;
|
130 |
-
"Sub-tropics, cool;
|
131 |
-
"Sub-tropics, cool;
|
132 |
-
"Sub-tropics, cool;
|
133 |
-
"
|
134 |
-
"
|
135 |
-
"
|
136 |
-
"
|
137 |
-
"Temperate, moderate;
|
138 |
-
"Temperate, moderate;
|
139 |
-
"Temperate,
|
140 |
-
"Temperate,
|
141 |
-
"Temperate,
|
142 |
-
"Temperate,
|
143 |
-
"Temperate, cool;
|
144 |
-
"Temperate, cool;
|
145 |
-
"
|
146 |
-
"
|
147 |
-
"
|
148 |
-
"
|
149 |
-
"Cold, no permafrost;
|
150 |
-
"Cold, no permafrost;
|
151 |
-
"
|
152 |
-
"
|
153 |
-
"
|
154 |
-
"
|
155 |
-
"
|
156 |
-
"
|
157 |
-
"
|
158 |
-
"Dominantly
|
159 |
-
"
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
('
|
182 |
-
('
|
183 |
-
('
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
"
|
244 |
-
"
|
245 |
-
"
|
246 |
-
"
|
247 |
-
"
|
248 |
-
"
|
249 |
-
"
|
250 |
-
"
|
251 |
-
"
|
252 |
-
"
|
253 |
-
"
|
254 |
-
"
|
255 |
-
"
|
256 |
-
"
|
257 |
-
"
|
258 |
-
"
|
259 |
-
"
|
260 |
-
"
|
261 |
-
"
|
262 |
-
"
|
263 |
-
"
|
264 |
-
"
|
265 |
-
"
|
266 |
-
"
|
267 |
-
"
|
268 |
-
"
|
269 |
-
"
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
)
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
self.
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import leafmap
|
3 |
+
import solara
|
4 |
+
import ipywidgets as widgets
|
5 |
+
from leafmap import leafmap
|
6 |
+
import leafmap.colormaps as cm
|
7 |
+
from leafmap.common import get_image_colormap
|
8 |
+
|
9 |
+
|
10 |
+
|
11 |
+
|
12 |
+
|
13 |
+
|
14 |
+
zoom = solara.reactive(2)
|
15 |
+
center = solara.reactive((20, 0))
|
16 |
+
|
17 |
+
|
18 |
+
maps = {
|
19 |
+
'Agro-ecological Zones: AEZ classification by climate/soil/terrain/LC': 'pages/aez.tif',
|
20 |
+
'Koeppen-Geiger (3-character) classification 2011-2040': 'https://s3.eu-west-1.amazonaws.com/data.gaezdev.aws.fao.org/res01/IPSL-CM5A-LR/rcp4p5/KG3_IPSL-CM5A-LR_rcp4p5_2020s.tif',
|
21 |
+
"Total number of growing period days": 'https://s3.eu-west-1.amazonaws.com/data.gaezdev.aws.fao.org/res01/GFDL-ESM2M/rcp2p6/TS/lgd_GFDL-ESM2M_rcp2p6_',
|
22 |
+
"Number of dry days during temperature growing period LGPt=5 (days)" : 'https://s3.eu-west-1.amazonaws.com/data.gaezdev.aws.fao.org/res01/IPSL-CM5A-LR/rcp8p5/TS/ndd2_IPSL-CM5A-LR_rcp8p5_',
|
23 |
+
'Longest period of consecutive dry days in temperature growing period LGPt=5(days)':'https://s3.eu-west-1.amazonaws.com/data.gaezdev.aws.fao.org/res01/HadGEM2-ES/rcp2p6/TS/ndd_HadGEM2-ES_rcp2p6_',
|
24 |
+
'Annual temperature amplitude (°C)': 'https://s3.eu-west-1.amazonaws.com/data.gaezdev.aws.fao.org/res01/NorESM1-M/rcp4p5/TS/td2_NorESM1-M_rcp4p5_',
|
25 |
+
'Mean annual temperature (°C)': 'https://s3.eu-west-1.amazonaws.com/data.gaezdev.aws.fao.org/res01/MIROC-ESM-CHEM/rcp4p5/TS/tmp_MIROC-ESM-CHEM_rcp4p5_',
|
26 |
+
'Annual precipitation (mm)': 'https://s3.eu-west-1.amazonaws.com/data.gaezdev.aws.fao.org/res01/MIROC-ESM-CHEM/rcp6p0/TS/prc_MIROC-ESM-CHEM_rcp6p0_',
|
27 |
+
'Total number of rain days (days with P > 1 mm)': 'https://s3.eu-west-1.amazonaws.com/data.gaezdev.aws.fao.org/res01/IPSL-CM5A-LR/rcp4p5/TS/ndr_IPSL-CM5A-LR_rcp4p5_'
|
28 |
+
|
29 |
+
}
|
30 |
+
anos = list(range(2025, 2041))
|
31 |
+
|
32 |
+
|
33 |
+
|
34 |
+
|
35 |
+
#municipios = ee.FeatureCollection('FAO/GAUL_SIMPLIFIED_500m/2015/level2').filter(ee.Filter.eq('ADM0_NAME', 'Brazil'))
|
36 |
+
#municipios_list =
|
37 |
+
|
38 |
+
# Get the list of municipality names
|
39 |
+
#estados_list = [estados_list]
|
40 |
+
|
41 |
+
maps_list= list(maps)
|
42 |
+
maps_values= list(maps.values())
|
43 |
+
|
44 |
+
|
45 |
+
aez_dict ={
|
46 |
+
"NAA": "#FFFFFF", # Branco
|
47 |
+
"Tropics, lowland; semi-arid, no soil/terrain limitations": "#FFD700", # Dourado
|
48 |
+
"Tropics, lowland; semi-arid, with soil/terrain limitations": "#DAA520", # Dourado escuro
|
49 |
+
"Tropics, lowland; sub-humid, no soil/terrain limitations": "#32CD32", # Verde Lima
|
50 |
+
"Tropics, lowland; sub-humid, with soil/terrain limitations": "#228B22", # Verde Floresta
|
51 |
+
"Tropics, lowland; humid, no soil/terrain limitations": "#008000", # Verde
|
52 |
+
"Tropics, lowland; humid, with soil/terrain limitations": "#006400", # Verde Escuro
|
53 |
+
"Tropics, highland; semi-arid, no soil/terrain limitations": "#FFA500", # Laranja
|
54 |
+
"Tropics, highland; semi-arid, with soil/terrain limitations": "#FF8C00", # Laranja Escuro
|
55 |
+
"Tropics, highland; sub-humid, no soil/terrain limitations": "#7FFF00", # Verde Chartreuse
|
56 |
+
"Tropics, highland; sub-humid, with soil/terrain limitations": "#ADFF2F", # Verde Amarelo
|
57 |
+
"Tropics, highland; humid, no soil/terrain limitations": "#00FF00", # Verde Limão
|
58 |
+
"Tropics, highland; humid, with soil/terrain limitations": "#00FA9A", # Verde Médio
|
59 |
+
"Sub-tropics, warm; semi-arid, no soil/terrain limitations": "#FF4500", # Laranja Vermelho
|
60 |
+
"Sub-tropics, warm; semi-arid, with soil/terrain limitations": "#FF6347", # Tomate
|
61 |
+
"Sub-tropics, warm; sub-humid, no soil/terrain limitations": "#9ACD32", # Verde Amarelo Escuro
|
62 |
+
"Sub-tropics, warm; sub-humid, with soil/terrain limitations": "#6B8E23", # Verde Oliva
|
63 |
+
"Sub-tropics, warm; humid, no soil/terrain limitations": "#3CB371", # Verde Mar Médio
|
64 |
+
"Sub-tropics, warm; humid, with soil/terrain limitations": "#2E8B57", # Verde Mar
|
65 |
+
"Sub-tropics, mud, cool; semi-arid, no soil/terrain limitations": "#8B4513", # Marrom Sela
|
66 |
+
"Sub-tropics, mud, cool; semi-arid, with soil/terrain limitations": "#A0522D", # Sienna
|
67 |
+
"Sub-tropics, mud, cool; sub-humid, no soil/terrain limitations": "#D2B48C", # Tan
|
68 |
+
"Sub-tropics, mud, cool; sub-humid, with soil/terrain limitations": "#BC8F8F", # Rosa Marrom
|
69 |
+
"Sub-tropics, mud, cool; humid, no soil/terrain limitations": "#8FBC8F", # Verde Mar Claro
|
70 |
+
"Sub-tropics, mud, cool; humid, with soil/terrain limitations": "#556B2F", # Verde Oliva Escuro
|
71 |
+
"Sub-tropics, cool; semi-arid, no soil/terrain limitations": "#CD853F", # Peru
|
72 |
+
"Sub-tropics, cool; sub-humid, no soil/terrain limitations": "#DEB887", # Burlywood
|
73 |
+
"Sub-tropics, cool; humid, with soil/terrain limitations": "#F4A460", # Sandy Brown
|
74 |
+
"Sub-tropics, cool; humid, no soil/terrain limitations": "#D2691E", # Chocolate
|
75 |
+
"Temperature, moderate; dry, no soil/terrain limitations": "#B0C4DE", # Azul Aço Claro
|
76 |
+
"Temperature, moderate; dry, with soil/terrain limitations": "#87CEEB", # Céu Azul
|
77 |
+
"Temperature, moderate; moist, no soil/terrain limitations": "#ADD8E6", # Azul Claro
|
78 |
+
"Temperature, moderate; moist, with soil/terrain limitations": "#6495ED", # Azul Cornflower
|
79 |
+
"Temperature, moderate; wet, no soil/terrain limitations": "#1E90FF", # Azul Dodger
|
80 |
+
"Temperature, moderate; wet, with soil/terrain limitations": "#0000FF", # Azul
|
81 |
+
"Temperature, cool; dry, no soil/terrain limitations": "#4682B4", # Azul Aço
|
82 |
+
"Temperature, cool; dry, with soil/terrain limitations": "#5F9EA0", # Azul Cadet
|
83 |
+
"Temperature, cool; moist, no soil/terrain limitations": "#00CED1", # Azul Turquesa Escuro
|
84 |
+
"Temperature, cool; moist, with soil/terrain limitations": "#40E0D0", # Turquesa
|
85 |
+
"Temperature, cool; wet, no soil/terrain limitations": "#00FFFF", # Ciano
|
86 |
+
"Temperature, cool; wet, with soil/terrain limitations": "#00BFFF", # Azul Céu Profundo
|
87 |
+
"Cold, no permafrost; dry, no soil/terrain limitations": "#A9A9A9", # Cinza Escuro
|
88 |
+
"Cold, no permafrost; dry, with soil/terrain limitations": "#808080", # Cinza
|
89 |
+
"Cold, no permafrost; moist, no soil/terrain limitations": "#C0C0C0", # Prata
|
90 |
+
"Cold, no permafrost; moist, with soil/terrain limitations": "#D3D3D3", # Cinza Claro
|
91 |
+
"Cold, no permafrost; wet, no soil/terrain limitations": "#E0FFFF", # Azul Claro Claro
|
92 |
+
"Cold, no permafrost; wet, with soil/terrain limitations": "#F0FFFF", # Azul Celeste
|
93 |
+
"Dominantly very steep terrain": "#8B0000", # Vermelho Escuro
|
94 |
+
"Land with severe soil/terrain limitations": "#FF0000", # Vermelho
|
95 |
+
"Ample irrigated soils": "#00FF00", # Verde Limão
|
96 |
+
"Dominantly hydromorphic soils": "#008080", # Verde Azulado
|
97 |
+
"Desert/Arid climate": "#FFDAB9", # Pêssego
|
98 |
+
"Boreal/Cold climate": "#000080", # Azul Marinho
|
99 |
+
"Arctic/Very cold climate": "#FFFFFF", # Branco
|
100 |
+
"Dominantly built-up land": "#A52A2A", # Marrom
|
101 |
+
"Dominantly water": "#0000FF" # Azul
|
102 |
+
}
|
103 |
+
|
104 |
+
|
105 |
+
legend_dict = {
|
106 |
+
"NA": "#FFFFFF",
|
107 |
+
"Tropics, lowland; semi-arid, no soil/terrain limitations": "#FF99CC",
|
108 |
+
"Tropics, lowland; semi-arid, with soil/terrain limitations": "#FF6699",
|
109 |
+
"Tropics, lowland; sub-humid, no soil/terrain limitations": "#FF9966",
|
110 |
+
"Tropics, lowland; sub-humid, with soil/terrain limitations": "#FF6600",
|
111 |
+
"Tropics, lowland; humid, no soil/terrain limitations": "#FFCC66",
|
112 |
+
"Tropics, lowland; humid, with soil/terrain limitations": "#FF9933",
|
113 |
+
"Tropics, highland; semi-arid, no soil/terrain limitations": "#FFCC99",
|
114 |
+
"Tropics, highland; semi-arid, with soil/terrain limitations": "#FFCC00",
|
115 |
+
"Tropics, highland; sub-humid, no soil/terrain limitations": "#FFFF99",
|
116 |
+
"Tropics, highland; sub-humid, with soil/terrain limitations": "#FFFF33",
|
117 |
+
"Tropics, highland; humid, no soil/terrain limitations": "#FFFF66",
|
118 |
+
"Tropics, highland; humid, with soil/terrain limitations": "#FFFF00",
|
119 |
+
"Sub-tropics, warm; semi-arid, no soil/terrain limitations": "#FFCC33",
|
120 |
+
"Sub-tropics, warm; semi-arid, with soil/terrain limitations": "#FF9900",
|
121 |
+
"Sub-tropics, warm; sub-humid, no soil/terrain limitations": "#FFCC00",
|
122 |
+
"Sub-tropics, warm; sub-humid, with soil/terrain limitations": "#FF9900",
|
123 |
+
"Sub-tropics, warm; humid, no soil/terrain limitations": "#FFD700",
|
124 |
+
"Sub-tropics, warm; humid, with soil/terrain limitations": "#FF8C00",
|
125 |
+
"Sub-tropics, mod. cool; semi-arid, no soil/terrain limitations": "#FFA07A",
|
126 |
+
"Sub-tropics, mod. cool; semi-arid, with soil/terrain limitations": "#FF4500",
|
127 |
+
"Sub-tropics, mod. cool; sub-humid, no soil/terrain limitations": "#FFA500",
|
128 |
+
"Sub-tropics, mod. cool; sub-humid, with soil/terrain limitations": "#FFDAB9",
|
129 |
+
"Sub-tropics, mod. cool; humid, no soil/terrain limitations": "#FFD700",
|
130 |
+
"Sub-tropics, mod. cool; humid, with soil/terrain limitations": "#FFC0CB",
|
131 |
+
"Sub-tropics, cool; semi-arid, no soil/terrain limitations": "#98FB98",
|
132 |
+
"Sub-tropics, cool; semi-arid, with soil/terrain limitations": "#7CFC00",
|
133 |
+
"Sub-tropics, cool; sub-humid, no soil/terrain limitations": "#ADFF2F",
|
134 |
+
"Sub-tropics, cool; sub-humid, with soil/terrain limitations": "#32CD32",
|
135 |
+
"Sub-tropics, cool; humid, no soil/terrain limitations": "#00FF00",
|
136 |
+
"Sub-tropics, cool; humid, with soil/terrain limitations": "#008000",
|
137 |
+
"Temperate, moderate; dry, no soil/terrain limitations": "#ADD8E6",
|
138 |
+
"Temperate, moderate; dry, with soil/terrain limitations": "#4682B4",
|
139 |
+
"Temperate, moderate; moist, no soil/terrain limitations": "#5F9EA0",
|
140 |
+
"Temperate, moderate; moist, with soil/terrain limitations": "#6495ED",
|
141 |
+
"Temperate, moderate; wet, no soil/terrain limitations": "#1E90FF",
|
142 |
+
"Temperate, moderate; wet, with soil/terrain limitations": "#0000FF",
|
143 |
+
"Temperate, cool; dry, no soil/terrain limitations": "#87CEEB",
|
144 |
+
"Temperate, cool; dry, with soil/terrain limitations": "#4169E1",
|
145 |
+
"Temperate, cool; moist, no soil/terrain limitations": "#191970",
|
146 |
+
"Temperate, cool; moist, with soil/terrain limitations": "#00008B",
|
147 |
+
"Temperate, cool; wet, no soil/terrain limitations": "#4B0082",
|
148 |
+
"Temperate, cool; wet, with soil/terrain limitations": "#8A2BE2",
|
149 |
+
"Cold, no permafrost; dry, no soil/terrain limitations": "#708090",
|
150 |
+
"Cold, no permafrost; dry, with soil/terrain limitations": "#2F4F4F",
|
151 |
+
"Cold, no permafrost; moist, no soil/terrain limitations": "#696969",
|
152 |
+
"Cold, no permafrost; moist, with soil/terrain limitations": "#808080",
|
153 |
+
"Cold, no permafrost; wet, no soil/terrain limitations": "#A9A9A9",
|
154 |
+
"Cold, no permafrost; wet, with soil/terrain limitations": "#D3D3D3",
|
155 |
+
"Dominantly very steep terrain": "#FFD700",
|
156 |
+
"Land with severe soil/terrain limitations": "#A0522D",
|
157 |
+
"Ample irrigated soils": "#CD5C5C",
|
158 |
+
"Dominantly hydromorphic soils": "#8B0000",
|
159 |
+
"Desert/Arid climate": "#FF4500",
|
160 |
+
"Boreal/Cold climate": "#2E8B57",
|
161 |
+
"Arctic/Very cold climate": "#00CED1",
|
162 |
+
"Dominantly built-up land": "#8B4513",
|
163 |
+
"Dominantly water": "#0000FF"
|
164 |
+
}
|
165 |
+
|
166 |
+
|
167 |
+
|
168 |
+
|
169 |
+
def add_widgets(m):
|
170 |
+
|
171 |
+
|
172 |
+
setattr(m, "zoom_to_layer", True)
|
173 |
+
style = {"description_width": "initial"}
|
174 |
+
padding = "0px 0px 0px 5px"
|
175 |
+
|
176 |
+
|
177 |
+
image = widgets.Dropdown(
|
178 |
+
value=None,
|
179 |
+
options=[('Agro-ecological Zones classification by climate/soil/terrain/LC', maps_values[0]),
|
180 |
+
('Koeppen-Geiger (3-character) classification 2011-2040', maps_values[1]),
|
181 |
+
('Total number of growing period days', maps_values[2]),
|
182 |
+
('Number of dry days during temperature growing period LGPt=5 (days)', maps_values[3]),
|
183 |
+
('Longest period of consecutive dry days in temperature growing period LGPt=5(days)', maps_values[4]),
|
184 |
+
('Annual temperature amplitude (°C)', maps_values[5]),
|
185 |
+
('Mean annual temperature (°C)', maps_values[6]),
|
186 |
+
('Annual precipitation (mm)', maps_values[7]),
|
187 |
+
('Total number of rain days (days with P > 1 mm)', maps_values[8]),
|
188 |
+
],
|
189 |
+
description="Image:",
|
190 |
+
style=style,
|
191 |
+
layout=widgets.Layout(width="270px", padding=padding),
|
192 |
+
)
|
193 |
+
|
194 |
+
ano = widgets.Dropdown(
|
195 |
+
value=None,
|
196 |
+
options=anos,
|
197 |
+
description="Ano:",
|
198 |
+
style=style,
|
199 |
+
layout=widgets.Layout(width="270px", padding=padding),
|
200 |
+
)
|
201 |
+
|
202 |
+
output = widgets.Output()
|
203 |
+
|
204 |
+
|
205 |
+
|
206 |
+
|
207 |
+
def change_ano(change):
|
208 |
+
if change.new:
|
209 |
+
if change.new not in m.get_layer_names():
|
210 |
+
#mosaic = f"{url}/datasets/{dataset.value}/{image.value}.json"
|
211 |
+
|
212 |
+
m.add_cog_layer(image.value+ str(ano.value) + '.tif', name=str(ano.value), palette = 'inferno' )
|
213 |
+
|
214 |
+
output.outputs = ()
|
215 |
+
#output.append_stdout(f"Image date: {image_date}\n")
|
216 |
+
|
217 |
+
ano.observe(change_ano, names="value")
|
218 |
+
|
219 |
+
|
220 |
+
def change_image(change):
|
221 |
+
if change.new:
|
222 |
+
if change.new not in m.get_layer_names():
|
223 |
+
#mosaic = f"{url}/datasets/{dataset.value}/{image.value}.json"
|
224 |
+
layer_list = m.get_layer_names()
|
225 |
+
|
226 |
+
for layer in layer_list:
|
227 |
+
m.remove_layer(m.find_layer(layer))
|
228 |
+
|
229 |
+
|
230 |
+
m.add_basemap("HYBRID")
|
231 |
+
#m.remove_legend()
|
232 |
+
|
233 |
+
if image.value == maps_values[0]:
|
234 |
+
m.add_raster(maps_values[0], layer_name=maps_list[0])
|
235 |
+
m.add_legend(legend_title="Legenda", legend_dict=aez_dict, layer_name=maps_list[0], position="bottomleft")
|
236 |
+
|
237 |
+
elif image.value == maps_values[1]:
|
238 |
+
|
239 |
+
|
240 |
+
#m.remove_colorbar()
|
241 |
+
#raster = 'pages/aez.tif'
|
242 |
+
legend_dict = {
|
243 |
+
"A4 Equatorial rainforest": "#00FF00", # Verde
|
244 |
+
"Am Equatorial monsoon": "#32CD32", # Verde Lima
|
245 |
+
"As Equatorial savannah, dry summer": "#ADFF2F", # Verde Amarelo
|
246 |
+
"Aw Equatorial savannah, dry winter": "#9ACD32", # Verde Amarelo Escuro
|
247 |
+
"BWh Desert climate, hot": "#FF4500", # Laranja Vermelho
|
248 |
+
"BWk Desert climate, cold": "#FF8C00", # Laranja Escuro
|
249 |
+
"BSh Steppe climate, hot": "#FFD700", # Ouro
|
250 |
+
"BSk Steppe climate, cold": "#DAA520", # Ouro Escuro
|
251 |
+
"Cfa Temperate/mesothermal, fully humid, hot": "#87CEEB", # Céu Azul
|
252 |
+
"Cfb Temperate/mesothermal, fully humid, warm": "#ADD8E6", # Azul Claro
|
253 |
+
"Cfc Temperate/mesothermal, fully humid, cold": "#4682B4", # Azul Aço
|
254 |
+
"Csa Temperate/mesothermal, dry summer, hot": "#FFA07A", # Salmão Claro
|
255 |
+
"Csb Temperate/mesothermal, dry summer, warm": "#FA8072", # Salmão
|
256 |
+
"Csc Temperate/mesothermal, dry summer, cold": "#E9967A", # Salmão Escuro
|
257 |
+
"Cwa Temperate/mesothermal, dry winter, hot": "#FFDAB9", # Pêssego
|
258 |
+
"Cwb Temperate/mesothermal, dry winter, warm": "#FFE4B5", # Moccasin
|
259 |
+
"Cwc Temperate/mesothermal, dry winter, cold": "#FFDEAD", # Navajo Branco
|
260 |
+
"Dfa Continental/microthermal, fully humid, hot": "#8B0000", # Vermelho Escuro
|
261 |
+
"Dfb Continental/microthermal, fully humid, warm": "#B22222", # Tijolo Fogo
|
262 |
+
"Dfc Continental/microthermal, fully humid, cold": "#DC143C", # Carmesim
|
263 |
+
"Dfd Continental/microthermal, fully humid, very cold": "#FF0000", # Vermelho
|
264 |
+
"Dsa Continental/microthermal, dry summer, hot": "#800080", # Roxo
|
265 |
+
"Dsb Continental/microthermal, dry summer, warm": "#9370DB", # Roxo Médio
|
266 |
+
"Dsc Continental/microthermal, dry summer, cold": "#8A2BE2", # Azul Violeta
|
267 |
+
"Dsd Continental/microthermal, dry summer, very cold": "#4B0082", # Índigo
|
268 |
+
"Dwa Continental/microthermal, dry winter, hot": "#000080", # Azul Marinho
|
269 |
+
"Dwb Continental/microthermal, dry winter, warm": "#0000CD", # Azul Médio
|
270 |
+
"Dwc Continental/microthermal, dry winter, cold": "#1E90FF", # Azul Dodger
|
271 |
+
"Dwd Continental/microthermal, dry winter, very cold": "#00BFFF", # Azul Céu Profundo
|
272 |
+
"ET Tundra climate": "#F0E68C", # Caqui
|
273 |
+
"EF Eternal Frost climate": "#FFFFFF" # Branco
|
274 |
+
}
|
275 |
+
|
276 |
+
custom_cmap = {
|
277 |
+
0: "#00FF00", # A4 Equatorial rainforest
|
278 |
+
1: "#32CD32", # Am Equatorial monsoon
|
279 |
+
2: "#ADFF2F", # As Equatorial savannah, dry summer
|
280 |
+
3: "#9ACD32", # Aw Equatorial savannah, dry winter
|
281 |
+
4: "#FF4500", # BWh Desert climate, hot
|
282 |
+
5: "#FF8C00", # BWk Desert climate, cold
|
283 |
+
6: "#FFD700", # BSh Steppe climate, hot
|
284 |
+
7: "#DAA520", # BSk Steppe climate, cold
|
285 |
+
8: "#87CEEB", # Cfa Temperate/mesothermal climate, fully humid, hot
|
286 |
+
9: "#ADD8E6", # Cfb Temperate/mesothermal climate, fully humid, warm
|
287 |
+
10: "#4682B4", # Cfc Temperate/mesothermal climate, fully humid, cold
|
288 |
+
11: "#FFA07A", # Csa Temperate/mesothermal climate, dry summer, hot
|
289 |
+
12: "#FA8072", # Csb Temperate/mesothermal climate, dry summer, warm
|
290 |
+
13: "#E9967A", # Csc Temperate/mesothermal climate, dry summer, cold
|
291 |
+
14: "#FFDAB9", # Cwa Temperate/mesothermal climate, dry winter, hot
|
292 |
+
15: "#FFE4B5", # Cwb Temperate/mesothermal climate, dry winter, warm
|
293 |
+
16: "#FFDEAD", # Cwc Temperate/mesothermal climate, dry winter, cold
|
294 |
+
17: "#8B0000", # Dfa Continental/microthermal climate, fully humid, hot
|
295 |
+
18: "#B22222", # Dfb Continental/microthermal climate, fully humid, warm
|
296 |
+
19: "#DC143C", # Dfc Continental/microthermal climate, fully humid, cold
|
297 |
+
20: "#FF0000", # Dfd Continental/microthermal climate, fully humid, very cold
|
298 |
+
21: "#800080", # Dsa Continental/microthermal climate, dry summer, hot
|
299 |
+
22: "#9370DB", # Dsb Continental/microthermal climate, dry summer, warm
|
300 |
+
23: "#8A2BE2", # Dsc Continental/microthermal climate, dry summer, cold
|
301 |
+
24: "#4B0082", # Dsd Continental/microthermal climate, dry summer, very cold
|
302 |
+
25: "#000080", # Dwa Continental/microthermal climate, dry winter, hot
|
303 |
+
26: "#0000CD", # Dwb Continental/microthermal climate, dry winter, warm
|
304 |
+
27: "#1E90FF", # Dwc Continental/microthermal climate, dry winter, cold
|
305 |
+
28: "#00BFFF", # Dwd Continental/microthermal climate, dry winter, very cold
|
306 |
+
29: "#F0E68C", # ET Tundra climate
|
307 |
+
30: "#FFFFFF" # EF Eternal Frost climate
|
308 |
+
}
|
309 |
+
|
310 |
+
|
311 |
+
|
312 |
+
m.add_cog_layer(image.value, colormap=custom_cmap, name=maps_list[1])
|
313 |
+
m.add_legend(legend_title="Legenda", legend_dict=legend_dict, layer_name=maps_list[1], position="bottomleft")
|
314 |
+
|
315 |
+
|
316 |
+
elif image.value == maps_values[5] or image.value == maps_values[6]:
|
317 |
+
|
318 |
+
|
319 |
+
|
320 |
+
|
321 |
+
colors = cm.get_palette(cmap_name='inferno', hashtag=True)
|
322 |
+
m.add_cog_layer(image.value+ str(ano.value) + '.tif', name=str(ano.value), palette = 'inferno' )
|
323 |
+
m.add_colorbar(colors= colors, vmin=0, vmax=40, position='bottomright', orientation='horizontal', label='°C', caption='Graus Celsius')
|
324 |
+
elif image.value == maps_values[7]:
|
325 |
+
|
326 |
+
|
327 |
+
|
328 |
+
colors = cm.get_palette(cmap_name='inferno', hashtag=True)
|
329 |
+
m.add_cog_layer(image.value+ str(ano.value) + '.tif', name=str(ano.value), palette = 'inferno' )
|
330 |
+
m.add_colorbar(colors= colors, vmin=0, vmax=3000, position='bottomright', orientation='horizontal', label='mm', caption='Precipitação Anual')
|
331 |
+
|
332 |
+
|
333 |
+
|
334 |
+
else:
|
335 |
+
|
336 |
+
|
337 |
+
m.add_cog_layer(image.value+ str(ano.value) + '.tif', name=str(ano.value), palette = 'inferno' )
|
338 |
+
|
339 |
+
colors = cm.get_palette(cmap_name='inferno', hashtag=True)
|
340 |
+
m.add_colorbar(colors= colors, vmin=0, vmax=365, position='bottomright', orientation='horizontal', label='Dias', caption='Dias no Ano')
|
341 |
+
|
342 |
+
|
343 |
+
|
344 |
+
#image_date = get_image_date(image.value, m)
|
345 |
+
|
346 |
+
output.outputs = ()
|
347 |
+
#output.append_stdout(f"Image date: {image_date}\n")
|
348 |
+
|
349 |
+
image.observe(change_image, names="value")
|
350 |
+
|
351 |
+
box = widgets.VBox(
|
352 |
+
[ ano,image, output]
|
353 |
+
)
|
354 |
+
m.add_widget(box, position="topright", add_header=False)
|
355 |
+
|
356 |
+
|
357 |
+
class Map(leafmap.Map):
|
358 |
+
def __init__(self, **kwargs):
|
359 |
+
super().__init__(**kwargs)
|
360 |
+
#ee.Authenticate()
|
361 |
+
#ee.Initialize(project='ee-curso-gee-rhamon')
|
362 |
+
#self.add_ee_data()
|
363 |
+
|
364 |
+
|
365 |
+
add_widgets(self)
|
366 |
+
self.add_layer_manager(opened= True)
|
367 |
+
#self.add_legend(legend_title="Legend", legend_dict=legend_dict, open=False)
|
368 |
+
#self.add_inspector()
|
369 |
+
|
370 |
+
|
371 |
+
|
372 |
+
|
373 |
+
|
374 |
+
|
375 |
+
|
376 |
+
|
377 |
+
|
378 |
+
|
379 |
+
@solara.component
|
380 |
+
def Page():
|
381 |
+
with solara.Column(style={"min-width": "500px"}):
|
382 |
+
Map.element(
|
383 |
+
zoom=zoom.value,
|
384 |
+
on_zoom=zoom.set,
|
385 |
+
center=center.value,
|
386 |
+
on_center=center.set,
|
387 |
+
height="600px",
|
388 |
+
toolbar_ctrl=False,
|
389 |
+
data_ctrl=True,
|
390 |
+
add_google_map=True,
|
391 |
+
)
|
pages/02_Solos.py
CHANGED
@@ -1,241 +1,190 @@
|
|
1 |
-
import os
|
2 |
-
import leafmap
|
3 |
-
import solara
|
4 |
-
import ipywidgets as widgets
|
5 |
-
from leafmap import leafmap
|
6 |
-
import leafmap.colormaps as cm
|
7 |
-
|
8 |
-
zoom = solara.reactive(2)
|
9 |
-
center = solara.reactive((20, 0))
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
maps = {
|
14 |
-
'Most limiting soil quality rating factor': 'https://s3.eu-west-1.amazonaws.com/data.gaezdev.aws.fao.org/LR/soi1/SQ0_mze_v9aH.tif',
|
15 |
-
"Nutrient retention capacity": 'https://s3.eu-west-1.amazonaws.com/data.gaezdev.aws.fao.org/LR/soi1/SQ2_mze_v9aH.tif',
|
16 |
-
"Rooting conditions" : 'https://s3.eu-west-1.amazonaws.com/data.gaezdev.aws.fao.org/LR/soi1/SQ3_mze_v9aH.tif',
|
17 |
-
'Soil and terrain suitability, rain-fed': 'https://s3.eu-west-1.amazonaws.com/data.gaezdev.aws.fao.org/LR/soi2/siHr_sst_mze.tif'
|
18 |
-
}
|
19 |
-
|
20 |
-
maps_list= list(maps)
|
21 |
-
maps_values= list(maps.values())
|
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 |
-
"0.
|
48 |
-
|
49 |
-
"0.
|
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 |
-
m.add_cog_layer(image.value, name= maps_list[
|
155 |
-
m.add_legend(legend_title="Legend", legend_dict=
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
#image_date = get_image_date(image.value, m)
|
196 |
-
|
197 |
-
output.outputs = ()
|
198 |
-
#output.append_stdout(f"Image date: {image_date}\n")
|
199 |
-
|
200 |
-
image.observe(change_image, names="value")
|
201 |
-
|
202 |
-
box = widgets.VBox(
|
203 |
-
[ image, output]
|
204 |
-
)
|
205 |
-
m.add_widget(box, position="topright", add_header=False)
|
206 |
-
|
207 |
-
|
208 |
-
class Map(leafmap.Map):
|
209 |
-
def __init__(self, **kwargs):
|
210 |
-
super().__init__(**kwargs)
|
211 |
-
#self.add_ee_data()
|
212 |
-
#ee.Authenticate()
|
213 |
-
#ee.Initialize(project='ee-curso-gee-rhamon')
|
214 |
-
add_widgets(self)
|
215 |
-
|
216 |
-
self.add_layer_manager(opened= True)
|
217 |
-
#self.add_legend(legend_title="Legend", legend_dict=legend_dict)
|
218 |
-
#self.add_inspector()
|
219 |
-
|
220 |
-
|
221 |
-
#def add_ee_data(self):
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
@solara.component
|
231 |
-
def Page():
|
232 |
-
with solara.Column(style={"min-width": "500px"}):
|
233 |
-
Map.element(
|
234 |
-
zoom=zoom.value,
|
235 |
-
on_zoom=zoom.set,
|
236 |
-
center=center.value,
|
237 |
-
on_center=center.set,
|
238 |
-
height="600px",
|
239 |
-
toolbar_ctrl=False,
|
240 |
-
data_ctrl=True,
|
241 |
-
)
|
|
|
1 |
+
import os
|
2 |
+
import leafmap
|
3 |
+
import solara
|
4 |
+
import ipywidgets as widgets
|
5 |
+
from leafmap import leafmap
|
6 |
+
import leafmap.colormaps as cm
|
7 |
+
|
8 |
+
zoom = solara.reactive(2)
|
9 |
+
center = solara.reactive((20, 0))
|
10 |
+
|
11 |
+
|
12 |
+
|
13 |
+
maps = {
|
14 |
+
'Most limiting soil quality rating factor': 'https://s3.eu-west-1.amazonaws.com/data.gaezdev.aws.fao.org/LR/soi1/SQ0_mze_v9aH.tif',
|
15 |
+
"Nutrient retention capacity": 'https://s3.eu-west-1.amazonaws.com/data.gaezdev.aws.fao.org/LR/soi1/SQ2_mze_v9aH.tif',
|
16 |
+
"Rooting conditions" : 'https://s3.eu-west-1.amazonaws.com/data.gaezdev.aws.fao.org/LR/soi1/SQ3_mze_v9aH.tif',
|
17 |
+
'Soil and terrain suitability, rain-fed': 'https://s3.eu-west-1.amazonaws.com/data.gaezdev.aws.fao.org/LR/soi2/siHr_sst_mze.tif'
|
18 |
+
}
|
19 |
+
|
20 |
+
maps_list= list(maps)
|
21 |
+
maps_values= list(maps.values())
|
22 |
+
|
23 |
+
|
24 |
+
legend_dict1 = {
|
25 |
+
"NA": "#FFFFFF", # Branco
|
26 |
+
"0.0 - 0.1": "#8B0000", # Vermelho escuro
|
27 |
+
"0.1 - 0.2": "#FF4500", # Laranja avermelhado
|
28 |
+
"0.2 - 0.3": "#FFA500", # Laranja
|
29 |
+
"0.3 - 0.4": "#FFD700", # Amarelo dourado
|
30 |
+
"0.4 - 0.5": "#FFFF00", # Amarelo
|
31 |
+
"0.5 - 0.6": "#ADFF2F", # Verde amarelado
|
32 |
+
"0.6 - 0.7": "#7FFF00", # Verde limão
|
33 |
+
"0.7 - 0.8": "#32CD32", # Verde médio
|
34 |
+
"0.8 - 0.9": "#008000", # Verde
|
35 |
+
"0.9 - 1.0": "#006400", # Verde escuro
|
36 |
+
"Permafrost": "#B0C4DE", # Cinza claro azulado
|
37 |
+
"Not evaluated": "#A9A9A9", # Cinza escuro
|
38 |
+
"Water": "#0000FF", # Azul
|
39 |
+
}
|
40 |
+
|
41 |
+
hex_colors_dict = {
|
42 |
+
0: "#FFFFFF", # NA
|
43 |
+
1: "#8B0000", # 0.0 - 0.1
|
44 |
+
2: "#FF4500", # 0.1 - 0.2
|
45 |
+
3: "#FFA500", # 0.2 - 0.3
|
46 |
+
4: "#FFD700", # 0.3 - 0.4
|
47 |
+
5: "#FFFF00", # 0.4 - 0.5
|
48 |
+
6: "#ADFF2F", # 0.5 - 0.6
|
49 |
+
7: "#7FFF00", # 0.6 - 0.7
|
50 |
+
8: "#32CD32", # 0.7 - 0.8
|
51 |
+
9: "#008000", # 0.8 - 0.9
|
52 |
+
10: "#006400", # 0.9 - 1.0
|
53 |
+
11: "#B0C4DE", # Permafrost
|
54 |
+
12: "#A9A9A9", # Not evaluated
|
55 |
+
13: "#0000FF", # Water
|
56 |
+
}
|
57 |
+
|
58 |
+
|
59 |
+
|
60 |
+
|
61 |
+
def add_widgets(m):
|
62 |
+
|
63 |
+
|
64 |
+
setattr(m, "zoom_to_layer", True)
|
65 |
+
style = {"description_width": "initial"}
|
66 |
+
padding = "0px 0px 0px 5px"
|
67 |
+
|
68 |
+
|
69 |
+
|
70 |
+
|
71 |
+
|
72 |
+
|
73 |
+
image = widgets.Dropdown(
|
74 |
+
value=None,
|
75 |
+
options=[('Most limiting soil quality rating factor', maps_values[0]),
|
76 |
+
('Nutrient retention capacity', maps_values[1]),
|
77 |
+
('Rooting conditions', maps_values[2]),
|
78 |
+
('Soil and terrain suitability, rain-fed', maps_values[3]),
|
79 |
+
],
|
80 |
+
description="Image:",
|
81 |
+
style=style,
|
82 |
+
layout=widgets.Layout(width="270px", padding=padding),
|
83 |
+
)
|
84 |
+
|
85 |
+
|
86 |
+
|
87 |
+
output = widgets.Output()
|
88 |
+
|
89 |
+
|
90 |
+
|
91 |
+
|
92 |
+
|
93 |
+
|
94 |
+
def change_image(change):
|
95 |
+
if change.new:
|
96 |
+
if change.new not in m.get_layer_names():
|
97 |
+
#mosaic = f"{url}/datasets/{dataset.value}/{image.value}.json"
|
98 |
+
layer_list = m.get_layer_names()
|
99 |
+
|
100 |
+
for layer in layer_list:
|
101 |
+
m.remove_layer(m.find_layer(layer))
|
102 |
+
#municipiosBR= 'https://geoftp.ibge.gov.br/organizacao_do_territorio/malhas_territoriais/malhas_municipais/municipio_2023/Brasil/BR_Municipios_2023.zip'
|
103 |
+
#estadosBR = 'https://geoftp.ibge.gov.br/organizacao_do_territorio/malhas_territoriais/malhas_municipais/municipio_2023/Brasil/BR_UF_2023.zip'
|
104 |
+
m.add_basemap("HYBRID")
|
105 |
+
#m.add_shp(estadosBR, layer_name='EstadosBR')
|
106 |
+
#m.add_shp(municipiosBR, layer_name='MunicipiosBR')
|
107 |
+
#m.remove_legend()
|
108 |
+
|
109 |
+
if image.value == maps_values[0]:
|
110 |
+
|
111 |
+
m.add_cog_layer(image.value, name= maps_list[0], colormap = hex_colors_dict, nodata =0)
|
112 |
+
m.add_legend(legend_title="Legend", legend_dict=legend_dict1)
|
113 |
+
|
114 |
+
|
115 |
+
elif image.value == maps_values[1]:
|
116 |
+
|
117 |
+
m.add_cog_layer(image.value, name= maps_list[1], colormap = hex_colors_dict, nodata =0)
|
118 |
+
m.add_legend(legend_title="Legend", legend_dict=legend_dict1)
|
119 |
+
|
120 |
+
elif image.value == maps_values[2]:
|
121 |
+
|
122 |
+
m.add_cog_layer(image.value, name= maps_list[2], colormap = hex_colors_dict, nodata=0)
|
123 |
+
m.add_legend(legend_title="Legend", legend_dict=legend_dict1)
|
124 |
+
|
125 |
+
elif image.value == maps_values[3]:
|
126 |
+
colors_dict = {
|
127 |
+
0: "#FFFFFF10", # Branco
|
128 |
+
1: "#006400", # Verde escuro
|
129 |
+
2: "#008000", # Verde
|
130 |
+
3: "#ADFF2F", # Verde claro
|
131 |
+
4: "#FFFF00", # Amarelo
|
132 |
+
5: "#DAA520", # Dourado escuro
|
133 |
+
6: "#FF8C00", # Laranja
|
134 |
+
7: "#A9A9A9", # Cinza escuro
|
135 |
+
8: "#D3D3D3", # Cinza claro
|
136 |
+
9: "#0000FF", # Azul
|
137 |
+
10: "#FF0000" # Vermelho
|
138 |
+
}
|
139 |
+
legend_dict = {
|
140 |
+
"NA": "#FFFFFF", # Branco
|
141 |
+
"SI > 75 : Very high": "#006400", # Verde escuro
|
142 |
+
"SI > 63 : High": "#008000", # Verde
|
143 |
+
"SI > 50 : Good": "#ADFF2F", # Verde claro
|
144 |
+
"SI > 35 : Medium": "#FFFF00", # Amarelo
|
145 |
+
"SI > 20 : Moderate": "#DAA520", # Dourado escuro
|
146 |
+
"SI > 10 : Marginal": "#FF8C00", # Laranja
|
147 |
+
"SI > 0 : Very marginal": "#A9A9A9", # Cinza escuro
|
148 |
+
"Not suitable": "#D3D3D3", # Cinza claro
|
149 |
+
"No cultivation": "#0000FF", # Azul
|
150 |
+
"Water": "#FF0000" # Vermelho
|
151 |
+
}
|
152 |
+
|
153 |
+
|
154 |
+
m.add_cog_layer(image.value, name= maps_list[3], colormap = colors_dict,nodata=0)
|
155 |
+
m.add_legend(legend_title="Legend", legend_dict=legend_dict)
|
156 |
+
|
157 |
+
|
158 |
+
output.outputs = ()
|
159 |
+
#output.append_stdout(f"Image date: {image_date}\n")
|
160 |
+
|
161 |
+
image.observe(change_image, names="value")
|
162 |
+
|
163 |
+
box = widgets.VBox(
|
164 |
+
[ image, output]
|
165 |
+
)
|
166 |
+
m.add_widget(box, position="topright", add_header=False)
|
167 |
+
|
168 |
+
|
169 |
+
class Map(leafmap.Map):
|
170 |
+
def __init__(self, **kwargs):
|
171 |
+
super().__init__(**kwargs)
|
172 |
+
|
173 |
+
add_widgets(self)
|
174 |
+
|
175 |
+
self.add_layer_manager(opened= True)
|
176 |
+
|
177 |
+
|
178 |
+
|
179 |
+
@solara.component
|
180 |
+
def Page():
|
181 |
+
with solara.Column(style={"min-width": "500px"}):
|
182 |
+
Map.element(
|
183 |
+
zoom=zoom.value,
|
184 |
+
on_zoom=zoom.set,
|
185 |
+
center=center.value,
|
186 |
+
on_center=center.set,
|
187 |
+
height="600px",
|
188 |
+
toolbar_ctrl=False,
|
189 |
+
data_ctrl=True,
|
190 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/03_Culturas.py
ADDED
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import leafmap
|
3 |
+
import solara
|
4 |
+
import ipywidgets as widgets
|
5 |
+
from leafmap import leafmap
|
6 |
+
import leafmap.colormaps as cm
|
7 |
+
|
8 |
+
zoom = solara.reactive(2)
|
9 |
+
center = solara.reactive((20, 0))
|
10 |
+
|
11 |
+
|
12 |
+
|
13 |
+
maps = {
|
14 |
+
'Milho - Potencial Produtivo Agro-Climático com somente chuva (2011-2040)': 'https://s3.eu-west-1.amazonaws.com/data.gaezdev.aws.fao.org/res02/HadGEM2-ES/rcp4p5/2020sH/maiz200b_yld.tif',
|
15 |
+
"Café Arabica - Potencial Produtivo Agro-Climático com somente chuva (2011-2040)": 'https://s3.eu-west-1.amazonaws.com/data.gaezdev.aws.fao.org/res02/MIROC-ESM-CHEM/rcp8p5/2020sH/cofa200b_yld.tif',
|
16 |
+
"Citrus - Potencial Produtivo Agro-Climático com somente chuva (2011-2040)" : 'https://s3.eu-west-1.amazonaws.com/data.gaezdev.aws.fao.org/res02/HadGEM2-ES/rcp2p6/2020sH/citr200b_yld.tif',
|
17 |
+
'Cana de Açúcar - Potencial Produtivo Agro-Climático com somente chuva (2011-2040)': 'https://s3.eu-west-1.amazonaws.com/data.gaezdev.aws.fao.org/res02/NorESM1-M/rcp2p6/2020sH/sugc200b_yld.tif'
|
18 |
+
}
|
19 |
+
|
20 |
+
maps_list= list(maps)
|
21 |
+
maps_values= list(maps.values())
|
22 |
+
|
23 |
+
|
24 |
+
|
25 |
+
def add_widgets(m):
|
26 |
+
|
27 |
+
|
28 |
+
setattr(m, "zoom_to_layer", True)
|
29 |
+
style = {"description_width": "initial"}
|
30 |
+
padding = "0px 0px 0px 5px"
|
31 |
+
|
32 |
+
|
33 |
+
|
34 |
+
image = widgets.Dropdown(
|
35 |
+
value=None,
|
36 |
+
options=[('Milho - Potencial Produtivo Agro-Climático com somente chuva (2011-2040)', maps_values[0]),
|
37 |
+
('Café Arabica - Potencial Produtivo Agro-Climático com somente chuva (2011-2040)', maps_values[1]),
|
38 |
+
('Citrus - Potencial Produtivo Agro-Climático com somente chuva (2011-2040)', maps_values[2]),
|
39 |
+
('Cana de Açúcar - Potencial Produtivo Agro-Climático com somente chuva (2011-2040)', maps_values[3]),
|
40 |
+
],
|
41 |
+
description="Image:",
|
42 |
+
style=style,
|
43 |
+
layout=widgets.Layout(width="270px", padding=padding),
|
44 |
+
)
|
45 |
+
|
46 |
+
|
47 |
+
|
48 |
+
output = widgets.Output()
|
49 |
+
|
50 |
+
|
51 |
+
def change_image(change):
|
52 |
+
if change.new:
|
53 |
+
if change.new not in m.get_layer_names():
|
54 |
+
#mosaic = f"{url}/datasets/{dataset.value}/{image.value}.json"
|
55 |
+
layer_list = m.get_layer_names()
|
56 |
+
|
57 |
+
for layer in layer_list:
|
58 |
+
m.remove_layer(m.find_layer(layer))
|
59 |
+
#municipiosBR= 'https://geoftp.ibge.gov.br/organizacao_do_territorio/malhas_territoriais/malhas_municipais/municipio_2023/Brasil/BR_Municipios_2023.zip'
|
60 |
+
#estadosBR = 'https://geoftp.ibge.gov.br/organizacao_do_territorio/malhas_territoriais/malhas_municipais/municipio_2023/Brasil/BR_UF_2023.zip'
|
61 |
+
m.add_basemap("HYBRID")
|
62 |
+
#m.add_shp(estadosBR, layer_name='EstadosBR')
|
63 |
+
#m.add_shp(municipiosBR, layer_name='MunicipiosBR')
|
64 |
+
#m.remove_legend()
|
65 |
+
|
66 |
+
if image.value == maps_values[0]:
|
67 |
+
|
68 |
+
|
69 |
+
m.add_cog_layer(image.value, name= maps_list[0], palette = 'RdYlGn')
|
70 |
+
|
71 |
+
|
72 |
+
|
73 |
+
elif image.value == maps_values[1]:
|
74 |
+
|
75 |
+
|
76 |
+
|
77 |
+
m.add_cog_layer(image.value, name= maps_list[1], palette = 'RdYlGn')
|
78 |
+
|
79 |
+
|
80 |
+
elif image.value == maps_values[2]:
|
81 |
+
|
82 |
+
|
83 |
+
|
84 |
+
m.add_cog_layer(image.value, name= maps_list[2], palette = 'RdYlGn')
|
85 |
+
|
86 |
+
|
87 |
+
elif image.value == maps_values[3]:
|
88 |
+
|
89 |
+
|
90 |
+
m.add_cog_layer(image.value, name= maps_list[3], palette = 'RdYlGn')
|
91 |
+
|
92 |
+
|
93 |
+
output.outputs = ()
|
94 |
+
#output.append_stdout(f"Image date: {image_date}\n")
|
95 |
+
|
96 |
+
image.observe(change_image, names="value")
|
97 |
+
|
98 |
+
box = widgets.VBox(
|
99 |
+
[ image, output]
|
100 |
+
)
|
101 |
+
m.add_widget(box, position="topright", add_header=False)
|
102 |
+
|
103 |
+
|
104 |
+
class Map(leafmap.Map):
|
105 |
+
def __init__(self, **kwargs):
|
106 |
+
super().__init__(**kwargs)
|
107 |
+
|
108 |
+
add_widgets(self)
|
109 |
+
|
110 |
+
self.add_layer_manager(opened= True)
|
111 |
+
self.add_colorbar(colors=cm.get_palette(cmap_name='RdYlGn', n_class=10) , vmin=0, vmax=10000.0, caption= 'Potencial Produtivo Agro-Climático (kg Massa Seca/ha)')
|
112 |
+
|
113 |
+
|
114 |
+
|
115 |
+
|
116 |
+
|
117 |
+
|
118 |
+
|
119 |
+
|
120 |
+
|
121 |
+
@solara.component
|
122 |
+
def Page():
|
123 |
+
with solara.Column(style={"min-width": "500px"}):
|
124 |
+
Map.element(
|
125 |
+
zoom=zoom.value,
|
126 |
+
on_zoom=zoom.set,
|
127 |
+
center=center.value,
|
128 |
+
on_center=center.set,
|
129 |
+
height="600px",
|
130 |
+
toolbar_ctrl=False,
|
131 |
+
data_ctrl=True,
|
132 |
+
)
|
requirements.txt
CHANGED
@@ -4,3 +4,4 @@ solara
|
|
4 |
plotly
|
5 |
leafmap>=0.42.3
|
6 |
setuptools
|
|
|
|
4 |
plotly
|
5 |
leafmap>=0.42.3
|
6 |
setuptools
|
7 |
+
xarray
|