Update app.py
Browse files
app.py
CHANGED
|
@@ -14,7 +14,7 @@ from glob import glob
|
|
| 14 |
import wget
|
| 15 |
|
| 16 |
##
|
| 17 |
-
def timer(start_time=None
|
| 18 |
if not start_time:
|
| 19 |
start_time = datetime.now()
|
| 20 |
return start_time
|
|
@@ -45,25 +45,25 @@ def predict(lat, lon):
|
|
| 45 |
return "Choose an area of ivory coast","","","",""
|
| 46 |
|
| 47 |
else:
|
| 48 |
-
start_time_research = timer(
|
| 49 |
df = pd.read_csv("data/frame.csv")
|
| 50 |
name = find_good_tile(df,point2)
|
| 51 |
-
timer(
|
| 52 |
if name ==404:
|
| 53 |
reponse = "Sentinel-2 does not have data on this location to date"
|
| 54 |
return reponse,"","","",""
|
| 55 |
else:
|
| 56 |
-
start_time_download = timer(
|
| 57 |
path = "https://data354-public-assets.s3.eu-west-3.amazonaws.com/cisentineldata/"
|
| 58 |
url = path+name
|
| 59 |
wget.download(url)
|
| 60 |
-
timer(
|
| 61 |
|
| 62 |
-
start_time_unzip = timer(
|
| 63 |
unzip()
|
| 64 |
-
timer(
|
| 65 |
|
| 66 |
-
start_time_processing = timer(
|
| 67 |
name,cld_prob,days_ago = select_best_cloud_coverage_tile()
|
| 68 |
bandes_path_10,bandes_path_20,bandes_path_60,tile_path,path_cld_20,path_cld_60 =paths(name)
|
| 69 |
# create image dataset
|
|
@@ -91,7 +91,7 @@ def predict(lat, lon):
|
|
| 91 |
|
| 92 |
# NDVI
|
| 93 |
ndvi_index = ndvi(cord,name)
|
| 94 |
-
timer(
|
| 95 |
|
| 96 |
# deleted download files
|
| 97 |
delete_tiles()
|
|
|
|
| 14 |
import wget
|
| 15 |
|
| 16 |
##
|
| 17 |
+
def timer(message,start_time=None):
|
| 18 |
if not start_time:
|
| 19 |
start_time = datetime.now()
|
| 20 |
return start_time
|
|
|
|
| 45 |
return "Choose an area of ivory coast","","","",""
|
| 46 |
|
| 47 |
else:
|
| 48 |
+
start_time_research = timer('research tile',None)
|
| 49 |
df = pd.read_csv("data/frame.csv")
|
| 50 |
name = find_good_tile(df,point2)
|
| 51 |
+
timer('research tile',start_time_research)
|
| 52 |
if name ==404:
|
| 53 |
reponse = "Sentinel-2 does not have data on this location to date"
|
| 54 |
return reponse,"","","",""
|
| 55 |
else:
|
| 56 |
+
start_time_download = timer('download tile',None)
|
| 57 |
path = "https://data354-public-assets.s3.eu-west-3.amazonaws.com/cisentineldata/"
|
| 58 |
url = path+name
|
| 59 |
wget.download(url)
|
| 60 |
+
timer('download tile',start_time_download)
|
| 61 |
|
| 62 |
+
start_time_unzip = timer('unzip data',None)
|
| 63 |
unzip()
|
| 64 |
+
timer('unzip data',start_time_unzip)
|
| 65 |
|
| 66 |
+
start_time_processing = timer('processing data',None)
|
| 67 |
name,cld_prob,days_ago = select_best_cloud_coverage_tile()
|
| 68 |
bandes_path_10,bandes_path_20,bandes_path_60,tile_path,path_cld_20,path_cld_60 =paths(name)
|
| 69 |
# create image dataset
|
|
|
|
| 91 |
|
| 92 |
# NDVI
|
| 93 |
ndvi_index = ndvi(cord,name)
|
| 94 |
+
timer('processing data',start_time_processing)
|
| 95 |
|
| 96 |
# deleted download files
|
| 97 |
delete_tiles()
|