Skip to content

Commit

Permalink
Make flake8 happy
Browse files Browse the repository at this point in the history
  • Loading branch information
ahuarte47 committed Nov 27, 2022
1 parent 786d65b commit a01d6a2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
8 changes: 4 additions & 4 deletions geodataflow/pipeline/filters/GEEProductCatalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def search_gee_datasets() -> List[Dict]:
datasets = [dataset for dataset in catalog_list if dataset['type'] == 'image_collection']
datasets = sorted(datasets, key=lambda obj: obj['title'], reverse=False)
return datasets
except:
except Exception:
return []


Expand Down Expand Up @@ -274,7 +274,7 @@ def ee_initialize(self):
# Authenticates and initializes Earth Engine.
try:
ee.Initialize()
except Exception as e:
except Exception:
# Get credentials:
# https://developers.google.com/earth-engine/guides/python_install-conda#get_credentials
ee.Authenticate()
Expand Down Expand Up @@ -304,8 +304,8 @@ def ee_object_props(self, ee_object):
scales = band_names.map(lambda b: image.select([b]).projection().nominalScale())
scale = ee.Algorithms.If(scales.distinct().size().gt(1),
ee.Dictionary.fromLists(ee.List(band_names), scales),
scales.get(0)
)
scales.get(0))

dictionary = dictionary.set('system:band_scales', scale)
return dictionary

Expand Down
8 changes: 2 additions & 6 deletions geodataflow/pipeline/filters/GEEProductDataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,6 @@ def run(self, feature_store, processing_args):
pair = item.split('=')
ee_config_options[pair[0].strip()] = pair[1].strip() if len(pair) > 1 else ''

ee = self.ee_initialize()

# Query & fetch GEE imagery from Google Earth Engine...
with GdalEnv(config_options=ee_config_options, temp_path=processing_args.temp_data_path()) as ee_env:
#
Expand All @@ -157,9 +155,7 @@ def run(self, feature_store, processing_args):
band_scales = image_props['system:band_scales']

# For each Date, get the mosaic the subset of GEE images.
for product_date, ee_subset in \
self.ee_enumerate_subsets(ee_dataset, ee_dataset_props, ee_image_props):

for product_date, ee_subset in self.ee_enumerate_subsets(ee_dataset, ee_dataset_props, ee_image_props):
if self.bands:
bands = self.bands.replace(' ', '').split(',') if isinstance(self.bands, str) else self.bands
ee_subset = ee_subset.select(bands)
Expand All @@ -186,7 +182,7 @@ def run(self, feature_store, processing_args):
factor_count -= 1
url = ee_subset.getDownloadURL(params)
break
except Exception as e:
except Exception:
factor_scale *= 2
url = None

Expand Down

0 comments on commit a01d6a2

Please sign in to comment.