JunchuanYu commited on
Commit
de52544
1 Parent(s): 972c9ce

Update run.py

Browse files
Files changed (1) hide show
  1. run.py +16 -16
run.py CHANGED
@@ -8,11 +8,12 @@ import numpy as np
8
  st.set_page_config(page_title="TPL MAPPING",layout="wide")
9
 
10
  st.markdown("""
11
- <h2 style='text-align: center;'>Lake Distribution map of Tibet Plateau 🏔️</h2>
12
- <h4 style='text-align: center;'><font color=Blue>YuJunchuan </font>(AGRS)</h4>
13
- <br/>
 
14
 
15
- """, unsafe_allow_html=True)
16
 
17
  row1_col1, row1_col2, row1_col3 = st.columns([6, 1,1])
18
 
@@ -39,14 +40,15 @@ S2 = (ee.ImageCollection('COPERNICUS/S2_SR')
39
  .median()
40
  .clip(region))
41
 
42
- pred = ee.Image("projects/useful-tempest-341103/assets/TPlake/pred");
43
 
 
44
  def pred_mask(pred,threshold):
45
  mask=pred.where(pred.lt(threshold),0).where(pred.gte(threshold),1).toInt()
46
  mask=mask.setDefaultProjection('epsg:4326',None,10)
47
  water=mask.updateMask(mask.gt(0.5))
48
  return water
49
-
50
  with row1_col3:
51
  st.sidebar.title("About")
52
  st.sidebar.info(
@@ -61,14 +63,13 @@ with row1_col3:
61
  st.sidebar.info("Email: jason.yu.mail@qq.com")
62
 
63
  with row1_col2:
64
- # 选择底图模块
65
  basemaps = ['HYBRID', 'SATELLITE', 'TERRAIN']
66
- basemap = st.selectbox("Basemap", basemaps,index=basemaps.index('HYBRID'))
67
  Map.add_basemap(basemap)
68
 
69
- # 选择典型湖泊
70
  Typicallakes = ["Typical Lakes", "Qinghai Lake", "Selincuo", "Zhaling Lake", "Eling Lake", "Zhuonai Lake", "Margai Chaka", "Kokexili Lake"]
71
- lakeword = st.selectbox("Typical Lakes", Typicallakes)
72
  if lakeword == "Qinghai Lake":
73
  Map.setCenter(100.192956,36.936857, zoom=9)
74
  elif lakeword == "Selincuo":
@@ -86,21 +87,20 @@ with row1_col2:
86
  else:
87
  Map.setCenter(87.745,33.092, zoom=6)
88
 
89
- Threshold = st.slider('Threshold', 0, 255, 128)
90
  water=pred_mask(pred,Threshold)
91
 
92
- split = st.checkbox("Split View")
93
  if split:
94
  left_layer = geemap.ee_tile_layer(water, {'min': 0, 'max':1, 'palette': '0905ff'}, name='water',opacity=0.5)
95
  right_layer = geemap.ee_tile_layer(S2, {'min': 0, 'max':3000, 'bands': ['B4', 'B3', 'B2']},name='Image',shown=False)
96
  Map.split_map(left_layer, right_layer)
97
  else:
98
  Map.addLayer(water, {'min': 0, 'max':1, 'palette': '0905ff'}, name='water',opacity=0.7)
99
-
100
- st.markdown("""<h6 style='text-align: center;'>you can follow the WeChat public account [45度科研人] and leave me a message!</h6>""", unsafe_allow_html=True)
101
  st.markdown("""<div align=center><img width = '300' height ='300' src ="https://dunazo.oss-cn-beijing.aliyuncs.com/blog/wechat-simple.png"/></div>""", unsafe_allow_html=True)
102
 
103
-
104
  with row1_col1:
105
- Map.to_streamlit(weight=800,height=700)
106
 
 
 
8
  st.set_page_config(page_title="TPL MAPPING",layout="wide")
9
 
10
  st.markdown("""
11
+ <h1 style='text-align: center;'>Lake Distribution map of Tibet Plateau 🏔️</h1>
12
+ <h3 style='text-align: center;'><font color=Blue>YuJunchuan </font>(AGRS)</h3>
13
+ <br/>
14
+ """, unsafe_allow_html=True)
15
 
16
+ # geemap.set_proxy(33210)
17
 
18
  row1_col1, row1_col2, row1_col3 = st.columns([6, 1,1])
19
 
 
40
  .median()
41
  .clip(region))
42
 
43
+ pred = ee.Image("projects/useful-tempest-341103/assets/TPlake/pred")
44
 
45
+ #
46
  def pred_mask(pred,threshold):
47
  mask=pred.where(pred.lt(threshold),0).where(pred.gte(threshold),1).toInt()
48
  mask=mask.setDefaultProjection('epsg:4326',None,10)
49
  water=mask.updateMask(mask.gt(0.5))
50
  return water
51
+
52
  with row1_col3:
53
  st.sidebar.title("About")
54
  st.sidebar.info(
 
63
  st.sidebar.info("Email: jason.yu.mail@qq.com")
64
 
65
  with row1_col2:
66
+
67
  basemaps = ['HYBRID', 'SATELLITE', 'TERRAIN']
68
+ basemap = st.selectbox("🗺️BASEMAP", basemaps,index=basemaps.index('HYBRID'))
69
  Map.add_basemap(basemap)
70
 
 
71
  Typicallakes = ["Typical Lakes", "Qinghai Lake", "Selincuo", "Zhaling Lake", "Eling Lake", "Zhuonai Lake", "Margai Chaka", "Kokexili Lake"]
72
+ lakeword = st.selectbox("🌊Typical Lakes", Typicallakes)
73
  if lakeword == "Qinghai Lake":
74
  Map.setCenter(100.192956,36.936857, zoom=9)
75
  elif lakeword == "Selincuo":
 
87
  else:
88
  Map.setCenter(87.745,33.092, zoom=6)
89
 
90
+ Threshold = st.slider('Threshold', 0, 255, 128)
91
  water=pred_mask(pred,Threshold)
92
 
93
+ split = st.checkbox("⛩️Split View")
94
  if split:
95
  left_layer = geemap.ee_tile_layer(water, {'min': 0, 'max':1, 'palette': '0905ff'}, name='water',opacity=0.5)
96
  right_layer = geemap.ee_tile_layer(S2, {'min': 0, 'max':3000, 'bands': ['B4', 'B3', 'B2']},name='Image',shown=False)
97
  Map.split_map(left_layer, right_layer)
98
  else:
99
  Map.addLayer(water, {'min': 0, 'max':1, 'palette': '0905ff'}, name='water',opacity=0.7)
100
+ st.markdown("", unsafe_allow_html=True)
101
+ st.markdown("👍 you can follow the WeChat public account [45度科研人] and leave me a message!", unsafe_allow_html=True)
102
  st.markdown("""<div align=center><img width = '300' height ='300' src ="https://dunazo.oss-cn-beijing.aliyuncs.com/blog/wechat-simple.png"/></div>""", unsafe_allow_html=True)
103
 
 
104
  with row1_col1:
 
105
 
106
+ Map.to_streamlit(weight=900,height=750)