youl commited on
Commit
c79c457
1 Parent(s): 66c9d87

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -2
app.py CHANGED
@@ -64,19 +64,30 @@ def predict(lat, lon):
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
70
  images_10 = extract_sub_image(bandes_path_10,tile_path,cord)
 
71
 
 
72
  # bandes with 20m resolution
73
  #path_cld_20
74
  images_20 = extract_sub_image(bandes_path_20,tile_path,cord,20,1)
75
-
 
 
76
  # bandes with 60m resolution
77
  #path_cld_60
78
  images_60 = extract_sub_image(bandes_path_60,tile_path,cord,60)
 
79
  #
 
80
  feature = images_10.tolist()+images_20.tolist()+images_60.tolist()
81
  bands = ['B02', 'B03', 'B04', 'B05', 'B06', 'B07', 'B08', 'B8A', 'B11', 'B12','B01','B09']
82
  X = pd.DataFrame([feature],columns = bands)
@@ -88,11 +99,15 @@ def predict(lat, lon):
88
  # make prediction
89
  biomass = loaded_model.predict(X)[0]
90
  carbon = 0.55*biomass
 
91
 
92
  # NDVI
 
93
  ndvi_index = ndvi(cord,name)
 
 
94
  timer('processing data',start_time_processing)
95
-
96
  # deleted download files
97
  delete_tiles()
98
 
 
64
  timer('unzip data',start_time_unzip)
65
 
66
  start_time_processing = timer('processing data',None)
67
+
68
+ start_time_select_best_tile = timer('select best tile',None)
69
  name,cld_prob,days_ago = select_best_cloud_coverage_tile()
70
  bandes_path_10,bandes_path_20,bandes_path_60,tile_path,path_cld_20,path_cld_60 =paths(name)
71
+ timer('select best tile',start_time_select_best_tile)
72
+
73
+ start_time_10m = timer('create 10m image',None)
74
  # create image dataset
75
  images_10 = extract_sub_image(bandes_path_10,tile_path,cord)
76
+ timer('create 10m image',start_time_10m)
77
 
78
+ start_time_20m = timer('create 20m image',None)
79
  # bandes with 20m resolution
80
  #path_cld_20
81
  images_20 = extract_sub_image(bandes_path_20,tile_path,cord,20,1)
82
+ start_time_20m = timer('create 20m image',start_time_20m)
83
+
84
+ start_time_60m = timer('create 60m image',None)
85
  # bandes with 60m resolution
86
  #path_cld_60
87
  images_60 = extract_sub_image(bandes_path_60,tile_path,cord,60)
88
+ start_time_60m = timer('create 60m image',start_time_60m)
89
  #
90
+ start_time_make_prediction = timer('make prediction',None)
91
  feature = images_10.tolist()+images_20.tolist()+images_60.tolist()
92
  bands = ['B02', 'B03', 'B04', 'B05', 'B06', 'B07', 'B08', 'B8A', 'B11', 'B12','B01','B09']
93
  X = pd.DataFrame([feature],columns = bands)
 
99
  # make prediction
100
  biomass = loaded_model.predict(X)[0]
101
  carbon = 0.55*biomass
102
+ timer('make prediction',start_time_make_prediction)
103
 
104
  # NDVI
105
+ start_time_make_ndvi = timer('NDVI calculation',None)
106
  ndvi_index = ndvi(cord,name)
107
+ timer('NDVI calculation',start_time_make_ndvi)
108
+
109
  timer('processing data',start_time_processing)
110
+
111
  # deleted download files
112
  delete_tiles()
113