YashMK89 commited on
Commit
da4d66e
·
verified ·
1 Parent(s): 95ea26b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -19
app.py CHANGED
@@ -595,24 +595,13 @@ elif imagery_base == "MODIS":
595
  except FileNotFoundError:
596
  st.error(f"Dataset file '{dataset_file}' not found.")
597
  data = {}
598
- elif imagery_base == "VIIRS": # Fetch VIIRS datasets directly from GEE
 
599
  try:
600
- # List all VIIRS-related collections dynamically from Earth Engine
601
- viirs_collections = ee.data.listAssets({'parent': 'projects/earthengine-public/assets'}).get('assets', [])
602
- viirs_collections = [asset['id'] for asset in viirs_collections if 'VIIRS' in asset['id']]
603
- if not viirs_collections:
604
- st.error("No VIIRS datasets found in Earth Engine.")
605
- data = {}
606
- else:
607
- data = {
608
- "VIIRS Datasets": {
609
- "sub_options": {col: col for col in viirs_collections},
610
- "bands": {}
611
- }
612
- }
613
- st.write(f"Fetched VIIRS datasets: {', '.join(viirs_collections)}")
614
- except Exception as e:
615
- st.error(f"Error fetching VIIRS datasets: {str(e)}")
616
  data = {}
617
  elif imagery_base == "Custom Input":
618
  custom_dataset_id = st.text_input("Enter Custom Earth Engine Dataset ID (e.g., AHN/AHN4)", value="")
@@ -722,7 +711,7 @@ st.markdown("<h5>Cloud Filtering</h5>", unsafe_allow_html=True)
722
  tile_cloud_threshold = st.slider(
723
  "Select Maximum Tile-Based Cloud Coverage Threshold (%)",
724
  min_value=0,
725
- max_value=100,
726
  value=20,
727
  step=5,
728
  help="Tiles with cloud coverage exceeding this threshold will be excluded."
@@ -731,7 +720,7 @@ tile_cloud_threshold = st.slider(
731
  pixel_cloud_threshold = st.slider(
732
  "Select Maximum Pixel-Based Cloud Coverage Threshold (%)",
733
  min_value=0,
734
- max_value=100,
735
  value=10,
736
  step=5,
737
  help="Individual pixels with cloud coverage exceeding this threshold will be masked."
 
595
  except FileNotFoundError:
596
  st.error(f"Dataset file '{dataset_file}' not found.")
597
  data = {}
598
+ elif imagery_base == "VIIRS": # New VIIRS Option
599
+ dataset_file = "viirs_datasets.json"
600
  try:
601
+ with open(dataset_file) as f:
602
+ data = json.load(f)
603
+ except FileNotFoundError:
604
+ st.error(f"Dataset file '{dataset_file}' not found.")
 
 
 
 
 
 
 
 
 
 
 
 
605
  data = {}
606
  elif imagery_base == "Custom Input":
607
  custom_dataset_id = st.text_input("Enter Custom Earth Engine Dataset ID (e.g., AHN/AHN4)", value="")
 
711
  tile_cloud_threshold = st.slider(
712
  "Select Maximum Tile-Based Cloud Coverage Threshold (%)",
713
  min_value=0,
714
+ max_value=50,
715
  value=20,
716
  step=5,
717
  help="Tiles with cloud coverage exceeding this threshold will be excluded."
 
720
  pixel_cloud_threshold = st.slider(
721
  "Select Maximum Pixel-Based Cloud Coverage Threshold (%)",
722
  min_value=0,
723
+ max_value=50,
724
  value=10,
725
  step=5,
726
  help="Individual pixels with cloud coverage exceeding this threshold will be masked."