Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EHSTPCR-1181: fix for get_datalabs_path #3010

Merged
merged 3 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ esa.hubble

- New method ``get_datalabs_path`` to return the complete path of a file in
datalabs by combining the datalabs volume path with the path of the file
in the table ehst.artifact [#2998]
in the table ehst.artifact [#2998, #3010]

esa.jwst
^^^^^^^^
Expand Down
4 changes: 4 additions & 0 deletions astroquery/esa/hubble/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1018,6 +1018,10 @@ def get_datalabs_path(self, filename, default_volume=None):
The complete path of the file name in Datalabs
"""

# FITS files are always compressed
if filename.endswith('.fits'):
filename = f"{filename}.gz"

query = f"select file_path from ehst.artifact where file_name = '{filename}'"
job = self.query_tap(query=query)
if job is None:
Expand Down
6 changes: 5 additions & 1 deletion astroquery/esa/hubble/tests/test_esa_hubble_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ def test_retrieve_fits_from_program(self):
folder=str(self.temp_folder_for_fits.name))
assert len(os.listdir(self.temp_folder_for_fits.name)) > 0

def test_get_datalabs_path(self):
def test_get_datalabs_path_image(self):
result = esa_hubble.get_datalabs_path(filename='ib4x04ivq_flt.jpg', default_volume=None)
assert result == '/data/user/hub_hstdata_i/i/b4x/04/ib4x04ivq_flt.jpg'

def test_get_datalabs_path_fits(self):
result = esa_hubble.get_datalabs_path(filename='ib4x04ivq_flt.fits', default_volume=None)
assert result == '/data/user/hub_hstdata_i/i/b4x/04/ib4x04ivq_flt.fits.gz'
Loading