Spaces:
Running
on
L4
Running
on
L4
Update app.py
Browse files
app.py
CHANGED
@@ -8,13 +8,21 @@ from IPython.display import display
|
|
8 |
import ipywidgets
|
9 |
import solara
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
instructions_top = '''
|
12 |

|
13 |
# Dataset Viewer
|
14 |
-
|
15 |
This app provides a way of exploring samples present in the MajorTOM-Core dataset.
|
16 |
It contains nearly every piece of Earth capture by ESA Sentinel-2 satellite.
|
17 |
-
|
18 |
### Instructions
|
19 |
To find a sample, navigate on the map to a place of interest. Click `Find Sample` to find a dataset sample that contains the central pixel of your current view.
|
20 |
'''
|
@@ -28,8 +36,9 @@ instructions_bottom = '''
|
|
28 |
image_data = solara.reactive(Image.new('RGB',(1068,1068)))
|
29 |
center = solara.reactive((20, 0))
|
30 |
gridcell = solara.reactive('')
|
|
|
31 |
zoom= solara.reactive(4)
|
32 |
-
|
33 |
|
34 |
@solara.component
|
35 |
def Page():
|
@@ -51,9 +60,9 @@ def Page():
|
|
51 |
solara.Markdown(instructions_bottom)
|
52 |
|
53 |
def update_image():
|
54 |
-
ret = map_to_image(m, return_centre=True, return_gridcell=True, l2a=(
|
55 |
if ret is not None:
|
56 |
-
image_data.value, center.value, gridcell.value = ret
|
57 |
zoom.value=12
|
58 |
else:
|
59 |
image_data.value = Image.new('RGB',(1068,1068))
|
@@ -81,7 +90,7 @@ def Page():
|
|
81 |
)
|
82 |
display(m)
|
83 |
button = solara.Button("Find Sample", on_click=update_image, height='80px')
|
84 |
-
solara.Select(label="Processing Level", value=
|
85 |
with solara.Column(align='center'):
|
86 |
output = solara.Image(image_data.value)
|
87 |
solara.Markdown('''
|
@@ -89,5 +98,5 @@ def Page():
|
|
89 |
|--------------------:|:----:|
|
90 |
| Latitude, Longitude | {:.3f}, {:.3f} |
|
91 |
| MajorTOM Grid | {} |
|
92 |
-
|
93 |
-
|
|
|
8 |
import ipywidgets
|
9 |
import solara
|
10 |
|
11 |
+
import sys
|
12 |
+
import os
|
13 |
+
import leafmap
|
14 |
+
#from .helpers.grid import *
|
15 |
+
#from .helpers.functional import *
|
16 |
+
from leafmap.toolbar import change_basemap
|
17 |
+
from IPython.display import display
|
18 |
+
import ipywidgets
|
19 |
+
import solara
|
20 |
+
|
21 |
instructions_top = '''
|
22 |

|
23 |
# Dataset Viewer
|
|
|
24 |
This app provides a way of exploring samples present in the MajorTOM-Core dataset.
|
25 |
It contains nearly every piece of Earth capture by ESA Sentinel-2 satellite.
|
|
|
26 |
### Instructions
|
27 |
To find a sample, navigate on the map to a place of interest. Click `Find Sample` to find a dataset sample that contains the central pixel of your current view.
|
28 |
'''
|
|
|
36 |
image_data = solara.reactive(Image.new('RGB',(1068,1068)))
|
37 |
center = solara.reactive((20, 0))
|
38 |
gridcell = solara.reactive('')
|
39 |
+
timestamp = solara.reactive('')
|
40 |
zoom= solara.reactive(4)
|
41 |
+
source = solara.reactive('S2-L2A')
|
42 |
|
43 |
@solara.component
|
44 |
def Page():
|
|
|
60 |
solara.Markdown(instructions_bottom)
|
61 |
|
62 |
def update_image():
|
63 |
+
ret = map_to_image(m, return_centre=True, return_gridcell=True, return_timestamp=True, source=source.value)#l2a=(source.value=='S2-L2A'))
|
64 |
if ret is not None:
|
65 |
+
image_data.value, center.value, gridcell.value, timestamp.value = ret
|
66 |
zoom.value=12
|
67 |
else:
|
68 |
image_data.value = Image.new('RGB',(1068,1068))
|
|
|
90 |
)
|
91 |
display(m)
|
92 |
button = solara.Button("Find Sample", on_click=update_image, height='80px')
|
93 |
+
solara.Select(label="Processing Level", value=source, values=['S2-L2A','S2-L1C', 'S1-RTC'], on_value=update_level)
|
94 |
with solara.Column(align='center'):
|
95 |
output = solara.Image(image_data.value)
|
96 |
solara.Markdown('''
|
|
|
98 |
|--------------------:|:----:|
|
99 |
| Latitude, Longitude | {:.3f}, {:.3f} |
|
100 |
| MajorTOM Grid | {} |
|
101 |
+
| Timestamp| {} |
|
102 |
+
'''.format(center.value[0], center.value[1], gridcell.value, timestamp.value))
|