YashMK89 commited on
Commit
fe61a21
·
verified ·
1 Parent(s): 3a1bd1e

update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -1
app.py CHANGED
@@ -53,6 +53,16 @@ st.header("Earth Engine Index Calculator")
53
  # Choose Index or Custom Formula
54
  index_choice = st.selectbox("Select an Index or Enter Custom Formula", ['NDVI', 'NDWI', 'Average NO₂', 'Custom Formula'])
55
 
 
 
 
 
 
 
 
 
 
 
56
  # Enter custom formula if selected
57
  custom_formula = ""
58
  if index_choice == 'Custom Formula':
@@ -267,9 +277,15 @@ if file_upload:
267
  # Generate the dynamic filename
268
  filename = f"{main_selection}_{sub_selection}_{start_date.strftime('%Y/%m/%d')}_{end_date.strftime('%Y/%m/%d')}_{shape_type}.csv"
269
 
270
- # Convert results to DataFrame for download
271
  if st.session_state.results:
 
272
  result_df = pd.DataFrame(st.session_state.results)
 
 
 
 
 
 
273
  st.download_button(
274
  label="Download results as CSV",
275
  data=result_df.to_csv(index=False).encode('utf-8'),
 
53
  # Choose Index or Custom Formula
54
  index_choice = st.selectbox("Select an Index or Enter Custom Formula", ['NDVI', 'NDWI', 'Average NO₂', 'Custom Formula'])
55
 
56
+ # Display corresponding formula based on the index selected
57
+ if index_choice == 'NDVI':
58
+ st.write("Formula for NDVI: NDVI = (B8 - B4) / (B8 + B4)")
59
+ elif index_choice == 'NDWI':
60
+ st.write("Formula for NDWI: NDWI = (B3 - B8) / (B3 + B8)")
61
+ elif index_choice == 'Average NO₂':
62
+ st.write("Formula for Average NO₂: Average NO₂ = Mean(NO2 band)")
63
+ elif index_choice == 'Custom Formula' and custom_formula:
64
+ st.write(f"Custom Formula: {custom_formula}")
65
+
66
  # Enter custom formula if selected
67
  custom_formula = ""
68
  if index_choice == 'Custom Formula':
 
277
  # Generate the dynamic filename
278
  filename = f"{main_selection}_{sub_selection}_{start_date.strftime('%Y/%m/%d')}_{end_date.strftime('%Y/%m/%d')}_{shape_type}.csv"
279
 
 
280
  if st.session_state.results:
281
+ # Convert the results to a DataFrame for better visualization
282
  result_df = pd.DataFrame(st.session_state.results)
283
+
284
+ # Show the results in a table format
285
+ st.write("Processed Results Table:")
286
+ st.dataframe(result_df)
287
+
288
+ # Allow user to download results as CSV
289
  st.download_button(
290
  label="Download results as CSV",
291
  data=result_df.to_csv(index=False).encode('utf-8'),