From 505c5b383789e2de8c6b49ca20b43243bb1c2f92 Mon Sep 17 00:00:00 2001 From: tsutterley Date: Fri, 15 Nov 2024 09:21:10 -0800 Subject: [PATCH] fix: endpoint for TN-13 and TN-14 is now documentation --- gravity_toolkit/utilities.py | 9 ++++++--- scripts/podaac_cumulus.py | 5 +++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/gravity_toolkit/utilities.py b/gravity_toolkit/utilities.py index 31f51c5..55986d3 100644 --- a/gravity_toolkit/utilities.py +++ b/gravity_toolkit/utilities.py @@ -1,7 +1,7 @@ #!/usr/bin/env python u""" utilities.py -Written by Tyler Sutterley (10/2024) +Written by Tyler Sutterley (11/2024) Download and management utilities for syncing time and auxiliary files PYTHON DEPENDENCIES: @@ -9,6 +9,7 @@ https://pypi.python.org/pypi/lxml UPDATE HISTORY: + Updated 11/2024: simplify unique file name function Updated 10/2024: update CMR search utility to replace deprecated scrolling https://cmr.earthdata.nasa.gov/search/site/docs/search/api.html Updated 08/2024: generalize hash function to use any available algorithm @@ -387,7 +388,9 @@ def create_unique_file(filename: str | pathlib.Path): filename: str or pathlib.Path full path to output file """ - filename = pathlib.Path(filename) + # validate input filename + filename = pathlib.Path(filename).expanduser().absolute() + stem, suffix = filename.stem, filename.suffix # create counter to add to the end of the filename if existing counter = 1 while counter: @@ -400,7 +403,7 @@ def create_unique_file(filename: str | pathlib.Path): # return the file descriptor return fd # new filename adds a counter before the file extension - filename = filename.with_name(f'{filename.stem}_{counter:d}{filename.suffix}') + filename = filename.with_name(f'{stem}_{counter:d}{suffix}') counter += 1 # PURPOSE: check ftp connection diff --git a/scripts/podaac_cumulus.py b/scripts/podaac_cumulus.py index 2493587..8942606 100644 --- a/scripts/podaac_cumulus.py +++ b/scripts/podaac_cumulus.py @@ -1,7 +1,7 @@ #!/usr/bin/env python u""" podaac_cumulus.py -Written by Tyler Sutterley (09/2024) +Written by Tyler Sutterley (11/2024) Syncs GRACE/GRACE-FO data from NASA JPL PO.DAAC Cumulus AWS S3 bucket S3 Cumulus syncs are only available in AWS instances in us-west-2 @@ -51,6 +51,7 @@ utilities.py: download and management utilities for syncing files UPDATE HISTORY: + Updated 11/2024: documentation endpoint for TN-13 and TN-14 files Updated 09/2024: updated default version for GRACE-FO to latest Updated 04/2024: added check to verify access to s3 buckets Updated 09/2023: check that collection metadata urls exist @@ -135,7 +136,7 @@ def podaac_cumulus(client, DIRECTORY, PROC=[], DREL=[], VERSION=[], urls = gravtk.utilities.cmr_metadata( mission='grace-fo', center=pr, release=rl, version=version, provider='POCLOUD', - endpoint=ENDPOINT) + endpoint='documentation') # TN-13 JPL degree 1 files try: