Skip to content

Commit

Permalink
Merge pull request #304 from openclimatefix/fix-data-tailor
Browse files Browse the repository at this point in the history
Fix data tailor
  • Loading branch information
peterdudfield authored Nov 5, 2024
2 parents 3885446 + 8f40147 commit 532cec9
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions satip/eumetsat.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ def _download_single_tailored_dataset(
"""

SEVIRI = "HRSEVIRI"
SEVIRI_HRV = "HRSEVIRI_HRV"
#SEVIRI_HRV = "HRSEVIRI_HRV"
RSS_ID = "HRSEVIRI_RSS"
CLM_ID = "MSGCLMK"

Expand All @@ -549,23 +549,25 @@ def _download_single_tailored_dataset(
else:
raise ValueError(f"Product ID {product_id} not recognized, ending now")

if tailor_id == SEVIRI: # Also do HRV
credentials = (self.user_key, self.user_secret)
token = eumdac.AccessToken(credentials)
datastore = eumdac.DataStore(token)
product_id = datastore.get_product("EO:EUM:DAT:MSG:HRSEVIRI", dataset_id)
self.create_and_download_datatailor_data(
dataset_id=product_id,
tailor_id=SEVIRI_HRV,
roi=roi,
file_format=file_format,
projection=projection,
)
# if tailor_id == SEVIRI_HRV: # Also do HRV
# credentials = (self.user_key, self.user_secret)
# token = eumdac.AccessToken(credentials)
# datastore = eumdac.DataStore(token)
# product_id = datastore.get_product("EO:EUM:DAT:MSG:HRSEVIRI", dataset_id)
# log.debug(f"Downloading HRV data for {dataset_id=}, {product_id=}")
# self.create_and_download_datatailor_data(
# dataset_id=product_id,
# tailor_id=SEVIRI_HRV,
# roi=roi,
# file_format=file_format,
# projection=projection,
# )

credentials = (self.user_key, self.user_secret)
token = eumdac.AccessToken(credentials)
datastore = eumdac.DataStore(token)
product_id = datastore.get_product("EO:EUM:DAT:MSG:HRSEVIRI", dataset_id)
log.debug(f"Downloading data for {dataset_id=}, {product_id=}")
self.create_and_download_datatailor_data(
dataset_id=product_id,
tailor_id=tailor_id,
Expand Down Expand Up @@ -686,7 +688,8 @@ def create_and_download_datatailor_data(
log.debug(f"Attempt {attempt}: Created customisation {customisation}")
break
except Exception as e:
log.debug(f"Attempt {attempt}: Error creating customisation: {e}")
log.debug(f"Attempt {attempt}: Error creating customisation: {e}, "
f"{dataset_id=}, {chain=}")
else:
log.debug(
f"Attempt {attempt}: Too many running customisations. "
Expand Down

0 comments on commit 532cec9

Please sign in to comment.