OnFarmView commited on
Commit
90ea1fa
·
1 Parent(s): f5a6569

add my first model config file :)

Browse files
Files changed (3) hide show
  1. .DS_Store +1 -1
  2. test/web copy.py +0 -105
  3. web copy.py +0 -105
.DS_Store CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:68d74a24e420f95467f807a4db46cdab6aa2325059eecc980aa838ca69a469b8
3
  size 10244
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4fae21a390aa9238a69e4e93ab7252ae9097097e37033ba66ef46ea16de05688
3
  size 10244
test/web copy.py DELETED
@@ -1,105 +0,0 @@
1
- import folium
2
- import pandas
3
- import geemap.foliumap as geemap
4
- import ee
5
- from datetime import date, timedelta, datetime
6
-
7
- def ee_authenticate(token_name="EARTHENGINE_TOKEN"):
8
- geemap.ee_initialize(token_name=token_name)
9
- def maskCloudAndShadows(image):
10
- cloudProb = image.select('MSK_CLDPRB')
11
- snowProb = image.select('MSK_SNWPRB')
12
- cloud = cloudProb.lt(5)
13
- snow = snowProb.lt(5)
14
- scl = image.select('SCL')
15
- shadow = scl.eq(3); # 3 = cloud shadow
16
- cirrus = scl.eq(10); # 10 = cirrus
17
- # Cloud probability less than 5% or cloud shadow classification
18
- mask = (cloud.And(snow)).And(cirrus.neq(1)).And(shadow.neq(1))
19
- return image.updateMask(mask).divide(10000)
20
-
21
- # Normalized difference vegetation index (NDVI)
22
- def getNDVI(image):
23
- ndvi = image.normalizedDifference(['B8','B4']).rename("NDVI")
24
- image = image.addBands(ndvi)
25
- return(image)
26
-
27
- def addDate(image):
28
- img_date = ee.Date(image.date())
29
- img_date = ee.Number.parse(img_date.format('YYYYMMdd'))
30
- return image.addBands(ee.Image(img_date).rename('date').toInt())
31
-
32
- ee_authenticate(token_name="4/1AfJohXleDqw1-fV1879iHUDYgPbM7f5OjCKfxFY3vJiiGqQDn_ff-Luhhhk") #4/1AfJohXkTlWMKd8fPevD3hd4tAq_j-YlD2CabTy7QtM7iu1gNB3XdBEqRehA
33
-
34
- map_center=(-43.525650, 172.639847)
35
- popup_message = 'Contact: [email protected]'
36
- crs = "epsg:4326"
37
- band = ['B8','B4','B3']
38
- rgbViza = {"min":0.0, "max":0.7,"bands":band}
39
-
40
- Map = geemap.Map(
41
- basemap="HYBRID",
42
- plugin_Draw=True,
43
- Draw_export=True,
44
- locate_control=True,
45
- plugin_LatLngPopup=False, center=map_center, zoom=8,
46
- )
47
-
48
- ed = date.today()
49
- sd = ed - timedelta(days=30)
50
-
51
-
52
- startDate = sd.strftime("%Y-%m-%d") + "T"
53
- endDate = ed.strftime("%Y-%m-%d") + "T"
54
-
55
-
56
- se2 = ee.ImageCollection('COPERNICUS/S2_SR').filterDate(
57
- startDate,endDate).filter(
58
- ee.Filter.lt("CLOUDY_PIXEL_PERCENTAGE",80)).map(maskCloudAndShadows).median()
59
-
60
- palette = ['FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD163', '99B718', '74A901', '66A000', '529400', '3E8601', '207401', '056201', '004C00', '023B01', '012E01', '011D01', '011301']
61
- vis_params = {
62
- 'min': 0,
63
- 'max': 1,
64
- 'palette': palette}
65
-
66
- NDVI_data = ee.ImageCollection('COPERNICUS/S2_SR').filterDate(startDate, endDate).filter(ee.Filter.lt("CLOUDY_PIXEL_PERCENTAGE",80)).map(maskCloudAndShadows).map(getNDVI)
67
- Map.addLayer(NDVI_data.select('NDVI').median(), vis_params, "Median of NDVI")
68
-
69
-
70
- band = ['B4','B3','B2']
71
- rgbViza = {"min":0.0, "max":0.7,"bands":band}
72
- titlemap = "Sentinel 2 - Natural Color"
73
- Map.addLayer(se2, rgbViza, titlemap)
74
-
75
-
76
- band = ['B8','B4','B3']
77
- rgbViza = {"min":0.0, "max":0.7,"bands":band}
78
- titlemap = "Sentinel 2 - Color Infrared"
79
- Map.addLayer(se2, rgbViza, titlemap)
80
-
81
- band = ['B11','B8','B2']
82
- rgbViza = {"min":0.0, "max":0.7,"bands":band}
83
- titlemap = "Sentinel 2 - Agriculture"
84
- Map.addLayer(se2, rgbViza, titlemap)
85
-
86
- band = ['B11','B8','B4']
87
- rgbViza = {"min":0.0, "max":0.7,"bands":band}
88
- titlemap = "Sentinel 2 - Vegetation Analysis"
89
- Map.addLayer(se2, rgbViza, titlemap)
90
-
91
- band = ['B8','B11','B2']
92
- rgbViza = {"min":0.0, "max":0.7,"bands":band}
93
- titlemap = "Sentinel 2 - Healthy Vegetation"
94
- Map.addLayer(se2, rgbViza, titlemap)
95
-
96
-
97
-
98
- folium.Marker(
99
- location=map_center,
100
- popup=popup_message,
101
- icon=folium.Icon(icon="info-sign", color="red")
102
- ).add_to(Map)
103
-
104
- Map.addLayerControl()
105
- Map.save("index.html")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
web copy.py DELETED
@@ -1,105 +0,0 @@
1
- import folium
2
- import pandas
3
- import geemap.foliumap as geemap
4
- import ee
5
- from datetime import date, timedelta, datetime
6
-
7
- def ee_authenticate(token_name="EARTHENGINE_TOKEN"):
8
- geemap.ee_initialize(token_name=token_name)
9
- def maskCloudAndShadows(image):
10
- cloudProb = image.select('MSK_CLDPRB')
11
- snowProb = image.select('MSK_SNWPRB')
12
- cloud = cloudProb.lt(5)
13
- snow = snowProb.lt(5)
14
- scl = image.select('SCL')
15
- shadow = scl.eq(3); # 3 = cloud shadow
16
- cirrus = scl.eq(10); # 10 = cirrus
17
- # Cloud probability less than 5% or cloud shadow classification
18
- mask = (cloud.And(snow)).And(cirrus.neq(1)).And(shadow.neq(1))
19
- return image.updateMask(mask).divide(10000)
20
-
21
- # Normalized difference vegetation index (NDVI)
22
- def getNDVI(image):
23
- ndvi = image.normalizedDifference(['B8','B4']).rename("NDVI")
24
- image = image.addBands(ndvi)
25
- return(image)
26
-
27
- def addDate(image):
28
- img_date = ee.Date(image.date())
29
- img_date = ee.Number.parse(img_date.format('YYYYMMdd'))
30
- return image.addBands(ee.Image(img_date).rename('date').toInt())
31
-
32
- ee_authenticate(token_name="4/1AfJohXleDqw1-fV1879iHUDYgPbM7f5OjCKfxFY3vJiiGqQDn_ff-Luhhhk") #4/1AfJohXkTlWMKd8fPevD3hd4tAq_j-YlD2CabTy7QtM7iu1gNB3XdBEqRehA
33
-
34
- map_center=(-43.525650, 172.639847)
35
- popup_message = 'Contact: [email protected]'
36
- crs = "epsg:4326"
37
- band = ['B8','B4','B3']
38
- rgbViza = {"min":0.0, "max":0.7,"bands":band}
39
-
40
- Map = geemap.Map(
41
- basemap="HYBRID",
42
- plugin_Draw=True,
43
- Draw_export=True,
44
- locate_control=True,
45
- plugin_LatLngPopup=False, center=map_center, zoom=8,
46
- )
47
-
48
- ed = date.today()
49
- sd = ed - timedelta(days=30)
50
-
51
-
52
- startDate = sd.strftime("%Y-%m-%d") + "T"
53
- endDate = ed.strftime("%Y-%m-%d") + "T"
54
-
55
-
56
- se2 = ee.ImageCollection('COPERNICUS/S2_SR').filterDate(
57
- startDate,endDate).filter(
58
- ee.Filter.lt("CLOUDY_PIXEL_PERCENTAGE",80)).map(maskCloudAndShadows).median()
59
-
60
- palette = ['FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD163', '99B718', '74A901', '66A000', '529400', '3E8601', '207401', '056201', '004C00', '023B01', '012E01', '011D01', '011301']
61
- vis_params = {
62
- 'min': 0,
63
- 'max': 1,
64
- 'palette': palette}
65
-
66
- NDVI_data = ee.ImageCollection('COPERNICUS/S2_SR').filterDate(startDate, endDate).filter(ee.Filter.lt("CLOUDY_PIXEL_PERCENTAGE",80)).map(maskCloudAndShadows).map(getNDVI)
67
- Map.addLayer(NDVI_data.select('NDVI').median(), vis_params, "Median of NDVI")
68
-
69
-
70
- band = ['B4','B3','B2']
71
- rgbViza = {"min":0.0, "max":0.7,"bands":band}
72
- titlemap = "Sentinel 2 - Natural Color"
73
- Map.addLayer(se2, rgbViza, titlemap)
74
-
75
-
76
- band = ['B8','B4','B3']
77
- rgbViza = {"min":0.0, "max":0.7,"bands":band}
78
- titlemap = "Sentinel 2 - Color Infrared"
79
- Map.addLayer(se2, rgbViza, titlemap)
80
-
81
- band = ['B11','B8','B2']
82
- rgbViza = {"min":0.0, "max":0.7,"bands":band}
83
- titlemap = "Sentinel 2 - Agriculture"
84
- Map.addLayer(se2, rgbViza, titlemap)
85
-
86
- band = ['B11','B8','B4']
87
- rgbViza = {"min":0.0, "max":0.7,"bands":band}
88
- titlemap = "Sentinel 2 - Vegetation Analysis"
89
- Map.addLayer(se2, rgbViza, titlemap)
90
-
91
- band = ['B8','B11','B2']
92
- rgbViza = {"min":0.0, "max":0.7,"bands":band}
93
- titlemap = "Sentinel 2 - Healthy Vegetation"
94
- Map.addLayer(se2, rgbViza, titlemap)
95
-
96
-
97
-
98
- folium.Marker(
99
- location=map_center,
100
- popup=popup_message,
101
- icon=folium.Icon(icon="info-sign", color="red")
102
- ).add_to(Map)
103
-
104
- Map.addLayerControl()
105
- Map.save("index.html")