pgzmnk commited on
Commit
a805f1e
1 Parent(s): 29ff8b7

Subset indicators.

Browse files
Files changed (1) hide show
  1. utils/indicators.py +4 -7
utils/indicators.py CHANGED
@@ -34,9 +34,9 @@ class IndexGenerator:
34
  # Authenticate to GEE & DuckDB
35
  self._authenticate_ee(GEE_SERVICE_ACCOUNT)
36
 
37
- # Set instance variables
38
- self.indices = self._load_indices(INDICES_FILE)
39
- breakpoint()
40
 
41
  def _cloudfree(self, gee_path, daterange):
42
  """
@@ -85,6 +85,7 @@ class IndexGenerator:
85
  daterange = [start_date, end_date]
86
 
87
  # Calculate index based on type
 
88
  match index_config["gee_type"]:
89
  case "image":
90
  dataset = ee.Image(index_config["gee_path"]).clip(self.roi)
@@ -119,10 +120,6 @@ class IndexGenerator:
119
  if not dataset:
120
  raise Exception("Failed to generate dataset.")
121
 
122
- # Whether to display on GEE map
123
- if self.show and index_config.get("show"):
124
- map.addLayer(dataset, index_config["viz"], index_config["name"])
125
-
126
  logging.info(f"Generated index: {index_config['name']}")
127
  return dataset
128
 
 
34
  # Authenticate to GEE & DuckDB
35
  self._authenticate_ee(GEE_SERVICE_ACCOUNT)
36
 
37
+ # Use defined subset of indices
38
+ all_indices = self._load_indices(INDICES_FILE)
39
+ self.indices = {k: all_indices[k] for k in indices}
40
 
41
  def _cloudfree(self, gee_path, daterange):
42
  """
 
85
  daterange = [start_date, end_date]
86
 
87
  # Calculate index based on type
88
+ logging.info(f"Generating index: {index_config['name']} of type {index_config['gee_type']}")
89
  match index_config["gee_type"]:
90
  case "image":
91
  dataset = ee.Image(index_config["gee_path"]).clip(self.roi)
 
120
  if not dataset:
121
  raise Exception("Failed to generate dataset.")
122
 
 
 
 
 
123
  logging.info(f"Generated index: {index_config['name']}")
124
  return dataset
125