JunchuanYu commited on
Commit
68b2737
1 Parent(s): 4dab1a2

Update run.py

Browse files
Files changed (1) hide show
  1. run.py +22 -27
run.py CHANGED
@@ -9,18 +9,17 @@ 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;'>YuJunchuan(jason.yu.mail@qq.com)</h3>
 
 
13
  """, unsafe_allow_html=True)
14
- # geemap.set_proxy(33210)
15
 
16
- row1_col1, row1_col2 = st.columns([4, 1])
17
 
18
  Map = geemap.Map()
19
 
20
- # 设置区域
21
  region = ee.FeatureCollection("projects/useful-tempest-341103/assets/water/TPBoundary")
22
 
23
- # 获取遥感影像
24
  datastart='2021-06-01'
25
  dataend='2021-10-15'
26
 
@@ -42,13 +41,25 @@ S2 = (ee.ImageCollection('COPERNICUS/S2_SR')
42
 
43
  pred = ee.Image("projects/useful-tempest-341103/assets/TPlake/pred");
44
 
45
- # 对分类数据进行mask处理
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_col2:
53
  # 选择底图模块
54
  basemaps = ['HYBRID', 'SATELLITE', 'TERRAIN']
@@ -75,37 +86,21 @@ with row1_col2:
75
  else:
76
  Map.setCenter(87.745,33.092, zoom=6)
77
 
78
- # 自定义设置阈值
79
  Threshold = st.slider('Threshold', 0, 255, 128)
80
  water=pred_mask(pred,Threshold)
81
 
82
- # 选择是否分屏查看
83
  split = st.checkbox("Split View")
84
  if split:
85
- left_layer = geemap.ee_tile_layer(water, {'min': 0, 'max':1, 'palette': '0905ff'}, name='water',opacity=0.7)
86
  right_layer = geemap.ee_tile_layer(S2, {'min': 0, 'max':3000, 'bands': ['B4', 'B3', 'B2']},name='Image',shown=False)
87
  Map.split_map(left_layer, right_layer)
88
  else:
89
  Map.addLayer(water, {'min': 0, 'max':1, 'palette': '0905ff'}, name='water',opacity=0.7)
90
-
91
- st.sidebar.title("About")
92
- st.sidebar.info(
93
- """
94
- This web [app]() is maintained by [Junchuan Yu](https://junchuanyu.netlify.app/posts/). You can follow me on social media:
95
- [GitHub](https://github.com/JunchuanYu) | [Zhihu](https://twitter.com/giswqs) .
96
 
97
- Sentinel-2 is used as the data, and 8-band images are used as training data (B4, B3, B2, B8, B11, B12, MNDWI, SDWI). The model uses a multi-scale deep neural network model based on transfer learning, and is implemented using otop technology
98
- """
99
- )
100
 
101
  with row1_col1:
102
  Map.to_streamlit(height=750)
103
 
104
- st.markdown("<h5 style='text-align: center;'>you can follow the WeChat public account [45度科研人] and leave me a message!</h5>", unsafe_allow_html=True)
105
-
106
- row2_col1, row2_col2,row2_col3,row2_col4 = st.columns([2,1,1,2])
107
- with row2_col2:
108
- st.markdown("<img src='https://dunazo.oss-cn-beijing.aliyuncs.com/blog/wechat-simple.png' style='margin-right:25px;width:200px;height:200px;'>", unsafe_allow_html=True)
109
- with row2_col3:
110
- st.markdown("<img src='https://dunazo.oss-cn-beijing.aliyuncs.com/blog/shoukuanma222.png' style='margin-right:25px;width:170px;height:190px;'>", unsafe_allow_html=True)
111
-
 
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
+
15
  """, unsafe_allow_html=True)
 
16
 
17
+ row1_col1, row1_col2, row1_col3 = st.columns([6, 2,2])
18
 
19
  Map = geemap.Map()
20
 
 
21
  region = ee.FeatureCollection("projects/useful-tempest-341103/assets/water/TPBoundary")
22
 
 
23
  datastart='2021-06-01'
24
  dataend='2021-10-15'
25
 
 
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(
53
+ """
54
+ This web [app](https://junchuanyu-ldtp.hf.space) is maintained by [Junchuan Yu](https://junchuanyu.netlify.app/posts/). You can follow me on social media:
55
+ [GitHub](https://github.com/JunchuanYu) | [Zhihu](https://twitter.com/giswqs) .
56
+
57
+ Sentinel-2 is used as the data, and 8-band images are used as training data (B4, B3, B2, B8, B11, B12, MNDWI, SDWI). The model uses a multi-scale deep neural network model based on transfer learning, and is implemented using otop technology
58
+ """
59
+ )
60
+ st.sidebar.title("Contect")
61
+ st.sidebar.info("Email: jason.yu.mail@qq.com")
62
+
63
  with row1_col2:
64
  # 选择底图模块
65
  basemaps = ['HYBRID', 'SATELLITE', 'TERRAIN']
 
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(height=750)
106