rhamon-garcia commited on
Commit
cb59c78
·
verified ·
1 Parent(s): dc45a7e

Upload 14 files

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