glam-processing 0.4.2__tar.gz → 0.4.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {glam_processing-0.4.2 → glam_processing-0.4.4}/PKG-INFO +1 -1
- {glam_processing-0.4.2 → glam_processing-0.4.4}/glam_processing/download.py +33 -17
- {glam_processing-0.4.2 → glam_processing-0.4.4}/pyproject.toml +1 -1
- {glam_processing-0.4.2 → glam_processing-0.4.4}/README.md +0 -0
- {glam_processing-0.4.2 → glam_processing-0.4.4}/glam_processing/__init__.py +0 -0
- {glam_processing-0.4.2 → glam_processing-0.4.4}/glam_processing/cli.py +0 -0
- {glam_processing-0.4.2 → glam_processing-0.4.4}/glam_processing/config/__init__.py +0 -0
- {glam_processing-0.4.2 → glam_processing-0.4.4}/glam_processing/config/clms.py +0 -0
- {glam_processing-0.4.2 → glam_processing-0.4.4}/glam_processing/config/settings.py +0 -0
- {glam_processing-0.4.2 → glam_processing-0.4.4}/glam_processing/earthdata.py +0 -0
- {glam_processing-0.4.2 → glam_processing-0.4.4}/glam_processing/exceptions.py +0 -0
- {glam_processing-0.4.2 → glam_processing-0.4.4}/glam_processing/spectral.py +0 -0
- {glam_processing-0.4.2 → glam_processing-0.4.4}/glam_processing/utils.py +0 -0
|
@@ -42,6 +42,7 @@ from . import exceptions
|
|
|
42
42
|
logging.basicConfig(
|
|
43
43
|
format="%(asctime)s - %(message)s",
|
|
44
44
|
datefmt="%d-%b-%y %H:%M:%S",
|
|
45
|
+
level=logging.INFO,
|
|
45
46
|
)
|
|
46
47
|
log = logging.getLogger(__name__)
|
|
47
48
|
|
|
@@ -184,24 +185,33 @@ class EarthDataDownloader(GlamDownloader):
|
|
|
184
185
|
return granules
|
|
185
186
|
|
|
186
187
|
def query_composites(self, start_date, end_date):
|
|
187
|
-
granules = self.query_granules(start_date, end_date)
|
|
188
188
|
composites = []
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
189
|
+
try:
|
|
190
|
+
granules = self.query_granules(start_date, end_date)
|
|
191
|
+
assert (
|
|
192
|
+
len(granules) > 275
|
|
193
|
+
) # ensure we have enough granules to create a composite
|
|
194
|
+
# todo: product specific granule check
|
|
195
|
+
for granule in tqdm(granules, desc="Getting available composite dates"):
|
|
196
|
+
composite_obj = {}
|
|
197
|
+
composite_obj["id"] = (
|
|
198
|
+
granule["meta"]["native-id"].split(".")[0]
|
|
199
|
+
+ "."
|
|
200
|
+
+ granule["meta"]["native-id"].split(".")[1]
|
|
201
|
+
)
|
|
202
|
+
composite_obj["start_date"] = granule["umm"]["TemporalExtent"][
|
|
203
|
+
"RangeDateTime"
|
|
204
|
+
]["BeginningDateTime"][:10]
|
|
205
|
+
composite_obj["end_date"] = granule["umm"]["TemporalExtent"][
|
|
206
|
+
"RangeDateTime"
|
|
207
|
+
]["EndingDateTime"][:10]
|
|
208
|
+
if composite_obj not in composites:
|
|
209
|
+
composites.append(composite_obj)
|
|
210
|
+
except AssertionError:
|
|
211
|
+
log.info(
|
|
212
|
+
f"Insufficient granules found to create a composite for {self.dataset}."
|
|
195
213
|
)
|
|
196
|
-
|
|
197
|
-
"RangeDateTime"
|
|
198
|
-
]["BeginningDateTime"][:10]
|
|
199
|
-
composite_obj["end_date"] = granule["umm"]["TemporalExtent"][
|
|
200
|
-
"RangeDateTime"
|
|
201
|
-
]["EndingDateTime"][:10]
|
|
202
|
-
if composite_obj not in composites:
|
|
203
|
-
composites.append(composite_obj)
|
|
204
|
-
|
|
214
|
+
return composites
|
|
205
215
|
return composites
|
|
206
216
|
|
|
207
217
|
def download_granules(self, start_date, end_date, out_dir):
|
|
@@ -277,8 +287,14 @@ class EarthDataDownloader(GlamDownloader):
|
|
|
277
287
|
composite["start_date"], composite["end_date"], out, vi=vi
|
|
278
288
|
)
|
|
279
289
|
|
|
290
|
+
log.debug(f"downloaded files: {len(vi_files)}")
|
|
291
|
+
|
|
292
|
+
# filter files to ensure they belong in this composite
|
|
293
|
+
composite_files = [file for file in vi_files if composite["id"] in file]
|
|
294
|
+
log.debug(f"filtered files: {len(composite_files)}")
|
|
295
|
+
|
|
280
296
|
vi_mosaic = self._create_mosaic_cog_from_tifs(
|
|
281
|
-
composite["start_date"],
|
|
297
|
+
composite["start_date"], composite_files, out
|
|
282
298
|
)
|
|
283
299
|
# Remove tiffs after mosaic creation.
|
|
284
300
|
for file in vi_files:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|