Skip to content

Commit

Permalink
Update printout
Browse files Browse the repository at this point in the history
  • Loading branch information
charles-turner-1 committed Jan 24, 2025
1 parent 2645d11 commit bd33b58
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
18 changes: 13 additions & 5 deletions src/access_nri_intake/experiment/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,19 @@ def use_datastore(
ds_full_path = str((catalog_dir / f"{datastore_name}.json").absolute())

scaffold_cmd = "scaffold_catalog_entry" if open_ds else "scaffold-catalog-entry"
print(
f"{Fore.GREEN}Datastore sucessfully written to {Fore.CYAN}{Style.BRIGHT}{ds_full_path}{Style.NORMAL}{Fore.GREEN}!"
f"\n{Fore.BLUE}Please note that this has not added the datastore to the access-nri-intake catalog."
f"\nTo add to catalog, please run '{Fore.WHITE}{Style.BRIGHT}{scaffold_cmd}{Fore.BLUE}{Style.NORMAL}' for help on how to do so."
)

if ds_info.valid:
print(
f"{Fore.GREEN}Datastore sucessfully written to {Fore.CYAN}{Style.BRIGHT}{ds_full_path}{Style.NORMAL}{Fore.GREEN}!"
f"\n{Fore.BLUE}Please note that this has not added the datastore to the access-nri-intake catalog."
f"\nTo add to catalog, please run '{Fore.WHITE}{Style.BRIGHT}{scaffold_cmd}{Fore.BLUE}{Style.NORMAL}' for help on how to do so."
)
else:
print(
f"{Fore.GREEN}Datastore found in {Fore.CYAN}{Style.BRIGHT}{ds_full_path}{Style.NORMAL}{Fore.GREEN}!"
f"\n{Fore.BLUE}Please note that this has not added the datastore to the access-nri-intake catalog."
f"\nTo add to catalog, please run '{Fore.WHITE}{Style.BRIGHT}{scaffold_cmd}{Fore.BLUE}{Style.NORMAL}' for help on how to do so."
)

if open_ds:
return intake.open_esm_datastore(
Expand Down
6 changes: 3 additions & 3 deletions src/access_nri_intake/experiment/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ def __post_init__(self):
We can match fo this pattern with the reget r'.+/file:///.+$
"""
if (
match := re.search(r"^file:///.+$", ds_json["catalog_file"])
) and match.group().lstrip("file://") != str(self.csv_handle):
if (match := re.search(r"^file:///.+$", ds_json["catalog_file"])) and re.sub(
r"^file://", "", match.group()
) != str(self.csv_handle.absolute()):
# If our internal reference starts with /file:///, then we need to
# ensure that the rest of this *perfectly* matches the csv file or the
# datastore will break when we try to open it.
Expand Down

0 comments on commit bd33b58

Please sign in to comment.