Skip to content

Commit

Permalink
Merge pull request #3010 from esdc-esac-esa-int/ESA_ehst_fix_get_data…
Browse files Browse the repository at this point in the history
…labs

EHSTPCR-1181: fix for get_datalabs_path
  • Loading branch information
bsipocz authored May 21, 2024
2 parents e35220b + baa8a7c commit 7da77a3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
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'

0 comments on commit 7da77a3

Please sign in to comment.